nwo
stringclasses
449 values
path
stringlengths
9
173
language
stringclasses
1 value
identifier
stringlengths
1
53
docstring
stringlengths
5
4.13k
function
stringlengths
10
87.2k
ast_function
stringlengths
351
354k
obf_function
stringlengths
10
87.2k
url
stringlengths
30
175
function_sha
stringlengths
40
40
source
stringclasses
3 values
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/WebViewDataCacheManager.ets
arkts
clearAll
==================== 缓存管理 ==================== 清空所有缓存
clearAll(): void { const totalCount = this.mangaDetailCache.size + this.chapterListCache.size; this.mangaDetailCache.clear(); this.chapterListCache.clear(); logger.info(TAG, `清空所有缓存,共 ${totalCount} 项`); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clearAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Lef...
clearAll(): void { const totalCount = this.mangaDetailCache.size + this.chapterListCache.size; this.mangaDetailCache.clear(); this.chapterListCache.clear(); logger.info(TAG, `清空所有缓存,共 ${totalCount} 项`); }
https://github.com/DaLongZhuaZi/manxia
f89c2f9a2c60bb9d0846e8fa5591e0578d0b511f
github
offlinecat-dev/OCNetORM
src/main/ets/query/QueryBuilder.ets
arkts
getPaginationParams
获取分页参数 @returns PaginationParams 实例,如果未设置分页则返回 null
getPaginationParams(): PaginationParams | null { if (this.pageNumber === 0 || this.pageSizeValue === 0) { return null } return new PaginationParams(this.pageNumber, this.pageSizeValue) }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getPaginationParams AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#i...
getPaginationParams(): PaginationParams | null { if (this.pageNumber === 0 || this.pageSizeValue === 0) { return null } return new PaginationParams(this.pageNumber, this.pageSizeValue) }
https://github.com/offlinecat-dev/OCNetORM
cf6702f9d24193c2c0978e16e7682a6ee18bc6c1
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Animation/ItemTransitionAnimator.ets
arkts
applyCurve
应用缓动曲线
private applyCurve(t: number): number { // 如果是ICurve对象,使用interpolate方法 if (typeof this.config.curve === 'object') { const curve = this.config.curve as ICurve; if (curve.interpolate) { return curve.interpolate(t); } } // 否则直接返回线性进度 return t; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left applyCurve AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left t AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left numbe...
private applyCurve(t: number): number { // 如果是ICurve对象,使用interpolate方法 if (typeof this.config.curve === 'object') { const curve = this.config.curve as ICurve; if (curve.interpolate) { return curve.interpolate(t); } } // 否则直接返回线性进度 return t; }
https://github.com/DaLongZhuaZi/manxia
2ddc07913210134a85f510521a3441f8b88f41e8
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Array.ets
arkts
constructor
Creates a new instance of Array with the given elements. @param { T } first The first element of the array. @param { T[] } d The rest of the elements to initialize the array with. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public constructor(first: T, ...d: T[]) { this.buffer = new FixedArray<Any>(d.length + 1) this.actualLength = d.length + 1 this.buffer[0] = first for (let k: int = 0; k < d.length; k++) { this.$_set_unsafe(k + 1, d[k]) } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left first AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#Ri...
public constructor(first: T, ...d: T[]) { this.buffer = new FixedArray<Any>(d.length + 1) this.actualLength = d.length + 1 this.buffer[0] = first for (let k: int = 0; k < d.length; k++) { this.$_set_unsafe(k + 1, d[k]) } }
https://gitcode.com/iop123123/arkts-static-skills
ba988959c8f4d6e11d4b519b8b2d221ae556015d
gitcode
openharmony/applications_permission_manager
permissionmanager/src/main/ets/common/utils/commonUtils.ets
arkts
isEmpty
String null @param {str} Word string
static isEmpty(str: string): boolean { return CommonUtils.isInvalid(str) || str.trim().length == 0; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isEmpty AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AS...
static isEmpty(str: string): boolean { return CommonUtils.isInvalid(str) || str.trim().length == 0; }
https://gitee.com/openharmony/applications_permission_manager.git
9bec37bbb7fe613855a9bb6fb4ce19d75b6e9f83
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/TypeCreator.ets
arkts
create
Forces creation of `this` creator and creators it depends on @returns created Type instance
public override create(): ClassType throws { return super.create() as ClassType }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left create AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left...
public override create(): ClassType throws { return super.create() as ClassType }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
f3b9530262162f1d639ef30fcf917e1ad7d96fa3
gitee
fuhhhhhhhh/openharmony
entry/src/main/ets/data/database/DBManager.ets
arkts
getInstance
获取 DBManager 单例实例
public static getInstance(context?: common.BaseContext): DBManager { if (!DBManager.instance) { DBManager.instance = new DBManager(); } if (context) { DBManager.instance.context = context; } return DBManager.instance; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#?#Left ? A...
public static getInstance(context?: common.BaseContext): DBManager { if (!DBManager.instance) { DBManager.instance = new DBManager(); } if (context) { DBManager.instance.context = context; } return DBManager.instance; }
https://github.com/fuhhhhhhhh/openharmony
4498f67fc034d948eef09c96e5af1d6b7e239c51
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/BarLineChartBaseModel.ets
arkts
getValuesByTouchPoint
Returns a recyclable MPPointD instance Returns the x and y values in the chart at the given touch point (encapsulated in a MPPointD). This method transforms pixel coordinates to coordinates / values in the chart. This is the opposite method to getPixelForValues(...). @param x @param y @return
public getValuesByTouchPoint(x: number, y: number, axis: AxisDependency, outputPoint?: MPPointD): MPPointD { let transformer: Transformer | null = this.getTransformer(axis); if (!transformer) { transformer = new Transformer(new ViewPortHandler()); } return transformer.getValuesByTouchPoint(x, y,...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getValuesByTouchPoint AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left x AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le...
public getValuesByTouchPoint(x: number, y: number, axis: AxisDependency, outputPoint?: MPPointD): MPPointD { let transformer: Transformer | null = this.getTransformer(axis); if (!transformer) { transformer = new Transformer(new ViewPortHandler()); } return transformer.getValuesByTouchPoint(x, y,...
https://gitee.com/openharmony-tpc/ohos_mpchart.git
9baa7d3335c5c8b65a95d69c5e968eb7fa9ae9ed
gitee
openharmony-sig/fluttertpc_qr_code_scanner
ohos/ohos/src/main/ets/components/plugin/libs/CameraService.ets
arkts
initCamera
初始化相机并开始捕获预览流
async initCamera(XComponentSurfaceId: string, front: boolean = false): Promise<void> { if (!this.camerasDevices) { return; } // 前置 if (front) { this.curcamerasDevice = this.camerasDevices[1] } else { this.curcamerasDevice = this.camerasDevices[0] } // 获取支持的模式类型 let sc...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left initCamera AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left XComponentSurfaceId AST#identifier...
async initCamera(XComponentSurfaceId: string, front: boolean = false): Promise<void> { if (!this.camerasDevices) { return; } // 前置 if (front) { this.curcamerasDevice = this.camerasDevices[1] } else { this.curcamerasDevice = this.camerasDevices[0] } // 获取支持的模式类型 let sc...
https://gitee.com/openharmony-sig/fluttertpc_qr_code_scanner.git
dfafc82da19f22b1fd2516c7d2d32873cd39f366
gitee
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/UserSessionService.ets
arkts
getCurrentUserId
获取当前登录用户ID @returns 用户ID,未登录返回null
static async getCurrentUserId(): Promise<number | null> { const session = await UserSessionService.getCurrentSession(); return session?.userId ?? null; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left getCurrentUserId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST...
static async getCurrentUserId(): Promise<number | null> { const session = await UserSessionService.getCurrentSession(); return session?.userId ?? null; }
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
28c07e78c1eaf45f112de130e30adeba75f833c9
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/ChartData.ets
arkts
getDataSetIndexByLabel
Retrieve the index of a DataSet with a specific label from the ChartData. Search can be case sensitive or not. IMPORTANT: This method does calculations at runtime, do not over-use in performance critical situations. @param dataSets the DataSet array to search @param label @param ignorecase if true, the search is not ...
protected getDataSetIndexByLabel(dataSets: JArrayList<T>, label: string, ignorecase: boolean): number { if (ignorecase) { for (let i: number = 0; i < dataSets.size(); i++) if (label.toLowerCase() == dataSets.get(i).getLabel().toLowerCase()) return i; ...
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left getDataSetIndexByLabel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dataSets AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right ...
protected getDataSetIndexByLabel(dataSets: JArrayList<T>, label: string, ignorecase: boolean): number { if (ignorecase) { for (let i: number = 0; i < dataSets.size(); i++) if (label.toLowerCase() == dataSets.get(i).getLabel().toLowerCase()) return i; ...
https://gitee.com/openharmony-tpc/ohos_mpchart.git
39258a47d5624a9258dec9f9f172ea0650ea7a4b
gitee
darcycui/DarcyHarmonyNext
library_camera/src/main/ets/CameraHelper.ets
arkts
savePicture
保存byte数组为图片
async savePicture(buffer: ArrayBuffer): Promise<void> { let photoHelper: photoAccessHelper.PhotoAccessHelper = photoAccessHelper.getPhotoAccessHelper(getContext(this) as common.UIAbilityContext); let options: photoAccessHelper.CreateOptions = { title: Date.now().toString() }; //createAsset...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left savePicture AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left buffer AST#identifier#Right AST#type_annotation#Left AST#:...
async savePicture(buffer: ArrayBuffer): Promise<void> { let photoHelper: photoAccessHelper.PhotoAccessHelper = photoAccessHelper.getPhotoAccessHelper(getContext(this) as common.UIAbilityContext); let options: photoAccessHelper.CreateOptions = { title: Date.now().toString() }; //createAsset...
https://github.com/darcycui/DarcyHarmonyNext/blob/241d0ee75929f6b3f9e1fe5b550acf6c9533c15c/library_camera/src/main/ets/CameraHelper.ets#L215-L242
ee4de321e0379ebdc373d1fdee4308c5b2f7c50c
github
LongLiveY96/chatcube
entry/src/main/ets/entryability/EntryAbility.ets
arkts
registerSettingsCallback
注册设置变化回调
private registerSettingsCallback(): void { this.settingsCallback = { onThemeModeChanged: (_mode: ThemeMode, colorMode: ConfigurationConstant.ColorMode): void => { this.setAppColorMode(colorMode); // 立即同步深浅模式与主题服务,避免等待系统配置回调导致的短暂闪动/状态不同步。 // 注意:此时 SettingsManager 已写入新的 mode,resolveIsD...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left registerSettingsCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Righ...
private registerSettingsCallback(): void { this.settingsCallback = { onThemeModeChanged: (_mode: ThemeMode, colorMode: ConfigurationConstant.ColorMode): void => { this.setAppColorMode(colorMode); // 立即同步深浅模式与主题服务,避免等待系统配置回调导致的短暂闪动/状态不同步。 // 注意:此时 SettingsManager 已写入新的 mode,resolveIsD...
https://github.com/LongLiveY96/chatcube
f3335377975806f36f41ce7aaf2b83eab31ebde9
github
DaLongZhuaZi/manxia
entry/src/main/ets/components/PreloadManager.ets
arkts
setPageInfo
设置当前页码和总页数
setPageInfo(currentPage: number, totalPages: number): void { this.currentPage = currentPage; this.totalPages = totalPages; this.updateDebugInfo(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setPageInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left currentPage AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , AST#...
setPageInfo(currentPage: number, totalPages: number): void { this.currentPage = currentPage; this.totalPages = totalPages; this.updateDebugInfo(); }
https://github.com/DaLongZhuaZi/manxia
91512878d569efb3361756a4870dc18dc879124c
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Debug/CrashRecorderService.ets
arkts
getCrashLogsDir
获取崩溃日志目录路径
public getCrashLogsDir(): string { return this.crashLogsDir; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCrashLogsDir AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST...
public getCrashLogsDir(): string { return this.crashLogsDir; }
https://github.com/DaLongZhuaZi/manxia
25b362ba9f17fcebfeb67af3969fdeb4caa4aade
github
the-wwyang/kids-learning-app
src/main/ets/services/WrongQuestionService.ets
arkts
areSimilarQuestions
检查是否为相似错题(题目结构相同但数字不同) @param q1 题目1 @param q2 题目2 @returns 是否相似
static areSimilarQuestions(q1: MathQuestion, q2: MathQuestion): boolean { // 题型必须相同 if (q1.type !== q2.type) return false; // 对于计算题,检查运算符是否相同 if (q1.type === QuestionType.CALCULATION) { return q1.operator === q2.operator; } // 其他题型认为同类型就是相似的 return true; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left areSimilarQuestions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left q1 AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
static areSimilarQuestions(q1: MathQuestion, q2: MathQuestion): boolean { // 题型必须相同 if (q1.type !== q2.type) return false; // 对于计算题,检查运算符是否相同 if (q1.type === QuestionType.CALCULATION) { return q1.operator === q2.operator; } // 其他题型认为同类型就是相似的 return true; }
https://github.com/the-wwyang/kids-learning-app
798496dc62b27d3c8367daac0e48f7faca1f76ab
github
ibestservices/ibest-ui
library/src/main/ets/components/dialog/dialog.ets
arkts
getMsgColor
获取内容区域文字颜色
getMsgColor() { return this.messageFontColor || (this.title ? GRAY_COLOR.GRAY_7 : this.messageColor) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getMsgColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A...
getMsgColor() { return this.messageFontColor || (this.title ? GRAY_COLOR.GRAY_7 : this.messageColor) }
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/dialog/dialog.ets#L243-L245
9f64ea8e41debd7c34662ba6acdbd51a0aa704cb
github
Coke0807/NewsAPP-HarmonyOS
NewsApp/entry/src/main/ets/utils/AuthUtil.ets
arkts
getUsername
获取用户名
static getUsername(): string { return AppStorage.get<string>(STORAGE_KEYS.USERNAME) || ''; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getUsername AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#str...
static getUsername(): string { return AppStorage.get<string>(STORAGE_KEYS.USERNAME) || ''; }
https://github.com/Coke0807/NewsAPP-HarmonyOS
1313b8405a3ac4bbad931749077964436d3d208c
github
HarmonyOS_Samples/MusicHome
features/player/src/main/ets/viewmodel/PlayerViewModel.ets
arkts
playPrevious
Skips to previous track according to MediaService play mode.
public playPrevious(): void { PlayerDataUtil.playPrevious(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left playPrevious AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expressio...
public playPrevious(): void { PlayerDataUtil.playPrevious(); }
https://gitcode.com/HarmonyOS_Samples/MusicHome
99a76b8c8c7f58374ecdd5c60968ecaa31a28bac
gitcode
openharmony/codelabs
ETSUI/LifeTrack/entry/src/main/ets/dao/EventDao.ets
arkts
deleteEventInstancesByOriginalId
删除指定原始事件的所有实例
async deleteEventInstancesByOriginalId(originalId: string): Promise<boolean> { const rdbStore = await this.initDatabase(); try { const predicates = new relationalStore.RdbPredicates('event_instances'); predicates.equalTo('original_id', originalId); const deletedRows = await rdbStore.delete...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left deleteEventInstancesByOriginalId AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left originalId AST#identifier#Right AST#type_annot...
async deleteEventInstancesByOriginalId(originalId: string): Promise<boolean> { const rdbStore = await this.initDatabase(); try { const predicates = new relationalStore.RdbPredicates('event_instances'); predicates.equalTo('original_id', originalId); const deletedRows = await rdbStore.delete...
https://gitcode.com/openharmony/codelabs
577c8d99de9005c02bde8a965284412488d1fe3a
gitcode
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/model/EventSourcing.ets
arkts
createEventChange
创建事件变更记录
static createEventChange(field: string, oldValue: string, newValue: string): EventChange { const result: EventChange = { field: field, oldValue: oldValue, newValue: newValue }; return result; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createEventChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left field AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le...
static createEventChange(field: string, oldValue: string, newValue: string): EventChange { const result: EventChange = { field: field, oldValue: oldValue, newValue: newValue }; return result; }
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
bf3a5d68dadb75b621d7a8c3c7f94271b64e8c36
github
AetheriumSimulator/qemu-hmos
entry/src/main/ets/utils/BreakpointSystem.ets
arkts
getBreakpoint
根据窗口宽度计算断点
static getBreakpoint(widthVp: number): BreakpointType { if (widthVp < BREAKPOINT_XS) { return 'xs' } else if (widthVp < BREAKPOINT_SM) { return 'sm' } else if (widthVp < BREAKPOINT_MD) { return 'md' } else { return 'lg' } }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getBreakpoint AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left widthVp AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#R...
static getBreakpoint(widthVp: number): BreakpointType { if (widthVp < BREAKPOINT_XS) { return 'xs' } else if (widthVp < BREAKPOINT_SM) { return 'sm' } else if (widthVp < BREAKPOINT_MD) { return 'md' } else { return 'lg' } }
https://github.com/AetheriumSimulator/qemu-hmos
2f61faa26a3aeae0ae4d09dac91d3310e2f85624
github
openharmony/arkui_advanced_ui_component
atomicserviceweb/source/atomicserviceweb.ets
arkts
login
静默登录 @param options 接口参数
public login(options: LoginOptions): void { let loginRequest: authentication.LoginWithHuaweiIDRequest = new authentication.HuaweiIDProvider().createLoginWithHuaweiIDRequest(); loginRequest.forceLogin = false; loginRequest.state = util.generateRandomUUID(); let controller: authentication.Authenti...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left login AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left options AST#identifier#Right AST#:#Left : AST#:#Right AST#...
public login(options: LoginOptions): void { let loginRequest: authentication.LoginWithHuaweiIDRequest = new authentication.HuaweiIDProvider().createLoginWithHuaweiIDRequest(); loginRequest.forceLogin = false; loginRequest.state = util.generateRandomUUID(); let controller: authentication.Authenti...
https://gitee.com/openharmony/arkui_advanced_ui_component.git
7f22bdda8ea800b9ef70fb432dbc0427892ee1eb
gitee
TDCQCX/ShiHuaMusic-Harmony
entry/src/main/ets/utils/StyleUtil.ets
arkts
updatePageStyles
更新页面样式
private static updatePageStyles() { // 这里可以根据需要添加全局样式更新逻辑 console.log('主题已变更,页面样式需要更新'); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left updatePageStyles AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right...
private static updatePageStyles() { // 这里可以根据需要添加全局样式更新逻辑 console.log('主题已变更,页面样式需要更新'); }
https://github.com/TDCQCX/ShiHuaMusic-Harmony
62976442799af0b0fc818acdf2b8a19f96fc67f0
github
Amaz1ny/HarmonyDO-public
entry/src/main/ets/models/SearchFilter.ets
arkts
formatShortDateRange
用于 UI 短格式展示(M/D - M/D、M/D 之后、M/D 之前)
formatShortDateRange(): string { const after: Date | null = this.afterDate; const before: Date | null = this.beforeDate; if (after !== null && before !== null) { return `${this.formatShortDate(after)} - ${this.formatShortDate(before)}`; } if (after !== null) { return `${this.formatShor...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left formatShortDateRange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#s...
formatShortDateRange(): string { const after: Date | null = this.afterDate; const before: Date | null = this.beforeDate; if (after !== null && before !== null) { return `${this.formatShortDate(after)} - ${this.formatShortDate(before)}`; } if (after !== null) { return `${this.formatShor...
https://github.com/Amaz1ny/HarmonyDO-public
5ec7f10137cd37faec499c6320c648c6761148e1
github
wanrenhuifu/JLU
harmonyos-鸿蒙实训/tkbrush-app/tkbrush-app/entry/src/main/ets/components/TKExaminationItem.ets
arkts
getQuestionType
type题目类型:1 单选,2 多选,3 判断
getQuestionType(type:number){ switch (type) { case 1: return '单选题' break; case 2: return '多选题' break; default: return '判断题' break; } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getQuestionType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Rig...
getQuestionType(type:number){ switch (type) { case 1: return '单选题' break; case 2: return '多选题' break; default: return '判断题' break; } }
https://github.com/wanrenhuifu/JLU
ac113efd7b8fa37e620a5ffdfe52ea717f2f4ba0
github
bhengubv/aether-protocol
arkts/src/main/ets/incentive/TipPacketPayload.ets
arkts
hasWellFormedSignature
True when a well-formed (64-byte) Ed25519 signature is present.
hasWellFormedSignature(): boolean { return this.signature !== null && this.signature.length === ED25519_SIGNATURE_LENGTH; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasWellFormedSignature AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right ...
hasWellFormedSignature(): boolean { return this.signature !== null && this.signature.length === ED25519_SIGNATURE_LENGTH; }
https://github.com/bhengubv/aether-protocol
79dba7e96fca29b891c5fe80e579f7980c9677b4
github
SMAT-Lab/Homecheck-Sec2026
test/unittest/sample/ValidTypeof/ets/ValidTypeofReport.ets
arkts
A
{'requireStringLiterals': true/false}都报
function A() { 'strnig' != typeof foo; for (let i = 0; i++; i < 5) { if (typeof bar !== 'umdefined') { typeof foo === `string + object` ? typeof foo : ''; } } return ''; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left A AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left...
function A() { 'strnig' != typeof foo; for (let i = 0; i++; i < 5) { if (typeof bar !== 'umdefined') { typeof foo === `string + object` ? typeof foo : ''; } } return ''; }
https://github.com/SMAT-Lab/Homecheck-Sec2026
f5d118bd9e83d876dbd6e0bf455e71cf50c12d7d
github
HarmonyOS_Samples/guide-snippets
ArkGraphics3D/entry/src/main/ets/material/pbr_clearcoat_normal.ets
arkts
setClearcoatNormalFactor
Adjust the clearcoat normal factor intensity
setClearcoatNormalFactor(v: number) { if (this.material) { const f: Vec4 = (this.material as MetallicRoughnessMaterial).clearCoatNormal.factor; f.x = GAIN * v / RESO; (this.material as MetallicRoughnessMaterial).clearCoatNormal.factor = f; } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setClearcoatNormalFactor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left v AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifi...
setClearcoatNormalFactor(v: number) { if (this.material) { const f: Vec4 = (this.material as MetallicRoughnessMaterial).clearCoatNormal.factor; f.x = GAIN * v / RESO; (this.material as MetallicRoughnessMaterial).clearCoatNormal.factor = f; } }
https://gitcode.com/HarmonyOS_Samples/guide-snippets
6e2ed19efde73020a3624b36c75c32740d8511e2
gitcode
Eklps/harmony-mall-perf
entry/src/main/ets/viewmodel/CartModel.ets
arkts
decreaseQuantity
减少商品数量
static decreaseQuantity(itemId: string) { let cartList = AppStorage.get<CartItemType[]>('cartList') || []; const index = cartList.findIndex(cartItem => cartItem.goods.id === itemId); if (index >= 0) { if (cartList[index].quantity <= 1) { // 数量为1时再减就移除 cartList.splice(index, 1); ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left decreaseQuantity AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left itemId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le...
static decreaseQuantity(itemId: string) { let cartList = AppStorage.get<CartItemType[]>('cartList') || []; const index = cartList.findIndex(cartItem => cartItem.goods.id === itemId); if (index >= 0) { if (cartList[index].quantity <= 1) { // 数量为1时再减就移除 cartList.splice(index, 1); ...
https://github.com/Eklps/harmony-mall-perf
1d847ae03ed789bc940cd2c754e1779ba042d094
github
wuba/omni-ui
omni_component/src/main/ets/components/filterbar/component/OmniFilterListGroup.ets
arkts
_refreshDataSource
刷新3个ListView的数据源
_refreshDataSource() { if (this.item && this.item.children) { this._firstList = this.item.children } if (this._firstIndex >= 0 && this._firstList.length > this._firstIndex) { this._secondList = this._firstList[this._firstIndex].children ?? []; if (this._secondIndex >= 0 && this._secondLi...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left _refreshDataSource AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block...
_refreshDataSource() { if (this.item && this.item.children) { this._firstList = this.item.children } if (this._firstIndex >= 0 && this._firstList.length > this._firstIndex) { this._secondList = this._firstList[this._firstIndex].children ?? []; if (this._secondIndex >= 0 && this._secondLi...
https://github.com/wuba/omni-ui
75c390becb1528e8467f6959b8ceced63e49dec9
github
openharmony/update_update_app
feature/ota/src/main/ets/manager/OtaUpdateManager.ets
arkts
checkNewVersion
从服务器取搜索新版本 @return resolve 新版本信息/reject 错误信息
async checkNewVersion(): Promise<UpgradeData<update.CheckResult>> { return new Promise((resolve, reject) => { this.updateManager.checkNewVersion().then((result: UpgradeData<update.CheckResult>) => { if (result?.callResult === UpgradeCallResult.OK) { globalThis.cachedNewVersionInfo = result...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left checkNewVersion AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#gene...
async checkNewVersion(): Promise<UpgradeData<update.CheckResult>> { return new Promise((resolve, reject) => { this.updateManager.checkNewVersion().then((result: UpgradeData<update.CheckResult>) => { if (result?.callResult === UpgradeCallResult.OK) { globalThis.cachedNewVersionInfo = result...
https://gitee.com/openharmony/update_update_app.git
a7f10832fb4cd4f5be702dd9f06746f7f83608b7
gitee
AGenUI/AGenUI
platforms/harmony/agenui/src/main/ets/agenui/bridge/MeasurementManager.ets
arkts
unregister
Unregister the specified component type @param type Component type string
unregister(type: string): void { nativeUnregisterMeasurement(this._engineId, type); this._registeredTypes.delete(type); console.info(`[MeasurementManager] unregistered: engineId=${this._engineId} type=${type}`); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left unregister AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#...
unregister(type: string): void { nativeUnregisterMeasurement(this._engineId, type); this._registeredTypes.delete(type); console.info(`[MeasurementManager] unregistered: engineId=${this._engineId} type=${type}`); }
https://github.com/AGenUI/AGenUI
9e6461ef4d48868a2694c78109a12181b8d41395
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebDAV/WebDAVAutoBackupScheduler.ets
arkts
initialize
初始化调度器 [修复] 不再在初始化时同步等待备份执行,避免备份+上传操作导致启动阻塞/ANR
async initialize(context: common.UIAbilityContext): Promise<void> { this.context = context; logger.info(TAG, '自动备份调度器初始化'); // [修复] 延迟检查备份,不阻塞启动流程 // 使用setTimeout延迟30秒后再检查,确保应用完全启动后再执行 setTimeout(() => { this.checkAndExecuteBackup().catch((error: Error) => { logger.error(TAG, `延...
AST#program#Left AST#expression_statement#Left AST#assignment_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left initialize AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left c...
async initialize(context: common.UIAbilityContext): Promise<void> { this.context = context; logger.info(TAG, '自动备份调度器初始化'); // [修复] 延迟检查备份,不阻塞启动流程 // 使用setTimeout延迟30秒后再检查,确保应用完全启动后再执行 setTimeout(() => { this.checkAndExecuteBackup().catch((error: Error) => { logger.error(TAG, `延...
https://github.com/DaLongZhuaZi/manxia
29070f40b1f5a251e0655e1e650a563f29397275
github
HarmonyOS_Samples/MusicHome
features/player/src/main/ets/model/MediaService.ets
arkts
getValidSelectIndex
Clamps MusicAppState.selectIndex to a valid queue index (0 if empty or out of range).
private getValidSelectIndex(): number { const len = this.getQueueLength(); const idx = this.getAppState().selectIndex; if (len === 0) { return 0; } if (idx < 0 || idx >= len) { return 0; } return idx; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getValidSelectIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left num...
private getValidSelectIndex(): number { const len = this.getQueueLength(); const idx = this.getAppState().selectIndex; if (len === 0) { return 0; } if (idx < 0 || idx >= len) { return 0; } return idx; }
https://gitcode.com/HarmonyOS_Samples/MusicHome
d7456ffb8ee00469ee0cac65d32d6288d0657a5e
gitcode
TDCQCX/ShiHuaMusic-Harmony
entry/src/main/ets/utils/StyleUtil.ets
arkts
getContentAreaStyle
获取页面内容区域样式
static getContentAreaStyle() { const theme = ThemeUtil.getCurrentThemeConfig(); const spacing = theme.spacing; return { backgroundColor: theme.colors.background, padding: `${spacing.md}px`, width: '100%', height: '100%' }; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getContentAreaStyle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#...
static getContentAreaStyle() { const theme = ThemeUtil.getCurrentThemeConfig(); const spacing = theme.spacing; return { backgroundColor: theme.colors.background, padding: `${spacing.md}px`, width: '100%', height: '100%' }; }
https://github.com/TDCQCX/ShiHuaMusic-Harmony
25dd35544b66857a79d21ccfcc60ed931a1aafce
github
honjow/Next2V
shared/src/main/ets/network/ApiService.ets
arkts
getReplies
Get reply list for a topic
async getReplies(topicId: number, cacheBuster: number = 0): Promise<V2exReply[]> { const endpoint = cacheBuster > 0 ? `${ApiConstants.API_REPLIES_SHOW}?topic_id=${topicId}&_=${cacheBuster}` : `${ApiConstants.API_REPLIES_SHOW}?topic_id=${topicId}` const replies = cacheBuster > 0 ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getReplies AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left topicId AST#identifier#Right AST#type_annotation#Left AST#:#Left : A...
async getReplies(topicId: number, cacheBuster: number = 0): Promise<V2exReply[]> { const endpoint = cacheBuster > 0 ? `${ApiConstants.API_REPLIES_SHOW}?topic_id=${topicId}&_=${cacheBuster}` : `${ApiConstants.API_REPLIES_SHOW}?topic_id=${topicId}` const replies = cacheBuster > 0 ...
https://github.com/honjow/Next2V
e48a2bef9dfe4e638d21d64f45d442e417f17ac4
github
Joker-x-dev/CoolMallArkTS
core/base/src/main/ets/viewmodel/BaseViewModel.ets
arkts
aboutToAppear
页面出现前(组件创建后、build 前) @returns {void} 无返回值
aboutToAppear(): void { }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#L...
aboutToAppear(): void { }
https://github.com/Joker-x-dev/CoolMallArkTS
0608c72472f93d9081a1f6e791df5e9e90bce891
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/WeakMap.ets
arkts
has
The has() method returns a boolean indicating whether an element with the specified key exists in the WeakMap object or not.
has(k: K): boolean { throw new Error("Not implemented"); return false; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left has AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left k AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left K AST#identifier#Right AST#)#Left ) AST#)#Right AST#arg...
has(k: K): boolean { throw new Error("Not implemented"); return false; }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
403484e3e71e46a89e19cf3849ce92f11111ca1d
gitee
openharmony/arkui_advanced_ui_component
atomicservicenavigation/source/atomicservicenavigation.ets
arkts
drawGradientCanvasHalf
双色渐变下两种颜色各占50%的实现,把整个画布区域分为两个一样的矩形在绘制 @param context 画布上下文 @param primaryColor 第一种颜色 @param secondaryColor 第二种颜色
drawGradientCanvasHalf(context: CanvasRenderingContext2D, primaryColor: ResourceColor, secondaryColor: ResourceColor): void { let height = this.navigationHeight * COLOR_RATIO_THIRTY_PERCENT; let grad1 = context.createLinearGradient(COORDINATE_NEGATIVE_ONE * this.navigationWidth * COLOR_RATIO_FIFTY_P...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left drawGradientCanvasHalf AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left CanvasRenderingContext2D AST#i...
drawGradientCanvasHalf(context: CanvasRenderingContext2D, primaryColor: ResourceColor, secondaryColor: ResourceColor): void { let height = this.navigationHeight * COLOR_RATIO_THIRTY_PERCENT; let grad1 = context.createLinearGradient(COORDINATE_NEGATIVE_ONE * this.navigationWidth * COLOR_RATIO_FIFTY_P...
https://gitee.com/openharmony/arkui_advanced_ui_component.git
947cd831650cc244900c06ac989b31475a5b176a
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
map
Creates a new Uint32Array using fn(arr[i]) over all elements of current Uint32Array. @param { function } fn - a function to apply for each element of current Uint32Array @returns { Uint32Array } - a new Uint32Array, where for each element from current Uint32Array fn was applied @syscap SystemCapability.Utils.Lang @FaAn...
public map(fn: (val: number, index: int, array: Uint32Array) => number): Uint32Array { let resBuf = new ArrayBuffer(this.lengthInt * Uint32Array.BYTES_PER_ELEMENT) let res = new Uint32Array(resBuf) for (let i = 0; i < this.lengthInt; i++) { res.set(i, fn(this.getUnsafe(i).toDoubl...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left map AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right...
public map(fn: (val: number, index: int, array: Uint32Array) => number): Uint32Array { let resBuf = new ArrayBuffer(this.lengthInt * Uint32Array.BYTES_PER_ELEMENT) let res = new Uint32Array(resBuf) for (let i = 0; i < this.lengthInt; i++) { res.set(i, fn(this.getUnsafe(i).toDoubl...
https://gitcode.com/iop123123/arkts-static-skills
07264b13167176fa4b9e88786b230d03e3700c1d
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
toReversed
Creates a reversed copy @returns { Float32Array } - a reversed copy @syscap SystemCapability.Utils.Lang @FaAndStageModel
public toReversed(): Float32Array { let newArray = new Float32Array(this.lengthInt); if (this.lengthInt > 0) { Float32Array.reverseCopyBuffer(newArray.buffer, this.buffer, this.byteOffset, this.lengthInt); } return newArray }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toReversed AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left Float32Arra...
public toReversed(): Float32Array { let newArray = new Float32Array(this.lengthInt); if (this.lengthInt > 0) { Float32Array.reverseCopyBuffer(newArray.buffer, this.buffer, this.byteOffset, this.lengthInt); } return newArray }
https://gitcode.com/iop123123/arkts-static-skills
77ee51d905a83408c8b2fed257c244a762d01537
gitcode
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ets
arkts
isNumeric
Check whether the string is number. @param { string } str a rationalNumber object of the string type. @returns { boolean } when the str can be parsed into a finite number return true otherwise return false.
static isNumeric(str: string): boolean { let val = Double.parseFloat(str) return !isNaN(val) && isFinite(val); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isNumeric AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string ...
static isNumeric(str: string): boolean { let val = Double.parseFloat(str) return !isNaN(val) && isFinite(val); }
https://gitcode.com/iop123123/arkts-static-skills
271ad7fe0f9618e8605ebd24327acc0efdbb78cc
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/BigInt.ets
arkts
operatorGreaterThanEqual
Checks if this BigInt is greater than or equal to another. @param { BigInt } other The value to compare with. @returns { boolean } True if this is greater than or equal to other, false otherwise. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public operatorGreaterThanEqual(other: BigInt): boolean { return !(other > this) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left operatorGreaterThanEqual AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi...
public operatorGreaterThanEqual(other: BigInt): boolean { return !(other > this) }
https://gitcode.com/iop123123/arkts-static-skills
2ad8d318248013a4e911e4ed4f7f4384cde78b8f
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets
arkts
getDescendantElements
获取后代元素
private getDescendantElements(element: string, tag: string): string[] { const innerHtml = this.extractInnerHtml(element); if (tag === '*') { return this.findAllElements(innerHtml); } return this.findElementsByTag(innerHtml, tag); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getDescendantElements AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left element AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string A...
private getDescendantElements(element: string, tag: string): string[] { const innerHtml = this.extractInnerHtml(element); if (tag === '*') { return this.findAllElements(innerHtml); } return this.findElementsByTag(innerHtml, tag); }
https://github.com/DaLongZhuaZi/manxia
b916eee87cb7afd80723246c2b396ee6c5d952cd
github
LongLiveY96/chatcube
entry/src/main/ets/viewmodels/ChatViewModel.ets
arkts
cancelGenerationForMessageRewrite
编辑 / 重新生成 / 删除会话前的取消生成路径, 不持久化半截 AI 消息。 与 stopGeneration 共用 cancelActiveRequestsForScope, 但走的是 discard 分支: - discardPendingAIMessagesForScope 把 pendingAIMessages 中匹配会话直接丢弃, 不会触发 databaseService.addMessage, 也不会让用户看到一条空 AI 消息; - 之后 ChatPage 会立即从 UI 尾部删掉旧消息, 写入新 prompt, 不需要任何"中断态"展示。 不要在普通 stop 按钮场景调用这个方法, 否则用户会丢失工具事件 / 部...
cancelGenerationForMessageRewrite(sessionId?: string): void { const scopedToSession = sessionId !== undefined && sessionId !== '' if (!scopedToSession) { this.cancelToken = this.cancelToken + 1 } this.discardPendingAIMessagesForScope(sessionId) this.cancelActiveRequestsForScope(scopedToSessi...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left cancelGenerationForMessageRewrite AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sessionId AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#string#Left string AST#s...
cancelGenerationForMessageRewrite(sessionId?: string): void { const scopedToSession = sessionId !== undefined && sessionId !== '' if (!scopedToSession) { this.cancelToken = this.cancelToken + 1 } this.discardPendingAIMessagesForScope(sessionId) this.cancelActiveRequestsForScope(scopedToSessi...
https://github.com/LongLiveY96/chatcube
a0dd2b336dd6dfcf3f4ef5d3ee318ae0b135bab9
github
openharmony/update_update_app
feature/ota/src/main/ets/manager/OtaUpdateManager.ets
arkts
onReceivedUpdateServiceMessage
收到推送消息 @param otaStatus 状态数据
async onReceivedUpdateServiceMessage(eventInfo: update.EventInfo): Promise<void> { this.log('receives from onReceivedUpdateServiceMessage:' + JSON.stringify(eventInfo)); let message: Message = { context: globalThis.extensionContext, eventInfo: eventInfo, }; await this.messageQueue.execute(...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left onReceivedUpdateServiceMessage AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#ide...
async onReceivedUpdateServiceMessage(eventInfo: update.EventInfo): Promise<void> { this.log('receives from onReceivedUpdateServiceMessage:' + JSON.stringify(eventInfo)); let message: Message = { context: globalThis.extensionContext, eventInfo: eventInfo, }; await this.messageQueue.execute(...
https://gitee.com/openharmony/update_update_app.git
8f2635378de9f95c28e546c9a1a40a92edd33dfc
gitee
ibestservices/ibest-ui
library/src/main/ets/components/pickerGroup/index.ets
arkts
tabNameChange
tabName 改变
tabNameChange(){ this.tabChange(this.currentName) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left tabNameChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left...
tabNameChange(){ this.tabChange(this.currentName) }
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/pickerGroup/index.ets#L81-L83
b460fd873e58217574d125075ed754ade8277c76
github
yongoe1024/RdbPlus
rdbplus/src/main/ets/core/Wrapper.ets
arkts
lt
小于 @param field 字段 @param value 值 @returns Wrapper
lt(field: string, value: relationalStore.ValueType, condition: boolean = true): Wrapper { if (condition) { this.whereList.push(`and ${field} < ?`) this.valueList.push(value) } return this }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left lt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left field AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Right...
lt(field: string, value: relationalStore.ValueType, condition: boolean = true): Wrapper { if (condition) { this.whereList.push(`and ${field} < ?`) this.valueList.push(value) } return this }
https://github.com/yongoe1024/RdbPlus/blob/83f7347b7ac692941729d3464923155948e876bb/rdbplus/src/main/ets/core/Wrapper.ets#L98-L104
966a7879e01c93a64dc27733c19da4c0662b0025
github
Countly/countly-sdk-hos
library/src/main/ets/internal/RequestQueue.ets
arkts
removeDifferentAppKeys
Drop any queued request whose `app_key=` parameter differs from the current app key. Paired with `replaceAllAppKeysWithCurrent`, use whichever matches the integrator's "what should happen to old-app-key traffic?" policy.
public async removeDifferentAppKeys(): Promise<void> { const encoded: string = encodeURIComponent(this.config.appKey); const before: number = this.queue.length; this.queue = this.queue.filter((r: string) => { const match: RegExpMatchArray | null = r.match(/(?:^|&)app_key=([^&]*)/); if (!match)...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left removeDifferentAppKeys AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Rig...
public async removeDifferentAppKeys(): Promise<void> { const encoded: string = encodeURIComponent(this.config.appKey); const before: number = this.queue.length; this.queue = this.queue.filter((r: string) => { const match: RegExpMatchArray | null = r.match(/(?:^|&)app_key=([^&]*)/); if (!match)...
https://github.com/Countly/countly-sdk-hos
2febac02f37a9d40af5dffeef47a7b07e149cda7
github
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnIconViewModel.ets
arkts
getSizeIcons
获取尺寸展示列表 @returns {IconSizeItem[]} 尺寸项数组
getSizeIcons(): IconSizeItem[] { return [ new IconSizeItem("20", 20), new IconSizeItem("28", 28), new IconSizeItem("36", 36), new IconSizeItem("48", 48), new IconSizeItem("64", 64), ]; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getSizeIcons AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left IconSizeItem AST#identifier#Right ...
getSizeIcons(): IconSizeItem[] { return [ new IconSizeItem("20", 20), new IconSizeItem("28", 28), new IconSizeItem("36", 36), new IconSizeItem("48", 48), new IconSizeItem("64", 64), ]; }
https://github.com/codelably/tuniao-ui
2bad19b2311ff4e8650558f1815996d9a257d017
github
Harrisonls2004/WaterFlow
entry/src/main/ets/common/utils/UserManager.ets
arkts
getUserInfo
Get user info by username. 优先从服务器获取,然后缓存到本地
static async getUserInfo(username: string): Promise<IUser | null> { try { if (!UserManager.dataPreferences) { Logger.error('UserManager', 'Preferences not initialized'); return null; } // 优先从服务器获取用户信息 if (SERVER_ENABLED) { try { const response = await Aut...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left getUserInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left username AST#identifier#Right AST#ERROR#Left AST#:#Left : A...
static async getUserInfo(username: string): Promise<IUser | null> { try { if (!UserManager.dataPreferences) { Logger.error('UserManager', 'Preferences not initialized'); return null; } // 优先从服务器获取用户信息 if (SERVER_ENABLED) { try { const response = await Aut...
https://github.com/Harrisonls2004/WaterFlow
b0b29f44e65481bed96adf3da22308e45ba1744d
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/WebViewImageLoader.ets
arkts
set
设置缓存项
set(key: string, data: ArrayBuffer, expireTime?: number): void { try { const expire = expireTime || (Date.now() + this.defaultExpireTime); // 检查缓存大小限制 if (data.byteLength > this.maxCacheSize / 10) { logger.warn(TAG, `缓存项过大,跳过缓存: ${key}, 大小: ${WebViewImageUtils.formatFileSize(data....
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left set AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Right ...
set(key: string, data: ArrayBuffer, expireTime?: number): void { try { const expire = expireTime || (Date.now() + this.defaultExpireTime); // 检查缓存大小限制 if (data.byteLength > this.maxCacheSize / 10) { logger.warn(TAG, `缓存项过大,跳过缓存: ${key}, 大小: ${WebViewImageUtils.formatFileSize(data....
https://github.com/DaLongZhuaZi/manxia
d809423bf4efba94a707aeaaa8f2d632625f2058
github
Nekofox-POT/LinMusic
entry/src/main/ets/package/audio_player/by_av_player.ets
arkts
set_play_status
播放/暂停 //
set_play_status(status: boolean) { if (status) { this.avPlayer?.play() } else { this.avPlayer?.pause() } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left set_play_status AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left status AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#...
set_play_status(status: boolean) { if (status) { this.avPlayer?.play() } else { this.avPlayer?.pause() } }
https://github.com/Nekofox-POT/LinMusic
b169fb9c069eb6ec0f245d53888c00bf20deb180
github
openharmony-tpc/ImageKnife
library/src/main/ets/cache/FileCache.ets
arkts
put
添加缓存键值对,同时写文件
put(key: string, value: ArrayBuffer): void { if (key == null || value == null) { throw new Error('key or value is invalid '); } if (!this.isInited) { return } // 如果size满了的话,需要按照LRU的方式删除第一个 if (this.lruCache.length == this.maxSize && !this.lruCache.contains(key)) { this.remov...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left put AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Right ...
put(key: string, value: ArrayBuffer): void { if (key == null || value == null) { throw new Error('key or value is invalid '); } if (!this.isInited) { return } // 如果size满了的话,需要按照LRU的方式删除第一个 if (this.lruCache.length == this.maxSize && !this.lruCache.contains(key)) { this.remov...
https://gitee.com/openharmony-tpc/ImageKnife.git
a9d3a26eea92ad80cef59562b0952bb00f2778de
gitee
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnCalendarViewModel.ets
arkts
setSelectedDate
设置单选模式下的选中日期 @param date 日期字符串,格式如 "2024-01-01"
setSelectedDate(date: string): void { this.selectedDate = date; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setSelectedDate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left date AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left )...
setSelectedDate(date: string): void { this.selectedDate = date; }
https://github.com/codelably/tuniao-ui
a7e9443f12ed98b0dfd1791c36f1eccf3ba14218
github
Cool_foolisher1/ArkTSRepository
GuardianAssistant/entry/src/main/ets/database/PrivacyNoteDB.ets
arkts
update
更新 @param item @returns 影响的行数
async update(item: Partial<PrivacyNoteDBInfo>) { // 如果没有 id 直接退出 if (!item.id) { return Promise.reject('id error') } const store = await this.getStoreInstance() const predicates = new relationalStore.RdbPredicates(this.tableName) predicates.equalTo('id', item.id) // 更新完成,返回受影响的行数 ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left update AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left item AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Ri...
async update(item: Partial<PrivacyNoteDBInfo>) { // 如果没有 id 直接退出 if (!item.id) { return Promise.reject('id error') } const store = await this.getStoreInstance() const predicates = new relationalStore.RdbPredicates(this.tableName) predicates.equalTo('id', item.id) // 更新完成,返回受影响的行数 ...
https://gitcode.com/Cool_foolisher1/ArkTSRepository
25a9c7550c40aa78d79c8b8390dadb7bcec50cc4
gitcode
XJTUWYD/ArkDiff
entry/src/main/ets/engine/DiffEngine.ets
arkts
buildUnified
========== 构建 Unified(无合并) ==========
private static buildUnified( linesA: string[], linesB: string[], lcs: LcsResult ): DiffLine[] { const result: DiffLine[] = []; const matches = lcs.matches; let cA = 0, cB = 0, mIdx = 0; while (cA < linesA.length || cB < linesB.length) { if (mIdx < matches.length) { const m = match...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left buildUnified AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left linesA AST#identifier#Right AST#:#Left ...
private static buildUnified( linesA: string[], linesB: string[], lcs: LcsResult ): DiffLine[] { const result: DiffLine[] = []; const matches = lcs.matches; let cA = 0, cB = 0, mIdx = 0; while (cA < linesA.length || cB < linesB.length) { if (mIdx < matches.length) { const m = match...
https://github.com/XJTUWYD/ArkDiff
b57a57bd08d107ac5bba409927b0b0958ad41651
github
openharmony/codelabs
ETSUI/LifeTrack/entry/src/main/ets/dao/EventDao.ets
arkts
rowToEvent
将数据库行转换为Event对象
private rowToEvent(resultSet: relationalStore.ResultSet): CalendarEvent { return { id: resultSet.getString(resultSet.getColumnIndex('id')), title: resultSet.getString(resultSet.getColumnIndex('title')), description: resultSet.getString(resultSet.getColumnIndex('description')), startTime: r...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left rowToEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resultSet AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expres...
private rowToEvent(resultSet: relationalStore.ResultSet): CalendarEvent { return { id: resultSet.getString(resultSet.getColumnIndex('id')), title: resultSet.getString(resultSet.getColumnIndex('title')), description: resultSet.getString(resultSet.getColumnIndex('description')), startTime: r...
https://gitcode.com/openharmony/codelabs
25c57363012d6559b2019bb4b32f71069a0321e6
gitcode
aimilin6688/KeePassHO
entry/src/main/ets/services/SettingsService.ets
arkts
setSortBy
设置排序方式 @param sortBy 排序方式 ('default' | 'name' | 'modified' | 'created')
public async setSortBy(sortBy: SortMode): Promise<void> { return this.put(SettingsService.KEY_SORT_BY, sortBy); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left setSortBy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left sortBy AST#identifier#Right AST#:#Left : AST#:...
public async setSortBy(sortBy: SortMode): Promise<void> { return this.put(SettingsService.KEY_SORT_BY, sortBy); }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/SettingsService.ets#L169-L171
c43a84895debe2dab050ed260992dc29fdbe86af
github
HarmonyOS_Samples/MusicHome
features/player/src/main/ets/util/BackgroundUtil.ets
arkts
stopContinuousTask
Stops continuous background running when the capability is available on device. @param context UIAbility context that started background running.
public static stopContinuousTask(context: common.UIAbilityContext): void { if (canIUse('SystemCapability.ResourceSchedule.BackgroundTaskManager.Core')) { try { backgroundTaskManager.stopBackgroundRunning(context).then(() => { Logger.info('this avPlayer: ', 'stopBackgroundRunning succeeded'...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left stopContinuousTask AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#L...
public static stopContinuousTask(context: common.UIAbilityContext): void { if (canIUse('SystemCapability.ResourceSchedule.BackgroundTaskManager.Core')) { try { backgroundTaskManager.stopBackgroundRunning(context).then(() => { Logger.info('this avPlayer: ', 'stopBackgroundRunning succeeded'...
https://gitcode.com/HarmonyOS_Samples/MusicHome
4510e75087c8a30120ddb153d809480e21a6722c
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Annotations/UnifiedAnnotationManager.ets
arkts
createHighlight
Create a highlight annotation.
async createHighlight(input: CreateHighlightInput): Promise<UnifiedAnnotationRecord> { await this.ensureSchema(); const anchor = input.anchor || {}; const styleJson = JSON.stringify(input.style); const contentType = input.contentType ?? UnifiedContentType.NOVEL; const existing = await this.findLat...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left createHighlight AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left input AST#identifier#Right AST#type_annotation#Left AST#:#Left ...
async createHighlight(input: CreateHighlightInput): Promise<UnifiedAnnotationRecord> { await this.ensureSchema(); const anchor = input.anchor || {}; const styleJson = JSON.stringify(input.style); const contentType = input.contentType ?? UnifiedContentType.NOVEL; const existing = await this.findLat...
https://github.com/DaLongZhuaZi/manxia
f958a89ead287e2a97e87f0808a485ef0b5d6137
github
ZestBox-18/kitebook-frontend
commons/data_core/src/main/ets/services/AccountManager.ets
arkts
renameBillsForTargetAccount
账户改名后同步账单目标账户字段。
private static async renameBillsForTargetAccount(originalName: string, nextName: string): Promise<void> { const predicates = new relationalStore.RdbPredicates(BILL_TABLE_NAME); predicates.equalTo('target_account', originalName); const data: relationalStore.ValuesBucket = { target_account: nextName, ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left renameBillsForTargetAccount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left or...
private static async renameBillsForTargetAccount(originalName: string, nextName: string): Promise<void> { const predicates = new relationalStore.RdbPredicates(BILL_TABLE_NAME); predicates.equalTo('target_account', originalName); const data: relationalStore.ValuesBucket = { target_account: nextName, ...
https://github.com/ZestBox-18/kitebook-frontend
713187aff240c68d8f23269b6d4967c9d69c5ad4
github
offlinecat-dev/OCNetORM
src/main/ets/core/HooksProcessor.ets
arkts
executeCallback
执行钩子回调 支持同步和异步钩子,等待 Promise 完成 @param callback 钩子回调函数 @param data 实体数据 @param entityName 实体名称 @param hookName 钩子名称
private async executeCallback( callback: HookCallback, data: EntityData, entityName: string, hookName: HookName ): Promise<void> { try { const result = callback(data) // 如果返回 Promise,等待其完成 if (result instanceof Promise) { await result } } catch (error) { ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left executeCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#:#L...
private async executeCallback( callback: HookCallback, data: EntityData, entityName: string, hookName: HookName ): Promise<void> { try { const result = callback(data) // 如果返回 Promise,等待其完成 if (result instanceof Promise) { await result } } catch (error) { ...
https://github.com/offlinecat-dev/OCNetORM
8711538fc14c5e5ba2ed20a7a58d4d9bddf61657
github
arkui-x/samples
CodeLab/Cases/feature/bluetooth/src/main/ets/viewmodel/BluetoothClientModel.ets
arkts
stopBLEScanInner
停止扫描蓝牙设备
private stopBLEScanInner() { Log.showInfo(TAG, `stopBLEScanInner`); try { ble.stopBLEScan(); Log.showInfo(TAG, `stopBLEScanInner: scan ble stop`); } catch (err) { Log.showError(TAG, `stopBLEScanInner: err = ${err}`); } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left stopBLEScanInner AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#...
private stopBLEScanInner() { Log.showInfo(TAG, `stopBLEScanInner`); try { ble.stopBLEScan(); Log.showInfo(TAG, `stopBLEScanInner: scan ble stop`); } catch (err) { Log.showError(TAG, `stopBLEScanInner: err = ${err}`); } }
https://gitcode.com/arkui-x/samples
c771a3b86c35dd142e9260622ca8ca363845f5d8
gitcode
zhangmeng1847/RDB
entry/src/main/ets/views/TaskItem.ets
arkts
finishedTask
任务完成样式
@Extend(Text) function finishedTask(){ .decoration({type:TextDecorationType.LineThrough}) .fontColor('#B1B2B1') }
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#call_expression#Left AST#identifier#Left Extend AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left Text AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#R...
@Extend(Text) function finishedTask(){ .decoration({type:TextDecorationType.LineThrough}) .fontColor('#B1B2B1') }
https://github.com/zhangmeng1847/RDB
798ab8ff67555bc0d820b316db1c78340a7eb7a7
github
AGenUI/AGenUI
platforms/harmony/agenui/src/main/ets/agenui/AGenUIContainer.ets
arkts
build
Builds the UI
build() { // Leave height unconstrained so the Stack grows with its content. Stack() { ContentSlot(this.nodeContent) } .width('100%') .onSizeChange((oldValue: SizeOptions, newValue: SizeOptions) => { const newWidth = Math.round(newValue.width as number); const oldWidth = Math.rou...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST...
build() { // Leave height unconstrained so the Stack grows with its content. Stack() { ContentSlot(this.nodeContent) } .width('100%') .onSizeChange((oldValue: SizeOptions, newValue: SizeOptions) => { const newWidth = Math.round(newValue.width as number); const oldWidth = Math.rou...
https://github.com/AGenUI/AGenUI
bf7e0ef716aa91db9e4472a3d389f41545360962
github
tdcare/tdwebrtc
src/main/ets/utils/LogUtil.ets
arkts
debug
打印DEBUG级别日志 @param args
static debug(...args: string[] | object[]): void { LogUtil.uniLog(args, hilog.LogLevel.DEBUG); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left debug AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#ERROR#Left AST#identifier#Left arg...
static debug(...args: string[] | object[]): void { LogUtil.uniLog(args, hilog.LogLevel.DEBUG); }
https://github.com/tdcare/tdwebrtc
c90270d61438fe21a04a8784a48a669cd01c0206
github
the-wwyang/kids-learning-app
src/main/ets/utils/AnimationUtils.ets
arkts
withIterations
获取循环动画配置 @param baseConfig 基础配置 @param iterations 循环次数(-1 表示无限循环) @returns 循环动画配置
static withIterations(baseConfig: AnimationConfig, iterations: number): AnimationConfig { return { ...baseConfig, iterations }; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left withIterations AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left baseConfig AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#...
static withIterations(baseConfig: AnimationConfig, iterations: number): AnimationConfig { return { ...baseConfig, iterations }; }
https://github.com/the-wwyang/kids-learning-app
4976eb3b50c59a4b1c88e70711fd0a19df2addee
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
constructor
Creates an Int8Array with respect to data, byteOffset and length. @param { ArrayBuffer } buf - data initializer @param { Number | undefined } byteOffset - byte offset from begin of the buf @param { Number | undefined } length - size of elements of type byte in newly created Int8Array @throws { RangeError } - Input para...
public constructor(buf: ArrayBuffer, byteOffset: Number | undefined, length: Number | undefined) { let intByteOffset: int = 0 if (byteOffset != undefined) { intByteOffset = byteOffset.toInt() if (intByteOffset < 0) { throw new RangeError("Range Error: byteOffs...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left buf AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Array...
public constructor(buf: ArrayBuffer, byteOffset: Number | undefined, length: Number | undefined) { let intByteOffset: int = 0 if (byteOffset != undefined) { intByteOffset = byteOffset.toInt() if (intByteOffset < 0) { throw new RangeError("Range Error: byteOffs...
https://gitcode.com/iop123123/arkts-static-skills
8bb249c6e716d7b232ae784b185014953b481fed
gitcode
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/ReminderService.ets
arkts
checkAndTriggerDueReminders
检查并触发到期的提醒
static async checkAndTriggerDueReminders(userId: number): Promise<ReminderNotificationResult[]> { try { const currentDate: string = new Date().toISOString(); const dueReminders: Reminder[] = await ReminderDAO.getDueReminders(userId, currentDate); console.log(`[ReminderService] 检查到 ${dueReminder...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left checkAndTriggerDueReminders AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right ...
static async checkAndTriggerDueReminders(userId: number): Promise<ReminderNotificationResult[]> { try { const currentDate: string = new Date().toISOString(); const dueReminders: Reminder[] = await ReminderDAO.getDueReminders(userId, currentDate); console.log(`[ReminderService] 检查到 ${dueReminder...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
ca3c7e2e7c142a47e4793fd728b7e1fa493de378
github
ibestservices/ibest-ui
entry/src/main/ets/utils/global.ets
arkts
getMainWindow
获取mainWindow
public static getMainWindow(){ return GlobalStore.windowStage.getMainWindowSync() }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getMainWindow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#E...
public static getMainWindow(){ return GlobalStore.windowStage.getMainWindowSync() }
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/entry/src/main/ets/utils/global.ets#L39-L41
3e04eb89be5d6d1f5481550770255db0431f8fdb
github
openharmony/arkcompiler_taihe_ffi_gen
test/ani_tuple/user/main.ets
arkts
testMakeIntPairArray
====== Test 7: Array<IntPair> - tuple as Array element ======
function testMakeIntPairArray() { let arr: Array<TupleTest.IntPair> = TupleTest.makeIntPairArray(3); console.log("makeIntPairArray length: " + arr.length); arktest.assertEQ(arr.length, 3); // arr[0] = [0, 0], arr[1] = [1, 10], arr[2] = [2, 20] arktest.assertEQ(arr[0][0], 0); arktest.assertEQ(arr...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testMakeIntPairArray AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#lexica...
function testMakeIntPairArray() { let arr: Array<TupleTest.IntPair> = TupleTest.makeIntPairArray(3); console.log("makeIntPairArray length: " + arr.length); arktest.assertEQ(arr.length, 3); // arr[0] = [0, 0], arr[1] = [1, 10], arr[2] = [2, 20] arktest.assertEQ(arr[0][0], 0); arktest.assertEQ(arr...
https://gitcode.com/openharmony/arkcompiler_taihe_ffi_gen
60f1f08f4b02f634b5a3790777805fe300b97125
gitcode
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test23_original_index.ets
arkts
testPromiseStatics
--- Promise.resolve / Promise.reject statics ---
function testPromiseStatics(): string { let resolved: Promise<number> = Promise.resolve(42); let rejected: Promise<number> = Promise.reject(-1); // Can't await in strict mode non-async, just verify creation return 'promises created'; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testPromiseStatics AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefin...
function testPromiseStatics(): string { let resolved: Promise<number> = Promise.resolve(42); let rejected: Promise<number> = Promise.reject(-1); // Can't await in strict mode non-async, just verify creation return 'promises created'; }
https://github.com/miaochiahao/ark-ghidra
afa33f1c8e06716078e9528621d8c2a6c82322ed
github
aimilin6688/KeePassHO
entry/src/main/ets/common/utils/FilenameUtils.ets
arkts
replaceFileName
替换文件名 @param url 文件路径 @param fileName 文件名 @returns 文件路径
public static replaceFileName(url: string, fileName: string): string { return url.replace(/[^/]+$/, fileName); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left replaceFileName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : A...
public static replaceFileName(url: string, fileName: string): string { return url.replace(/[^/]+$/, fileName); }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/FilenameUtils.ets#L30-L32
9a00a47af6207c4678ac61dfe4c825416b3ecfef
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets
arkts
hypot
Return a new Decimal whose value is the square root of the sum of the squares of the arguments, rounded to `precision` significant digits using rounding mode `rounding`. @param { Value[] } n {double | string | Decimal} Decimal @returns { Decimal } the Decimal type
static hypot(...n: Value[]): Decimal { let t = new Decimal(0); external = false; for (let i = 0; i < n.length;) { let v = new Decimal(n[i++]); if (!v.d) { if (v.s) { external = true; return new Decimal(Infinity);...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left hypot AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#ERROR#Left AST#identifier#Left n A...
static hypot(...n: Value[]): Decimal { let t = new Decimal(0); external = false; for (let i = 0; i < n.length;) { let v = new Decimal(n[i++]); if (!v.d) { if (v.s) { external = true; return new Decimal(Infinity);...
https://gitcode.com/iop123123/arkts-static-skills
2cb50f38b0432a9baa89ce5558a328700d3358cb
gitcode
wodekouwei/qlog
qloglib/src/main/ets/qlog/xlog/CommonUtils.ets
arkts
existFile
文件是否存在 @param path 文件路径
public static existFile(path: string): boolean { try { return fileIo.accessSync(path) } catch (e) { Logg.e(TAG, 'exist file is error') return false } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left existFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#...
public static existFile(path: string): boolean { try { return fileIo.accessSync(path) } catch (e) { Logg.e(TAG, 'exist file is error') return false } }
https://gitcode.com/wodekouwei/qlog
60a04520e2c5825eb3b3f72dab191469b09d1ff7
gitcode
zhubowen-bot/Bowen_ArkWeb_framework
entry/src/main/ets/utiles/EmitterUtil.ets
arkts
getListenerCount
获取指定事件的订阅数 @param eventId 事件ID,string类型的eventId不支持空字符串。 @returns
static getListenerCount(eventId: number | string): number { return emitter.getListenerCount(eventId); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getListenerCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left eventId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expre...
static getListenerCount(eventId: number | string): number { return emitter.getListenerCount(eventId); }
https://github.com/zhubowen-bot/Bowen_ArkWeb_framework
f45ecfcbfebe1b75f74fb8c2e8344637d64b6dd6
github
HarmonyOS_Samples/hmosworld
HMOSWorld/Application/features/discover/src/main/ets/views/SearchView.ets
arkts
confirmDeleteHistory
Confirm dialog
confirmDeleteHistory(): void { promptAction.showDialog({ message: $r('app.string.confirm_delete_search_history'), buttons: [ { text: $r('app.string.cancel'), color: $r('sys.color.ohos_id_color_text_secondary') }, { text: $r('app.string.sure'), ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left confirmDeleteHistory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#stateme...
confirmDeleteHistory(): void { promptAction.showDialog({ message: $r('app.string.confirm_delete_search_history'), buttons: [ { text: $r('app.string.cancel'), color: $r('sys.color.ohos_id_color_text_secondary') }, { text: $r('app.string.sure'), ...
https://gitcode.com/HarmonyOS_Samples/hmosworld
4d67f99b926e5d7952f3690d174c83153b5afce2
gitcode
Joker-x-dev/CoolMallArkTS
core/state/src/main/ets/UserState.ets
arkts
refreshUserInfo
从网络刷新用户信息 @returns {void} 无返回值 @example getUserState().refreshUserInfo();
refreshUserInfo(): void { if (!this.isLoggedIn()) { return; } RequestHelper.repository(new UserInfoRepository().getPersonInfo()) .execute() .then((userInfo: User): void => { this.updateUserInfo(userInfo); }); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left refreshUserInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bl...
refreshUserInfo(): void { if (!this.isLoggedIn()) { return; } RequestHelper.repository(new UserInfoRepository().getPersonInfo()) .execute() .then((userInfo: User): void => { this.updateUserInfo(userInfo); }); }
https://github.com/Joker-x-dev/CoolMallArkTS
e08c90a4d2dfe1850f766f823b255a77cc12e62b
github
LJ666-ui/harmony-health-care
entry/src/main/ets/ar/ARNavigationService.ets
arkts
handlePositionUpdate
处理位置更新
private handlePositionUpdate(position: Position3D): void { if (!this.navigationState.isActive) { return; } // 更新当前位置 this.navigationState.currentPosition = position; this.navigationState.lastUpdateTime = Date.now(); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handlePositionUpdate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left position AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#iden...
private handlePositionUpdate(position: Position3D): void { if (!this.navigationState.isActive) { return; } // 更新当前位置 this.navigationState.currentPosition = position; this.navigationState.lastUpdateTime = Date.now(); }
https://github.com/LJ666-ui/harmony-health-care
06ff95435a03da361e2b94c51d1877672cfd54f9
github
HarmonyOS_Samples/MusicHome
features/recommendation/src/main/ets/model/RecommendSongUiDataSource.ets
arkts
getData
@param index - Zero-based index into the backing array. @returns Song UI model at the given index.
public getData(index: number): RecommendPrivateSongUi { return this.dataArray[index]; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number ...
public getData(index: number): RecommendPrivateSongUi { return this.dataArray[index]; }
https://gitcode.com/HarmonyOS_Samples/MusicHome
25069a259da89537cf3c9f2f42da9df7cafd4511
gitcode
openharmony/arkcompiler_taihe_ffi_gen
test/ani_tuple/user/main.ets
arkts
testSwapIntPair
====== Test 3: IntPair - roundtrip (pass in and return) ======
function testSwapIntPair() { let pair: TupleTest.IntPair = [100, 200]; let swapped = TupleTest.swapIntPair(pair); console.log("swapIntPair: [" + swapped[0] + ", " + swapped[1] + "]"); arktest.assertEQ(swapped[0], 200); arktest.assertEQ(swapped[1], 100); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testSwapIntPair AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#lexical_dec...
function testSwapIntPair() { let pair: TupleTest.IntPair = [100, 200]; let swapped = TupleTest.swapIntPair(pair); console.log("swapIntPair: [" + swapped[0] + ", " + swapped[1] + "]"); arktest.assertEQ(swapped[0], 200); arktest.assertEQ(swapped[1], 100); }
https://gitcode.com/openharmony/arkcompiler_taihe_ffi_gen
a9ddbe286cf77e260abc55d93677a50f33b6a57c
gitcode
AetheriumSimulator/qemu-hmos
entry/src/main/ets/utils/NetworkManager.ets
arkts
testConnection
测试网络连接 使用 TCP socket 测试目标端口是否可达
public async testConnection(host: string, port: number): Promise<boolean> { return new Promise((resolve) => { try { // 使用 HarmonyOS socket API 测试连接 import('@ohos.net.socket').then((socket) => { const tcpSocket = socket.constructTCPSocketInstance(); const connec...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left testConnection AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left host AST#identifier#Right AST#:#Left : AS...
public async testConnection(host: string, port: number): Promise<boolean> { return new Promise((resolve) => { try { // 使用 HarmonyOS socket API 测试连接 import('@ohos.net.socket').then((socket) => { const tcpSocket = socket.constructTCPSocketInstance(); const connec...
https://github.com/AetheriumSimulator/qemu-hmos
2b3483ed49f4bd0b35d98492fd70bb8063c395a9
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/components/Legend.ets
arkts
setOrientation
sets the orientation of the legend @param value
public setOrientation(value: LegendOrientation): void { this.mOrientation = value; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setOrientation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ...
public setOrientation(value: LegendOrientation): void { this.mOrientation = value; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
12adbbb43b38c70bda7c33ac3bec73c1d262bd8c
gitee
heeh02/superconnect
harmony/entry/src/main/ets/input/GestureController.ets
arkts
onUp
etype lets Cancel suppress the synthetic tap-click so a button never sticks.
onUp(ev: TouchEvent, etype: TouchType): void { const remaining: TouchObject[] = this.stillDown(ev); const dt: number = this.now() - this.downMs; if (this.st === GState.Pending) { this.clearT(); if (etype !== TouchType.Cancel) { const upPt: Pt = this.buffered.length > 0 ? this.buffered...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onUp AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ev AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left TouchEvent AST#identifier#Right AST#,#Left , AST#,#Ri...
onUp(ev: TouchEvent, etype: TouchType): void { const remaining: TouchObject[] = this.stillDown(ev); const dt: number = this.now() - this.downMs; if (this.st === GState.Pending) { this.clearT(); if (etype !== TouchType.Cancel) { const upPt: Pt = this.buffered.length > 0 ? this.buffered...
https://github.com/heeh02/superconnect
e5d824444c9b2b5ece37921f948a85bb3b946763
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets
arkts
getElementsByXPathPath
根据XPath路径获取元素
private getElementsByXPathPath(xpath: string): string[] { let elements: string[] = [this.content]; // 分解XPath路径 const steps = this.parseXPathSteps(xpath); for (const step of steps) { const newElements: string[] = []; for (const element of elements) { const matched = this....
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getElementsByXPathPath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left xpath AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ident...
private getElementsByXPathPath(xpath: string): string[] { let elements: string[] = [this.content]; // 分解XPath路径 const steps = this.parseXPathSteps(xpath); for (const step of steps) { const newElements: string[] = []; for (const element of elements) { const matched = this....
https://github.com/DaLongZhuaZi/manxia
c524d10c0199534c50c8e82b13ded1dc55f5bc18
github
openharmony/codelabs
ETSUI/AccountApp/entry/src/main/ets/database/RdbHelper.ets
arkts
deleteAppAccount
[新增] 删除一条账号记录
public deleteAppAccount(id: number): Promise<number> { return new Promise((resolve) => { if (!this.rdbStore) { resolve(-1); return; } try { let predicates = new relationalStore.RdbPredicates('APP_ACCOUNT_TABLE'); predicates.equalTo('id', id); this.rdbStore.delete(predicates, ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left deleteAppAccount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left n...
public deleteAppAccount(id: number): Promise<number> { return new Promise((resolve) => { if (!this.rdbStore) { resolve(-1); return; } try { let predicates = new relationalStore.RdbPredicates('APP_ACCOUNT_TABLE'); predicates.equalTo('id', id); this.rdbStore.delete(predicates, ...
https://gitcode.com/openharmony/codelabs
74b601decaadd7c5b41a1219c4dc7500ea923031
gitcode
aimilin6688/KeePassHO
entry/src/main/ets/services/template/TemplateService.ets
arkts
getTemplatesGroup
==================== 模板分组管理 ==================== 获取模板分组
getTemplatesGroup(kdbx: Kdbx): KdbxGroup | null { // 首先检查数据库元数据 if (kdbx.meta && kdbx.meta.entryTemplatesGroup) { const group = this.findGroupByUuid(kdbx.getDefaultGroup(), kdbx.meta.entryTemplatesGroup); if (group) { return group; } } // 查找名为Templates的分组 return this.fin...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getTemplatesGroup AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left kdbx AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
getTemplatesGroup(kdbx: Kdbx): KdbxGroup | null { // 首先检查数据库元数据 if (kdbx.meta && kdbx.meta.entryTemplatesGroup) { const group = this.findGroupByUuid(kdbx.getDefaultGroup(), kdbx.meta.entryTemplatesGroup); if (group) { return group; } } // 查找名为Templates的分组 return this.fin...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/template/TemplateService.ets#L288-L299
55e3f9058f3becb72bd10e633741820307db52fd
github
openharmony/codelabs
ETSUI/MemoTime/entry/src/main/ets/model/Recording.ets
arkts
generateRecordingUUID
生成 UUID
function generateRecordingUUID(): string { const timestamp = Date.now().toString(36) const randomPart = Math.random().toString(36).substring(2, 15) return `recording-${timestamp}-${randomPart}` }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left generateRecordingUUID AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#prede...
function generateRecordingUUID(): string { const timestamp = Date.now().toString(36) const randomPart = Math.random().toString(36).substring(2, 15) return `recording-${timestamp}-${randomPart}` }
https://gitcode.com/openharmony/codelabs
0017f0b1f76d911dd00adabd20e39bccce6ce520
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Date.ets
arkts
getUTCMonth
Returns the month of the specified date according to universal time, as a zero-based value (where zero indicates the first month of the year). @returns An integer number, between 0 and 11, representing the month in the given date according to UTC time. 0 corresponds to January, 1 to February, and so on.
public getUTCMonth(): byte { return ecmaMonthFromTime(this.ms); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getUTCMonth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left byte AST#i...
public getUTCMonth(): byte { return ecmaMonthFromTime(this.ms); }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
2748979fccf3c61c0049c428fc614db8d66c214f
gitee
terryma2024/happyword
harmonyos/entry/src/ohosTest/ets/test/PackManagerFlow.ui.test.ets
arkts
bindViaShortCode
Drive the manual short-code redeem flow against the mock to leave the device in a `CloudCredentials.isBound() === true` state. The UI-level path is preferred over poking `wordmagic_cloud` preferences directly because: 1. `CloudCredentials.init` runs async in `aboutToAppear` for both `PackManagerPage` and `ConfigPage`; ...
async function bindViaShortCode(driver: Driver): Promise<void> { try { await clickByIdShared(driver, 'HomeConfigButton'); await driver.delayMs(1500); for (let attempt: number = 0; attempt < 5; attempt++) { const bind: Component | null = await driver.findComponent(ON.id('ConfigBindParentButto...
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left bindViaShortCode AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left driver AST#identifier#Right AST#...
async function bindViaShortCode(driver: Driver): Promise<void> { try { await clickByIdShared(driver, 'HomeConfigButton'); await driver.delayMs(1500); for (let attempt: number = 0; attempt < 5; attempt++) { const bind: Component | null = await driver.findComponent(ON.id('ConfigBindParentButto...
https://github.com/terryma2024/happyword
d02dce6bac3bd8fc82310730e0590c578d11271a
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.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.
isInt16Array(value: Object): boolean { return value instanceof Int16Array; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isInt16Array AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Object AST#identifier#Right AST#)#Left ) A...
isInt16Array(value: Object): boolean { return value instanceof Int16Array; }
https://gitcode.com/iop123123/arkts-static-skills
a25d252111efeeff988424526a6e207d2018da12
gitcode
openharmony-sig/smartperf
device/device_ui/entry/src/main/ets/pages/FloatBall.ets
arkts
initAllCollect
initCollectPid(){ //尝试循环刷新 当前running abilitysInfo 获取pid globalThis.collectIntervalPid = setInterval(()=>{ //初始化采集目标进程pid getPidOfAbility(globalThis.collectPkg).then(pid=>{ globalThis.processPid = pid if(pid != "-1"){ clearInterval(globalThis.collectIntervalPid) SPLogger.DEBUG(TAG, "clear collectIntervalPid and cur pid:...
initAllCollect() { console.log("collectIntervalCollect initAllCollect...."); if (globalThis.collectConfigs != -1 && globalThis.collectPkg != -1) { if(globalThis.collectConfigs.screen_capture){ MainWorker.postMessage({"screen_capture":true}) } if(globalThis.collectConfigs.trace){ ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left initAllCollect AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Lef...
initAllCollect() { console.log("collectIntervalCollect initAllCollect...."); if (globalThis.collectConfigs != -1 && globalThis.collectPkg != -1) { if(globalThis.collectConfigs.screen_capture){ MainWorker.postMessage({"screen_capture":true}) } if(globalThis.collectConfigs.trace){ ...
https://gitee.com/openharmony-sig/smartperf.git
8e0ee5acdbeb9059699f80a7a82e096d3205750b
gitee
openharmony-sig/applications_clock
common/src/main/ets/manager/FormManager.ets
arkts
fetchAllFormsFromSp
从 sp 中获取所有卡片信息 @return 卡片信息数组
public async fetchAllFormsFromSp(): Promise<FormInfo[]> { const preferences = await this.getPreferences(); let formList: FormInfo[] = []; let obj: Object = await preferences.getAll(); formList = TsUtilManager.transferObjectToFormInfo(obj); return formList; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left fetchAllFormsFromSp AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right ...
public async fetchAllFormsFromSp(): Promise<FormInfo[]> { const preferences = await this.getPreferences(); let formList: FormInfo[] = []; let obj: Object = await preferences.getAll(); formList = TsUtilManager.transferObjectToFormInfo(obj); return formList; }
https://gitee.com/openharmony-sig/applications_clock.git
9fe56a7261adbd369b4ce3fdac79a372985397b1
gitee
Mydstiny/RemoteDeskHarmonyOS
entry/src/main/ets/model/RemoteHost.ets
arkts
isValid
上次连接延迟 (ms) 验证必填字段
isValid(): boolean { const basic: boolean = this.label.length > 0 && (this.protocol === 'rdp' || this.protocol === 'rustdesk' || this.protocol === 'ssh'); if (this.protocol === 'rustdesk') { // RustDesk: 需要远程ID (customHostname), 不需要host/username return basic && this.customHostname.lengt...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isValid AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statement_b...
isValid(): boolean { const basic: boolean = this.label.length > 0 && (this.protocol === 'rdp' || this.protocol === 'rustdesk' || this.protocol === 'ssh'); if (this.protocol === 'rustdesk') { // RustDesk: 需要远程ID (customHostname), 不需要host/username return basic && this.customHostname.lengt...
https://github.com/Mydstiny/RemoteDeskHarmonyOS
b7e829c16ce5f4f5378ae71e20b1b2b867fab075
github
CLMC2025/Vignette
entry/src/main/ets/ui/Animations.ets
arkts
flip
创建翻转动画
static flip(duration: number = 600): AnimationConfig { return new AnimationConfig( AnimationType.FLIP, AnimationDirection.CENTER, duration, 0, Curve.EaseInOut ); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left flip AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left duration AST#identifier#Right AST#:#Left : AST#:#Right AST#...
static flip(duration: number = 600): AnimationConfig { return new AnimationConfig( AnimationType.FLIP, AnimationDirection.CENTER, duration, 0, Curve.EaseInOut ); }
https://github.com/CLMC2025/Vignette
a581372795a0e54a454d8edbf17c34d5a3a8d9ca
github
DaLongZhuaZi/manxia
entry/src/main/ets/Utils/CompressionUtils.ets
arkts
cleanupParsedArchiveStructure
清理解析后的结构(清理临时目录)
public async cleanupParsedArchiveStructure(structure: ParsedArchiveStructure): Promise<void> { await this.cleanupTempDirectories(structure.tempDirectories); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left cleanupParsedArchiveStructure AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left structure AST#identifier#R...
public async cleanupParsedArchiveStructure(structure: ParsedArchiveStructure): Promise<void> { await this.cleanupTempDirectories(structure.tempDirectories); }
https://github.com/DaLongZhuaZi/manxia
4fdb8ad0695eaf4d27c0c88295f13146c953a1bc
github
openharmony/applications_permission_manager
permissionmanager/src/main/ets/common/base/BasePermissionStrategy.ets
arkts
preProcessingPermission
预处理权限 @param permission 权限 @param tokenId 应用token return
public async preProcessingPermission(permission: Permission, tokenId: number): Promise<PermissionWithOption[]> { return []; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left preProcessingPermission AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left permission AST#identifier#Right ...
public async preProcessingPermission(permission: Permission, tokenId: number): Promise<PermissionWithOption[]> { return []; }
https://gitee.com/openharmony/applications_permission_manager.git
1dced82c8bfef5b4ae4516844cae3b357d4a38b0
gitee
arkui-x/samples
CodeLab/Cases/feature/bottompanelslide/src/main/ets/model/DataSource.ets
arkts
pushData
添加数据 @param {PanelDataType} data - 需要添加的数据
public pushData(data: PanelDataType | PanelDataType[]): void { if (Array.isArray(data)) { this.dataArray.push(...data); } else { this.dataArray.push(data); } this.notifyDataAdd(this.dataArray.length - 1); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left pushData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left ...
public pushData(data: PanelDataType | PanelDataType[]): void { if (Array.isArray(data)) { this.dataArray.push(...data); } else { this.dataArray.push(data); } this.notifyDataAdd(this.dataArray.length - 1); }
https://gitcode.com/arkui-x/samples
bc15da4214cec2744d75409ec51698c4765b6a07
gitcode