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
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/utils/Transformer.ets
arkts
rectToPixelPhase
Transform a rectangle with all matrices with potential animation phases. @param r @param phaseY
public rectToPixelPhase(r: MyRect, phaseY: number) { // multiply the height of the rect with the phase r.top *= phaseY; r.bottom *= phaseY; this.mMatrixValueToPx.mapRect(r); this.mViewPortHandler.getMatrixTouch().mapRect(r); this.mMatrixOffset.mapRect(r); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left rectToPixelPhase AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left r AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left My...
public rectToPixelPhase(r: MyRect, phaseY: number) { // multiply the height of the rect with the phase r.top *= phaseY; r.bottom *= phaseY; this.mMatrixValueToPx.mapRect(r); this.mViewPortHandler.getMatrixTouch().mapRect(r); this.mMatrixOffset.mapRect(r); }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
2183f20f5038a62a95aff6e0665f281def71f891
gitee
zmuxuny/ai-guardian-star
entry/src/main/ets/database/DatabaseHelper.ets
arkts
queryVideoRecords
查询视频列表,只返回保留天数内的记录,按录制时间倒序
public async queryVideoRecords(limitDays?: number): Promise<VideoRecord[]> { const days = limitDays ?? this.getRetentionDays(); const beforeTs = Date.now() - days * 24 * 60 * 60 * 1000; const predicates = new relationalStore.RdbPredicates("t_video_record"); predicates.greaterThanOrEqualTo("record_time...
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 queryVideoRecords AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left limitDays AST#identifier#Right AST#ERROR#Left AST#?#L...
public async queryVideoRecords(limitDays?: number): Promise<VideoRecord[]> { const days = limitDays ?? this.getRetentionDays(); const beforeTs = Date.now() - days * 24 * 60 * 60 * 1000; const predicates = new relationalStore.RdbPredicates("t_video_record"); predicates.greaterThanOrEqualTo("record_time...
https://github.com/zmuxuny/ai-guardian-star/blob/87ab023d8b9aab4303a9fc1e97508e1f8ee01e07/entry/src/main/ets/database/DatabaseHelper.ets#L714-L754
13e67a35be69c89289ce0da47e5ab33b7db5458e
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/ChartData.ets
arkts
setDrawValues
Enables / disables drawing values (value-text) for all DataSets this data object contains. @param enabled
public setDrawValues(enabled: boolean): void { if (this.mDataSets) { for (let data of this.mDataSets.dataSource) { data.setDrawValues(enabled); } } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setDrawValues AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left...
public setDrawValues(enabled: boolean): void { if (this.mDataSets) { for (let data of this.mDataSets.dataSource) { data.setDrawValues(enabled); } } }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
65f0881d4e095f57db1c68df2072a6781b1284d4
gitee
openharmony-sig/FastBle
library/src/main/ets/BleManager.ets
arkts
disableBluetooth
Disable bluetooth
public disableBluetooth() { //TODO }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left disableBluetooth 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#{#Lef...
public disableBluetooth() { //TODO }
https://gitee.com/openharmony-sig/FastBle.git
2fead50ce3e60e9d53230f4c9c2f3c8aac49b8ef
gitee
richshaw2015/nds
ohos/entry/src/main/ets/utils/BackgroundMusicManager.ets
arkts
setVolume
更新音量(0-100) 在用户设置值基础上乘以 0.5 衰减系数
public setVolume(volumePercent: number): void { if (!this.avPlayer) return; const vol = (volumePercent / 100.0) * 0.25; this.avPlayer.setVolume(vol); hilog.debug(DOMAIN, TAG, 'BGM volume updated: %{public}d%% (actual: %{public}f)', volumePercent, vol); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setVolume AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left volumePercent AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number...
public setVolume(volumePercent: number): void { if (!this.avPlayer) return; const vol = (volumePercent / 100.0) * 0.25; this.avPlayer.setVolume(vol); hilog.debug(DOMAIN, TAG, 'BGM volume updated: %{public}d%% (actual: %{public}f)', volumePercent, vol); }
https://github.com/richshaw2015/nds
1dafb65c2428de6c563669b693c8808fed487b9c
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/BarEntry.ets
arkts
calcSum
Calculates the sum across all values of the given stack. @param vals @return
public static calcSum(vals: number[]): number { if (vals == null) return 0; let sum: number = 0; for (let f of vals) sum += f; return sum; }
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 calcSum AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left vals AST#identifier#Right AST#:#Left : AST#:#Ri...
public static calcSum(vals: number[]): number { if (vals == null) return 0; let sum: number = 0; for (let f of vals) sum += f; return sum; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
30c17e59fbfc34e0534b72bdcf2be445d6ae72d2
gitee
HarmonyOS_Samples/BestPracticeSnippets
AppDataSecurity/entry/src/main/ets/pages/Index.ets
arkts
getEl2Path
[Start get_el2_path]
getEl2Path(): void { let context = this.getUIContext().getHostContext() as common.UIAbilityContext; context.area = contextConstant.AreaMode.EL2; let filePath = context.filesDir + '/health_data.txt'; this.message = filePath; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getEl2Path 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#L...
getEl2Path(): void { let context = this.getUIContext().getHostContext() as common.UIAbilityContext; context.area = contextConstant.AreaMode.EL2; let filePath = context.filesDir + '/health_data.txt'; this.message = filePath; }
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
66cb973ecd4c9254452cb1cfbd44ce954bebc3ca
gitcode
751496032/ZRouter
RouterApi/src/main/ets/api/Router.ets
arkts
popNavWithResult
@deprecated @see {ZRouter.getInstance().popNavWithResult} @param name @param result @param animated
public static popNavWithResult<T>(name: string, result: T, animated: boolean = true) { ZRouter.getRouterMgr().popNavWithResult<T>(name, result, animated) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#ERROR#Right AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#binary_expression#Left AST#identifier#Left popNavWithResult AST#identifier#Right AST#<#Left < AS...
public static popNavWithResult<T>(name: string, result: T, animated: boolean = true) { ZRouter.getRouterMgr().popNavWithResult<T>(name, result, animated) }
https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/api/Router.ets#L468-L470
3b7b2081448628e0dccd84b1a0f02396928fdbad
github
AetheriumSimulator/qemu-hmos
entry/src/main/ets/utils/BreakpointSystem.ets
arkts
getCurrentBreakpointInfo
获取当前显示器信息并计算断点
static async getCurrentBreakpointInfo(): Promise<BreakpointInfo> { try { const displayInfo = display.getDefaultDisplaySync() // px 转 vp: vp = px / density const density = displayInfo.densityPixels || 1 const widthVp = displayInfo.width / density const heightVp = displayInfo.height / ...
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 getCurrentBreakpointInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#R...
static async getCurrentBreakpointInfo(): Promise<BreakpointInfo> { try { const displayInfo = display.getDefaultDisplaySync() // px 转 vp: vp = px / density const density = displayInfo.densityPixels || 1 const widthVp = displayInfo.width / density const heightVp = displayInfo.height / ...
https://github.com/AetheriumSimulator/qemu-hmos
81775081e910a3accb267145a9fe35abab9ab998
github
HarmonyOS_Samples/arkts-clock
entry/src/main/ets/utils/DrawClock.ets
arkts
drawTime
Draw the time text below the dial
drawTime(context: CanvasRenderingContext2D, radius: number, time: string) { context.save(); context.beginPath(); context.font = '90px'; context.textAlign = "center"; context.textBaseline = "middle"; context.fillStyle = '#000'; context.fillText(time, 0, radius + 80); context.restore(); ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left drawTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left CanvasRenderingContext2D AST#...
drawTime(context: CanvasRenderingContext2D, radius: number, time: string) { context.save(); context.beginPath(); context.font = '90px'; context.textAlign = "center"; context.textBaseline = "middle"; context.fillStyle = '#000'; context.fillText(time, 0, radius + 80); context.restore(); ...
https://gitcode.com/HarmonyOS_Samples/arkts-clock
55e5fb656e2e0a2075834c6c5d407c95d38c677e
gitcode
openharmony/codelabs
Card/StepsCardJS/entry/src/main/ets/pages/MainPage.ets
arkts
requestNotification
Request notification bar permissions.
requestNotification() { Notification.requestEnableNotification().then(() => { Logger.info(CommonConstants.MAIN_PAGE_TAG, 'requestEnableNotification success'); }).catch((err: Error) => { Logger.error(CommonConstants.MAIN_PAGE_TAG, 'requestEnableNotification failed : ' + JSON.stringify(err)); })...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left requestNotification 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_bloc...
requestNotification() { Notification.requestEnableNotification().then(() => { Logger.info(CommonConstants.MAIN_PAGE_TAG, 'requestEnableNotification success'); }).catch((err: Error) => { Logger.error(CommonConstants.MAIN_PAGE_TAG, 'requestEnableNotification failed : ' + JSON.stringify(err)); })...
https://gitee.com/openharmony/codelabs.git
02e4adb33e2e8138c8d03f09d3dd31df0626a6dd
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Scraper/ScraperManager.ets
arkts
getDetail
==================== 详情获取方法 ==================== 获取条目详情 @param source 刮削源 @param externalId 外部ID
public async getDetail(source: ScraperSource, externalId: string): Promise<ScraperDetailResult> { logger.info(TAG, `获取详情: source=${source}, id=${externalId}`); switch (source) { case ScraperSource.BANGUMI: return this.bangumiScraper.getDetail(externalId); case ScraperSource.ANILIST: ...
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 getDetail AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left source AST#identifier#Right AST#:#Left : AST#:...
public async getDetail(source: ScraperSource, externalId: string): Promise<ScraperDetailResult> { logger.info(TAG, `获取详情: source=${source}, id=${externalId}`); switch (source) { case ScraperSource.BANGUMI: return this.bangumiScraper.getDetail(externalId); case ScraperSource.ANILIST: ...
https://github.com/DaLongZhuaZi/manxia
c59e04c59f756b998b3c62ea7c94198b0cb9c1d9
github
2763981847/Clock-Alarm
entry/src/main/ets/pages/DetailPage.ets
arkts
pageTransition
定义页面进入和退出的过渡效果
pageTransition() { // 页面进入效果 PageTransitionEnter({ type: RouteType.None, duration: CommonConstants.ANIMATION_SHORT_DURATION }) .slide(SlideEffect.Bottom); // 页面退出效果 PageTransitionExit({ type: RouteType.None, duration: CommonConstants.ANIMATION_SHORT_DURATION }) .slide(SlideEffect.Bottom); ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left pageTransition 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...
pageTransition() { // 页面进入效果 PageTransitionEnter({ type: RouteType.None, duration: CommonConstants.ANIMATION_SHORT_DURATION }) .slide(SlideEffect.Bottom); // 页面退出效果 PageTransitionExit({ type: RouteType.None, duration: CommonConstants.ANIMATION_SHORT_DURATION }) .slide(SlideEffect.Bottom); ...
https://github.com/2763981847/Clock-Alarm
7aa458117a5119dd1c25d6eb9cde2cd537d353c5
github
HarmonyOS_Samples/BestPracticeSnippets
SegmentedPhotograph/entry/src/main/ets/mode/CameraService.ets
arkts
releaseCamera
[End take_picture] Release the session and related parameters
async releaseCamera(): Promise<void> { Logger.info(TAG, 'releaseCamera is called'); try { await this.previewOutput?.release(); } catch (error) { let err = error as BusinessError; Logger.error(TAG, `previewOutput release fail: error: ${JSON.stringify(err)}`); } finally { this.pr...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left releaseCamera 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 A...
async releaseCamera(): Promise<void> { Logger.info(TAG, 'releaseCamera is called'); try { await this.previewOutput?.release(); } catch (error) { let err = error as BusinessError; Logger.error(TAG, `previewOutput release fail: error: ${JSON.stringify(err)}`); } finally { this.pr...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
b406d008a9265d42f090b9e504dfc8450c251305
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/usbdriver/AbstractController.ets
arkts
getProductId
获取产品 ID
getProductId(): number { return this.productId; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getProductId 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...
getProductId(): number { return this.productId; }
https://github.com/AlkaidLab/moonlight-harmony
ffc9d013338c7d8581263f7ee48ae9518350e479
github
dingzhilin1990/zhilinclaw
src/plugins/PluginManager.ets
arkts
isEnabled
检查插件是否已启用 @param name 插件名称
public isEnabled(name: string): boolean { const wrapper = this.plugins.get(name); return wrapper?.enabled ?? false; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string...
public isEnabled(name: string): boolean { const wrapper = this.plugins.get(name); return wrapper?.enabled ?? false; }
https://github.com/dingzhilin1990/zhilinclaw
2071f1a53ef6642f8255319bff6f8a393236c7f5
github
offlinecat-dev/OCNetORM
src/main/ets/query/RelationLoader.ets
arkts
loadOneToOneTargetSide
加载 ONE_TO_ONE 关联数据(外键在目标实体侧) 根据目标实体的外键值查询源实体 @param entities 主实体数据数组 @param relation 关联关系元数据 @returns 带有关联数据的实体数组
private async loadOneToOneTargetSide( entities: Array<EntityData>, relation: RelationMetadata, options: RelationQueryOptions | null = null ): Promise<Array<EntityData>> { return await this.oneToOneSupport.loadOneToOneTargetSide(entities, relation, options) }
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 loadOneToOneTargetSide AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left entities AS...
private async loadOneToOneTargetSide( entities: Array<EntityData>, relation: RelationMetadata, options: RelationQueryOptions | null = null ): Promise<Array<EntityData>> { return await this.oneToOneSupport.loadOneToOneTargetSide(entities, relation, options) }
https://github.com/offlinecat-dev/OCNetORM
044e5d9e405a6b09129964296bf8d3fc1cc1dd3a
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Console.ets
arkts
assert
Conditionally prints an error message if the assertion condition is false @param {...Any[]} vals - Values to be logged if condition is false. Condition is the first value in vals (if exist) @returns {void} @public
public assert(...vals: Any[]): void { if (vals.length == 0) { return } let shouldAssert = vals[0] instanceof boolean && vals[0] == true if (!shouldAssert) { if (vals.length == 1) { vals[0] = "Assertion failed" ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left assert AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#ERROR#Left AST#identifier#Left vals AST#identifier#Right AST#:#Left : AS...
public assert(...vals: Any[]): void { if (vals.length == 0) { return } let shouldAssert = vals[0] instanceof boolean && vals[0] == true if (!shouldAssert) { if (vals.length == 1) { vals[0] = "Assertion failed" ...
https://gitcode.com/iop123123/arkts-static-skills
cc86e32044389a5324ead8e8c3761b3074b386ef
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/TouchInputHandler.ets
arkts
cancelActiveInput
取消当前触摸/鼠标手势。 用于本地系统手势(如三指唤出 IME)接管输入前,防止远端保留 已按下的触摸点、鼠标左键/右键或触控板拖拽状态。
cancelActiveInput(): void { this.trackpad.dispose(); this.resetMouseState(true); this.touchStates.clear(); this.lastForce.clear(); this.lastSize.clear(); this.nativeInput.sendTouchEvent( TOUCH_EVENT_CANCEL_ALL, 0, 0, 0, 0, 0, 0, 0 ); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left cancelActiveInput 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_...
cancelActiveInput(): void { this.trackpad.dispose(); this.resetMouseState(true); this.touchStates.clear(); this.lastForce.clear(); this.lastSize.clear(); this.nativeInput.sendTouchEvent( TOUCH_EVENT_CANCEL_ALL, 0, 0, 0, 0, 0, 0, 0 ); }
https://github.com/AlkaidLab/moonlight-harmony
4008872b9fce806b9f0cd0849cf1e2fc6e57d3aa
github
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnBadgeViewModel.ets
arkts
decrementValue
减少徽标数值
decrementValue(): void { if (this.badgeValue > 0) { this.badgeValue = this.badgeValue - 1; } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left decrementValue 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...
decrementValue(): void { if (this.badgeValue > 0) { this.badgeValue = this.badgeValue - 1; } }
https://github.com/codelably/tuniao-ui
ff879d102a5f50eb7538b43f17135672afd5005c
github
Joker-x-dev/CoolMallArkTS
core/data/src/main/ets/repository/CartRepository.ets
arkts
removeSpecFromCart
从购物车删除商品规格 @param {number} goodsId 商品ID @param {number} specId 规格ID @returns {Promise<void>} Promise<void>
removeSpecFromCart(goodsId: number, specId: number): Promise<void> { return this.dataSource.removeSpecFromCart(goodsId, specId); }
AST#program#Left AST#expression_statement#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left removeSpecFromCart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left goodsId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left numbe...
removeSpecFromCart(goodsId: number, specId: number): Promise<void> { return this.dataSource.removeSpecFromCart(goodsId, specId); }
https://github.com/Joker-x-dev/CoolMallArkTS
46b4c59ea2a4c6f4387fde9f1b45202c242ea4c2
github
wuba/omni-ui
omni_component/src/main/ets/components/guide/model/ObservedMaskVisibleState.ets
arkts
isShowGuideMask
获取引导页蒙版显示状态 @returns 蒙版是否正在显示
isShowGuideMask() { return this.globalShowGuideMask; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left isShowGuideMask 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...
isShowGuideMask() { return this.globalShowGuideMask; }
https://github.com/wuba/omni-ui
b5f4d6cbc90adb3d6c730e0edd105b9aa4a58161
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelSettingsManager.ets
arkts
updateDictRules
更新字典规则列表
async updateDictRules(rules: DictRule[]): Promise<void> { this.dictRules = rules.slice(); await this.settingsManager.setJSON(NOVEL_SETTING_KEYS.DICT_RULES, this.dictRules); logger.info(TAG, `字典规则已更新,共 ${rules.length} 条`); }
AST#program#Left AST#expression_statement#Left AST#assignment_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left updateDictRules AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#L...
async updateDictRules(rules: DictRule[]): Promise<void> { this.dictRules = rules.slice(); await this.settingsManager.setJSON(NOVEL_SETTING_KEYS.DICT_RULES, this.dictRules); logger.info(TAG, `字典规则已更新,共 ${rules.length} 条`); }
https://github.com/DaLongZhuaZi/manxia
3b3d0fd2c311834e73898fcdb5b5c475a290a6c2
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/Char.ets
arkts
charsToCodePoint
charsToCodePoint(char, char) combines to chars to code point @returns codepoint decoded from UTF-16.
public static charsToCodePoint(highValue: char, lowValue: char): UTF_16_CodePoint { return ((highValue - Char.HIGH_SURROGATE_MIN) * 0x400) + (lowValue - Char.LOW_SURROGATE_MIN) + 0x10000; }
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 charsToCodePoint AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left highValue AST#identifier#Right AST#ERROR#Left AST#:#L...
public static charsToCodePoint(highValue: char, lowValue: char): UTF_16_CodePoint { return ((highValue - Char.HIGH_SURROGATE_MIN) * 0x400) + (lowValue - Char.LOW_SURROGATE_MIN) + 0x10000; }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
f7526e765fdd448691a73b8f4c11ec0277723852
gitee
Cool_foolisher1/ArkTSRepository
ArkTSDemo/products/entry/src/main/ets/MyDemoOld/pages/heima/security/common/AVPlayerManager.ets
arkts
playByRawSrc
根据资源播放
static async playByRawSrc(fdSrcPath: string, loop?: boolean) { const context = new UIContext().getHostContext() as Context // 初始化播放器 const player = await AVPlayerManager.init() // 循环播放 AVPlayerManager.loop = Boolean(loop) // 是否为正在播放的资源 if (AVPlayerManager.fdSrcPath === fdSrcPath) { a...
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 playByRawSrc AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left fdSrcPath AST#identifier#Right AST#ERROR#Left AST#:#Left :...
static async playByRawSrc(fdSrcPath: string, loop?: boolean) { const context = new UIContext().getHostContext() as Context // 初始化播放器 const player = await AVPlayerManager.init() // 循环播放 AVPlayerManager.loop = Boolean(loop) // 是否为正在播放的资源 if (AVPlayerManager.fdSrcPath === fdSrcPath) { a...
https://gitcode.com/Cool_foolisher1/ArkTSRepository
17782e9cb2dadde05d011f868e5c7322debc486f
gitcode
Cool_foolisher1/ArkTSRepository
RandomNumberSimulator/entry/src/main/ets/common/utils/PreferenceUtils.ets
arkts
put
设置数据 @param context 应用上下文 @param name 首选项文件名 @param key 键 @param value 数据
public static async put(context: Context = new UIContext().getHostContext() as Context, name: string, key: string, value: Object): Promise<void> { const preferences = PreferenceUtils.getPreferences(context, name) try { preferences.putSync(key, value) } catch (error) { } try { await...
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 put AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#id...
public static async put(context: Context = new UIContext().getHostContext() as Context, name: string, key: string, value: Object): Promise<void> { const preferences = PreferenceUtils.getPreferences(context, name) try { preferences.putSync(key, value) } catch (error) { } try { await...
https://gitcode.com/Cool_foolisher1/ArkTSRepository
ed05b3dcc5c0b272fa51d8e00fbfb90187826a49
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/pages/NovelSettingsPage.ets
arkts
showHistoryCountPicker
显示搜索历史条数选择器
showHistoryCountPicker(): void { this.getUIContext().getPromptAction().showActionMenu({ title: '选择最大搜索历史条数', buttons: [ { text: '10 条', color: $r('sys.color.ohos_id_color_text_primary') }, { text: '20 条', color: $r('sys.color.ohos_id_color_text_primary') }, { text: '50 条', colo...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left showHistoryCountPicker 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#state...
showHistoryCountPicker(): void { this.getUIContext().getPromptAction().showActionMenu({ title: '选择最大搜索历史条数', buttons: [ { text: '10 条', color: $r('sys.color.ohos_id_color_text_primary') }, { text: '20 条', color: $r('sys.color.ohos_id_color_text_primary') }, { text: '50 条', colo...
https://github.com/DaLongZhuaZi/manxia
4de599af8b9bedba500285cc0a0a16df36b40154
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Set.ets
arkts
constructor
Creates a new Set instance from an iterable object or FixedArray. @param { Iterable<K> | FixedArray<K> | null } [elements] - The iterable object, FixedArray, or null used for initialization. @syscap SystemCapability.Utils.Lang @FaAndStageModel
constructor(elements?: Iterable<K> | FixedArray<K> | null) { if (elements == null) { this.elements = new FinalMap<K, K>(); } else if (elements instanceof Iterable) { const it = (elements as Iterable<K>).$_iterator() const entriesIter = new MappingIterator<K, [K, K...
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 elements AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expressio...
constructor(elements?: Iterable<K> | FixedArray<K> | null) { if (elements == null) { this.elements = new FinalMap<K, K>(); } else if (elements instanceof Iterable) { const it = (elements as Iterable<K>).$_iterator() const entriesIter = new MappingIterator<K, [K, K...
https://gitcode.com/iop123123/arkts-static-skills
eeaefabc9663ffc4376237ace8f7b76cc93da344
gitcode
aimilin6688/KeePassHO
entry/src/main/ets/services/template/TemplateBuilder.ets
arkts
withCustomIcon
设置自定义图标UUID
withCustomIcon(iconUuid: string): TemplateBuilder { this.entry.customIcon = new KdbxUuid(iconUuid); return this; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left withCustomIcon AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left iconUuid AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST#...
withCustomIcon(iconUuid: string): TemplateBuilder { this.entry.customIcon = new KdbxUuid(iconUuid); return this; }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/template/TemplateBuilder.ets#L158-L161
bc17b5e36025beee33ab961f906573927393765b
github
Joker-x-dev/CoolMallArkTS
core/navigation/src/main/ets/feedback/FeedbackNavigator.ets
arkts
toSubmit
跳转到提交反馈 @returns {void} 无返回值
static toSubmit(): void { navigateTo(FeedbackRoutes.Submit); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left toSubmit 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_st...
static toSubmit(): void { navigateTo(FeedbackRoutes.Submit); }
https://github.com/Joker-x-dev/CoolMallArkTS
c7a97253f2e37acec323f429d33b1901b7e57851
github
ibestservices/ibest-ui
library/src/main/ets/components/carInput/index.ets
arkts
stopEdit
输入框结束编辑
stopEdit(){ this.textInputController.stopEditing() }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left stopEdit 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#expression_statement#Left AS...
stopEdit(){ this.textInputController.stopEditing() }
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/carInput/index.ets#L146-L148
b43ef0eedb9a21ea34dbe7579f82fa4b10af9e21
github
midori52000/ArkPilot
Agent/entry/src/main/ets/apim/ApiManagementService.ets
arkts
getPresets
========== 预设管理 ==========
getPresets(): ProviderPreset[] { return BUILTIN_PROVIDER_PRESETS; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getPresets 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 ProviderPreset AST#identifier#Right AST#[#Left [ AS...
getPresets(): ProviderPreset[] { return BUILTIN_PROVIDER_PRESETS; }
https://github.com/midori52000/ArkPilot
a55c6d09e3175310877873120542181a651b7c41
github
richshaw2015/nds
ohos/entry/src/main/ets/types/MelonDSNative.ets
arkts
getRewindWindow
============================================================================ 倒带接口 ============================================================================ 获取倒带窗口 对齐 Android MelonEmulator.getRewindWindow()
static getRewindWindow(): RewindWindowResult { return MelonDSNative.native.getRewindWindow(); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getRewindWindow 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 Rewind...
static getRewindWindow(): RewindWindowResult { return MelonDSNative.native.getRewindWindow(); }
https://github.com/richshaw2015/nds
c9fc66592fbc2fd61dabbb4f4d1e05dbdf7013d4
github
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnCheckboxViewModel.ets
arkts
setCheckboxValues2
设置复选框组2的选中值集合 @param values 新的选中值数组
setCheckboxValues2(values: Array<string | number>): void { this.checkboxValues2 = values; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setCheckboxValues2 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left values AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identifier#Left A...
setCheckboxValues2(values: Array<string | number>): void { this.checkboxValues2 = values; }
https://github.com/codelably/tuniao-ui
2769b6573f594058bd6990a79e4eb3354019e3a8
github
Dabing-0x19d/berverage_HarmonyOS6.0
entry/src/main/ets/model/yearlySpendingChart.ets
arkts
calculateData
计算消费数据
calculateData(): void { if (this.chartMode === 'weekly') { this.calculateWeeklyData() } else { this.calculateYearlyData() } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left calculateData 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_bloc...
calculateData(): void { if (this.chartMode === 'weekly') { this.calculateWeeklyData() } else { this.calculateYearlyData() } }
https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0
024b31672a6815ca16c6cb556a8b64f4424d8813
github
HarmonyCandies/image_cropper
image_cropper/src/main/ets/Utils.ets
arkts
degrees
/ Convert [radians] to degrees.
static degrees(radians: number): number { return radians * NumberUtils.radians2Degrees; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left degrees AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left radians AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right A...
static degrees(radians: number): number { return radians * NumberUtils.radians2Degrees; }
https://github.com/HarmonyCandies/image_cropper/blob/dd3664946b413166307b736a5763f998084364e1/image_cropper/src/main/ets/Utils.ets#L81-L83
c14a1e25194b33301ab0cc6adf5491dac228c464
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
forEach
Performs the specified action for each element in Float64Array @param { function } callbackfn - A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public forEach(callbackfn: (value: number, index: int, array: Float64Array) => void): void { for (let i = 0; i < this.lengthInt; ++i) { callbackfn((this.getUnsafe(i)).toDouble(), i, this) } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#ERROR#Right AST#expression_statement#Left AST#identifier#Left forEach AST#identifier#Right AST#ERROR#Left AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left callbackfn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Ri...
public forEach(callbackfn: (value: number, index: int, array: Float64Array) => void): void { for (let i = 0; i < this.lengthInt; ++i) { callbackfn((this.getUnsafe(i)).toDouble(), i, this) } }
https://gitcode.com/iop123123/arkts-static-skills
0abeb11b51baa8721569d433fbbb8566938a57b2
gitcode
LJ666-ui/harmony-health-care
entry/src/main/ets/ar/VoiceGuide.ets
arkts
generateAnnouncementText
生成播报文本 @param waypoint 途经点
private generateAnnouncementText(waypoint: Waypoint): string { // 使用途经点的instruction字段 // 如果有ttsText,使用ttsText(更精简) // 否则使用instruction const text = waypoint.instruction; // 简化播报文本 return this.simplifyText(text); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left generateAnnouncementText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left waypoint AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#...
private generateAnnouncementText(waypoint: Waypoint): string { // 使用途经点的instruction字段 // 如果有ttsText,使用ttsText(更精简) // 否则使用instruction const text = waypoint.instruction; // 简化播报文本 return this.simplifyText(text); }
https://github.com/LJ666-ui/harmony-health-care
9c63ad7f5e3be7fe7d21f5f26e14bfa7e234e3af
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/String.ets
arkts
contains
Checks if this String contains the specified string. The search starts from specified index (negative fromIndex is equivalent to fromIndex = 0, and fromIndex >= length implies no match). @param str string to search @param fromIndex index to start search from @throws NullPointerException if str param is null @returns tr...
public contains(str: String, fromIndex: number): boolean { return this.contains(str, fromIndex as int); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left contains AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left String A...
public contains(str: String, fromIndex: number): boolean { return this.contains(str, fromIndex as int); }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
e0181d2aa110e6599839ed7267dd4b8a7566043d
gitee
CsCesium/KantaiHomo
entry/src/main/ets/features/alerts/executor.ets
arkts
handleDevResult
装备开发结果 — 仅 Toast(工厂场景无需震动/系统通知)
async function handleDevResult(alert: DevResultAlert): Promise<void> { const config = getAlertBus().getConfig(); if (!config.enableToast || !config.enableDevResultToast) return; const body = `🔧 开发结果:${alert.itemNames.join('、')}`; console.info(`[AlertExecutor] dev result: ${body}`); await executeToast(body, ...
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left handleDevResult AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left alert AST#identifier#Right AST#ty...
async function handleDevResult(alert: DevResultAlert): Promise<void> { const config = getAlertBus().getConfig(); if (!config.enableToast || !config.enableDevResultToast) return; const body = `🔧 开发结果:${alert.itemNames.join('、')}`; console.info(`[AlertExecutor] dev result: ${body}`); await executeToast(body, ...
https://github.com/CsCesium/KantaiHomo
a70f5c492319a3b04bf96f27f4c2c8a7d1fb24f8
github
aimilin6688/KeePassHO
entry/src/main/ets/services/SupportService.ets
arkts
getShowSupportDialog
获取支持弹框
private static getShowSupportDialog(): promptAction.ShowDialogOptions { return { title: $r('app.string.support_dialog_title'), message: $r('app.string.support_dialog_message'), buttons: [ { text: $r('app.string.cancel_button_text'), color: $r('app.color.text_secon...
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 getShowSupportDialog AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#R...
private static getShowSupportDialog(): promptAction.ShowDialogOptions { return { title: $r('app.string.support_dialog_title'), message: $r('app.string.support_dialog_message'), buttons: [ { text: $r('app.string.cancel_button_text'), color: $r('app.color.text_secon...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/SupportService.ets#L114-L130
0e28842a4232a22e65e9eeda39beb21c1cc6813a
github
LZZLHY/hlib
entry/src/main/ets/api/DomainManifest.ets
arkts
getActiveDomains
─── 关键 API ──────────────────────────────────────── 当前生效的域名列表 = 内置 DOMAINS + 远程拉到的,按内置在前的顺序合并去重。 同步调用,UI / SpeedTestVM / DomainSelectorDialog 直接消费。
static getActiveDomains(): string[] { const merged: string[] = []; const seen: Set<string> = new Set<string>(); for (let i = 0; i < DOMAINS.length; i++) { const d: string = DOMAINS[i]; if (!seen.has(d)) { seen.add(d); merged.push(d); } } if (DomainManifest.enabled...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getActiveDomains 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 strin...
static getActiveDomains(): string[] { const merged: string[] = []; const seen: Set<string> = new Set<string>(); for (let i = 0; i < DOMAINS.length; i++) { const d: string = DOMAINS[i]; if (!seen.has(d)) { seen.add(d); merged.push(d); } } if (DomainManifest.enabled...
https://github.com/LZZLHY/hlib
42538b9768dd73f0f479c97b84cce1bf75e214e7
github
751496032/ZRouter
RouterApi/src/main/ets/api/Router.ets
arkts
popToName
@deprecated @see {ZRouter.getInstance().popToName} @param name @param animated
public static popToName(name: string, animated: boolean = true) { ZRouter.getRouterMgr().popToName(name, animated) }
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 popToName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#...
public static popToName(name: string, animated: boolean = true) { ZRouter.getRouterMgr().popToName(name, animated) }
https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/api/Router.ets#L438-L440
76d2649fc74a92fa14c81e5b1226044097292378
github
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/BinaryEncodingVisitor.ets
arkts
visitUint64
访问 uint64 字段 Wire type: 0 (varint)
visitUint64(value: bigint, fieldNumber: number): void { this.writer.tag(fieldNumber, 0).int64(value) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitUint64 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 bigint AST#identifier#Right AST#,#Left , AS...
visitUint64(value: bigint, fieldNumber: number): void { this.writer.tag(fieldNumber, 0).int64(value) }
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
4928e7790207af1478fce798becc4722b65646a6
gitcode
qiuhaotc/Sunshine_HarmonyOS
entry/src/main/ets/calculator/UnitSunshineCalculator.ets
arkts
createFullSunshineData
创建无遮挡的单元数据
createFullSunshineData( buildingId: number, floor: number, unitIndex: number ): UnitSunshineData { const unitData = new UnitSunshineData(); unitData.buildingId = buildingId; unitData.floor = floor; unitData.unitIndex = unitIndex; // 无遮挡不需要精确位置 unitData.x = 0; unitData.y ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left createFullSunshineData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left buildingId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#L...
createFullSunshineData( buildingId: number, floor: number, unitIndex: number ): UnitSunshineData { const unitData = new UnitSunshineData(); unitData.buildingId = buildingId; unitData.floor = floor; unitData.unitIndex = unitIndex; // 无遮挡不需要精确位置 unitData.x = 0; unitData.y ...
https://github.com/qiuhaotc/Sunshine_HarmonyOS
97120e305b2d202e8d21ec6930bc78d838de516e
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelSourceManager.ets
arkts
getExploreKinds
获取书源的发现分类
getExploreKinds(sourceId: string): LegadoExploreKind[] { const executor = this.getExecutor(sourceId); if (!executor) { return []; } return executor.getExploreKinds(); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getExploreKinds AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right A...
getExploreKinds(sourceId: string): LegadoExploreKind[] { const executor = this.getExecutor(sourceId); if (!executor) { return []; } return executor.getExploreKinds(); }
https://github.com/DaLongZhuaZi/manxia
b7ad4cb19bdad87c84a6ab1d5952dcf93c6e2684
github
Amaz1ny/HarmonyDO-public
entry/src/main/ets/services/network/ApiClient.ets
arkts
getSiteInfo
获取站点信息(含分类)
async getSiteInfo(): Promise<SiteResponse> { if (this.siteInfoCache !== null) { return this.siteInfoCache; } if (this.siteInfoInFlight !== null) { return await this.siteInfoInFlight; } this.siteInfoInFlight = this.fetchSiteInfo(); try { const resp: SiteResponse = await this....
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getSiteInfo AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST...
async getSiteInfo(): Promise<SiteResponse> { if (this.siteInfoCache !== null) { return this.siteInfoCache; } if (this.siteInfoInFlight !== null) { return await this.siteInfoInFlight; } this.siteInfoInFlight = this.fetchSiteInfo(); try { const resp: SiteResponse = await this....
https://github.com/Amaz1ny/HarmonyDO-public
18b7d7f11edd62dfb907ddaaaeca7fc8dbbb9e07
github
arkui-x/samples
CodeLab/Cases/feature/calendarswitch/src/main/ets/customcalendar/utils/StyleUtils.ets
arkts
getBackgroundColor
获取日期背景色(仅用于月视图和周视图) @param day 日期信息 @param currentSelectDay 当前选择的日期 @param CalendarStyle 自定义日历样式 @returns 返回颜色
static getBackgroundColor(day: Day, currentSelectDay: DayInfo, CalendarStyle: CalendarStyle): Color | number | string | Resource { const IS_SELECT_DAY: boolean = currentSelectDay.year === day.dayInfo.year && currentSelectDay.month === day.dayInfo.month && currentSelectDay.date === day.dayInfo.da...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getBackgroundColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left day AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
static getBackgroundColor(day: Day, currentSelectDay: DayInfo, CalendarStyle: CalendarStyle): Color | number | string | Resource { const IS_SELECT_DAY: boolean = currentSelectDay.year === day.dayInfo.year && currentSelectDay.month === day.dayInfo.month && currentSelectDay.date === day.dayInfo.da...
https://gitcode.com/arkui-x/samples
97a50b2ee3adfda3f36c0ee90717ee5e80d50f62
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Double.ets
arkts
compare
compare(double, double) checks if two doubles are differs no more than by Double.DELTA @param { double } lhs left-hand side double for comparison @param { double } rhs right-hand side double for comparison @returns { boolean } true if lhs and rhs are equal with respect to Double.DELTA @static @syscap SystemCapability.U...
public static compare(lhs: double, rhs: double): boolean { return (abs(lhs - rhs) <= Double.DELTA) }
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 compare AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left lhs AST#identifier#Right AST#:#Left : AST#:#Rig...
public static compare(lhs: double, rhs: double): boolean { return (abs(lhs - rhs) <= Double.DELTA) }
https://gitcode.com/iop123123/arkts-static-skills
da45256097a3b1391a9712030d91559d6f621bef
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
toLocaleString
Converts Uint8ClampedArray to a string with respect to locale @param locales @param options @returns string representation
public toLocaleString(locales: Object, options: Object): string { throw new Error("Uint8ClampedArray.toLocaleString: not implemented") }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toLocaleString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left locales AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Object AST#ide...
public toLocaleString(locales: Object, options: Object): string { throw new Error("Uint8ClampedArray.toLocaleString: not implemented") }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
9f7ebf342b7b0781c69f704c6da75591d71ed591
gitee
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test7_original_index.ets
arkts
testTypeAssertion
--- Type assertion (as) ---
function testTypeAssertion(val: Object): string { let str: string = val as string; return str.toUpperCase(); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testTypeAssertion AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left val AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:...
function testTypeAssertion(val: Object): string { let str: string = val as string; return str.toUpperCase(); }
https://github.com/miaochiahao/ark-ghidra
5debe273fd0e7f5a99bd16310b018459510ac97b
github
qiuhaotc/HarmonyOSPlayground
entry/src/main/ets/database/BillDatabase.ets
arkts
queryBillsByDateRange
按日期范围查询账单
async queryBillsByDateRange(startDate: string, endDate: string): Promise<BillModel[]> { if (!this.rdbStore) { throw new Error('数据库未初始化'); } const predicates = new relationalStore.RdbPredicates(this.TABLE_NAME); predicates.between('date', startDate, endDate); pred...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left queryBillsByDateRange AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left startDate AST#identifie...
async queryBillsByDateRange(startDate: string, endDate: string): Promise<BillModel[]> { if (!this.rdbStore) { throw new Error('数据库未初始化'); } const predicates = new relationalStore.RdbPredicates(this.TABLE_NAME); predicates.between('date', startDate, endDate); pred...
https://github.com/qiuhaotc/HarmonyOSPlayground
e4342faeca51cd4c2129e4e95abc2bd10fe7a57e
github
killetom/ktretrofit
ktretrofit/src/main/ets/retrofit/util/MetadataUtil.ets
arkts
getPartParameters
Get part parameters metadata
static getPartParameters(target: Object, propertyKey?: string | symbol): Record<number, string> | null { return this.getMetadata('retrofit:partParams', target, propertyKey) || null; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getPartParameters AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left target AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
static getPartParameters(target: Object, propertyKey?: string | symbol): Record<number, string> | null { return this.getMetadata('retrofit:partParams', target, propertyKey) || null; }
https://github.com/killetom/ktretrofit
1faf4077e00819064658ef500f75a729b970a9cd
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/CoverCacheManager.ets
arkts
ensureSourcePkg
确保图源的 pkg 已缓存
private async ensureSourcePkg(sourceId: number): Promise<string | null> { // 已缓存则直接返回 if (this.sourcePkgCache.has(sourceId)) { return this.sourcePkgCache.get(sourceId) || null; } try { // 从数据库查询图源信息 const sql = 'SELECT pkg FROM comic_source WHERE id = ?'; const records = a...
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 ensureSourcePkg AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#L...
private async ensureSourcePkg(sourceId: number): Promise<string | null> { // 已缓存则直接返回 if (this.sourcePkgCache.has(sourceId)) { return this.sourcePkgCache.get(sourceId) || null; } try { // 从数据库查询图源信息 const sql = 'SELECT pkg FROM comic_source WHERE id = ?'; const records = a...
https://github.com/DaLongZhuaZi/manxia
64113dbd55985e62dce67b5b971b85ffb6d98cfb
github
openharmony-sig/applications_calculator
common/src/main/ets/util/CommonUtil.ets
arkts
checkIfDeviceIsPhone
Check whether the current device is a mobile phone. @return {boolean} Whether the current device is a mobile phone.
static checkIfDeviceIsPhone(): boolean { return deviceInfo.deviceType === DEVICE_TYPE_PHONE; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left checkIfDeviceIsPhone 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 bool...
static checkIfDeviceIsPhone(): boolean { return deviceInfo.deviceType === DEVICE_TYPE_PHONE; }
https://gitee.com/openharmony-sig/applications_calculator.git
def16e6d865246b0b675e493ad7b192ebc67072f
gitee
admundhou/mshijie
product/default/src/main/ets/controller/VideoController.ets
arkts
initTitleThis
Transfer this on the playTitle page. @param progressThis PlayTitle this object.
initTitleThis(titleThis) { this.titleThis = titleThis; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left initTitleThis AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left titleThis AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#...
initTitleThis(titleThis) { this.titleThis = titleThis; }
https://github.com/admundhou/mshijie
aca656346bf3c44d5311fa32503fa1550fd05fa7
github
LJ666-ui/harmony-health-care
entry/src/main/ets/utils/DeviceTypeUtil.ets
arkts
initDeviceType
初始化设备类型
private initDeviceType(): void { try { const displayInfo = display.getDefaultDisplaySync(); this.screenWidth = displayInfo.width; this.screenHeight = displayInfo.height; // 根据屏幕宽度和高度判断设备类型 // 手环/手表: 宽度和高度都较小(通常 < 500vp),且接近正方形或圆形 // 手机: 300-600vp // 平板竖屏: 600-840vp ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left initDeviceType 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#v...
private initDeviceType(): void { try { const displayInfo = display.getDefaultDisplaySync(); this.screenWidth = displayInfo.width; this.screenHeight = displayInfo.height; // 根据屏幕宽度和高度判断设备类型 // 手环/手表: 宽度和高度都较小(通常 < 500vp),且接近正方形或圆形 // 手机: 300-600vp // 平板竖屏: 600-840vp ...
https://github.com/LJ666-ui/harmony-health-care
3321bda391c32736ccefc3c0b40e94f77ad1e37b
github
LongLiveY96/chatcube
entry/src/main/ets/services/AttachmentStorageService.ets
arkts
saveAttachment
保存附件到文件系统
async saveAttachment(attachment: MessageAttachment): Promise<string> { if (!this.isInitialized || this.baseDir === '') { console.error('AttachmentStorageService', 'Service not initialized, baseDir is empty') return '' } try { const filePath = this.buildAttachmentFilePath(attachment) ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left saveAttachment AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left attachment AST#identifier#Righ...
async saveAttachment(attachment: MessageAttachment): Promise<string> { if (!this.isInitialized || this.baseDir === '') { console.error('AttachmentStorageService', 'Service not initialized, baseDir is empty') return '' } try { const filePath = this.buildAttachmentFilePath(attachment) ...
https://github.com/LongLiveY96/chatcube
f94eb693c52ad4ff87c971e24a70decc7da7f8a8
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/Array.ets
arkts
lastIndexOf
lastIndexOf(arr: short[], key: short, fromIndex: int) tries to find entry of key into arr which is not greater than fromIndex @param arr array to find a key @param key a value to find @param fromIndex an index of arr to begin search with (including, search is performed backwards) @returns last index of key if found in ...
function lastIndexOf(arr: short[], key: short, fromIndex: int): int throws { return lastIndexOf(arr, key, -1, fromIndex) }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left lastIndexOf AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left arr AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right...
function lastIndexOf(arr: short[], key: short, fromIndex: int): int throws { return lastIndexOf(arr, key, -1, fromIndex) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
2fb97dd4135339402d9e674b3fe9bdc5a098ae4e
gitee
openharmony/vendor_unionman
unionpi_tiger/sample_hzu/led_APP/entry/src/main/ets/view/person/TextPro.ets
arkts
build
输入框内默认文字
build() { Row() { Image(this.inputImage !== undefined ? this.inputImage : '') .width(Constant.INPUT_IMAGE_SIZE) .height(Constant.INPUT_IMAGE_SIZE) .margin({ left: 12 }) TextInput({ placeholder: this.hintText }) .fontSize(16) .padding({ left: 16 }) .place...
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() { Image(this.inputImage !== undefined ? this.inputImage : '') .width(Constant.INPUT_IMAGE_SIZE) .height(Constant.INPUT_IMAGE_SIZE) .margin({ left: 12 }) TextInput({ placeholder: this.hintText }) .fontSize(16) .padding({ left: 16 }) .place...
https://gitee.com/openharmony/vendor_unionman.git
c19de4d8d72d3e41e38e39ea2549c77293780355
gitee
the-wwyang/kids-learning-app
src/main/ets/services/ParentalControlService.ets
arkts
getDaysAgoString
获取N天前的日期字符串
private getDaysAgoString(days: number): string { const date = new Date(); date.setDate(date.getDate() - days); const year = date.getFullYear(); const month = (date.getMonth() + 1).toString().padStart(2, '0'); const day = date.getDate().toString().padStart(2, '0'); return `${year}-${month}-${da...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getDaysAgoString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left days AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
private getDaysAgoString(days: number): string { const date = new Date(); date.setDate(date.getDate() - days); const year = date.getFullYear(); const month = (date.getMonth() + 1).toString().padStart(2, '0'); const day = date.getDate().toString().padStart(2, '0'); return `${year}-${month}-${da...
https://github.com/the-wwyang/kids-learning-app
9e1f476a7869e394df6534e805c09a1ebda4f318
github
DaLongZhuaZi/manxia
entry/src/main/ets/pages/MainMenuPage.ets
arkts
isDynamicFilterItemSelected
检查动态筛选项是否被选中(直接访问 @State 变量,确保UI响应)
private isDynamicFilterItemSelected(item: string, type: string): boolean { switch (type) { case 'author': return this.dynamicFilterSelectedAuthors.has(item); case 'tag': return this.dynamicFilterSelectedTags.has(item); case 'keyword': return this.dynamicFilterSelectedKeywords.has(item); ca...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left isDynamicFilterItemSelected 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#i...
private isDynamicFilterItemSelected(item: string, type: string): boolean { switch (type) { case 'author': return this.dynamicFilterSelectedAuthors.has(item); case 'tag': return this.dynamicFilterSelectedTags.has(item); case 'keyword': return this.dynamicFilterSelectedKeywords.has(item); ca...
https://github.com/DaLongZhuaZi/manxia
0b6ffbcc04e19e39140d38aca3b6d1faa42b2243
github
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/services/LibFreeRDP.ets
arkts
sendSynchronizeEvent
Send a synchronize event (used for heartbeat)
static sendSynchronizeEvent(inst: number, flags: number): boolean { if (!LibFreeRDP.ensureNativeReady()) { return false; } return freerdpNative!.freerdpSendSynchronizeEvent(inst, flags); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left sendSynchronizeEvent 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#...
static sendSynchronizeEvent(inst: number, flags: number): boolean { if (!LibFreeRDP.ensureNativeReady()) { return false; } return freerdpNative!.freerdpSendSynchronizeEvent(inst, flags); }
https://github.com/tangwengang-del/freerdp-harmonyos
40e6352b8d069fa1b99603ad65111c88fcd3cd2e
github
tdcare/tdwebrtc
src/main/ets/WebRTCManager.ets
arkts
receiveMediaFrames
接收完整媒体帧(Rust 层 RTP 解包 + 帧重组,消除 JSON/base64 开销) @returns 完整媒体帧列表
public receiveMediaFrames(): NapiMediaFrame[] { if (!this.client) return []; return this.client.pollMediaFrames(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left receiveMediaFrames 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 Nap...
public receiveMediaFrames(): NapiMediaFrame[] { if (!this.client) return []; return this.client.pollMediaFrames(); }
https://github.com/tdcare/tdwebrtc
c05147fe4b9641cb43a30d50422b5c016cbd532b
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/database/QueryHelper.ets
arkts
toError
统一错误转换 @param message 错误消息 @param err 错误对象 @returns Error 对象
private static toError(message: string, err: Error | string | Record<string, Object>): Error { let details = ''; try { details = typeof err === 'string' ? err : JSON.stringify(err); } catch (_) { details = ''; } return new Error(`${message}${details ? ' -> ' + details : ''}`); }
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 toError AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left message AST#identifier#Right AST#ERROR#Left AST#:#Left : AS...
private static toError(message: string, err: Error | string | Record<string, Object>): Error { let details = ''; try { details = typeof err === 'string' ? err : JSON.stringify(err); } catch (_) { details = ''; } return new Error(`${message}${details ? ' -> ' + details : ''}`); }
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
cca428b77e49d330e1d46dff626f0faf5ce4f0cf
github
asasugar/HarmoneyNote
entry/src/main/ets/viewmodel/BusinessViewModel.ets
arkts
getDetailPageListItems
Get detail page list items. @return {Array<ListItemData>} detailListItems.
getDetailPageListItems(): Array<ListItemData> { let detailListItems: Array<ListItemData> = []; for (let i = 0; i < CommonConstants.DETAIL_LIST_SIZE; i++) { let listItem = new ListItemData(); listItem.title = $r('app.string.list_item_title'); listItem.subTitle = $r('app.string.list_item_sub_t...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getDetailPageListItems AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left ...
getDetailPageListItems(): Array<ListItemData> { let detailListItems: Array<ListItemData> = []; for (let i = 0; i < CommonConstants.DETAIL_LIST_SIZE; i++) { let listItem = new ListItemData(); listItem.title = $r('app.string.list_item_title'); listItem.subTitle = $r('app.string.list_item_sub_t...
https://github.com/asasugar/HarmoneyNote
7b662988a0b7fb45861458cb13806d415f4118a1
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.HashMap.ets
arkts
$_iterator
Returns an iterator for the HashMap @returns An iterator for the HashMap
$_iterator(): IterableIterator<[K, V]> { return this.entries(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left $_iterator 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#call_expression#Left ...
$_iterator(): IterableIterator<[K, V]> { return this.entries(); }
https://gitcode.com/iop123123/arkts-static-skills
36165bc52d737b5841ff19f2de2db7b848c413e0
gitcode
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/buffer/AbstractBuffer.ets
arkts
reset
Resets the buffer index to 0 and makes the buffer reusable.
public reset(): void { this.index = 0; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left reset AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Rig...
public reset(): void { this.index = 0; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
34ed09358af83b12d8ba41e3ebf819f4d7f17a3b
gitee
openharmony/applications_app_samples
code/BasicFeature/ApplicationModels/DynamicRouter/RouterModule/src/main/ets/utils/RouterModule.ets
arkts
pop
通过获取页面栈并pop
public static pop(routerName: string): void { // 查找到对应的路由栈进行pop RouterModule.getRouter(routerName).pop(); }
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#identifier#Left pop AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left routerName AST#identifier#R...
public static pop(routerName: string): void { // 查找到对应的路由栈进行pop RouterModule.getRouter(routerName).pop(); }
https://github.com/openharmony/applications_app_samples
72e11199a42b04c7761fd000cde7fe2cd324b7e3
github
openharmony-tpc/VCard
library/src/main/ets/components/VCardBuilder.ets
arkts
appendPhoneticNameFields
Emits SOUND;IRMC, SORT-STRING, and de-fact values for phonetic names like X-PHONETIC-FAMILY.
private appendPhoneticNameFields(nameContact: contact.Name): void { let phoneticFamilyName: string | null; let phoneticMiddleName: string | null; let phoneticGivenName: string | null; { let familyName = nameContact.familyName let middleName = nameContact.midd...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left appendPhoneticNameFields AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left nameContact AST#identifier#Right AST#ERROR#Left AST#:#Left : AS...
private appendPhoneticNameFields(nameContact: contact.Name): void { let phoneticFamilyName: string | null; let phoneticMiddleName: string | null; let phoneticGivenName: string | null; { let familyName = nameContact.familyName let middleName = nameContact.midd...
https://gitee.com/openharmony-tpc/VCard.git
89ac718aea29f1b4022287ea4bc47c5a4fcfff1d
gitee
erosTeam/NextE
shared/src/main/ets/model/CustomProfile.ets
arkts
fCats
EH f_cats = sum of EXCLUDED categories; 0 when nothing or everything is selected.
fCats(): number { if (this.selectedCats === 0 || this.selectedCats === ALL_CATS) { return 0 } return ALL_CATS - this.selectedCats }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left fCats 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_block#...
fCats(): number { if (this.selectedCats === 0 || this.selectedCats === ALL_CATS) { return 0 } return ALL_CATS - this.selectedCats }
https://github.com/erosTeam/NextE
5f866c1675a688e1126801b665a9dead83a66de2
github
openharmony/applications_app_samples
code/BasicFeature/Media/Image/photomodify/src/main/ets/components/feature/ComputeFeature.ets
arkts
onDragMaterial
素材的拖拽
onDragMaterial(dx: number, dy: number): void { this.x = this.x + dx; this.y = this.y + dy; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onDragMaterial AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dx AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left , AS...
onDragMaterial(dx: number, dy: number): void { this.x = this.x + dx; this.y = this.y + dy; }
https://github.com/openharmony/applications_app_samples
9bebe5980ea35174f63bbff063dd90bc313ca772
github
Nekofox-POT/LinMusic
entry/src/main/ets/package/audio_player/by_ffmpeg_player.ets
arkts
get_eq_mode
获取当前 EQ 模式 返回 0/1/2
get_eq_mode(): number { return nativeModule.get_eq_mode() }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left get_eq_mode 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_...
get_eq_mode(): number { return nativeModule.get_eq_mode() }
https://github.com/Nekofox-POT/LinMusic
cfe719d3d486fe6d834ba88b1ef37c00f6072772
github
openharmony/codelabs
CommonEventAndNotification/AlarmClock/entry/src/main/ets/viewmodel/MainViewModel.ets
arkts
fillZero
Padding zeros for insufficient digits @param val number @return content string
public fillZero(val: number): string{ return (val > MainConstant.DEFAULT_SINGLE_DIGIT_MAX ? val.toString() : (MainConstant.DEFAULT_ZEROING + val)); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left fillZero AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left val AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number A...
public fillZero(val: number): string{ return (val > MainConstant.DEFAULT_SINGLE_DIGIT_MAX ? val.toString() : (MainConstant.DEFAULT_ZEROING + val)); }
https://gitee.com/openharmony/codelabs.git
c59493b7d7037b7d756f378522a3b2e2cffd2f29
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
from
Creates an array from an array of the same type. @param { Float64Array } arr - An array to convert to a new array. @returns { Float64Array } - A new Float64Array @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static from(arr: Float64Array): Float64Array { let result = new Float64Array(arr.length) result.set(arr) return result }
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#from#Left from AST#from#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#identifier#Righ...
public static from(arr: Float64Array): Float64Array { let result = new Float64Array(arr.length) result.set(arr) return result }
https://gitcode.com/iop123123/arkts-static-skills
fccd9ee4b605261be378523c1db98099e1310d66
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Source/SourceManager.ets
arkts
getPopular
==================== 执行功能 ==================== 获取热门漫画
async getPopular(sourceId: number, page: number = 1, limit: number = 20): Promise<ComicInfo[]> { return await this.executor.getPopular(sourceId, page, limit); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getPopular 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#:#Left : ...
async getPopular(sourceId: number, page: number = 1, limit: number = 20): Promise<ComicInfo[]> { return await this.executor.getPopular(sourceId, page, limit); }
https://github.com/DaLongZhuaZi/manxia
a16519789ce09f47eb0e24632fcbeec37b4dc57c
github
openharmony-tpc/openharmony_tpc_samples
dialogs/library/src/main/ets/components/progress/base/LVBase.ets
arkts
setAnimRepeatMode
设置动画执行模式 为true时动画值会一次由start变为end,一次由end变为start 为end时动画值每次都是由start变为end
setAnimRepeatMode(animRepeatMode:boolean) { this.animRepeatMode = animRepeatMode }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setAnimRepeatMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left animRepeatMode AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ER...
setAnimRepeatMode(animRepeatMode:boolean) { this.animRepeatMode = animRepeatMode }
https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git
8b063417545a270cefce44744f443509beaf82f1
gitee
honjow/Next2V
shared/src/main/ets/network/Socks5HttpClient.ets
arkts
parseUrl
─── URL / request building ──────────────────────────────────────────────
private static parseUrl(url: string): ParsedUrl { // scheme://host[:port]/path?query const schemeIdx = url.indexOf('://') if (schemeIdx < 0) { throw new Error(`Invalid URL: ${url}`) } const scheme = url.substring(0, schemeIdx).toLowerCase() if (scheme !== 'http' && scheme !== 'https') { ...
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 parseUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:...
private static parseUrl(url: string): ParsedUrl { // scheme://host[:port]/path?query const schemeIdx = url.indexOf('://') if (schemeIdx < 0) { throw new Error(`Invalid URL: ${url}`) } const scheme = url.substring(0, schemeIdx).toLowerCase() if (scheme !== 'http' && scheme !== 'https') { ...
https://github.com/honjow/Next2V
e36583e3e7c8bd8155f35da654dbafd0bf59fddb
github
openharmony-sig/online_event
college_growth_program/homework/三期成长打卡作业/2022_0113/crusie/笔记和作业-0113-张煜华/code/ice1/entry/src/main/ets/CominLog/PlayerManager.ets
arkts
cancelProgressTimer
取消定时器
cancelProgressTimer() { if (typeof (this.progressIntervalID) != 'undefined') { clearInterval(this.progressIntervalID); this.progressIntervalID = undefined; } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left cancelProgressTimer 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_bloc...
cancelProgressTimer() { if (typeof (this.progressIntervalID) != 'undefined') { clearInterval(this.progressIntervalID); this.progressIntervalID = undefined; } }
https://gitee.com/openharmony-sig/online_event.git
b6b5a0d8a7aa07cab2bd5ff102119cf5e35199e7
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/RegExp.ets
arkts
compile
Recompiles a regular expression with new source and flags after the RegExp object has already been created @param pattern the text of the regular expression @param flags any combination of flag values
public compile(pattern : String, flags: String) { this.pattern = pattern; this.flags = flags; this.source = RegExp.escapePattern(pattern); this.initializeFlags(); this.compile(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left compile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left pattern AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left String AST#identifier...
public compile(pattern : String, flags: String) { this.pattern = pattern; this.flags = flags; this.source = RegExp.escapePattern(pattern); this.initializeFlags(); this.compile(); }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
4d4992769854279a4b184571425fc49b7984864b
gitee
qiuhaotc/HarmonyOSPlayground
entry/src/main/ets/database/BillDatabase.ets
arkts
queryBillsByYear
按年查询账单
async queryBillsByYear(year: string): Promise<BillModel[]> { if (!this.rdbStore) { throw new Error('数据库未初始化'); } const predicates = new relationalStore.RdbPredicates(this.TABLE_NAME); predicates.like('date', `${year}%`); predicates.orderByDesc('date').orderByDesc...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left queryBillsByYear AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left year AST#identifier#Right AS...
async queryBillsByYear(year: string): Promise<BillModel[]> { if (!this.rdbStore) { throw new Error('数据库未初始化'); } const predicates = new relationalStore.RdbPredicates(this.TABLE_NAME); predicates.like('date', `${year}%`); predicates.orderByDesc('date').orderByDesc...
https://github.com/qiuhaotc/HarmonyOSPlayground
c82692f7c2a34ba6e4f83e0935aff1a34f93f512
github
openharmony/codelabs
ETSUI/MemoTime/entry/src/main/ets/service/AudioService.ets
arkts
getCurrentPlayingId
获取当前正在播放的录音 ID
getCurrentPlayingId(): string { return this.currentPlayingId }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCurrentPlayingId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#st...
getCurrentPlayingId(): string { return this.currentPlayingId }
https://gitcode.com/openharmony/codelabs
8955100cce47b14519480722022cbc01a8833062
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/GamepadManager.ets
arkts
fallbackToLegacyInput
回退到传统输入方案 仅标记模式切换,不启动驱动服务(由 loadUsbDriverSetting 统一管理)
private fallbackToLegacyInput(): void { this.useGameControllerKit = false; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left fallbackToLegacyInput 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 A...
private fallbackToLegacyInput(): void { this.useGameControllerKit = false; }
https://github.com/AlkaidLab/moonlight-harmony
1c43b26017568b27d2a94ad61f4ec439227ee213
github
offlinecat-dev/OCNetORM
src/main/ets/mapping/ViewModelMapper.ets
arkts
toEntityData
将 ViewModel 转换为 EntityData(使用回调) 简化版本,直接使用回调函数进行映射 @param viewModel ViewModel 实例 @param entityName 实体名称 @param propertyNames 属性名列表 @param valueGetter 值获取回调 @returns EntityData 实例
static toEntityData<T>( viewModel: T, entityName: string, propertyNames: Array<string>, valueGetter: ReversePropertyMapper<T> ): EntityData { const entityData = new EntityData(entityName) for (let i = 0; i < propertyNames.length; i++) { const propertyName = propertyNames[i] cons...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#binary_expression#Left AST#identifier#Left toEntityData AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#formal_parameters#Left AST#(#Left ( AST#(#...
static toEntityData<T>( viewModel: T, entityName: string, propertyNames: Array<string>, valueGetter: ReversePropertyMapper<T> ): EntityData { const entityData = new EntityData(entityName) for (let i = 0; i < propertyNames.length; i++) { const propertyName = propertyNames[i] cons...
https://github.com/offlinecat-dev/OCNetORM
797384cb09058f3e2f46cb6ea5c239b0e6ac54e2
github
Harrisonls2004/WaterFlow
entry/src/main/ets/common/utils/FootprintManager.ets
arkts
addFootprint
Add or update a footprint
static async addFootprint(productId: string, productName: string, price: string, imageUrl: string, username: string): Promise<boolean> { try { console.log('FootprintManager: Adding footprint:', productId); if (!FootprintManager.preferencesInstance) { console.error('FootprintManager: Preferenc...
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 addFootprint AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left productId AST#identifier#Right AST#ERROR#Left AST#:#Left :...
static async addFootprint(productId: string, productName: string, price: string, imageUrl: string, username: string): Promise<boolean> { try { console.log('FootprintManager: Adding footprint:', productId); if (!FootprintManager.preferencesInstance) { console.error('FootprintManager: Preferenc...
https://github.com/Harrisonls2004/WaterFlow
acb799baaa4bb7e875f2cf8016d9ed4a8afd0a07
github
harmonyos/codelabs
HarmonyOS_NEXT/DistributedContacts/entry/src/main/ets/pages/ListPage.ets
arkts
showDialogInfo
In the dialog box that is displayed, select a device from the list and verify the device for the first time. After the verification is successful, start the remote device application for the second time.
showDialogInfo(): void { this.deviceList = []; // Register a listening callback. // A dialog box is displayed when a device is discovered or an authenticated device is found. this.remoteDeviceModel.registerDeviceListCallback(() => { this.deviceList = []; Logger.info(TAG, `registerDeviceLis...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left showDialogInfo 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...
showDialogInfo(): void { this.deviceList = []; // Register a listening callback. // A dialog box is displayed when a device is discovered or an authenticated device is found. this.remoteDeviceModel.registerDeviceListCallback(() => { this.deviceList = []; Logger.info(TAG, `registerDeviceLis...
https://gitee.com/harmonyos/codelabs.git
338776bc78ecaa154a21f8da45352218c5f733ac
gitee
offlinecat-dev/OCNetORM
src/main/ets/mapping/DataMapper.ets
arkts
isNewRecord
检查实体数据是否为新记录(主键为空或为 0) @param entityData 实体数据 @returns 是否为新记录
isNewRecord(entityData: EntityData): boolean { const pkValue = this.getPrimaryKeyValue(entityData) if (pkValue === null) { return true } if (typeof pkValue === 'number' && pkValue === 0) { return true } return false }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isNewRecord AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left entityData AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left EntityData AST#identifier#Right AST#)#...
isNewRecord(entityData: EntityData): boolean { const pkValue = this.getPrimaryKeyValue(entityData) if (pkValue === null) { return true } if (typeof pkValue === 'number' && pkValue === 0) { return true } return false }
https://github.com/offlinecat-dev/OCNetORM
04b7aa279f5fb313e5ad96af904ff223db0ea0d8
github
terryma2024/happyword
harmonyos/entry/src/main/ets/services/ImageCompressor.ets
arkts
toJpegFilename
Replace the original extension with `.jpg` (case-insensitive). Server-side validation only checks the multipart `Content-Type` header (which we set to `image/jpeg`), but a matching extension keeps audit logs / blob URLs readable.
private static toJpegFilename(name: string): string { if (name.length === 0) { return 'lesson.jpg'; } const dot: number = name.lastIndexOf('.'); if (dot <= 0) { return `${name}.jpg`; } return `${name.substring(0, dot)}.jpg`; }
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 toJpegFilename AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left ...
private static toJpegFilename(name: string): string { if (name.length === 0) { return 'lesson.jpg'; } const dot: number = name.lastIndexOf('.'); if (dot <= 0) { return `${name}.jpg`; } return `${name.substring(0, dot)}.jpg`; }
https://github.com/terryma2024/happyword
8bc37f15e5600cbb40e7fa3042b480d64269846c
github
aimilin6688/KeePassHO
entry/src/main/ets/storage/ftp/FTPHandler.ets
arkts
getFileInfo
获取文件信息
public async getFileInfo(path: string): Promise<FileItemInfo> { if (!this.client) { throw new Error('FTP client is not connected'); } // 特殊处理根路径 if (path === '/' || path === '') { return { name: '/', size: 0, isDirectory: true, modifiedTime: 0 }; ...
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 getFileInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:...
public async getFileInfo(path: string): Promise<FileItemInfo> { if (!this.client) { throw new Error('FTP client is not connected'); } // 特殊处理根路径 if (path === '/' || path === '') { return { name: '/', size: 0, isDirectory: true, modifiedTime: 0 }; ...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/ftp/FTPHandler.ets#L120-L160
34915f00072e77948eebde7a7a1b3fc404cd150d
github
the-wwyang/kids-learning-app
src/main/ets/services/ParentalControlService.ets
arkts
checkTimeLimit
检查是否超过时间限制
public async checkTimeLimit(): Promise<{ exceeded: boolean, type: string, remaining: number }> { const config = await this.getTimeLimitConfig(); if (!config.enabled) { return { exceeded: false, type: 'none', remaining: 999 }; } // 检查每日限制 const todayUsage = await this.getToday...
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 checkTimeLimit AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:...
public async checkTimeLimit(): Promise<{ exceeded: boolean, type: string, remaining: number }> { const config = await this.getTimeLimitConfig(); if (!config.enabled) { return { exceeded: false, type: 'none', remaining: 999 }; } // 检查每日限制 const todayUsage = await this.getToday...
https://github.com/the-wwyang/kids-learning-app
aff8da138dfa4d764c9e5a5a456b0a79fc65400a
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/utils/ObjectPool.ets
arkts
recycleArray
Recycle a List of Poolables that this pool is capable of generating. The T instances passed must not already exist inside this or any other ObjectPool instance. @param objects A list of objects of type T to recycle public recycle( objects:Array<T>){
public recycleArray(objects: JArrayList<T>) { while (objects.size() + this.objectsPointer + 1 > this.desiredCapacity) { this.resizePool(); } let objectsListSize = objects.size(); // Not relying on recycle(T object) because this is more performant. if (this.objects) { for (let i = 0; i...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left recycleArray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left objects AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_ex...
public recycleArray(objects: JArrayList<T>) { while (objects.size() + this.objectsPointer + 1 > this.desiredCapacity) { this.resizePool(); } let objectsListSize = objects.size(); // Not relying on recycle(T object) because this is more performant. if (this.objects) { for (let i = 0; i...
https://gitee.com/openharmony-tpc/ohos_mpchart.git
1b7aeec4dcd8d044b1147b38e5bd8dca1c427a64
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
internal
Creates a slice of current Uint8Array using range [begin, end) @param begin start index to be taken into slice @param end last index to be taken into slice @returns a new Uint8Array with elements of current Uint8Array[begin;end) where end index is excluded @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/R...
/* public */ internal slice(begin: int, end: int): Uint8Array { if (begin < -this.length) { begin = 0 } if (begin < 0) { begin = this.length + begin } if (begin >= this.length) { return new Uint8Array(new ArrayBuffer(0)) } ...
AST#program#Left AST#comment#Left /* public */ AST#comment#Right AST#ERROR#Left AST#call_expression#Left AST#identifier#Left internal AST#identifier#Right AST#ERROR#Left AST#identifier#Left slice AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left begin AST#identifier#Ri...
/* public */ internal slice(begin: int, end: int): Uint8Array { if (begin < -this.length) { begin = 0 } if (begin < 0) { begin = this.length + begin } if (begin >= this.length) { return new Uint8Array(new ArrayBuffer(0)) } ...
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
8f72551a9e0a67ea7daed285cc2d84b0bcf72890
gitee
LJ666-ui/harmony-health-care
entry/src/main/ets/data/hospitalData.ets
arkts
createFloorPlan
创建楼层平面图
function createFloorPlan(buildingId: string, floor: number): FloorPlan { const width = 800; // 像素 const height = 600; const scale = 10; // 10像素 = 1米 // 根据楼层生成不同的可行走区域和障碍物 let walkableAreas: Area[]; let obstacles: Obstacle[]; if (buildingId === 'OUTPATIENT') { if (floor === 1) { // 一楼大厅布局 ...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left createFloorPlan AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left buildingId AST#identifier#Right AST#type_annotation#Left AST#:#Left : ...
function createFloorPlan(buildingId: string, floor: number): FloorPlan { const width = 800; // 像素 const height = 600; const scale = 10; // 10像素 = 1米 // 根据楼层生成不同的可行走区域和障碍物 let walkableAreas: Area[]; let obstacles: Obstacle[]; if (buildingId === 'OUTPATIENT') { if (floor === 1) { // 一楼大厅布局 ...
https://github.com/LJ666-ui/harmony-health-care
0a03da219799bd655b2804bc43ad54d57de7de3a
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/NotificationDAO.ets
arkts
markAsRead
标记单条通知为已读
static async markAsRead(notificationId: number): Promise<void> { const store = DatabaseManager.getDatabase(); const sql = `UPDATE notifications SET is_read = 1 WHERE notification_id = ?`; await store.executeSql(sql, [notificationId]); }
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 markAsRead AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left notificationId AST#identifier#Right AST#ERROR#Left AST#:#Lef...
static async markAsRead(notificationId: number): Promise<void> { const store = DatabaseManager.getDatabase(); const sql = `UPDATE notifications SET is_read = 1 WHERE notification_id = ?`; await store.executeSql(sql, [notificationId]); }
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
e5266ce345a868bffde4d85eee662c70f5270e1e
github
fangmingtao/Ohs_ArkTs_Eyepetizer
entry/src/main/ets/common/PreferencesUtil.ets
arkts
getNumber
读取数字数据 @param context 应用上下文 @param key 键 @param defaultValue 默认值 @returns 数字值
static async getNumber(context: common.UIAbilityContext, key: string, defaultValue: number = 0): Promise<number> { try { const dataPreferences = await PreferencesUtil.getPreferences(context); return await dataPreferences.get(key, defaultValue) as number; } catch (error) { console.error('Pref...
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 getNumber AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#...
static async getNumber(context: common.UIAbilityContext, key: string, defaultValue: number = 0): Promise<number> { try { const dataPreferences = await PreferencesUtil.getPreferences(context); return await dataPreferences.get(key, defaultValue) as number; } catch (error) { console.error('Pref...
https://gitcode.com/fangmingtao/Ohs_ArkTs_Eyepetizer
45438b575237e90b9de43a30e177d46b524fa1eb
gitcode
751496032/ZRouter
RouterApi/src/main/ets/api/RouterMgr.ets
arkts
redirectForResult2
携带结果重定向到指定页面 redirectForResult2 - finishWithResult @see {finishWithResult} @param name @param param @param callback
public redirectForResult2<T>(name: string, param?: ObjectOrNull, callback?: OnPopResultCallback<T>, builder?: NavDestBuilder<T>) { const redirectType = builder?.options?.redirectType const state = this.getCurrentState() state.redirectInfo.name = state.stackTopInfo?.metadata?.name || '' state.redir...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#binary_expression#Left AST#identifier#Left redirectForResult2 AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#formal_parameters#Left AST#(#Left ( ...
public redirectForResult2<T>(name: string, param?: ObjectOrNull, callback?: OnPopResultCallback<T>, builder?: NavDestBuilder<T>) { const redirectType = builder?.options?.redirectType const state = this.getCurrentState() state.redirectInfo.name = state.stackTopInfo?.metadata?.name || '' state.redir...
https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/api/RouterMgr.ets#L265-L289
48432b0a4bba07568309bde3dac4c3f8a4f6aeea
github
Joker-x-dev/CoolMallArkTS
core/designsystem/src/main/ets/component/Row.ets
arkts
build
渲染布局 @returns {void} 无返回值 @example RowEndCenter() { Text("Hi"); }
build(): void { RowBase({ options: this.options, justifyContent: FlexAlign.End, alignItems: VerticalAlign.Center, widthValue: this.widthValue, heightValue: this.heightValue, sizeValue: this.sizeValue, paddingValue: this.paddingValue, marginValue: this.marginValue, ...
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 { RowBase({ options: this.options, justifyContent: FlexAlign.End, alignItems: VerticalAlign.Center, widthValue: this.widthValue, heightValue: this.heightValue, sizeValue: this.sizeValue, paddingValue: this.paddingValue, marginValue: this.marginValue, ...
https://github.com/Joker-x-dev/CoolMallArkTS
e725486bcce6621bdaca2870deddaa0aa1f0ba5d
github
terryma2024/happyword
harmonyos/entry/src/ohosTest/ets/test/BoundDeviceInfoFlow.ui.test.ets
arkts
bindViaShortCode
Drive the redeem path via the mock to leave the device bound.
async function bindViaShortCode(driver: Driver): Promise<void> { try { await openConfigPage(driver); await scrollConfigToParentAccountRow(driver); // Bind row should be present; if already bound (e.g. an earlier run // left the device in the bound state) skip the redeem step. const bound: Compone...
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left bindViaShortCode AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left driver AST#identifier#Right AST#...
async function bindViaShortCode(driver: Driver): Promise<void> { try { await openConfigPage(driver); await scrollConfigToParentAccountRow(driver); // Bind row should be present; if already bound (e.g. an earlier run // left the device in the bound state) skip the redeem step. const bound: Compone...
https://github.com/terryma2024/happyword
703532554a2fdbd49af7e0251cabc1098cbb2608
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
constructor
Creates an Int8Array with respect to data, byteOffset and length. @param { ArrayBuffer } buf - data initializer @param { int } byteOffset - byte offset from begin of the buf @param { int } length - size of elements of type byte in newly created Int8Array @throws { RangeError } - Input parameter error. @syscap SystemCap...
public constructor(buf: ArrayBuffer, byteOffset: int, length: int) { this(buf, new Number(byteOffset), new Number(length)) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left buf AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Array...
public constructor(buf: ArrayBuffer, byteOffset: int, length: int) { this(buf, new Number(byteOffset), new Number(length)) }
https://gitcode.com/iop123123/arkts-static-skills
4737bd8cc3073081a12e0a5d6906f91931e0ad69
gitcode
LambdaYH/ScrcpyForHarmonyOS
app/src/main/ets/pages/ControlPage.ets
arkts
calcVideoDisplaySize
计算视频显示尺寸 - 保持比例
calcVideoDisplaySize() { if (this.containerWidth === 0 || this.containerHeight === 0 || this.videoWidth === 0 || this.videoHeight === 0) { return; } const containerRatio = this.containerWidth / this.containerHeight; const videoRatio = this.videoWidth / this.videoHeight; if (containerRatio ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left calcVideoDisplaySize 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_blo...
calcVideoDisplaySize() { if (this.containerWidth === 0 || this.containerHeight === 0 || this.videoWidth === 0 || this.videoHeight === 0) { return; } const containerRatio = this.containerWidth / this.containerHeight; const videoRatio = this.videoWidth / this.videoHeight; if (containerRatio ...
https://github.com/LambdaYH/ScrcpyForHarmonyOS
14dfe442033ed5b47bdb9614f6105cd9e17025e3
github