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
StarHeartY/CalculatorX
entry/src/main/ets/components/MenuComponents.ets
arkts
build
允许外部传入左边距,默认为 44
build() { Row() { Divider() .strokeWidth(0.75) .color($r('sys.color.comp_divider')) .margin({ left: this.marginLeft, right: 12 }) } .width('100%') .margin({ top: -4, bottom: -4 }) .zIndex(1) .hitTestBehavior(HitTestMode.None) }
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() { Row() { Divider() .strokeWidth(0.75) .color($r('sys.color.comp_divider')) .margin({ left: this.marginLeft, right: 12 }) } .width('100%') .margin({ top: -4, bottom: -4 }) .zIndex(1) .hitTestBehavior(HitTestMode.None) }
https://github.com/StarHeartY/CalculatorX
4f0d0171e4b347fee7ebcf5355be1f922a364780
github
Countly/countly-sdk-hos
library/src/main/ets/internal/Utils.ets
arkts
openExternalUrlViaContext
SDK-default external URL opener. Invoked from Content / Feedback when a link action fires and no integrator-supplied opener is wired. Uses the `UIAbilityContext` the integrator passed via `CountlyConfig(context, ...)` to launch a view-data intent, the platform routes the URL to the system browser or the registered defa...
public static openExternalUrlViaContext(ctx: common.Context | null, url: string, logger: Logger): void { if (ctx === null) { logger.w(`[Utils] openExternalUrl: no context available, dropped url=${url}`); return; } try { // `startAbility` lives on UIAbilityContext but not ApplicationConte...
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 openExternalUrlViaContext AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ctx AST#identifier#Right AST#...
public static openExternalUrlViaContext(ctx: common.Context | null, url: string, logger: Logger): void { if (ctx === null) { logger.w(`[Utils] openExternalUrl: no context available, dropped url=${url}`); return; } try { // `startAbility` lives on UIAbilityContext but not ApplicationConte...
https://github.com/Countly/countly-sdk-hos
f70b344f11f353a0605465a523f395ccbcd693db
github
OSpark-Team/Free-PCM
library/src/main/ets/utils/AudioRendererPlayer.ets
arkts
flush
刷新播放缓冲区 @returns Promise<void> 刷新完成后 resolve @remarks - 立即丢弃缓冲区中未播放的数据 - 通常在跳转或错误处理时调用 @throws - AudioRenderer 未初始化
public async flush(): Promise<void> { if (!this.renderer) { throw new Error('AudioRenderer not initialized'); } await this.renderer.flush(); }
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 flush AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : A...
public async flush(): Promise<void> { if (!this.renderer) { throw new Error('AudioRenderer not initialized'); } await this.renderer.flush(); }
https://github.com/OSpark-Team/Free-PCM/blob/3440e7220d07d28815d172b4b3237145434075ee/library/src/main/ets/utils/AudioRendererPlayer.ets#L604-L609
1fbacd206544342c7ed3a8674d8ba35897195af1
github
openharmony/codelabs
Media/ImageEdit/entry/src/main/ets/viewModel/CropShow.ets
arkts
getCurrentImageLines
Get image lines. @returns
private getCurrentImageLines(): Array<LineSegment> { let flipImage = this.getCurrentFlipImage(); let imagePoints = MathUtils.rectToPoints(flipImage); let origin = this.getDisplayCenter(); let tX = this.isFlipHorizontal ? -1 : 1; let tY = this.isFlipVertically ? -1 : 1; let angle = this.rotatio...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getCurrentImageLines 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 AS...
private getCurrentImageLines(): Array<LineSegment> { let flipImage = this.getCurrentFlipImage(); let imagePoints = MathUtils.rectToPoints(flipImage); let origin = this.getDisplayCenter(); let tX = this.isFlipHorizontal ? -1 : 1; let tY = this.isFlipVertically ? -1 : 1; let angle = this.rotatio...
https://gitee.com/openharmony/codelabs.git
0941f8dcc7b65400b248b8c100463b4ca287741f
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
from
Creates an Uint32Array from array-like argument @param o array-like object to initialize Uint32Array @returns new Uint32Array
public from(o: Object): Uint32Array { throw new Error("Uint32Array.from: not implemented") }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left from AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left o AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#R...
public from(o: Object): Uint32Array { throw new Error("Uint32Array.from: not implemented") }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
bc312d30d5d8c57d80e84e5890e9081044eb548a
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Animation/AnimationSettingsManager.ets
arkts
isBookCloseAnimationEnabled
检查书籍关闭动画是否启用
public isBookCloseAnimationEnabled(): boolean { return this.currentSettings.bookCloseEnabled; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isBookCloseAnimationEnabled 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#Le...
public isBookCloseAnimationEnabled(): boolean { return this.currentSettings.bookCloseEnabled; }
https://github.com/DaLongZhuaZi/manxia
0a1484cafdcc5fea7b2e8e2b8a55cb2b434a5d6e
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/viewmodel/StreamViewModel.ets
arkts
setServerInitiatedRotation
3秒防抖 设置是否是服务器触发的旋转 当收到服务器的分辨率变化通知时调用,避免循环通知
setServerInitiatedRotation(value: boolean): void { this.isServerInitiatedRotation = value; if (value) { console.info('StreamViewModel: 标记为服务器触发的旋转'); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setServerInitiatedRotation 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 boolean AST#identifier#Right...
setServerInitiatedRotation(value: boolean): void { this.isServerInitiatedRotation = value; if (value) { console.info('StreamViewModel: 标记为服务器触发的旋转'); } }
https://github.com/AlkaidLab/moonlight-harmony
2ded2790c8b6145391b8564b850a128cb3c2962a
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/I18nManager.ets
arkts
tf3
模板格式化(3个参数):替换翻译字符串中的 ${k1}、${k2} 和 ${k3} 占位符。
tf3(key: string, k1: string, v1: string | number, k2: string, v2: string | number, k3: string, v3: string | number): string { let result = this.t(key); result = result.replace(`\${${k1}}`, String(v1)); result = result.replace(`\${${k2}}`, String(v2)); result = result.replace(`\${${k3}}`, String(v3)); ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left tf3 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 ...
tf3(key: string, k1: string, v1: string | number, k2: string, v2: string | number, k3: string, v3: string | number): string { let result = this.t(key); result = result.replace(`\${${k1}}`, String(v1)); result = result.replace(`\${${k2}}`, String(v2)); result = result.replace(`\${${k3}}`, String(v3)); ...
https://github.com/richshaw2015/nds
3eadafa003c2ac4a1e195d7c585db321c9b46add
github
openharmony-sig/applications_calculator
feature/calculation/src/main/ets/model/BaseDataSource.ets
arkts
unregisterDataChangeListener
Unregister data change listener. @param listener DataChangeListener
unregisterDataChangeListener(listener: DataChangeListener): void { const pos: number = this.listeners.indexOf(listener); if (pos >= 0) { LogUtil.info(TAG, 'remove listener'); this.listeners.splice(pos, 1); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left unregisterDataChangeListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left listener AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left DataChangeListener AST#...
unregisterDataChangeListener(listener: DataChangeListener): void { const pos: number = this.listeners.indexOf(listener); if (pos >= 0) { LogUtil.info(TAG, 'remove listener'); this.listeners.splice(pos, 1); } }
https://gitee.com/openharmony-sig/applications_calculator.git
f6ef57cd441389a0f1185f7830b1cce2455a02a6
gitee
openharmony/applications_notes
common/utils/src/main/ets/default/baseUtil/RdbStoreUtil.ets
arkts
delete
delete @param predicates @param callback
delete(predicates: relationalStore.RdbPredicates, callback: Callback<number> | null) { rdbStore!.delete(predicates).then((affectedRowCount: number) => { LogUtil.info(TAG, "delete success, affectedRowCount is " + affectedRowCount) if (callback != null) { callback(affectedRowCount) } }...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#member_expression#Left AST#non_null_expression#Left AST#unary_expression#Left AST#delete#Left delete AST#delete#Right AST#ERROR#Left AST#for...
delete(predicates: relationalStore.RdbPredicates, callback: Callback<number> | null) { rdbStore!.delete(predicates).then((affectedRowCount: number) => { LogUtil.info(TAG, "delete success, affectedRowCount is " + affectedRowCount) if (callback != null) { callback(affectedRowCount) } }...
https://gitee.com/openharmony/applications_notes.git
c6af1be2957048d9a7a03073912f8e43fe4e20f5
gitee
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/StreamingSession.ets
arkts
stop
停止串流会话
async stop(): Promise<void> { console.info('停止串流'); this.userInitiatedStop = true; this.isRunning = false; this.resetControllerState(); GamepadManager.getInstance().stopAllSensors(); this.audioVibrationService.stop(); NetworkBoostService.getInstance().stop(); await this.cleanup(); }
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left stop 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#generi...
async stop(): Promise<void> { console.info('停止串流'); this.userInitiatedStop = true; this.isRunning = false; this.resetControllerState(); GamepadManager.getInstance().stopAllSensors(); this.audioVibrationService.stop(); NetworkBoostService.getInstance().stop(); await this.cleanup(); }
https://github.com/AlkaidLab/moonlight-harmony
2d6602f6d42d43755cf5caa6a968973db220425e
github
openharmony-sig/applications_clock
feature/worldclock/src/main/ets/manager/WorldClockManager.ets
arkts
getDbBucketFromWorldClock
transfer world clock object to value bucket needed by database @param world clock object @return value bucket needed by database
getDbBucketFromWorldClock(worldClockInfo: WorldClockInfo): dataRdb.ValuesBucket { return { 'SORT_ORDER': worldClockInfo.sortOrder, 'CITY_INDEX': worldClockInfo.cityIndex, 'TIMEZONE': worldClockInfo.timezone, 'CITY': worldClockInfo.city, 'OFFSET': worldClockInfo.offset, }; }
AST#program#Left AST#expression_statement#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getDbBucketFromWorldClock AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left worldClockInfo AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Righ...
getDbBucketFromWorldClock(worldClockInfo: WorldClockInfo): dataRdb.ValuesBucket { return { 'SORT_ORDER': worldClockInfo.sortOrder, 'CITY_INDEX': worldClockInfo.cityIndex, 'TIMEZONE': worldClockInfo.timezone, 'CITY': worldClockInfo.city, 'OFFSET': worldClockInfo.offset, }; }
https://gitee.com/openharmony-sig/applications_clock.git
f532e1633a90f138de2bc461bc5aa6a77f23c11d
gitee
fuhhhhhhhh/openharmony
entry/src/main/ets/data/DatabaseHelper.ets
arkts
deleteTransactionsByType
删除指定类型的交易记录 @param transactionType 交易类型 (0=支出, 1=收入) @returns 删除的记录数量
public static async deleteTransactionsByType(transactionType: number): Promise<number> { if (!DatabaseHelper.isInitialized || !DatabaseHelper.transactionDao) { throw new Error('数据库未初始化,请先调用 DatabaseHelper.initialize()'); } return await DatabaseHelper.transactionDao.deleteTransactionsByType(transacti...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left deleteTransactionsByType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left transact...
public static async deleteTransactionsByType(transactionType: number): Promise<number> { if (!DatabaseHelper.isInitialized || !DatabaseHelper.transactionDao) { throw new Error('数据库未初始化,请先调用 DatabaseHelper.initialize()'); } return await DatabaseHelper.transactionDao.deleteTransactionsByType(transacti...
https://github.com/fuhhhhhhhh/openharmony
f252090752f8c64e08dd1e0dea8256ce14496eec
github
qiuhaotc/Sunshine_HarmonyOS
entry/src/main/ets/utils/SunAngleHelper.ets
arkts
getSunAngle
计算太阳位置 @param latitude 纬度 @param longitude 经度 @param dateTimeUtc UTC时间 @returns 太阳位置(高度角和方位角)
getSunAngle(latitude: number, longitude: number, dateTimeUtc: Date): SunPosition { const year = dateTimeUtc.getUTCFullYear(); const month = dateTimeUtc.getUTCMonth() + 1; const day = dateTimeUtc.getUTCDate(); const hour = dateTimeUtc.getUTCHours(); const minute = dateTimeUtc.getUTCMinutes(); c...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getSunAngle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left latitude AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , AST#,#R...
getSunAngle(latitude: number, longitude: number, dateTimeUtc: Date): SunPosition { const year = dateTimeUtc.getUTCFullYear(); const month = dateTimeUtc.getUTCMonth() + 1; const day = dateTimeUtc.getUTCDate(); const hour = dateTimeUtc.getUTCHours(); const minute = dateTimeUtc.getUTCMinutes(); c...
https://github.com/qiuhaotc/Sunshine_HarmonyOS
5aeeb4116b1f5ba55339b9b97ec8c5f20aed8890
github
qiuhaotc/HarmonyOSPlayground
entry/src/main/ets/pages/StatisticsPage.ets
arkts
calculateCumulativePolylinePoints
计算累积图坐标点(支持正负值)
calculateCumulativePolylinePoints(data: number[], maxAmount: number, minAmount: number, width: number, height: number): Array<[number, number]> { const points: Array<[number, number]> = []; if (data.length < 2) { return points; } const stepX = width / (d...
AST#program#Left AST#expression_statement#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left calculateCumulativePolylinePoints 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...
calculateCumulativePolylinePoints(data: number[], maxAmount: number, minAmount: number, width: number, height: number): Array<[number, number]> { const points: Array<[number, number]> = []; if (data.length < 2) { return points; } const stepX = width / (d...
https://github.com/qiuhaotc/HarmonyOSPlayground
f32203b60eeb4acdd214e34b1da96e3d05f2e4c5
github
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/hosts/app/tabs/classes/meowTabInfo.ets
arkts
searchNext
Search next.
searchNext() { try { this.controller?.searchNext(true); } catch (e) { meow(`Failed to search next for [${this.searchedSearchKey}]: ${e}`, 'meowTabInfo][currentTabSearchNext', meowLevel.ERROR); } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left searchNext 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 AS...
searchNext() { try { this.controller?.searchNext(true); } catch (e) { meow(`Failed to search next for [${this.searchedSearchKey}]: ${e}`, 'meowTabInfo][currentTabSearchNext', meowLevel.ERROR); } }
https://github.com/awaLiny2333/LinysBrowser_NEXT
b43220257fa8d7e9e4950645d8467caf028f846e
github
apap6628114/nga_oh
entry/src/main/ets/common/datasource/BaseLazyDataSource.ets
arkts
totalCount
返回当前元素总数。
totalCount(): number { return this.dataList.length }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left totalCount 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 number AST#number#Right AST#ERROR#Right AST#statement_b...
totalCount(): number { return this.dataList.length }
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/common/datasource/BaseLazyDataSource.ets#L21-L23
a46de7a35142a3647827ea3645e4b6231cad87c4
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets
arkts
of
Returns Type of value @param {FixedArray<int>} v value @returns {Type} Type instance of this value @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static of(v: FixedArray<int>): Type { return ArrayType.getInstance(Class.of(v), TypeAPI.getTypeDescriptor(new Int())) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#of#Left of AST#of#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left v AST#identifier#Right AST#:#...
public static of(v: FixedArray<int>): Type { return ArrayType.getInstance(Class.of(v), TypeAPI.getTypeDescriptor(new Int())) }
https://gitcode.com/iop123123/arkts-static-skills
4deca3a0241eb75c94886122363898643314a525
gitcode
LJ666-ui/harmony-health-care
entry/src/main/ets/utils/SettingsUtil.ets
arkts
getNurseInfo
获取护士信息
async getNurseInfo(): Promise<object | null> { if (this.dataPreferences === null) { return null; } try { const value: preferences.ValueType = await this.dataPreferences.get('nurse_info', '{}'); const jsonStr: string = value as string; if (jsonStr && jsonStr !== '{}' && jsonStr !== ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getNurseInfo AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AS...
async getNurseInfo(): Promise<object | null> { if (this.dataPreferences === null) { return null; } try { const value: preferences.ValueType = await this.dataPreferences.get('nurse_info', '{}'); const jsonStr: string = value as string; if (jsonStr && jsonStr !== '{}' && jsonStr !== ...
https://github.com/LJ666-ui/harmony-health-care
7e90a1b8c09ea217b2639cb3acb9c283f6bf1377
github
webabcd/HarmonyDemo
entry/src/main/ets/pages/component/layout/RefreshDemo.ets
arkts
myRefreshingContent
自定义的下拉刷新容器
@Builder function myRefreshingContent(refreshStatus: RefreshStatus) { Stack() { Row() { LoadingProgress().height(32).color(Color.White) Text("refreshStatus:" + refreshStatus).fontSize(16).fontColor(Color.White).margin({ left: 20 }) } .alignItems(VerticalAlign.Center) } .constraintSize({ mi...
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Builder AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left myRefreshingContent AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right A...
@Builder function myRefreshingContent(refreshStatus: RefreshStatus) { Stack() { Row() { LoadingProgress().height(32).color(Color.White) Text("refreshStatus:" + refreshStatus).fontSize(16).fontColor(Color.White).margin({ left: 20 }) } .alignItems(VerticalAlign.Center) } .constraintSize({ mi...
https://github.com/webabcd/HarmonyDemo
631b2b10e8c77124206fc96665bc56c5af5620a8
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/components/YAxis.ets
arkts
getSpaceBottom
Returns the bottom axis space in percent of the full range. Default 10f @return
public getSpaceBottom(): number { return this.mSpacePercentBottom; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getSpaceBottom 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 number AST#...
public getSpaceBottom(): number { return this.mSpacePercentBottom; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
6c59d6cdd3a81c8616b839e91a22a107507ba696
gitee
offlinecat-dev/OCNetORM
src/main/ets/query/RelationLoadResult.ets
arkts
getFailedRelationNames
获取失败的关联名称列表 @returns 失败的关联名称数组
getFailedRelationNames(): Array<string> { const names: Array<string> = [] for (let i = 0; i < this.results.length; i++) { if (!this.results[i].success) { names.push(this.results[i].relationName) } } return names }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getFailedRelationNames AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left ...
getFailedRelationNames(): Array<string> { const names: Array<string> = [] for (let i = 0; i < this.results.length; i++) { if (!this.results[i].success) { names.push(this.results[i].relationName) } } return names }
https://github.com/offlinecat-dev/OCNetORM
a04afddaee0a38d46db6754c50428d69d87ca505
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Jsonx.ets
arkts
tryGetLong
Attempts to get an long value from an object by key. Returns the fallback value if the key is not found or if the value is not an long. @param {string} key - The key to look up @param {long} [fallback=0] - The fallback value to return if the key is not found @returns {long} The long value if found, fallback value other...
tryGetLong(key: string, fallback: long = 0): long { return this.tryGetElement(key)?.tryAsLong() ?? fallback }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left tryGetLong 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#,...
tryGetLong(key: string, fallback: long = 0): long { return this.tryGetElement(key)?.tryAsLong() ?? fallback }
https://gitcode.com/iop123123/arkts-static-skills
3db38afd9246749fb1e040f8127aee98e38f079a
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Source/SuwayomiSource.ets
arkts
executeGraphQL
执行 GraphQL 查询
private async executeGraphQL(query: string, variables?: SuwayomiGraphQLVariables): Promise<GraphQLData | null> { const serverUrl = this.getNormalizedServerUrl(); if (!serverUrl) { logger.error(TAG, '服务器地址未配置'); return null; } try { const url = `${serverUrl}/api/graphql`; const...
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 executeGraphQL AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left query AST#identifier#Right AST#:#Left ...
private async executeGraphQL(query: string, variables?: SuwayomiGraphQLVariables): Promise<GraphQLData | null> { const serverUrl = this.getNormalizedServerUrl(); if (!serverUrl) { logger.error(TAG, '服务器地址未配置'); return null; } try { const url = `${serverUrl}/api/graphql`; const...
https://github.com/DaLongZhuaZi/manxia
336fa8cb80c76dc02a8f38292ff1da8a17f014df
github
AetheriumSimulator/qemu-hmos
entry/src/main/ets/managers/QemuVMManager.ets
arkts
setReleaseBuild
设置是否是正式版本(影响 KVM 提示信息)
setReleaseBuild(isRelease: boolean) { this.isReleaseBuild = isRelease }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setReleaseBuild AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isRelease AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Rig...
setReleaseBuild(isRelease: boolean) { this.isReleaseBuild = isRelease }
https://github.com/AetheriumSimulator/qemu-hmos
e185b07718dda8af2c8240fa55e9d6935501a1e3
github
Joker-x-dev/CoolMallArkTS
core/model/src/main/ets/request/GoodsIdRequest.ets
arkts
constructor
@param {Partial<GoodsIdRequest>} init - 初始化数据
constructor(init?: Partial<GoodsIdRequest>) { if (!init) { return; } this.goodsId = init.goodsId ?? this.goodsId; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expres...
constructor(init?: Partial<GoodsIdRequest>) { if (!init) { return; } this.goodsId = init.goodsId ?? this.goodsId; }
https://github.com/Joker-x-dev/CoolMallArkTS
4b2ea55d171c3d70fe5fca055e193c400f7514ff
github
qiuhaotc/Sunshine_HarmonyOS
entry/src/main/ets/model/UnitSunshineData.ets
arkts
getHeatmapOpacity
获取热力图透明度
getHeatmapOpacity(): number { const hours = this.winterSolsticeSunshine; return Math.min(0.8, 0.3 + (hours / 3) * 0.5); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getHeatmapOpacity 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 number AST#number#Right AST#ERROR#Right AST#stat...
getHeatmapOpacity(): number { const hours = this.winterSolsticeSunshine; return Math.min(0.8, 0.3 + (hours / 3) * 0.5); }
https://github.com/qiuhaotc/Sunshine_HarmonyOS
71e9b693f3c263c927c45d97f5a638e683feaac3
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/TarPackager.ets
arkts
getAllFiles
获取目录中的所有文件(递归) [修复] 为每个条目添加单独的错误处理,防止单个条目失败导致整个目录被跳过
private async getAllFiles(dir: string, baseDir?: string): Promise<string[]> { const base = baseDir || dir; const files: string[] = []; try { if (!SafeFileUtils.accessSync(dir)) { logger.warn(TAG, `目录不存在: ${dir}`); return files; } const entries = SafeFileUtils....
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 getAllFiles AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dir AST#identifier#Right AST#:#Left : AST...
private async getAllFiles(dir: string, baseDir?: string): Promise<string[]> { const base = baseDir || dir; const files: string[] = []; try { if (!SafeFileUtils.accessSync(dir)) { logger.warn(TAG, `目录不存在: ${dir}`); return files; } const entries = SafeFileUtils....
https://github.com/DaLongZhuaZi/manxia
3fa96ed02738ab6671127b16f58bcadead3331f2
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/RadarChartModel.ets
arkts
getFactor
Returns the factor that is needed to transform values into pixels. @return
public getFactor(): number { let content: MyRect = this.mViewPortHandler.getContentRect(); return Math.min(content.width() / 2, content.height() / 2) / this.mYAxis.mAxisRange; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getFactor 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 number AST#numbe...
public getFactor(): number { let content: MyRect = this.mViewPortHandler.getContentRect(); return Math.min(content.width() / 2, content.height() / 2) / this.mYAxis.mAxisRange; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
fc6caa4bb26a22c1dd94902dccd8c2d409ce1e00
gitee
Nekofox-POT/LinMusic
entry/src/main/ets/建筑垃圾堆/class_audio_ffmpeg_player.ets
arkts
load_dsd
dsd缓存加载(ffmpeg_player 原生支持 DSD,此方法保留兼容) //
load_dsd() { // ffmpeg_player 可直接解码 DSD,无需预转换缓存 }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left load_dsd 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#{#Left { AST#{#Right AST#comment#Left // ffmpeg_playe...
load_dsd() { // ffmpeg_player 可直接解码 DSD,无需预转换缓存 }
https://github.com/Nekofox-POT/LinMusic
e966776a27d5a34fb042575a44df9cd7beff10b8
github
Harrisonls2004/WaterFlow
entry/src/main/ets/common/utils/CartManager.ets
arkts
getTotalPrice
Calculate total price of SELECTED items.
static getTotalPrice(): number { let total = 0; for (let i = 0; i < cachedCartList.length; i++) { let item = cachedCartList[i]; if (item.isSelected) { let priceStr = item.price || ''; let priceNum = parseFloat(priceStr.replace('¥', '').replace(',', '')); let qty = item.quan...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getTotalPrice 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 number AST#n...
static getTotalPrice(): number { let total = 0; for (let i = 0; i < cachedCartList.length; i++) { let item = cachedCartList[i]; if (item.isSelected) { let priceStr = item.price || ''; let priceNum = parseFloat(priceStr.replace('¥', '').replace(',', '')); let qty = item.quan...
https://github.com/Harrisonls2004/WaterFlow
99a731628a0d6f5442836542b7a0f39a980c01fd
github
CLMC2025/Vignette
entry/src/main/ets/database/repositories/WordRepository.ets
arkts
clearCachedDefinition
Clear cached definition
async clearCachedDefinition(word: string): Promise<void> { this.ensureInitialized(); const normalizedWord = word.toLowerCase().trim(); const predicates = new relationalStore.RdbPredicates(TABLE_DEFINITIONS); predicates.equalTo('word', normalizedWord); await this.store!.delete(predicates); co...
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 clearCachedDefinition AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#L...
async clearCachedDefinition(word: string): Promise<void> { this.ensureInitialized(); const normalizedWord = word.toLowerCase().trim(); const predicates = new relationalStore.RdbPredicates(TABLE_DEFINITIONS); predicates.equalTo('word', normalizedWord); await this.store!.delete(predicates); co...
https://github.com/CLMC2025/Vignette
ae749857f7dd1767d1d14f2649fa5ebbfba647ec
github
YDYm233/EasyRandom_HarmonyNextApp
common/VitalUI/src/main/ets/components/ColorPickerComponent/ColorPickerDialog.ets
arkts
rgbToHsl
RGB(A) → HSL
function rgbToHsl(r: number, g: number, b: number, a: number = 1): HslColor { const rn = r / 255, gn = g / 255, bn = b / 255 const max = Math.max(rn, gn, bn), min = Math.min(rn, gn, bn) const l = (max + min) / 2 let h = 0, s = 0 if (max !== min) { const d = max - min s = l > 0.5 ? d / (2 - max - min) ...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left rgbToHsl AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left r AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#...
function rgbToHsl(r: number, g: number, b: number, a: number = 1): HslColor { const rn = r / 255, gn = g / 255, bn = b / 255 const max = Math.max(rn, gn, bn), min = Math.min(rn, gn, bn) const l = (max + min) / 2 let h = 0, s = 0 if (max !== min) { const d = max - min s = l > 0.5 ? d / (2 - max - min) ...
https://github.com/YDYm233/EasyRandom_HarmonyNextApp
ac8c144af86041248850942f4bf07303dca0836e
github
offlinecat-dev/OCNetORM
src/main/ets/query/PredicateBuilder.ets
arkts
createSuccess
创建成功结果
static createSuccess(predicates: relationalStore.RdbPredicates, description: string): PredicateBuildResult { const result = new PredicateBuildResult() result.predicates = predicates result.success = true result.description = description return result }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createSuccess AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left predicates AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expre...
static createSuccess(predicates: relationalStore.RdbPredicates, description: string): PredicateBuildResult { const result = new PredicateBuildResult() result.predicates = predicates result.success = true result.description = description return result }
https://github.com/offlinecat-dev/OCNetORM
07baf6b37699a16498e6f470fd4d9c9dc4104ab9
github
Countly/countly-sdk-hos
library/src/main/ets/internal/LifecycleObserver.ets
arkts
dispatchBg
Internal background dispatch. A bg arriving while not-ready cancels any pending fg AND any pending auto-view (the same way an actual bg + return cycle would have): we never replay an out-of-date fg/auto-view after the app has already moved on.
private dispatchBg(): void { if (!this.ready) { this.pendingFg = false; this.pendingAutoView = null; return; } this.onBackground(); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left dispatchBg 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#expressi...
private dispatchBg(): void { if (!this.ready) { this.pendingFg = false; this.pendingAutoView = null; return; } this.onBackground(); }
https://github.com/Countly/countly-sdk-hos
3fce43247bd0ce408da1413d524631a5362d435d
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
find
Finds the first element in the BigInt64Array that satisfies the condition @param fn condition @returns the first element that satisfies fn
public find(fn: (val: long, index: int) => boolean): long { let newF: (val: long, index: int, array: BigInt64Array) => boolean = (val: long, index: int, array: BigInt64Array): boolean => { return fn(val, index) } return this.find(newF) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left find 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#Righ...
public find(fn: (val: long, index: int) => boolean): long { let newF: (val: long, index: int, array: BigInt64Array) => boolean = (val: long, index: int, array: BigInt64Array): boolean => { return fn(val, index) } return this.find(newF) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
f69f72a4e112722a30f0a8e08cfadcf21abf92ef
gitee
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/CategoryDAO.ets
arkts
update
更新分类信息(自动清除缓存) 缓存失效策略: - 更新后清除该用户的所有分类缓存 - 确保数据一致性
static async update(category: Category): Promise<void> { if (!category.validate()) { throw new Error('[CategoryDAO] 无效分类数据'); } const store = DatabaseManager.getDatabase(); const now = new Date().toISOString(); const sql = ` UPDATE categories SET name = ?, type = ?, icon = ?, col...
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 update AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left category AST#identifier#Right AST#:#Left : AST#:#...
static async update(category: Category): Promise<void> { if (!category.validate()) { throw new Error('[CategoryDAO] 无效分类数据'); } const store = DatabaseManager.getDatabase(); const now = new Date().toISOString(); const sql = ` UPDATE categories SET name = ?, type = ?, icon = ?, col...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
aec2be762cd4e525bc7a9e999c39af6d88d807a7
github
openharmony/codelabs
ETSUI/MemoTime/entry/src/main/ets/service/DataService.ets
arkts
deleteSchedule
删除日程(软删除)
async deleteSchedule(id: string): Promise<void> { if (!this.rdbStore) { return } try { const predicates = new relationalStore.RdbPredicates(AppConstants.TABLE_SCHEDULE) predicates.equalTo('id', id) const valuesBucket: relationalStore.ValuesBucket = { isDeleted: 1, ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left deleteSchedule AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#ty...
async deleteSchedule(id: string): Promise<void> { if (!this.rdbStore) { return } try { const predicates = new relationalStore.RdbPredicates(AppConstants.TABLE_SCHEDULE) predicates.equalTo('id', id) const valuesBucket: relationalStore.ValuesBucket = { isDeleted: 1, ...
https://gitcode.com/openharmony/codelabs
5b8802ffe8645b7fecfad7015bfd3ea76f06dd14
gitcode
aimilin6688/KeePassHO
entry/src/main/ets/services/SettingsService.ets
arkts
getSortBy
获取排序方式
public async getSortBy(): Promise<SortMode> { return this.get(SettingsService.KEY_SORT_BY, SortMode.DEFAULT); }
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 getSortBy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left...
public async getSortBy(): Promise<SortMode> { return this.get(SettingsService.KEY_SORT_BY, SortMode.DEFAULT); }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/SettingsService.ets#L176-L178
916f6b547e83efcbb6c8598c14824e7e27b7f1c7
github
Cool_foolisher1/ArkTSRepository
GraphicalCode/commons/src/main/ets/util/BreakpointSystemUtil.ets
arkts
getInstance
获取BreakpointSystemUtil实例 @returns BreakpointSystemUtil
public static getInstance(): BreakpointSystemUtil { if (!BreakpointSystemUtil.instance) { BreakpointSystemUtil.instance = new BreakpointSystemUtil() } return BreakpointSystemUtil.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#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L...
public static getInstance(): BreakpointSystemUtil { if (!BreakpointSystemUtil.instance) { BreakpointSystemUtil.instance = new BreakpointSystemUtil() } return BreakpointSystemUtil.instance }
https://gitcode.com/Cool_foolisher1/ArkTSRepository
cace27ad704dfee343997843ea7ac47b43c6958c
gitcode
openharmony-sig/FastBle
library/src/main/ets/BleManager.ets
arkts
cancelScan
Cancel scan
public cancelScan() { BleScanner.getInstance().stopLeScan(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left cancelScan 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#{#Left { AS...
public cancelScan() { BleScanner.getInstance().stopLeScan(); }
https://gitee.com/openharmony-sig/FastBle.git
a8cf8de36b2d7e02fbc2dfdb212f5a39c61c3ce5
gitee
yongoe1024/RdbPlus
rdbplus/src/main/ets/BaseMapper.ets
arkts
deleteById
根据主键删除 @param id 主键 @returns sql执行结果:改变数量
async deleteById(id: relationalStore.ValueType, db?: Connection): Promise<relationalStore.ValueType> { let isClose: boolean = true if (db === undefined) { db = await this.getConnection() } else { isClose = false } const sqlData = this.sqlUtils.deleteById(id) let res = await db.exec...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left deleteById AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_annotation#Left AST#:#Left...
async deleteById(id: relationalStore.ValueType, db?: Connection): Promise<relationalStore.ValueType> { let isClose: boolean = true if (db === undefined) { db = await this.getConnection() } else { isClose = false } const sqlData = this.sqlUtils.deleteById(id) let res = await db.exec...
https://github.com/yongoe1024/RdbPlus/blob/83f7347b7ac692941729d3464923155948e876bb/rdbplus/src/main/ets/BaseMapper.ets#L378-L391
95d9e5c02c7002f1c901ee134556c714c1d1f8ce
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Debug/CrashRecorderService.ets
arkts
readCrashLog
读取指定崩溃日志内容
public readCrashLog(fileName: string): string { try { const filePath = `${this.crashLogsDir}/${fileName}`; const file = SafeFileUtils.openSync(filePath, fs.OpenMode.READ_ONLY); const stat = SafeFileUtils.statSync(filePath); const buf = new ArrayBuffer(Number(stat.size)); SafeFileUtil...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left readCrashLog AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left fileName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#R...
public readCrashLog(fileName: string): string { try { const filePath = `${this.crashLogsDir}/${fileName}`; const file = SafeFileUtils.openSync(filePath, fs.OpenMode.READ_ONLY); const stat = SafeFileUtils.statSync(filePath); const buf = new ArrayBuffer(Number(stat.size)); SafeFileUtil...
https://github.com/DaLongZhuaZi/manxia
1b87a95abfb1a227146221180a5c91bf2bdd98e2
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/NdsRomCache.ets
arkts
listFiles
列出目录中的所有文件
private listFiles(dirPath: string): CachedFileInfo[] { const files: CachedFileInfo[] = []; try { const entries = fileIo.listFileSync(dirPath); for (const entry of entries) { const fullPath = `${dirPath}/${entry}`; try { const stat = fileIo.statSync(fullPath); ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left listFiles AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left dirPath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Ri...
private listFiles(dirPath: string): CachedFileInfo[] { const files: CachedFileInfo[] = []; try { const entries = fileIo.listFileSync(dirPath); for (const entry of entries) { const fullPath = `${dirPath}/${entry}`; try { const stat = fileIo.statSync(fullPath); ...
https://github.com/richshaw2015/nds
8bae11b1e75c0c2674a77db78a8fbd9322a585f3
github
darcycui/DarcyHarmonyNext
entry/src/main/ets/learn/Person.ets
arkts
getMayEmpty
TODO: 注意返回值类型为联合类型
getMayEmpty(): string | undefined { return this.mayempty }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getMayEmpty 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#string#Le...
getMayEmpty(): string | undefined { return this.mayempty }
https://github.com/darcycui/DarcyHarmonyNext/blob/241d0ee75929f6b3f9e1fe5b550acf6c9533c15c/entry/src/main/ets/learn/Person.ets#L59-L61
459b2545dd8939b92451ab29c264d15c849212fa
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/network/WakeOnLan.ets
arkts
sendWolToAddresses
批量发送 WOL 到多个地址(对齐 Android WakeOnLanSender.sendWolPacket) 策略:遍历每个地址,先尝试广播(失败忽略),再 DNS 解析后发送到实际 IP。 任何一个地址发送成功即视为成功,全部失败才抛异常。
static async sendWolToAddresses(macAddress: string, addresses: string[], httpPort: number = WakeOnLan.DEFAULT_HTTP_PORT): Promise<void> { WakeOnLan.validateMacAddress(macAddress); const payload = WakeOnLan.createMagicPacket(macAddress); const allPorts = WakeOnLan.getAllPorts(httpPort); let sentWolPac...
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 sendWolToAddresses AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left macAddress AST#identifier#Right AST#ERROR#Left AST#:...
static async sendWolToAddresses(macAddress: string, addresses: string[], httpPort: number = WakeOnLan.DEFAULT_HTTP_PORT): Promise<void> { WakeOnLan.validateMacAddress(macAddress); const payload = WakeOnLan.createMagicPacket(macAddress); const allPorts = WakeOnLan.getAllPorts(httpPort); let sentWolPac...
https://github.com/AlkaidLab/moonlight-harmony
5b98f5f01eb9ecd13bca25d1857270feab88474f
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/StringBuilder.ets
arkts
constructor
Constructs a new builder instance with provided string @param { String } s string that will be used to initialize the builder @syscap SystemCapability.Utils.Lang @FaAndStageModel
public constructor (s: String) { this.buf[this.index++] = s; this.length = s.getLength(); if (!s.isCompressed()) { this.compress = false; } }
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 s AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left String ...
public constructor (s: String) { this.buf[this.index++] = s; this.length = s.getLength(); if (!s.isCompressed()) { this.compress = false; } }
https://gitcode.com/iop123123/arkts-static-skills
48634806be7de3fd76c213c4f8d070e3cd4b2cbd
gitcode
Kira-Yagami-Light/Kira-Projects
TodoTask/entry/src/main/ets/data/database/PreferenceDao.ets
arkts
ensureInitialized
确保 Preferences 已初始化
private async ensureInitialized(): Promise<void> { if (!this.isInitialized || !this.preference) { await this.init(); } }
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 ensureInitialized AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right...
private async ensureInitialized(): Promise<void> { if (!this.isInitialized || !this.preference) { await this.init(); } }
https://github.com/Kira-Yagami-Light/Kira-Projects
92ad897efdfcd48c81419bb1f715b32a718f5e98
github
Mydstiny/RemoteDeskHarmonyOS
entry/src/main/ets/model/RemoteHost.ets
arkts
toJSON
bits per pixel
toJSON(): DisplayConfigJSON { return { width: this.width, height: this.height, multiMonitor: this.multiMonitor, monitorCount: this.monitorCount, dynamicResolution: this.dynamicResolution, colorDepth: this.colorDepth }; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toJSON 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 DisplayConfigJSON AST#identifier#Right AST#ERROR#Right ...
toJSON(): DisplayConfigJSON { return { width: this.width, height: this.height, multiMonitor: this.multiMonitor, monitorCount: this.monitorCount, dynamicResolution: this.dynamicResolution, colorDepth: this.colorDepth }; }
https://github.com/Mydstiny/RemoteDeskHarmonyOS
7845a890006e6131dc74f4f5ece88dd3830eb567
github
itrainhub/wu-ui
WuUI/wu_ui/src/main/ets/components/popup/index.ets
arkts
calcDialogSize
计算对话框宽高
calcDialogSize() { if (typeof this.popupWidth === 'undefined') { if (this.placement === 'center') { this.popupWidth = Math.floor(WuGlobalData.screenWidth * 0.4) } else if (this.placement === 'left' || this.placement === 'right') { this.popupWidth = Math.floor(WuGlobalData.screenWidth *...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left calcDialogSize 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...
calcDialogSize() { if (typeof this.popupWidth === 'undefined') { if (this.placement === 'center') { this.popupWidth = Math.floor(WuGlobalData.screenWidth * 0.4) } else if (this.placement === 'left' || this.placement === 'right') { this.popupWidth = Math.floor(WuGlobalData.screenWidth *...
https://github.com/itrainhub/wu-ui
e4583e64b2ad866f4f9372b20514f05ae6dd9538
github
HarmonyOS_Samples/BestPracticeSnippets
ArkUI/Component_Reuse_Scenarios/entry/src/main/ets/segment/segment2.ets
arkts
build
[EndExclude Case2]
build() { Column() { List() { LazyForEach(this.dataSource, (item: number) => { ListItem() { if (item % 2 === 0) { // Simulate business condition judgment SinglePicture() // Render single image list item } else { MultiPicture() // Renderin...
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#object#Left AST#{#Left { AST#{#Right AST#method_def...
build() { Column() { List() { LazyForEach(this.dataSource, (item: number) => { ListItem() { if (item % 2 === 0) { // Simulate business condition judgment SinglePicture() // Render single image list item } else { MultiPicture() // Renderin...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
d3a3e314db381cea523c23c5ce1928e1984c8c73
gitcode
LJ666-ui/harmony-health-care
entry/src/main/ets/common/utils/TokenManager.ets
arkts
getCurrentRole
获取当前登录角色
static getCurrentRole(): string | null { if (this.isDoctorLoggedIn()) { return 'DOCTOR'; } else if (this.isFamilyLoggedIn()) { return 'FAMILY'; } else if (this.isNurseLoggedIn()) { return 'NURSE'; } else if (this.isUserLoggedIn()) { return 'USER'; } return null; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getCurrentRole 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#binary_expression#Left ...
static getCurrentRole(): string | null { if (this.isDoctorLoggedIn()) { return 'DOCTOR'; } else if (this.isFamilyLoggedIn()) { return 'FAMILY'; } else if (this.isNurseLoggedIn()) { return 'NURSE'; } else if (this.isUserLoggedIn()) { return 'USER'; } return null; }
https://github.com/LJ666-ui/harmony-health-care
0947efc87718308c36df46166b3cc5594c64df55
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Storage/DownloadDirManager.ets
arkts
getMangaArchiveFilePath
获取在线漫画归档文件路径
public getMangaArchiveFilePath(sourceName: string, mangaTitle: string, chapterTitle: string): string { const chapterDir = this.getMangaArchiveDirectoryPath(sourceName, mangaTitle, chapterTitle); const fileName = `${this.sanitizeFolderName(chapterTitle.length > 0 ? chapterTitle : 'chapter')}.cbz`; return `...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getMangaArchiveFilePath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string...
public getMangaArchiveFilePath(sourceName: string, mangaTitle: string, chapterTitle: string): string { const chapterDir = this.getMangaArchiveDirectoryPath(sourceName, mangaTitle, chapterTitle); const fileName = `${this.sanitizeFolderName(chapterTitle.length > 0 ? chapterTitle : 'chapter')}.cbz`; return `...
https://github.com/DaLongZhuaZi/manxia
0d6029164aecd616401e9cdafcca10d6eb75f7e2
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/TypeCreator.ets
arkts
addField
Adds field @param fld field to add @returns this
public addField(fld: FieldCreator): ClassTypeCreator throws { fld.frozen.freeze() this.fields.push(fld) return this; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addField AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left fld AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left FieldCre...
public addField(fld: FieldCreator): ClassTypeCreator throws { fld.frozen.freeze() this.fields.push(fld) return this; }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
396a4f8cde041d5cb7e5c5c288b13e637aa56221
gitee
CPF-ApplicationTPC/openharmony_tpc_samples
OhosVideoCache/library/src/main/ets/HttpProxyCacheServer.ets
arkts
getCacheSize
获取缓存目录的总大小(字节) @returns 缓存总大小(字节)
public getCacheSize(): number { if (!this.config) { LogUtil.error('Config is null, cannot get cache size'); return 0; } const cacheDir = StorageUtils.DEFAULT_DIR; if (!cacheDir) { LogUtil.error('Cache root directory is not configured'); return 0; } try { if (!fs...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCacheSize 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 number AST#nu...
public getCacheSize(): number { if (!this.config) { LogUtil.error('Config is null, cannot get cache size'); return 0; } const cacheDir = StorageUtils.DEFAULT_DIR; if (!cacheDir) { LogUtil.error('Cache root directory is not configured'); return 0; } try { if (!fs...
https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples
36380c425d667613a0f0a9e87b1707335aee5f88
gitcode
751496032/ZRouter
RouterApi/src/main/ets/api/Router.ets
arkts
removeInterceptor
移除拦截器 @param interceptor @param stackName @returns true:移除成功,false:移除失败
public static removeInterceptor<T extends IInterceptor>(interceptor: T, stackName: string = DEFAULT_STACK_NAME): boolean { return ZRouter.getRouterMgr().removeInterceptor<T>(interceptor, stackName) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#identifier#Left removeInterceptor AST#identifier#Right AST#<#Left < AST#<#Right AST#type_identifier#Left T AST#type_identifier#Right AST#extends#Left extends AST#extends#Right AST#ERROR#Left AST#t...
public static removeInterceptor<T extends IInterceptor>(interceptor: T, stackName: string = DEFAULT_STACK_NAME): boolean { return ZRouter.getRouterMgr().removeInterceptor<T>(interceptor, stackName) }
https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/api/Router.ets#L300-L303
7291f9648dfb9aeee22b09149f9cad9efc35203a
github
encorexin/WordPressCMS
harmonyos/entry/src/main/ets/services/http/AIStreamClient.ets
arkts
fetchModels
获取可用模型列表(OpenAI 兼容接口)
static async fetchModels(endpoint: string, apiKey: string): Promise<string[]> { // 从 chat/completions 端点推导 models 端点 let modelsUrl = endpoint.trim().replace(/\/$/, '') if (modelsUrl.includes('/chat/completions')) { modelsUrl = modelsUrl.replace('/chat/completions', '/models') } else if (modelsUr...
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 fetchModels AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left endpoint AST#identifier#Right AST#ERROR#Left AST#:#Left : A...
static async fetchModels(endpoint: string, apiKey: string): Promise<string[]> { // 从 chat/completions 端点推导 models 端点 let modelsUrl = endpoint.trim().replace(/\/$/, '') if (modelsUrl.includes('/chat/completions')) { modelsUrl = modelsUrl.replace('/chat/completions', '/models') } else if (modelsUr...
https://github.com/encorexin/WordPressCMS
65609210769238c0217955956293a67459b70b28
github
richshaw2015/nds
ohos/entry/src/main/ets/pages/settings/KeyMappingSettings.ets
arkts
formatAxisBindingName
格式化轴绑定显示名称 (ppsspp 风格) 格式: pad1.Y Axis+ / pad1.X Axis-
function formatAxisBindingName(axisId: number, direction: string): string { const axisName = AXIS_NAMES[axisId] ?? String(axisId) const dirSign = direction === 'positive' ? '+' : '-' return `pad1.${axisName} Axis${dirSign}` }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left formatAxisBindingName AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left axisId AST#identifier#Right AST#type_annotation#Left AST#:#Left ...
function formatAxisBindingName(axisId: number, direction: string): string { const axisName = AXIS_NAMES[axisId] ?? String(axisId) const dirSign = direction === 'positive' ? '+' : '-' return `pad1.${axisName} Axis${dirSign}` }
https://github.com/richshaw2015/nds
601e8d0b88590640abcf19a25d33c1667a54aec8
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/String.ets
arkts
substring
Selects a substring of this String, starting at a specified index and ending at index before another specified index. If 'begin' < 0, then 'begin' is assumed to be equal to zero. If 'begin' > this.length, then 'begin' is assumed to be equal to the this.length. @param { int } begin to start substring @returns { String }...
public substring(begin: int): String { return this.substring(begin, this.getLength()); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left substring AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left begin AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#Ri...
public substring(begin: int): String { return this.substring(begin, this.getLength()); }
https://gitcode.com/iop123123/arkts-static-skills
00e3fd44eb8d85395dbdb0adb288460965ec7cd1
gitcode
offlinecat-dev/OCNetORM
src/main/ets/query/SubQueryRelationExecutor.ets
arkts
executeSubQueryOneToMany
执行 ONE_TO_MANY 关系的子查询 查询目标表,返回符合条件的记录的外键值(即源实体 ID)
private async executeSubQueryOneToMany( subQuery: SubQuery, store: relationalStore.RdbStore, inverseKey: string, targetTableName: string, targetEntityName: string ): Promise<Array<ValueType>> { const targetMetadata = MetadataStorage.getInstance().getEntityMetadata(targetEntityName) if (t...
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 executeSubQueryOneToMany AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left subQuery AST#identifier#Righ...
private async executeSubQueryOneToMany( subQuery: SubQuery, store: relationalStore.RdbStore, inverseKey: string, targetTableName: string, targetEntityName: string ): Promise<Array<ValueType>> { const targetMetadata = MetadataStorage.getInstance().getEntityMetadata(targetEntityName) if (t...
https://github.com/offlinecat-dev/OCNetORM
5ae1829cb6abd23d17649757510a13570dff8c5e
github
LJ666-ui/harmony-health-care
entry/src/main/ets/skill/utils/SkillTestTool.ets
arkts
testMedicationReminder
测试用药提醒意图
private async testMedicationReminder(): Promise<void> { const testName = '用药提醒'; try { const result = await this.skill.handleQuickCommand('该吃药了'); const passed = result.ttsText.includes('药') || result.ttsText.includes('用药'); this.addResult(testName, '该吃药了', passed, result); }...
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 testMedicationReminder AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#...
private async testMedicationReminder(): Promise<void> { const testName = '用药提醒'; try { const result = await this.skill.handleQuickCommand('该吃药了'); const passed = result.ttsText.includes('药') || result.ttsText.includes('用药'); this.addResult(testName, '该吃药了', passed, result); }...
https://github.com/LJ666-ui/harmony-health-care
849e16077155d1fce6c06071ab5ce8a85bcd19e7
github
Joker-x-dev/CoolMallArkTS
feature/user/src/main/ets/viewmodel/FootprintViewModel.ets
arkts
loadFootprints
加载足迹数据 @returns {void} 无返回值
loadFootprints(): void { this.uiState = BaseNetWorkListUiState.LOADING; Promise.all([ this.repository.getAllFootprints(), this.repository.getFootprintCount() ]) .then((result: (Footprint[] | number)[]): void => { const footprints: Footprint[] = result[0] as Footprint[]; c...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left loadFootprints 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_blo...
loadFootprints(): void { this.uiState = BaseNetWorkListUiState.LOADING; Promise.all([ this.repository.getAllFootprints(), this.repository.getFootprintCount() ]) .then((result: (Footprint[] | number)[]): void => { const footprints: Footprint[] = result[0] as Footprint[]; c...
https://github.com/Joker-x-dev/CoolMallArkTS
c196711ba470fd520d45e48f5507ba09a4b1af6c
github
Delsin-Yu/JustPDF
entry/src/main/ets/components/PageInfo.ets
arkts
releaseThumbnail
Releases a reference to the thumbnail. When the reference count reaches zero, the PixelMap is released and any pending thumbnail task is cancelled. Used to free memory when the thumbnail scrolls out of view.
public releaseThumbnail(): void { // Decrement reference count this.thumbnailRefCount--; // Only evict when no more references if (this.thumbnailRefCount > 0) { return; } // Ensure ref count doesn't go negative this.thumbnailRefCount = 0; // Cancel pending thumbnail task if an...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left releaseThumbnail 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#expre...
public releaseThumbnail(): void { // Decrement reference count this.thumbnailRefCount--; // Only evict when no more references if (this.thumbnailRefCount > 0) { return; } // Ensure ref count doesn't go negative this.thumbnailRefCount = 0; // Cancel pending thumbnail task if an...
https://github.com/Delsin-Yu/JustPDF/blob/07d9dd917e7592f584d67821fb06a7369bd3f15b/entry/src/main/ets/components/PageInfo.ets#L560-L591
d33fe3d3747b0b26344039b655a1bb7dcd2b83b6
github
richshaw2015/nds
ohos/entry/src/main/ets/pages/settings/LayoutsSettings.ets
arkts
onBackPress
拦截系统返回键 (对齐 Android LayoutEditorActivity.onBackPressedDispatcher) 编辑器模式下: 弹出菜单而不是直接退出 列表模式下: 正常返回
onBackPress(): boolean { if (this.mode === PageMode.EDITOR) { this.storeLayoutChanges(); this.showMenuDialog = true; return true; // 消费事件,阻止默认返回 } return false; // 列表模式,走默认返回 }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onBackPress 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#stateme...
onBackPress(): boolean { if (this.mode === PageMode.EDITOR) { this.storeLayoutChanges(); this.showMenuDialog = true; return true; // 消费事件,阻止默认返回 } return false; // 列表模式,走默认返回 }
https://github.com/richshaw2015/nds
cfda1e29f5ddc0d00ea4e3f5dd80606a83f71d96
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/TouchInputHandler.ets
arkts
setSensitivity
设置灵敏度
setSensitivity(sensitivity: number): void { this.config.sensitivity = sensitivity; this.trackpad.updateConfig(sensitivity, undefined, undefined); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setSensitivity AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sensitivity AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) A...
setSensitivity(sensitivity: number): void { this.config.sensitivity = sensitivity; this.trackpad.updateConfig(sensitivity, undefined, undefined); }
https://github.com/AlkaidLab/moonlight-harmony
e524854b598c19ac8d0f9444cb384737a6642c1f
github
honjow/Next2V
shared/src/main/ets/settings/ImageUploadSettings.ets
arkts
current
The live config, read from the V2 mirror that apply() keeps in lockstep with the persisted keys.
static current(): ImageUploadSettingsSnapshot { const state = connectImageUpload() return ImageUploadSettings.normalize({ provider: (state.provider || 'imgbb') as ImageUploadProviderId, imgbbApiKey: state.imgbbApiKey || '', smmsToken: state.smmsToken || '', imgurClientId: state.imgurCl...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left current 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 ImageUploadSet...
static current(): ImageUploadSettingsSnapshot { const state = connectImageUpload() return ImageUploadSettings.normalize({ provider: (state.provider || 'imgbb') as ImageUploadProviderId, imgbbApiKey: state.imgbbApiKey || '', smmsToken: state.smmsToken || '', imgurClientId: state.imgurCl...
https://github.com/honjow/Next2V
cf7eb0d6c0356768f41a3d34ed90a5dc4bc175a9
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/SyncPrimitives.ets
arkts
unlock
Calling the method means exiting the critical section. If there are blocked coroutines, unlocks one of them.
public unlock(): void { Mutex.unlock(this); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left unlock 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_stat...
public unlock(): void { Mutex.unlock(this); }
https://gitcode.com/iop123123/arkts-static-skills
1b5d290ad7c4a362d06614cb094c3a9cb209975b
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/CoverCacheManager.ets
arkts
doDownloadCover
执行封面下载
private async doDownloadCover( sourceId: number, externalId: string, coverUrl: string, headers?: Record<string, string> ): Promise<string | null> { try { // 确保图源目录存在 const dirReady = await this.ensureSourceDir(sourceId); if (!dirReady) { logger.error(TAG, '图源目录创建失败,无法下载...
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 doDownloadCover AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#L...
private async doDownloadCover( sourceId: number, externalId: string, coverUrl: string, headers?: Record<string, string> ): Promise<string | null> { try { // 确保图源目录存在 const dirReady = await this.ensureSourceDir(sourceId); if (!dirReady) { logger.error(TAG, '图源目录创建失败,无法下载...
https://github.com/DaLongZhuaZi/manxia
12874cad6ac8f21dc52123297d1e96d905e4704b
github
Eklps/harmony-mall-perf
entry/src/main/ets/viewmodel/ListDataSource.ets
arkts
pushData
加载更多,返回是否成功加载(根据当前分类加载)
public pushData(): boolean { if (this.listData.length < MAX_DATA_LENGTH) { // 这里的逻辑需要根据搜索条件来加载,现在的模拟数据比较简单, // 实际上应该请求后端带参数的接口。 // 为简单起见,我们追加数据后再次执行一次本地筛选 let dataToAdd = goodsInitialList; if (dataToAdd.length > 0) { // 先生成新ID避免key重复 let newItems: GoodsListItem...
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#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#bool...
public pushData(): boolean { if (this.listData.length < MAX_DATA_LENGTH) { // 这里的逻辑需要根据搜索条件来加载,现在的模拟数据比较简单, // 实际上应该请求后端带参数的接口。 // 为简单起见,我们追加数据后再次执行一次本地筛选 let dataToAdd = goodsInitialList; if (dataToAdd.length > 0) { // 先生成新ID避免key重复 let newItems: GoodsListItem...
https://github.com/Eklps/harmony-mall-perf
af4c1fc679a848ca05758c3b303a55d751f1501a
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/listener/ChartTouchListener.ets
arkts
getTouchMode
returns the touch mode the listener is currently in @return
public getTouchMode(): number { return this.mTouchMode; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getTouchMode 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 number AST#nu...
public getTouchMode(): number { return this.mTouchMode; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
d0a3bb195d13f2e7e554180b6285d7aafe1950dc
gitee
yongoe1024/RdbPlus
rdbplus/src/main/ets/BaseMapper.ets
arkts
getPage
分页查询 @param current 页数 @param size 每页大小 @param wrapper 查询条件 @returns Page类
async getPage(current: number, size: number, wrapper: Wrapper = new Wrapper(), db?: Connection): Promise<Page<T>> { let isClose: boolean = true if (db === undefined) { db = await this.getConnection() } else { isClose = false } const count: number = await this.count(wrapper, db) let...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getPage AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left current AST#identifier#Right AST#type_annotation#Left AST#:#Le...
async getPage(current: number, size: number, wrapper: Wrapper = new Wrapper(), db?: Connection): Promise<Page<T>> { let isClose: boolean = true if (db === undefined) { db = await this.getConnection() } else { isClose = false } const count: number = await this.count(wrapper, db) let...
https://github.com/yongoe1024/RdbPlus/blob/83f7347b7ac692941729d3464923155948e876bb/rdbplus/src/main/ets/BaseMapper.ets#L218-L243
db6e303cc8582fc44bfbae4c0b7d6397fbd1a957
github
arkui-x/samples
CodeLab/Cases/feature/customaddresspicker/src/main/ets/customaddresspicker/model/AddressModel.ets
arkts
constructor
存放市、区信息
constructor(code: string = '', name: string = '', children: City[]) { this.code = code; this.name = name; this.children = children; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left code AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#identifier#Lef...
constructor(code: string = '', name: string = '', children: City[]) { this.code = code; this.name = name; this.children = children; }
https://gitcode.com/arkui-x/samples
53480f1efe1f37d10fd9954ca2ae11f87bf64d1a
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/WebViewSourceManager.ets
arkts
isWebViewSource
检测图源是否为WebView类型 @param sourceId 图源ID @returns 是否为WebView类型
async isWebViewSource(sourceId: number): Promise<boolean> { try { const record: ComicSourceDatabaseRecord | null = await this.dataManager.getComicSourceById(sourceId); if (LegadoMangaSourceBridge.getInstance().isLegadoMangaRecord(record)) { return false; } const config: Object | nu...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left isWebViewSource AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceId AST#identifier#Right AST#type_annotation#Left AST#:#Le...
async isWebViewSource(sourceId: number): Promise<boolean> { try { const record: ComicSourceDatabaseRecord | null = await this.dataManager.getComicSourceById(sourceId); if (LegadoMangaSourceBridge.getInstance().isLegadoMangaRecord(record)) { return false; } const config: Object | nu...
https://github.com/DaLongZhuaZi/manxia
a4247bb6eed6b430b62943afa1126fd310a65e1e
github
HarmonyOS_Samples/BestPracticeSnippets
SegmentedPhotograph/entry/src/main/ets/mode/CameraService.ets
arkts
takePicture
[Start take_picture] Trigger a photo taking based on the specified parameters
async takePicture(): Promise<void> { Logger.info(TAG, 'takePicture start'); let cameraDeviceIndex = GlobalContext.get().getT<number>('cameraDeviceIndex'); let photoSettings: camera.PhotoCaptureSetting = { quality: camera.QualityLevel.QUALITY_LEVEL_HIGH, mirror: cameraDeviceIndex ? true : false...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left takePicture 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...
async takePicture(): Promise<void> { Logger.info(TAG, 'takePicture start'); let cameraDeviceIndex = GlobalContext.get().getT<number>('cameraDeviceIndex'); let photoSettings: camera.PhotoCaptureSetting = { quality: camera.QualityLevel.QUALITY_LEVEL_HIGH, mirror: cameraDeviceIndex ? true : false...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
edd1e85ecf258710a2b9501aba4e45ed09cf0af7
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Source/SuwayomiSource.ets
arkts
getChapterProgress
获取章节阅读进度
public async getChapterProgress(chapterId: string): Promise<number> { const query = ` query GetChapterProgress($id: Int!) { chapter(id: $id) { id lastPageRead pageCount } } `; const variables: MangaIdVariables = { id: parseInt(chapterId) }; con...
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 getChapterProgress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left chapterId AST#identifier#Right AST#ERROR#Left AST#:#...
public async getChapterProgress(chapterId: string): Promise<number> { const query = ` query GetChapterProgress($id: Int!) { chapter(id: $id) { id lastPageRead pageCount } } `; const variables: MangaIdVariables = { id: parseInt(chapterId) }; con...
https://github.com/DaLongZhuaZi/manxia
2fdf920f78087af4d222769b83c1aa5530fe0dc4
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/division/division_int.ets
arkts
main
--- desc: check division for integer operands ---
function main(): void { const a: int = {{v.left}} const b: int = {{v.right}} assert (a / b) == {{v.result}}
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main 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#predefined_type#Left A...
function main(): void { const a: int = {{v.left}} const b: int = {{v.right}} assert (a / b) == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
5021be19cb7209da73595caa1b1f479c1387bb79
gitee
LJ666-ui/harmony-health-care
5-skill离线包/星云智联–分布式AI全周期智慧健康管理平台_skills/skills/AIConsultationSkill.ets
arkts
formatConsultationResponse
格式化问诊响应
private static formatConsultationResponse(analysis: any, symptomInfo: SymptomInfo): ConsultationResult { return { possibleCauses: analysis.possibleCauses || [], recommendations: analysis.recommendations || [], urgencyLevel: analysis.urgencyLevel || 'medium', shouldSeeDoctor: analysis.shoul...
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 formatConsultationResponse AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left analysis AST#identifier#Right AST#ERROR#...
private static formatConsultationResponse(analysis: any, symptomInfo: SymptomInfo): ConsultationResult { return { possibleCauses: analysis.possibleCauses || [], recommendations: analysis.recommendations || [], urgencyLevel: analysis.urgencyLevel || 'medium', shouldSeeDoctor: analysis.shoul...
https://github.com/LJ666-ui/harmony-health-care
03a2218e0562c68b0eb2b9d21a1156f36b9b3458
github
openharmony/codelabs
ETSUI/AccountApp/entry/src/main/ets/pages/ForgotPasswordPage.ets
arkts
handleCopyEmail
复制邮箱到剪贴板
handleCopyEmail() { try { let data = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, this.supportEmail); let systemPasteboard = pasteboard.getSystemPasteboard(); systemPasteboard.setData(data).then(() => { promptAction.showToast({ message: '邮箱地址已复制' }); }).catch((err: Busines...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left handleCopyEmail 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#Le...
handleCopyEmail() { try { let data = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, this.supportEmail); let systemPasteboard = pasteboard.getSystemPasteboard(); systemPasteboard.setData(data).then(() => { promptAction.showToast({ message: '邮箱地址已复制' }); }).catch((err: Busines...
https://gitcode.com/openharmony/codelabs
b48457242873915fe975dcf6e114d194d905b3eb
gitcode
wanrenhuifu/JLU
harmonyos-鸿蒙实训/tkbrush-app/tkbrush-app/entry/src/main/ets/components/TKQuestionCard.ets
arkts
getISSelected
当前题是否已做
getISSelected(item:Question){ const question = this.userAnswers.find(obj=>obj.questionId===item.id) if (question && question.userAnswer.length > 0) { return true }else{ return false } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getISSelected AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left item AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Question AST#identifier#Rig...
getISSelected(item:Question){ const question = this.userAnswers.find(obj=>obj.questionId===item.id) if (question && question.userAnswer.length > 0) { return true }else{ return false } }
https://github.com/wanrenhuifu/JLU
7b91b334dada7a99431952d91e61e80ce3342f1e
github
FinalScave/SweetEditor
platform/OHOS/sweeteditor/src/main/ets/EditorRenderer.ets
arkts
render
Render the editor content onto the canvas. Returns true if transient scrollbar refresh should be scheduled.
render(ctx: CanvasRenderingContext2D, model: EditorRenderModel, viewWidth: number, viewHeight: number, cursorVisible: boolean): boolean { const perf = PerfStepRecorder.start(); this.currentFontKey = ''; ctx.clearRect(0, 0, viewWidth, viewHeight); ctx.fillStyle = argbToCssColor(this.theme.backgroun...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left render AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ctx AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left CanvasRenderingContext2D AST#identifier#Right AST#...
render(ctx: CanvasRenderingContext2D, model: EditorRenderModel, viewWidth: number, viewHeight: number, cursorVisible: boolean): boolean { const perf = PerfStepRecorder.start(); this.currentFontKey = ''; ctx.clearRect(0, 0, viewWidth, viewHeight); ctx.fillStyle = argbToCssColor(this.theme.backgroun...
https://github.com/FinalScave/SweetEditor
c99685fafdb793431a0a145c65303efda3ffe317
github
openharmony-sig/qr-code-generator
library/src/main/ets/components/MainPage/qrcodegen.ets
arkts
toSvgString
Returns a string of SVG code for an image depicting this QR Code, with the given number of border modules. The string always uses Unix newlines (\n), regardless of the platform.
public toSvgString(border: int): string { if (border < 0) throw new Error("Border must be non-negative"); let parts: Array<string> = []; for (let y = 0; y < this.size; y++) { for (let x = 0; x < this.size; x++) { if (this.getModule(x, y)) parts.push(`M${x + border...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toSvgString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left border AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier...
public toSvgString(border: int): string { if (border < 0) throw new Error("Border must be non-negative"); let parts: Array<string> = []; for (let y = 0; y < this.size; y++) { for (let x = 0; x < this.size; x++) { if (this.getModule(x, y)) parts.push(`M${x + border...
https://gitee.com/openharmony-sig/qr-code-generator.git
d62efc4ddd20f4b56b4bf625c030b5562d13b927
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/ternary/ternary_long.ets
arkts
main
--- desc: check ternary if-else operation with condition of long integer operand ---
function main(): void { const a: long = {{v.condition}} const b: long = {{v.ifTrue}} const c: long = {{v.ifFalse}} assert (a ? b : c) == {{v.result}}
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main 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#predefined_type#Left A...
function main(): void { const a: long = {{v.condition}} const b: long = {{v.ifTrue}} const c: long = {{v.ifFalse}} assert (a ? b : c) == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
074051eff6fa1bd2b1ce2aba0f98ec6c99a8a274
gitee
CLMC2025/Vignette
entry/src/main/ets/manager/SessionPlanner.ets
arkts
constructor
遗忘后插入强化任务数
constructor( storyRatio: number = 0.4, clozeRatio: number = 0.25, choiceRatio: number = 0.15, collocationRatio: number = 0.15, pronunciationRatio: number = 0.05, maxTasksPerWord: number = 3, reinforcementCount: number = 2 ) { this.storyRatio = storyRatio; this.clozeRatio = clozeR...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left storyRatio AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#identifi...
constructor( storyRatio: number = 0.4, clozeRatio: number = 0.25, choiceRatio: number = 0.15, collocationRatio: number = 0.15, pronunciationRatio: number = 0.05, maxTasksPerWord: number = 3, reinforcementCount: number = 2 ) { this.storyRatio = storyRatio; this.clozeRatio = clozeR...
https://github.com/CLMC2025/Vignette
f62c0443fb39baecc3dc0968f185f3ac9b3edd07
github
CLMC2025/Vignette
entry/src/main/ets/manager/ReviewTimeManager.ets
arkts
constructor
会话超时:30分钟
private constructor() { this.sessionStats = { totalWordsReviewed: 0, totalTimeSpent: 0, averageTimePerWord: 0, currentSessionStartTime: Date.now(), currentSessionDuration: 0 }; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left constructor 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#{#Left ...
private constructor() { this.sessionStats = { totalWordsReviewed: 0, totalTimeSpent: 0, averageTimePerWord: 0, currentSessionStartTime: Date.now(), currentSessionDuration: 0 }; }
https://github.com/CLMC2025/Vignette
a45084d34d2da8c991b1810a84d42d554e17f02d
github
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnReadMoreViewModel.ets
arkts
logFold
记录收起事件
logFold(): void { this.eventLog = "触发了收起事件"; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left logFold 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#Left...
logFold(): void { this.eventLog = "触发了收起事件"; }
https://github.com/codelably/tuniao-ui
5152f87e95ad356019fe2d9b32ea6a90be478b86
github
HarmonyOS_Samples/guide-snippets
ArkTS/ArkTSCompilationToolchain/ArkGuardForBytecodeObfuscation/BytecodeObfuscationIssues/entry/src/main/ets/pages/MainPage.ets
arkts
testExportNamespace
[End import_utils]
function testExportNamespace() { // [EndExclude import_ns] NS.foo(); // [End import_ns] }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testExportNamespace 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#comment...
function testExportNamespace() { // [EndExclude import_ns] NS.foo(); // [End import_ns] }
https://gitcode.com/HarmonyOS_Samples/guide-snippets
8c0439247d990ad37c86145630c3d08b5fb5a7fc
gitcode
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/services/LibFreeRDP.ets
arkts
sendClipboardData
Send clipboard data
static sendClipboardData(inst: number, data: string): boolean { if (!LibFreeRDP.ensureNativeReady()) { return false; } return freerdpNative!.freerdpSendClipboardData(inst, data); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left sendClipboardData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left inst AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
static sendClipboardData(inst: number, data: string): boolean { if (!LibFreeRDP.ensureNativeReady()) { return false; } return freerdpNative!.freerdpSendClipboardData(inst, data); }
https://github.com/tangwengang-del/freerdp-harmonyos
4df1e125670f79da3623bc45bda445aca4b23ee2
github
LJ666-ui/harmony-health-care
entry/src/main/ets/utils/DeviceTypeUtil.ets
arkts
getDeviceType
获取当前设备类型
public getDeviceType(): DeviceType { return this.currentDeviceType; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getDeviceType 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 DeviceTy...
public getDeviceType(): DeviceType { return this.currentDeviceType; }
https://github.com/LJ666-ui/harmony-health-care
0c17df9303c3c0ab9f6bbf99f82de678be559ed1
github
openharmony/codelabs
Media/ImageEdit/entry/src/main/ets/utils/MathUtils.ets
arkts
hasIntersection
Determine if two lines intersect. @param line1 @param line2 @returns true means intersect, false means not intersect.
static hasIntersection(line1: LineSegment, line2: LineSegment): boolean { let p1 = line1.start; let p2 = line1.end; let p3 = line2.start; let p4 = line2.end; if (Math.max(p1.x, p2.x) < Math.min(p3.x, p4.x) || Math.max(p1.y, p2.y) < Math.min(p3.y, p4.y) || Math.max(p3.x, p4.x) < Math.min(p1.x...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left hasIntersection AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left line1 AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left...
static hasIntersection(line1: LineSegment, line2: LineSegment): boolean { let p1 = line1.start; let p2 = line1.end; let p3 = line2.start; let p4 = line2.end; if (Math.max(p1.x, p2.x) < Math.min(p3.x, p4.x) || Math.max(p1.y, p2.y) < Math.min(p3.y, p4.y) || Math.max(p3.x, p4.x) < Math.min(p1.x...
https://gitee.com/openharmony/codelabs.git
e7b5ec8eb05f74d7843380ee31df75f6c2e23fde
gitee
OHPG/FinSdk
jellyfin/src/main/ets/api/PlaylistsApi.ets
arkts
removeUserFromPlaylist
@summary Remove a user from a playlist\'s users. @param {PlaylistsApiRemoveUserFromPlaylistRequest} requestParameters Request parameters. @param {*} [options] Override http request option. @throws {RequiredError} @memberof PlaylistsApi
public removeUserFromPlaylist(requestParameters: PlaylistsApiRemoveUserFromPlaylistRequest): Promise<void> { return this.apiClient.delete({path: `/Playlists/${requestParameters.playlistId}/Users/${requestParameters.userId}`}) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left removeUserFromPlaylist AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right ...
public removeUserFromPlaylist(requestParameters: PlaylistsApiRemoveUserFromPlaylistRequest): Promise<void> { return this.apiClient.delete({path: `/Playlists/${requestParameters.playlistId}/Users/${requestParameters.userId}`}) }
https://github.com/OHPG/FinSdk
4f660389ce90ad1d8b5ba48165f29e4d423ec868
github
OSpark-Team/Free-PCM
library/src/main/ets/utils/AudioRendererPlayer.ets
arkts
getVolume
获取当前音量 @returns 音量值(0.0 ~ 1.0),未创建时返回 null @remarks - 0.0 = 静音 - 1.0 = 最大音量 - 默认值通常是 1.0
public getVolume(): number | null { if (!this.renderer) { return null; } return this.renderer.getVolume(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getVolume 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#binary_expression#Left AST#i...
public getVolume(): number | null { if (!this.renderer) { return null; } return this.renderer.getVolume(); }
https://github.com/OSpark-Team/Free-PCM/blob/3440e7220d07d28815d172b4b3237145434075ee/library/src/main/ets/utils/AudioRendererPlayer.ets#L422-L427
3b4b3c175009369c083152a7349923f86cc1fce5
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/BaseDataSet.ets
arkts
setColorByAlpha
Sets a color with a specific alpha value. @param color @param alpha from 0-255
public setColorByAlpha(color: number, alpha: number): void { let mColor: number = ColorTemplate.argb(alpha, ColorTemplate.red(color), ColorTemplate.green(color), ColorTemplate.blue(color)); this.setColorsByVariable([mColor]) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setColorByAlpha AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left color AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left...
public setColorByAlpha(color: number, alpha: number): void { let mColor: number = ColorTemplate.argb(alpha, ColorTemplate.red(color), ColorTemplate.green(color), ColorTemplate.blue(color)); this.setColorsByVariable([mColor]) }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
05fd739c84b74ef5131e1989cb9017d645e65fae
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets
arkts
getTagName
获取元素的标签名
private getTagName(element: string): string { const match = element.match(/^<([a-zA-Z][a-zA-Z0-9]*)/); return match ? match[1].toLowerCase() : ''; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getTagName 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 AST#string#R...
private getTagName(element: string): string { const match = element.match(/^<([a-zA-Z][a-zA-Z0-9]*)/); return match ? match[1].toLowerCase() : ''; }
https://github.com/DaLongZhuaZi/manxia
f8873291fdb62b13bc9557d2945862958ff73ec6
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/DataConverter.ets
arkts
toNumber
安全转换数字 @param value - 输入值 @param defaultValue - 默认值 @returns 数字值
static toNumber(value: Object, defaultValue: number = 0): number { if (value === null || value === undefined) { return defaultValue; } if (typeof value === 'number' && !isNaN(value)) { return value; } if (typeof value === 'string') { const parsed = parseFloat(value); ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left toNumber 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...
static toNumber(value: Object, defaultValue: number = 0): number { if (value === null || value === undefined) { return defaultValue; } if (typeof value === 'number' && !isNaN(value)) { return value; } if (typeof value === 'string') { const parsed = parseFloat(value); ...
https://github.com/DaLongZhuaZi/manxia
eec266aa5dc9e86f7d8eb2dbc047010e1cad9f49
github
Mydstiny/RemoteDeskHarmonyOS
entry/src/main/ets/services/SshPreflightService.ets
arkts
createToken
创建一次性 token @returns token ID (随机字符串)
createToken(data: SshPreflightTokenData): string { // 清理过期 token this.cleanup(); const tokenId = 'spt_' + Date.now().toString(36) + '_' + Math.random().toString(36).substring(2, 10); data.createdAt = Date.now(); this.tokens.set(tokenId, data); return tokenId; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left createToken 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#identifier#Left SshPreflightTokenData AST#identifier#Right A...
createToken(data: SshPreflightTokenData): string { // 清理过期 token this.cleanup(); const tokenId = 'spt_' + Date.now().toString(36) + '_' + Math.random().toString(36).substring(2, 10); data.createdAt = Date.now(); this.tokens.set(tokenId, data); return tokenId; }
https://github.com/Mydstiny/RemoteDeskHarmonyOS
3f3507e423a3580e332a6b8f8733a07eb82587c5
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/TabConfig.ets
arkts
generateTabsFromWorkflows
根据 workflows 自动生成标签配置
function generateTabsFromWorkflows(config: Record<string, Object>): TabConfig[] { const tabs: TabConfig[] = []; const workflows = config['workflows'] as Record<string, Object> | undefined; if (!workflows) { return getDefaultTabsConfig(0).tabs; } let order = 0; // 检查 popular 工作流 if (workflows['pop...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left generateTabsFromWorkflows AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left config AST#identifier#Right AST#type_annotation#Left AST#:#L...
function generateTabsFromWorkflows(config: Record<string, Object>): TabConfig[] { const tabs: TabConfig[] = []; const workflows = config['workflows'] as Record<string, Object> | undefined; if (!workflows) { return getDefaultTabsConfig(0).tabs; } let order = 0; // 检查 popular 工作流 if (workflows['pop...
https://github.com/DaLongZhuaZi/manxia
b17742ec7b844f51b6b86f3f50677087a12a18b8
github
harmonyos/codelabs
HarmonyOS_NEXT/MusicHome/common/mediaCommon/src/main/ets/utils/MediaService.ets
arkts
seek
Seek play music. @param ms.
public seek(ms: number) { if (this.isPrepared && this.state != AudioPlayerState.ERROR && this.avPlayer) { let seekMode = this.getCurrentTime() < ms ? 0 : 1; let realTime = (ms <= 0 ? 0 : (ms >= this.getDuration() ? this.getDuration() : ms)); this.isCurrent = false; this.avPlayer.seek(realT...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left seek AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ms AST#identifier#Right AST#:#Left : AST#:#R...
public seek(ms: number) { if (this.isPrepared && this.state != AudioPlayerState.ERROR && this.avPlayer) { let seekMode = this.getCurrentTime() < ms ? 0 : 1; let realTime = (ms <= 0 ? 0 : (ms >= this.getDuration() ? this.getDuration() : ms)); this.isCurrent = false; this.avPlayer.seek(realT...
https://gitee.com/harmonyos/codelabs.git
0c9c10dcf39b9b037ba51cf81064728c51cbaaca
gitee
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/StreamWindowManager.ets
arkts
initScreenSize
初始化屏幕尺寸
async initScreenSize(): Promise<DisplaySize> { try { const displayInfo = display.getDefaultDisplaySync(); this.screenWidth = displayInfo.width / displayInfo.densityPixels; this.screenHeight = displayInfo.height / displayInfo.densityPixels; console.info(`StreamWindowManager: 屏幕尺寸 ${t...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left initScreenSize 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#gener...
async initScreenSize(): Promise<DisplaySize> { try { const displayInfo = display.getDefaultDisplaySync(); this.screenWidth = displayInfo.width / displayInfo.densityPixels; this.screenHeight = displayInfo.height / displayInfo.densityPixels; console.info(`StreamWindowManager: 屏幕尺寸 ${t...
https://github.com/AlkaidLab/moonlight-harmony
d19de591c3737a203267d438b239303435771f54
github
XJTUWYD/ArkDiff
entry/src/main/ets/engine/LcsEngine.ets
arkts
compute
计算两个字符串数组的最长公共子序列 @param linesA 原始文本行数组 @param linesB 修改后文本行数组 @returns LcsResult 包含所有匹配行对
static compute(linesA: string[], linesB: string[]): LcsResult { const m = linesA.length; const n = linesB.length; // 空数组边界处理 if (m === 0 || n === 0) { return { matches: [], lengthA: m, lengthB: n }; } // 超过阈值时抛出提示(调用方应改用其他算法) if (m > LCS_MAX_LINES || n...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left compute AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left linesA AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#L...
static compute(linesA: string[], linesB: string[]): LcsResult { const m = linesA.length; const n = linesB.length; // 空数组边界处理 if (m === 0 || n === 0) { return { matches: [], lengthA: m, lengthB: n }; } // 超过阈值时抛出提示(调用方应改用其他算法) if (m > LCS_MAX_LINES || n...
https://github.com/XJTUWYD/ArkDiff
b867ec8cc25655d644927eb9224acb5f9c1e0594
github
Joker-x-dev/CoolMallArkTS
feature/user/src/main/ets/view/AddressDetailPage.ets
arkts
build
构建地址详情页面 @returns {void} 无返回值
build(): void { AppNavDestination({ title: this.vm.isEditMode ? $r("app.string.edit_address") : $r("app.string.add_address"), viewModel: this.vm, paddingValue: { top: this.windowSafeAreaState.topInset, left: this.windowSafeAreaState.leftInset, right: this....
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#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#...
build(): void { AppNavDestination({ title: this.vm.isEditMode ? $r("app.string.edit_address") : $r("app.string.add_address"), viewModel: this.vm, paddingValue: { top: this.windowSafeAreaState.topInset, left: this.windowSafeAreaState.leftInset, right: this....
https://github.com/Joker-x-dev/CoolMallArkTS
f9f7c4406b6e3f7d73e590b57cbfad4aaf03c632
github