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
Octo-o-o-o/harmonyos-ai-workspace
tools/hooks/test-fixtures/GoodPrefStore.ets
arkts
buildPayload
ARKTS-003 误报检查:Record<string, Object> 字面量索引赋值合法
buildPayload(): object { const partObj: Record<string, Object> = {}; partObj['type'] = 'image_url'; partObj['image_url'] = { url: 'https://example.com/x.jpg' }; return partObj; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left buildPayload 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#object#Left object AST#object#Right AST#ERROR#Right AST#statement...
buildPayload(): object { const partObj: Record<string, Object> = {}; partObj['type'] = 'image_url'; partObj['image_url'] = { url: 'https://example.com/x.jpg' }; return partObj; }
https://github.com/Octo-o-o-o/harmonyos-ai-workspace
afc1c2a8f20d67a4074b344786c23eabf4ba5021
github
CLMC2025/Vignette
entry/src/main/ets/sync/WebDavSyncManager.ets
arkts
uploadReviewEvents
Backward compatible alias for UI.
async uploadReviewEvents(): Promise<WebDavSyncResult> { return this.uploadLocalReviewEvents(); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left uploadReviewEvents AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#g...
async uploadReviewEvents(): Promise<WebDavSyncResult> { return this.uploadLocalReviewEvents(); }
https://github.com/CLMC2025/Vignette
fa9a5dab9de94d05194119181988bb65d0a42e4d
github
qiuhaotc/HarmonyOSPlayground
entry/src/main/ets/utils/DateUtil.ets
arkts
formatDate
格式化日期对象为字符串 格式: YYYY-MM-DD
static formatDate(date: Date): string { const year = date.getFullYear(); const month = String(date.getMonth() + 1).padStart(2, '0'); const day = String(date.getDate()).padStart(2, '0'); return `${year}-${month}-${day}`; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left formatDate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left date AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Date ...
static formatDate(date: Date): string { const year = date.getFullYear(); const month = String(date.getMonth() + 1).padStart(2, '0'); const day = String(date.getDate()).padStart(2, '0'); return `${year}-${month}-${day}`; }
https://github.com/qiuhaotc/HarmonyOSPlayground
4c2ef314f7a6550a97c13c79590d4bc76cbeaa2e
github
AGenUI/AGenUI
platforms/harmony/agenui/src/main/ets/agenui/logger/AGenUILogger.ets
arkts
getInstance
Returns the AGenUILogger singleton instance
public static getInstance(): AGenUILogger { if (!AGenUILogger.instance) { AGenUILogger.instance = new AGenUILogger(); } return AGenUILogger.instance; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L...
public static getInstance(): AGenUILogger { if (!AGenUILogger.instance) { AGenUILogger.instance = new AGenUILogger(); } return AGenUILogger.instance; }
https://github.com/AGenUI/AGenUI
bdae29691a69bcf49fe826b7127e270764c7833b
github
codelably/HCompass
core/navigation/src/main/ets/NavigationService.ets
arkts
getStack
获取导航栈实例 @returns 导航栈
getStack(): NavPathStack { return this.stack; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getStack 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 NavPathStack AST#identifier#Right AST#ERROR#Right AST...
getStack(): NavPathStack { return this.stack; }
https://github.com/codelably/HCompass
fcb9de88ee3ac304c3a3e7f8ecf394741c94359b
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/ComputerManager.ets
arkts
getCachedServerInfo
获取最近 ${SERVER_INFO_CACHE_TTL_MS}ms 内缓存的 ServerInfo,过期/缺失返回 null。
getCachedServerInfo(uuid: string): ServerInfo | null { if (!uuid) return null; const entry = this.serverInfoCache.get(uuid); if (!entry) return null; if (Date.now() - entry.timestamp > SERVER_INFO_CACHE_TTL_MS) { this.serverInfoCache.delete(uuid); return null; } return entry.info; ...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getCachedServerInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uuid AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier...
getCachedServerInfo(uuid: string): ServerInfo | null { if (!uuid) return null; const entry = this.serverInfoCache.get(uuid); if (!entry) return null; if (Date.now() - entry.timestamp > SERVER_INFO_CACHE_TTL_MS) { this.serverInfoCache.delete(uuid); return null; } return entry.info; ...
https://github.com/AlkaidLab/moonlight-harmony
8570ce139a50a28222ca3f9bc87d3ec305501fff
github
zmuxuny/ai-guardian-star
entry/src/main/ets/database/DatabaseHelper.ets
arkts
setRetentionDays
设置保留天数并存入 AppStorage(调用方负责会员校验)
public setRetentionDays(days: number): void { AppStorage.setOrCreate<number>(STORAGE_KEY_RETENTION, days); hilog.info(DOMAIN, TAG, `保留天数已设为 ${days} 天`); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setRetentionDays 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#Left...
public setRetentionDays(days: number): void { AppStorage.setOrCreate<number>(STORAGE_KEY_RETENTION, days); hilog.info(DOMAIN, TAG, `保留天数已设为 ${days} 天`); }
https://github.com/zmuxuny/ai-guardian-star/blob/87ab023d8b9aab4303a9fc1e97508e1f8ee01e07/entry/src/main/ets/database/DatabaseHelper.ets#L162-L165
3272c6cb265b44975faadf2f465f3f3dc7489a10
github
offlinecat-dev/OCNetORM
src/main/ets/query/QueryBuilder.ets
arkts
clone
克隆查询构建器 用于执行器隔离内部可变状态,避免影响外部 builder 实例
clone(): QueryBuilder { const cloned = new QueryBuilder(this.entityName) cloned.conditions = this.getConditions() cloned.orderByColumns = this.getOrderByColumns() cloned.limitValue = this.limitValue cloned.offsetValue = this.offsetValue cloned.selectedColumns = this.selectedColumns.slice() ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clone 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 QueryBuilder AST#identifier#Right AST#ERROR#Right AST#st...
clone(): QueryBuilder { const cloned = new QueryBuilder(this.entityName) cloned.conditions = this.getConditions() cloned.orderByColumns = this.getOrderByColumns() cloned.limitValue = this.limitValue cloned.offsetValue = this.offsetValue cloned.selectedColumns = this.selectedColumns.slice() ...
https://github.com/offlinecat-dev/OCNetORM
9db6fe5b2994d0bdcacfe22cfd2ef93944102823
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/TouchInputHandler.ets
arkts
handlePenEvent
处理手写笔事件(仅 DIRECT 模式) 将手写笔触摸事件转化为 Moonlight 的 PenEvent
private handlePenEvent(event: TouchEvent): void { const touches = event.touches; const changedTouches = event.changedTouches; const areaWidth = event.target.area.width as number; const areaHeight = event.target.area.height as number; // 从 BaseEvent 获取笔的压感和倾斜信息 const eventPressure = event.pres...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handlePenEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le...
private handlePenEvent(event: TouchEvent): void { const touches = event.touches; const changedTouches = event.changedTouches; const areaWidth = event.target.area.width as number; const areaHeight = event.target.area.height as number; // 从 BaseEvent 获取笔的压感和倾斜信息 const eventPressure = event.pres...
https://github.com/AlkaidLab/moonlight-harmony
28dae9a58cc23da4cd2da616e3b02b909245b16c
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
set
Copies all elements of arr to the current Int32Array. @param arr array to copy data from
public set(arr: int[]): void { this.set(arr, 0) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#...
public set(arr: int[]): void { this.set(arr, 0) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
0be31b0a89d4fcede1d81d9c45e2ffac3dc248ff
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/libs/htmlparser/Matcher.ets
arkts
parseSelector
解析 CSS 选择器字符串
static parseSelector(selector: string): SelectorNode[][] { const trimmed = selector.trim(); if (!trimmed) return []; const groups = Matcher.splitByComma(trimmed); const result: SelectorNode[][] = []; for (const group of groups) { const chain = Matcher.parseSelectorChain(group.trim()); ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left parseSelector AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left selector AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#...
static parseSelector(selector: string): SelectorNode[][] { const trimmed = selector.trim(); if (!trimmed) return []; const groups = Matcher.splitByComma(trimmed); const result: SelectorNode[][] = []; for (const group of groups) { const chain = Matcher.parseSelectorChain(group.trim()); ...
https://github.com/DaLongZhuaZi/manxia
7f45fb31a589f4f0183ce068882b22e4c676fc6c
github
Cool_foolisher1/ArkTSRepository
GuardianAssistant/entry/src/main/ets/manager/AudioCapturerManager.ets
arkts
stopRecorder
结束录音采集
async stopRecorder(): Promise<AudioInfo> { // 获取音频采集器 const audioCapturer = await this.getAudioCapturer() // 1. 停止录音 await audioCapturer.stop() // 2. 释放资源和硬件占用 audioCapturer.release() // 3. 释放变量,对象重新赋值为 null,可以被 垃圾回收机制 自动清理 this.audioCapturer = null // 停止录音采集时,返回录音文件关键信息 return...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left stopRecorder AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic...
async stopRecorder(): Promise<AudioInfo> { // 获取音频采集器 const audioCapturer = await this.getAudioCapturer() // 1. 停止录音 await audioCapturer.stop() // 2. 释放资源和硬件占用 audioCapturer.release() // 3. 释放变量,对象重新赋值为 null,可以被 垃圾回收机制 自动清理 this.audioCapturer = null // 停止录音采集时,返回录音文件关键信息 return...
https://gitcode.com/Cool_foolisher1/ArkTSRepository
c7a00c4dabaeabab2466de565b7225113303eee7
gitcode
tdcare/tdwebrtc
src/main/ets/utils/NetworkUtil.ets
arkts
hasNetWiFi
判断当前网络是否是Wi-Fi网络。
static hasNetWiFi(): boolean { return NetworkUtil.hasNetBearType(connection.NetBearType.BEARER_WIFI); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left hasNetWiFi AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#bo...
static hasNetWiFi(): boolean { return NetworkUtil.hasNetBearType(connection.NetBearType.BEARER_WIFI); }
https://github.com/tdcare/tdwebrtc
da228d6a7d83d191b4895a70d7bde9c76a61291e
github
Mydstiny/RemoteDeskHarmonyOS
entry/src/main/ets/services/CloudStore.ets
arkts
loadAllHostsRaw
==================== Raw CRUD (不解密, 供迁移使用) ====================
loadAllHostsRaw(): RemoteHost[] { return this.loadAllHostsInternal(false); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left loadAllHostsRaw AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Lef...
loadAllHostsRaw(): RemoteHost[] { return this.loadAllHostsInternal(false); }
https://github.com/Mydstiny/RemoteDeskHarmonyOS
d4a88cbd7bed731d30fa3dcc4991f41377e52e1c
github
HarmonyOS_Samples/scankit-samplecode-clientdemo-arkts
common/sample_common/src/main/ets/model/CommonEventManager.ets
arkts
createCB
Callback for subscriber creation.
private createCB(error: BusinessError, commonEventSubscriber: commonEventManager.CommonEventSubscriber): void { if (error) { Logger.error(TAG, `Failed to createCB. Code: ${error.code}`); } else { Logger.info(TAG, `Start to createCB.`); this.subscriber = commonEventSubscriber; // Subscr...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left createCB AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left error AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Bus...
private createCB(error: BusinessError, commonEventSubscriber: commonEventManager.CommonEventSubscriber): void { if (error) { Logger.error(TAG, `Failed to createCB. Code: ${error.code}`); } else { Logger.info(TAG, `Start to createCB.`); this.subscriber = commonEventSubscriber; // Subscr...
https://gitcode.com/HarmonyOS_Samples/scankit-samplecode-clientdemo-arkts
295c8ac49ae4afb1b1429165f64aab977d4155c4
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/components/PreloadManager.ets
arkts
markNetworkLoad
标记网络加载
markNetworkLoad(pageIndex: number): void { // 【修复】从loading中移除,添加到completed this.loading.delete(pageIndex); this.completed.add(pageIndex); this.pageStatusMap.set(pageIndex, PreloadItemStatus.COMPLETED); this.stats.networkLoads++; this.updateDebugInfo(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left markNetworkLoad AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left pageIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) AS...
markNetworkLoad(pageIndex: number): void { // 【修复】从loading中移除,添加到completed this.loading.delete(pageIndex); this.completed.add(pageIndex); this.pageStatusMap.set(pageIndex, PreloadItemStatus.COMPLETED); this.stats.networkLoads++; this.updateDebugInfo(); }
https://github.com/DaLongZhuaZi/manxia
455ee9addb6ebdd1da5640a0e938ce1e30099133
github
HarmonyOS_Samples/MultiPictureBeautification
multipicturecommon/src/main/ets/utils/WindowUtil.ets
arkts
addWindowAvoidMonitor
Register avoid area change listener (for keyboard, system bar changes)
addWindowAvoidMonitor(addFunction: (avoidOptions: window.AvoidAreaOptions) => void): void { if (!this.mainWindow) { return; } try { this.mainWindow.on('avoidAreaChange', addFunction); } catch (err) { Logger.error(LogConstants.LOG_TAG_WINDOW_UTIL, 'Failed to monitor window avo...
AST#program#Left AST#ERROR#Left AST#identifier#Left addWindowAvoidMonitor AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left...
addWindowAvoidMonitor(addFunction: (avoidOptions: window.AvoidAreaOptions) => void): void { if (!this.mainWindow) { return; } try { this.mainWindow.on('avoidAreaChange', addFunction); } catch (err) { Logger.error(LogConstants.LOG_TAG_WINDOW_UTIL, 'Failed to monitor window avo...
https://gitcode.com/HarmonyOS_Samples/MultiPictureBeautification
ce01b491813f88513820638332c0dfa13ae44b2c
gitcode
openharmony/applications_call
entry/src/main/ets/ServiceAbility/TelephonyApi.ets
arkts
unRegisterCallStateCallback
onRegister call state callback
public unRegisterCallStateCallback() { try { call.off('callDetailsChange', (data) => { if (!data) { LogUtils.i(TAG, prefixLog + 'call.off unRegisterCallStateCallback') return; } LogUtils.i(TAG, prefixLog + 'call.off unRegisterCallStateCallback') }); } ca...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left unRegisterCallStateCallback 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#Lef...
public unRegisterCallStateCallback() { try { call.off('callDetailsChange', (data) => { if (!data) { LogUtils.i(TAG, prefixLog + 'call.off unRegisterCallStateCallback') return; } LogUtils.i(TAG, prefixLog + 'call.off unRegisterCallStateCallback') }); } ca...
https://gitee.com/openharmony/applications_call.git
8edc3d84fe50ea4fcd3bd7c07b5080d200a1e476
gitee
aimilin6688/KeePassHO
entry/src/main/ets/common/utils/WebDavClient.ets
arkts
getBase64Auth
认证头字符串 @returns
private getBase64Auth(): string { return CommonUtils.base64Encode(`${this.config?.username}:${this.config?.password}`) }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getBase64Auth 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 AS...
private getBase64Auth(): string { return CommonUtils.base64Encode(`${this.config?.username}:${this.config?.password}`) }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/WebDavClient.ets#L358-L360
d86651797bfaaffd090044ec678063f93b97c8c0
github
openharmony/applications_permission_manager
permissionmanager/src/main/ets/common/base/BasePermissionStrategy.ets
arkts
denyHandle
禁止操作 @param permission 权限 @param callerAppInfo 调用方信息 @param locationFlag 位置权限组flag @param buttonStatus return
public denyHandle( permission: Permission, callerAppInfo: CallerAppInfo, locationFlag: number, buttonStatus: ButtonStatus ): PermissionOption { return PermissionOption.REVOKE; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left denyHandle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left permission AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left...
public denyHandle( permission: Permission, callerAppInfo: CallerAppInfo, locationFlag: number, buttonStatus: ButtonStatus ): PermissionOption { return PermissionOption.REVOKE; }
https://gitee.com/openharmony/applications_permission_manager.git
3f1d7fe21899fee672d2f3807d7f1ffd906b5b4c
gitee
ChangJing01/HarmonyOS-FinalProject
entry/src/main/ets/pages/ShoppingCartPage.ets
arkts
toggleItemSelect
单选逻辑:使用 Checkbox 传递的最新 value
toggleItemSelect(index: number, checked: boolean) { // 先更新当前项状态 this.cartItems[index].selected = checked; // 计算最新的全选状态 const newAllSelected = this.cartItems.every(item => item.selected); // 更新全选状态(这可能会触发 BottomBar 中 Checkbox 的 onChange) this.isAllSelected = newAllSelected; // 强制刷新数组并计算价...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left toggleItemSelect AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#R...
toggleItemSelect(index: number, checked: boolean) { // 先更新当前项状态 this.cartItems[index].selected = checked; // 计算最新的全选状态 const newAllSelected = this.cartItems.every(item => item.selected); // 更新全选状态(这可能会触发 BottomBar 中 Checkbox 的 onChange) this.isAllSelected = newAllSelected; // 强制刷新数组并计算价...
https://github.com/ChangJing01/HarmonyOS-FinalProject
090a313d2d9d7e1c3b4e7dee6e033fbd0e4e6d6a
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Loading/LoadingStateManager.ets
arkts
getNextPhase
获取下一个阶段
private getNextPhase(currentPhase: LoadingPhase): LoadingPhase | null { const phases = Object.values(LoadingPhase); const currentIndex = phases.indexOf(currentPhase); return currentIndex < phases.length - 1 ? phases[currentIndex + 1] : null; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getNextPhase AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left currentPhase AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi...
private getNextPhase(currentPhase: LoadingPhase): LoadingPhase | null { const phases = Object.values(LoadingPhase); const currentIndex = phases.indexOf(currentPhase); return currentIndex < phases.length - 1 ? phases[currentIndex + 1] : null; }
https://github.com/DaLongZhuaZi/manxia
c8a132ae8d6c4a47ae10dc9ae73eff065c90f256
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
constructor
Creates a copy of Int16Array. @param { Int16Array } other - data initializer @syscap SystemCapability.Utils.Lang @FaAndStageModel
public constructor(other: Int16Array) { this.buffer = other.buffer.slice(other.byteOffset, other.byteOffset + other.byteLength) as ArrayBuffer this.byteLength = other.byteLength this.lengthInt = other.length this.byteOffset = 0 }
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 other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Int...
public constructor(other: Int16Array) { this.buffer = other.buffer.slice(other.byteOffset, other.byteOffset + other.byteLength) as ArrayBuffer this.byteLength = other.byteLength this.lengthInt = other.length this.byteOffset = 0 }
https://gitcode.com/iop123123/arkts-static-skills
be3070db38cb4c9ca2934f8f0f84eadd3765cfe2
gitcode
YDYm233/EasyRandom_HarmonyNextApp
product/wearable/src/main/ets/utils/WearScreenUtil.ets
arkts
resultFontSize
结果字号 (fp)
static get resultFontSize(): number { const screenSize = WearScreenUtil.screenSize; if (screenSize === 'small') return 40; if (screenSize === 'large') return 56; // 暂无此设备,预留 return 48; // standard }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left get AST#identifier#Right AST#call_expression#Left AST#identifier#Left resultFontSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L...
static get resultFontSize(): number { const screenSize = WearScreenUtil.screenSize; if (screenSize === 'small') return 40; if (screenSize === 'large') return 56; // 暂无此设备,预留 return 48; // standard }
https://github.com/YDYm233/EasyRandom_HarmonyNextApp
3e4fa5829ce2263d5f089643fcac9ea837b58f6b
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/DynamicUrlResolver.ets
arkts
extractDomain
从URL中提取域名
extractDomain(url: string): string { try { const match = url.match(/^https?:\/\/([^\/]+)/); return match ? match[1] : ''; } catch (e) { logger.error(TAG, `提取域名失败: ${e}`); return ''; } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left extractDomain AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AS...
extractDomain(url: string): string { try { const match = url.match(/^https?:\/\/([^\/]+)/); return match ? match[1] : ''; } catch (e) { logger.error(TAG, `提取域名失败: ${e}`); return ''; } }
https://github.com/DaLongZhuaZi/manxia
2adfd86011a827d337a44d04bf19914d046328e2
github
popsiclelmlm/Hey
entry/src/main/ets/core/SingboxConfig.ets
arkts
asObject
---- JSON 读取辅助(沿用 XrayConfig.ets 的 ArkTS 惯用法)----
function asObject(value: JsonField): JsonObject | undefined { if (value === undefined || value === null) { return undefined; } if (typeof value !== 'object' || Array.isArray(value)) { return undefined; } return value as JsonObject; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left asObject AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left value AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right ...
function asObject(value: JsonField): JsonObject | undefined { if (value === undefined || value === null) { return undefined; } if (typeof value !== 'object' || Array.isArray(value)) { return undefined; } return value as JsonObject; }
https://github.com/popsiclelmlm/Hey
5369e99cf7e2f17c96703c716d9b0f5f3dee271c
github
dingzhilin1990/zhilinclaw
src/plugins/PluginManager.ets
arkts
getPluginStatus
获取插件状态
public getPluginStatus(name: string): Record<string, any> | null { const wrapper = this.plugins.get(name); if (!wrapper) return null; return { name: wrapper.plugin.metadata.name, version: wrapper.plugin.metadata.version, enabled: wrapper.enabled, loadTime: wrapper.loadTime, ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getPluginStatus 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 ...
public getPluginStatus(name: string): Record<string, any> | null { const wrapper = this.plugins.get(name); if (!wrapper) return null; return { name: wrapper.plugin.metadata.name, version: wrapper.plugin.metadata.version, enabled: wrapper.enabled, loadTime: wrapper.loadTime, ...
https://github.com/dingzhilin1990/zhilinclaw
a4ce7c851b347da09de1b0c7d96786ac59fdd6a2
github
azhu0001/localsend-harmony
common/src/main/ets/utils/Strings.ets
arkts
getSliceByBytes
将指定字符串按指定字符数分割 @param array 用于接收返回数据数组,传空数组 @param str 用于分割的数组 @param len 分割长度 @returns
static getSliceByBytes(array: string[], str: string, len: number): string[] { if (!str) { return [] } const size: number = buffer.byteLength(str, 'utf-8') if (size < len) { array.push(str) return array } let currentSize = 0; let lastCharLen = 0 let subEnd = 0 for ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getSliceByBytes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left array AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expre...
static getSliceByBytes(array: string[], str: string, len: number): string[] { if (!str) { return [] } const size: number = buffer.byteLength(str, 'utf-8') if (size < len) { array.push(str) return array } let currentSize = 0; let lastCharLen = 0 let subEnd = 0 for ...
https://gitcode.com/azhu0001/localsend-harmony
f30a6b3f64b043fe160d85e4e3b8c167d63de97e
gitcode
richshaw2015/nds
ohos/entry/src/main/ets/components/game/PauseMenu.ets
arkts
toImageUri
将文件绝对路径转换为 Image 组件可用的 file:// URI
function toImageUri(path: string): string { if (!path) return ''; try { if (path.startsWith('/storage/Users/')) { return 'file://docs' + path; } return fileUri.getUriFromPath(path); } catch (_e) { return path; } }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left toImageUri AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left path AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right...
function toImageUri(path: string): string { if (!path) return ''; try { if (path.startsWith('/storage/Users/')) { return 'file://docs' + path; } return fileUri.getUriFromPath(path); } catch (_e) { return path; } }
https://github.com/richshaw2015/nds
29662bf78c4c2dbdb5c8b7804a5860ecc8506c8d
github
AGenUI/AGenUI
playground/harmony/entry/src/main/ets/components/CustomChartComponent.ets
arkts
buildDonutChart
───────────────────────────────────────────── Donut chart ─────────────────────────────────────────────
private buildDonutChart(data: NewDonutData): void { const model: PieChartModel = new PieChartModel(); const description: Description = new Description(); description.setEnabled(false); model.setDescription(description); const legend: Legend | null = model.getLegend(); if (legend !== null) { ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildDonutChart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le...
private buildDonutChart(data: NewDonutData): void { const model: PieChartModel = new PieChartModel(); const description: Description = new Description(); description.setEnabled(false); model.setDescription(description); const legend: Legend | null = model.getLegend(); if (legend !== null) { ...
https://github.com/AGenUI/AGenUI
2c019134c5cc3226d4afe1d9be188a28ba10a6f5
github
CPF-ApplicationTPC/openharmony_tpc_samples
SwipeMenuListView/library/src/main/ets/components/SwipeMenuList.ets
arkts
setOpenCurve
设置菜单打开时的自定义动画曲线 @param curve 自定义曲线
setOpenCurve(curve: curves.ICurve): void { this.openAnimationConfig.setCustomCurve(curve); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setOpenCurve AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left curve AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Left curves AST#iden...
setOpenCurve(curve: curves.ICurve): void { this.openAnimationConfig.setCustomCurve(curve); }
https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples
447d30bdf662dda4f69d6b44c9cbefbdb8b86156
gitcode
Cool_foolisher1/ArkTSRepository
GraphicalCode/features/algorithm/src/main/ets/model/CardComponentDataModel.ets
arkts
preloadComponentData
加载组件数据 @returns Promise<void>
public preloadComponentData(): Promise<void> { this.service.getComponentDetailData().then((detailList: ComponentDetailModel[]) => { this.service.setDetailsToPreference(detailList) }) return this.service.getComponentData() .then((result: ResponseModel<ComponentModel>) => { this.service....
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left preloadComponentData 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#instantiation_exp...
public preloadComponentData(): Promise<void> { this.service.getComponentDetailData().then((detailList: ComponentDetailModel[]) => { this.service.setDetailsToPreference(detailList) }) return this.service.getComponentData() .then((result: ResponseModel<ComponentModel>) => { this.service....
https://gitcode.com/Cool_foolisher1/ArkTSRepository
804a175674ac58d968863ce6b97ee79749fec7ab
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/json.ets
arkts
stringifyWithGetters
Converts an object to a JavaScript Object Notation (JSON) string, invoking any instance methods annotated with @JSONStringifyGetter and including their return values in the output. Each annotated method's name is used as the JSON key, and its return value is used as the corresponding value. @param { Any } obj - An obje...
public static stringifyWithGetters( obj: Any, replacer: Array<double | string> | Array<string> | Array<double>, space?: int | string): string { if (obj === undefined) { return '' } const filter: FixedArray<string> = new FixedArray<s...
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 stringifyWithGetters AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#:#Lef...
public static stringifyWithGetters( obj: Any, replacer: Array<double | string> | Array<string> | Array<double>, space?: int | string): string { if (obj === undefined) { return '' } const filter: FixedArray<string> = new FixedArray<s...
https://gitcode.com/iop123123/arkts-static-skills
2609c9019342dda0679eeedcdbfc5936b0612211
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/AppInitializationManager.ets
arkts
completePhase
完成某个阶段
completePhase(phase: InitPhase): void { if (!this.state.completedPhases.includes(phase)) { this.state.completedPhases.push(phase); } const phaseInfo = PHASE_CONFIG[phase]; logger.info(TAG, `✅ 完成阶段: ${phaseInfo.displayName}`); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left completePhase AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left phase AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left InitPhase AST#identifier#Right AST#)#Left...
completePhase(phase: InitPhase): void { if (!this.state.completedPhases.includes(phase)) { this.state.completedPhases.push(phase); } const phaseInfo = PHASE_CONFIG[phase]; logger.info(TAG, `✅ 完成阶段: ${phaseInfo.displayName}`); }
https://github.com/DaLongZhuaZi/manxia
f0c8d44cfadeebae2979a3cb1b9ba0b325079c78
github
aimilin6688/KeePassHO
entry/src/main/ets/common/utils/WebDavClient.ets
arkts
get
获取文件内容 @param path 路径 @returns 结果
public async get(path: string): Promise<ResultInfo> { const req = new rcp.Request(path, "GET", { "Depth": "0" }); const rr = await this.request(req); if (!rr.success) { return Promise.reject(rr); } return rr; }
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 get AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right A...
public async get(path: string): Promise<ResultInfo> { const req = new rcp.Request(path, "GET", { "Depth": "0" }); const rr = await this.request(req); if (!rr.success) { return Promise.reject(rr); } return rr; }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/WebDavClient.ets#L345-L352
357de052290482c91e975476c2b218a019369c9d
github
dingzhilin1990/zhilinclaw
src/core/ZhiLinClawCore.ets
arkts
registerInternalHandlers
注册内部事件处理器
private registerInternalHandlers(): void { // 处理插件加载事件 this.eventBus.subscribe('plugin:loaded', (data: any) => { this.log(`插件已加载:${data.pluginName}`); }); // 处理技能注册事件 this.eventBus.subscribe('skill:registered', (data: any) => { this.log(`技能已注册:${data.skillName}`); }); // 处理内存...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left registerInternalHandlers AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Righ...
private registerInternalHandlers(): void { // 处理插件加载事件 this.eventBus.subscribe('plugin:loaded', (data: any) => { this.log(`插件已加载:${data.pluginName}`); }); // 处理技能注册事件 this.eventBus.subscribe('skill:registered', (data: any) => { this.log(`技能已注册:${data.skillName}`); }); // 处理内存...
https://github.com/dingzhilin1990/zhilinclaw
b38c4560de682d8939b63786f9c1f1eab1a85756
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/StringBuilder.ets
arkts
concatStrings
Concatenates two strings and return a result as a new string @param { String } lhs left string (prefix) @param { String } rhs right string (suffix) @returns { String } result of concatenation @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static concatStrings(lhs: String, rhs: String): String { return lhs.concat(rhs); }
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 concatStrings AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left lhs AST#identifier#Right AST#:#Left : AST...
public static concatStrings(lhs: String, rhs: String): String { return lhs.concat(rhs); }
https://gitcode.com/iop123123/arkts-static-skills
57207540b57f9570473d2893e2eb849a9ce61b18
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Download/UnifiedDownloadManager.ets
arkts
getActiveTaskCount
获取活跃的下载任务数量
public getActiveTaskCount(): number { return this.getIndexedTaskCount(this.taskIdsByStatus, UnifiedTaskStatus.DOWNLOADING) + this.getIndexedTaskCount(this.taskIdsByStatus, UnifiedTaskStatus.PENDING); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getActiveTaskCount 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 ...
public getActiveTaskCount(): number { return this.getIndexedTaskCount(this.taskIdsByStatus, UnifiedTaskStatus.DOWNLOADING) + this.getIndexedTaskCount(this.taskIdsByStatus, UnifiedTaskStatus.PENDING); }
https://github.com/DaLongZhuaZi/manxia
0f45913aaaf9676be31f2850a53af6e05e24324d
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/utils/ViewPortHandler.ets
arkts
isFullyZoomedOutY
Returns true if the chart is fully zoomed out on it's y-axis (vertical). @return
public isFullyZoomedOutY(): boolean { return !(this.mScaleY > this.mMinScaleY || this.mMinScaleY > 1); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isFullyZoomedOutY AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean...
public isFullyZoomedOutY(): boolean { return !(this.mScaleY > this.mMinScaleY || this.mMinScaleY > 1); }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
24aba642a01946a3be99ea986921d1d3b5a86ccb
gitee
the-wwyang/kids-learning-app
src/main/ets/utils/AudioManager.ets
arkts
stopSound
停止音效 @param type 音效类型
stopSound(type: SoundType): void { const audioPlayer = this.loadedSounds.get(type); if (audioPlayer) { // TODO: 停止播放 // audioPlayer.stop(); console.log(`Stopping sound: ${type}`); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left stopSound AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left SoundType AST#identifier#Right AST#)#Left ) AS...
stopSound(type: SoundType): void { const audioPlayer = this.loadedSounds.get(type); if (audioPlayer) { // TODO: 停止播放 // audioPlayer.stop(); console.log(`Stopping sound: ${type}`); } }
https://github.com/the-wwyang/kids-learning-app
8a9188c6d65083533485bfa543c9bed2a517fa64
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test36_original_index.ets
arkts
testEnumLookup
--- Enum-const pattern with lookup ---
function testEnumLookup(): string { let names: Record<string, string> = {}; names['0'] = 'NORTH'; names['1'] = 'EAST'; names['2'] = 'SOUTH'; names['3'] = 'WEST'; let n0: string = names['0']; let n2: string = names['2']; let keys: string[] = Object.keys(names); return n0 + ',' + n2 + ',' + String(keys....
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testEnumLookup AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_t...
function testEnumLookup(): string { let names: Record<string, string> = {}; names['0'] = 'NORTH'; names['1'] = 'EAST'; names['2'] = 'SOUTH'; names['3'] = 'WEST'; let n0: string = names['0']; let n2: string = names['2']; let keys: string[] = Object.keys(names); return n0 + ',' + n2 + ',' + String(keys....
https://github.com/miaochiahao/ark-ghidra
3c7de63958ed4948fa0fcea6396291a0cdcb176d
github
openharmony-sig/FastBle
library/src/main/ets/BleManager.ets
arkts
setOperateTimeout
Set operate timeout @param count @return BleManager
public setOperateTimeout(count: number): BleManager { this.operateTimeout = count; return this; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setOperateTimeout AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left count AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le...
public setOperateTimeout(count: number): BleManager { this.operateTimeout = count; return this; }
https://gitee.com/openharmony-sig/FastBle.git
0ff04f6ff0bed83a4f2ed119c5612f4d2529adb2
gitee
arkui-x/samples
CodeLab/Cases/feature/customdrawtabbar/src/main/ets/components/tabsConcaveCircle/TabsConcaveCircle.ets
arkts
createCanvas
创建canvas 背景 和 凹槽
createCanvas() { if (this.circleInfo) { this.context.reset() CanvasCreateRectangle({ context: this.context, tabsBgColor: this.tabsBgColor }) CanvasClipGroove({ context: this.context, menuLength: this.tabsMenu.length, center: this.animationPositionX, ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left createCanvas AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left ...
createCanvas() { if (this.circleInfo) { this.context.reset() CanvasCreateRectangle({ context: this.context, tabsBgColor: this.tabsBgColor }) CanvasClipGroove({ context: this.context, menuLength: this.tabsMenu.length, center: this.animationPositionX, ...
https://gitcode.com/arkui-x/samples
388178ddf8990de91c2d44c981f9d5c41d509bcb
gitcode
openharmony/codelabs
Data/DeviceHealth/entry/src/main/ets/database/EncryptedDB.ets
arkts
deleteEvents
Delete events (pass-through)
static deleteEvents( dbDelete: () => void ): void { dbDelete() }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left deleteEvents AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left dbDelete AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#...
static deleteEvents( dbDelete: () => void ): void { dbDelete() }
https://gitcode.com/openharmony/codelabs
c8837930d833cf8d4c76cdd16da1911d73eace65
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebDAV/WebDAVClient.ets
arkts
getFileContents
获取文件内容
async getFileContents(remotePath: string, format: 'string' | 'arraybuffer' = 'arraybuffer'): Promise<string | ArrayBuffer> { const url = this.getFullUrl(remotePath); logger.info(TAG, `下载文件: ${url}`); const result = await this.sendRequest('GET', url, { responseType: format }); if (result.stat...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getFileContents AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left remotePath AST#identifier#Right AST#type_annotation#Left AST#:#...
async getFileContents(remotePath: string, format: 'string' | 'arraybuffer' = 'arraybuffer'): Promise<string | ArrayBuffer> { const url = this.getFullUrl(remotePath); logger.info(TAG, `下载文件: ${url}`); const result = await this.sendRequest('GET', url, { responseType: format }); if (result.stat...
https://github.com/DaLongZhuaZi/manxia
5bd6db3a3cf264b896bc2b863298b1fd51dc0453
github
HarmonyOS_Samples/BestPracticeSnippets
TaskPoolPractice/entry/src/main/ets/pages/sample3/Sample3.ets
arkts
correctConcurrentFunc
[End wrong_1] [Start correct_fun_1] Sample3.ets
@Concurrent function correctConcurrentFunc() { let promise = Promise.resolve(); promise.then(() => { emitter.emit("1", { data: { name: "anonymous" } }); }) }
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Concurrent AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left correctConcurrentFunc AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Ri...
@Concurrent function correctConcurrentFunc() { let promise = Promise.resolve(); promise.then(() => { emitter.emit("1", { data: { name: "anonymous" } }); }) }
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
c64c4eedff4235aaf12d5dd5cfedce9886298ebd
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/StreamInputHandler.ets
arkts
startMouseInterceptor
==================== 鼠标高速轮询 ==================== 启动鼠标高速轮询 优先尝试 C++ 层 OH_Input_AddMouseEventMonitor(需要 INPUT_MONITORING 权限), 以硬件轮询率直接调用 moonlight API。 @param viewWidth 视图宽度 (vp) @param viewHeight 视图高度 (vp) @returns true 表示 C++ Monitor 已启动(不需要 keepalive), false 表示 Monitor 不可用(调用方应启用 keepalive 动画来保持 ArkUI 帧率)
startMouseInterceptor(viewWidth: number, viewHeight: number): boolean { const mouseInterceptor = MouseInterceptorService.getInstance(); // 保存 XComponent 实际尺寸,供 ArkUI 回退路径绝对模式使用 this.viewWidthVp = viewWidth; this.viewHeightVp = viewHeight; // 获取屏幕物理尺寸 let screenWidthPx = 1080; let screenH...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left startMouseInterceptor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left viewWidth AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Lef...
startMouseInterceptor(viewWidth: number, viewHeight: number): boolean { const mouseInterceptor = MouseInterceptorService.getInstance(); // 保存 XComponent 实际尺寸,供 ArkUI 回退路径绝对模式使用 this.viewWidthVp = viewWidth; this.viewHeightVp = viewHeight; // 获取屏幕物理尺寸 let screenWidthPx = 1080; let screenH...
https://github.com/AlkaidLab/moonlight-harmony
b19a4df0830d1ac3d12523c887b5c8debf00487b
github
LongLiveY96/chatcube
entry/src/main/ets/services/AIApiService.ets
arkts
isToolResultMessage
检查是否是工具结果消息
isToolResultMessage(): boolean { return this.role === 'tool' && this.toolCallId !== '' }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isToolResultMessage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST...
isToolResultMessage(): boolean { return this.role === 'tool' && this.toolCallId !== '' }
https://github.com/LongLiveY96/chatcube
77f215b366d9ba3898b8322116a8b6e85c6722fc
github
HarmonyOS_Samples/MultiPictureBeautification
features/multipictureediting/src/main/ets/viewmodel/EditingViewModel.ets
arkts
isSmallScreen
Check if current screen is small (XS width + SM height)
isSmallScreen(widthBp: WidthBreakpoint, heightBp: HeightBreakpoint): boolean { return widthBp <= WidthBreakpoint.WIDTH_SM && heightBp <= HeightBreakpoint.HEIGHT_MD; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isSmallScreen AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left widthBp AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left WidthBreakpoint AST#identifier#Right AS...
isSmallScreen(widthBp: WidthBreakpoint, heightBp: HeightBreakpoint): boolean { return widthBp <= WidthBreakpoint.WIDTH_SM && heightBp <= HeightBreakpoint.HEIGHT_MD; }
https://gitcode.com/HarmonyOS_Samples/MultiPictureBeautification
59f6acfee7cbff51551be3eb47a022bff7d90445
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
entries
Returns an array of key, value pairs for every entry in the Uint8ClampedArray @returns { IterableIterator<[int, Number]> } - key, value pairs for every entry in the array @syscap SystemCapability.Utils.Lang @FaAndStageModel
public entries(): IterableIterator<[int, Number]> { return new Uint8ClampedArrayIteratorEntries(this) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left entries 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_sta...
public entries(): IterableIterator<[int, Number]> { return new Uint8ClampedArrayIteratorEntries(this) }
https://gitcode.com/iop123123/arkts-static-skills
0e80c9ef20830d7e96ea0dd2f9854f8e88c66c3c
gitcode
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test32_original_index.ets
arkts
testChainedTransform
--- Chained string transforms ---
function testChainedTransform(): string { let s: string = ' Hello, WORLD! '; let result: string = s.trim().toLowerCase().replace('world', 'arkts'); return result; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testChainedTransform AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predef...
function testChainedTransform(): string { let s: string = ' Hello, WORLD! '; let result: string = s.trim().toLowerCase().replace('world', 'arkts'); return result; }
https://github.com/miaochiahao/ark-ghidra
12adff99b87a5eaebb811577139005c293a780c2
github
AGenUI/AGenUI
platforms/harmony/agenui/src/main/ets/agenui/AGenEngineUI.ets
arkts
destroy
MARK: - Lifecycle Destroys the SurfaceManager and releases all resources
public destroy(): void { this.removeAllListeners(); this._surfaces.forEach(surface => { surface.surfaceManager = null; }); this._surfaces.clear(); this._surfaceBridge.teardown(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left destroy 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_sta...
public destroy(): void { this.removeAllListeners(); this._surfaces.forEach(surface => { surface.surfaceManager = null; }); this._surfaces.clear(); this._surfaceBridge.teardown(); }
https://github.com/AGenUI/AGenUI
e93ff0087e8f1c671e36ab2dce75df844459290a
github
webabcd/HarmonyDemo
entry/src/main/ets/pages/security/CryptoDemo.ets
arkts
decryptRsa
rsa 解密,通过私钥解密
public static decryptRsa(cipherData: Uint8Array, privateKeyData: Uint8Array): Uint8Array { let cipherBlog: cryptoFramework.DataBlob = { data: cipherData }; let privateKey = CryptoHelper.getRsaKeyPair(null, privateKeyData).priKey let cipher = cryptoFramework.createCipher('RSA1024|PKCS1'); cipher.initS...
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 decryptRsa AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left cipherData AST#identifier#Right AST#:#Left :...
public static decryptRsa(cipherData: Uint8Array, privateKeyData: Uint8Array): Uint8Array { let cipherBlog: cryptoFramework.DataBlob = { data: cipherData }; let privateKey = CryptoHelper.getRsaKeyPair(null, privateKeyData).priKey let cipher = cryptoFramework.createCipher('RSA1024|PKCS1'); cipher.initS...
https://github.com/webabcd/HarmonyDemo
0fc02676f6f6177601afb2a2eb2bf3ad4dfa8cc0
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/WebViewDataCacheManager.ets
arkts
deleteMangaDetail
删除漫画详情缓存
deleteMangaDetail(sourceId: number, mangaId: string): void { const key = this.generateKey(sourceId, mangaId); this.mangaDetailCache.delete(key); logger.info(TAG, `删除漫画详情缓存: ${key}`); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left deleteMangaDetail 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#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , A...
deleteMangaDetail(sourceId: number, mangaId: string): void { const key = this.generateKey(sourceId, mangaId); this.mangaDetailCache.delete(key); logger.info(TAG, `删除漫画详情缓存: ${key}`); }
https://github.com/DaLongZhuaZi/manxia
848c78b52ec3b103297e8654e9632bf5088fc10f
github
LongLiveY96/chatcube
entry/src/main/ets/pages/Index.ets
arkts
onBackPress
处理返回键/返回手势
onBackPress(): boolean { // 如果分享预览弹窗打开,关闭弹窗 if (this.showSharePreview) { this.showSharePreview = false return true } // 如果系统提示词弹窗打开,关闭弹窗 if (this.showSystemPromptSheet) { this.showSystemPromptSheet = false return true } // 如果设置弹窗打开,关闭弹窗 if (this.isAnySettingsS...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onBackPress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#stateme...
onBackPress(): boolean { // 如果分享预览弹窗打开,关闭弹窗 if (this.showSharePreview) { this.showSharePreview = false return true } // 如果系统提示词弹窗打开,关闭弹窗 if (this.showSystemPromptSheet) { this.showSystemPromptSheet = false return true } // 如果设置弹窗打开,关闭弹窗 if (this.isAnySettingsS...
https://github.com/LongLiveY96/chatcube
a71ec4d7398a8700f0cb5b96f1adbe29bad9969c
github
Harrisonls2004/WaterFlow
entry/src/main/ets/common/utils/FollowManager.ets
arkts
getFollowingUsers
Get full user info list of users this user is following 返回完整的用户信息列表(包含 ID)
static async getFollowingUsers(userId?: number): Promise<FollowUserInfo[]> { try { if (SERVER_ENABLED) { try { const response = await FollowApi.getFollowing(userId); console.info(`FollowManager: getFollowingUsers response code=${response.code}`); if (response.code === 2...
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 getFollowingUsers AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#?#Left...
static async getFollowingUsers(userId?: number): Promise<FollowUserInfo[]> { try { if (SERVER_ENABLED) { try { const response = await FollowApi.getFollowing(userId); console.info(`FollowManager: getFollowingUsers response code=${response.code}`); if (response.code === 2...
https://github.com/Harrisonls2004/WaterFlow
5287305f31d830580f90d16ebe310abab61e555b
github
OHPG/FinSdk
jellyfin/src/main/ets/api/UserLibraryApi.ets
arkts
getSpecialFeatures
Gets special features for an item. @summary Gets special features for an item. @param {UserLibraryApiGetSpecialFeaturesRequest} requestParameters Request parameters. @throws {RequiredError} @memberof UserLibraryApi
public async getSpecialFeatures(requestParameters: UserLibraryApiGetSpecialFeaturesRequest): Promise<BaseItemDto> { this.assertParam(requestParameters.itemId) return this.apiClient.get({path: `/Items/${requestParameters.itemId}/SpecialFeatures`, parameters: requestParameters, excludeParams: ['itemId']}) }
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 getSpecialFeatures AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Righ...
public async getSpecialFeatures(requestParameters: UserLibraryApiGetSpecialFeaturesRequest): Promise<BaseItemDto> { this.assertParam(requestParameters.itemId) return this.apiClient.get({path: `/Items/${requestParameters.itemId}/SpecialFeatures`, parameters: requestParameters, excludeParams: ['itemId']}) }
https://github.com/OHPG/FinSdk
31fbaa4bad84efb60aedacf6ce7c1fadec5b5484
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
constructor
Creates an Uint8Array with respect to length. @param length data initializer
public constructor(length: int) { this.length = length this.byteLength = length * Uint8Array.BYTES_PER_ELEMENT this.byteOffset = 0 this.buffer = new ArrayBuffer(this.byteLength) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left length AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#...
public constructor(length: int) { this.length = length this.byteLength = length * Uint8Array.BYTES_PER_ELEMENT this.byteOffset = 0 this.buffer = new ArrayBuffer(this.byteLength) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
355063de02dbd651ce4f926a9b1f37114507750a
gitee
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/components/AxisBase.ets
arkts
isAxisMaxCustom
Returns true if the axis max value has been customized (and is not calculated automatically) @return
public isAxisMaxCustom(): boolean { return this.mCustomAxisMax; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isAxisMaxCustom AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean A...
public isAxisMaxCustom(): boolean { return this.mCustomAxisMax; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
259eba441b0f747d26aff6c3b15ab85b955f9687
gitee
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/GamepadManager.ets
arkts
verifyAndRegisterGCDevice
异步验证 GCK 报告的设备是否真的是手柄 当设备名称通过了品牌匹配(如 "rapoo")但同时包含强非手柄关键词(如 "keyboard")时, 通过 InputDevice API 查询实际设备源类型来确认: - 有 joystick 源 → 是带键盘功能的手柄(如 Gamesir G8+ keyboard)→ 注册 - 无 joystick 源 → 是手柄品牌的键盘产品(如 RAPOO Keyboard-1)→ 跳过
private async verifyAndRegisterGCDevice(deviceId: string, info: GameControllerDeviceInfo): Promise<void> { try { // 通过名称或 vendor/product 匹配 InputDevice const deviceIds = await inputDevice.getDeviceIds(); let hasJoystickSource = false; for (const id of deviceIds) { const devInfo = ...
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 verifyAndRegisterGCDevice AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left deviceId AST#identifier#Right AST#ERROR#Le...
private async verifyAndRegisterGCDevice(deviceId: string, info: GameControllerDeviceInfo): Promise<void> { try { // 通过名称或 vendor/product 匹配 InputDevice const deviceIds = await inputDevice.getDeviceIds(); let hasJoystickSource = false; for (const id of deviceIds) { const devInfo = ...
https://github.com/AlkaidLab/moonlight-harmony
9ad330b50cb5dd9828ae300507a4811df67e4b3e
github
HarmonyCandies/image_cropper
image_cropper/src/main/ets/model/Geometry.ets
arkts
subtract
Binary subtraction operator
subtract(other: Offset): Offset { return new Offset(this.dx - other.dx, this.dy - other.dy); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left subtract AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Offset AST#identifier#Right AST#)#Left ) AST#)...
subtract(other: Offset): Offset { return new Offset(this.dx - other.dx, this.dy - other.dy); }
https://github.com/HarmonyCandies/image_cropper/blob/dd3664946b413166307b736a5763f998084364e1/image_cropper/src/main/ets/model/Geometry.ets#L118-L120
438e3805659a280f07ce521717712dc904dbeefa
github
OSpark-Team/Free-PCM
library/src/main/ets/utils/AudioRendererPlayer.ets
arkts
getDecoder
获取解码器实例 @returns <PcmStreamDecoder> 解码器实例
public getDecoder(): PcmStreamDecoder | null { return this.decoder; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getDecoder AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left AST#...
public getDecoder(): PcmStreamDecoder | null { return this.decoder; }
https://github.com/OSpark-Team/Free-PCM/blob/3440e7220d07d28815d172b4b3237145434075ee/library/src/main/ets/utils/AudioRendererPlayer.ets#L699-L701
07736e0953593947e4c851c1d5827ce840712ba1
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Parsers/TxtParser.ets
arkts
initTocRules
初始化TXT目录规则
private async initTocRules(): Promise<void> { try { await this.txtTocRuleManager.initialize(); this.compiledPattern = this.txtTocRuleManager.getCombinedPattern(); logger.info(TAG, `TXT目录规则初始化完成,启用规则数: ${this.txtTocRuleManager.getEnabledRules().length}`); } catch (error) { logger.warn(T...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left initTocRules AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#...
private async initTocRules(): Promise<void> { try { await this.txtTocRuleManager.initialize(); this.compiledPattern = this.txtTocRuleManager.getCombinedPattern(); logger.info(TAG, `TXT目录规则初始化完成,启用规则数: ${this.txtTocRuleManager.getEnabledRules().length}`); } catch (error) { logger.warn(T...
https://github.com/DaLongZhuaZi/manxia
753b753bc7d3f712796de26d3b633a08299725c2
github
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/services/NetworkManager.ets
arkts
setOnNetworkAvailableCallback
Set callback for network available event
static setOnNetworkAvailableCallback(callback: () => void): void { onNetworkAvailableCallback = callback; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left setOnNetworkAvailableCallback AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AS...
static setOnNetworkAvailableCallback(callback: () => void): void { onNetworkAvailableCallback = callback; }
https://github.com/tangwengang-del/freerdp-harmonyos
6dd674e6604aebfcd43e04aac0e45344267254ae
github
CLMC2025/Vignette
entry/src/main/ets/sync/VersionControl.ets
arkts
compareVersions
比较两个版本
static compareVersions(version1: VersionInfo, version2: VersionInfo): number { if (version1.version < version2.version) { return -1; } else if (version1.version > version2.version) { return 1; } return 0; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left compareVersions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left version1 AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
static compareVersions(version1: VersionInfo, version2: VersionInfo): number { if (version1.version < version2.version) { return -1; } else if (version1.version > version2.version) { return 1; } return 0; }
https://github.com/CLMC2025/Vignette
e12b9fee87f87ca8b733d76588ab87289fb702bd
github
dingzhilin1990/zhilinclaw
examples/WeatherPlugin.ets
arkts
onDisable
插件禁用时清理资源
async onDisable(): Promise<void> { console.log('[WeatherPlugin] 插件禁用中...'); // 清理资源 this.skill = undefined; }
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left onDisable AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#g...
async onDisable(): Promise<void> { console.log('[WeatherPlugin] 插件禁用中...'); // 清理资源 this.skill = undefined; }
https://github.com/dingzhilin1990/zhilinclaw
435dc2ff43ad4e2e050c7b43abedcf77123787a7
github
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/pages/Index.ets
arkts
onDragLeaveSideArea
Something is dragged out of the side area. Release the drag block.
onDragLeaveSideArea() { animateToImmediately(defaultAnimation(), () => { this.myUi.sideAreaShrinkBlock_drag = false; }); this.onDragLeaveAnyArea(); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onDragLeaveSideArea 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...
onDragLeaveSideArea() { animateToImmediately(defaultAnimation(), () => { this.myUi.sideAreaShrinkBlock_drag = false; }); this.onDragLeaveAnyArea(); }
https://github.com/awaLiny2333/LinysBrowser_NEXT
8f2ee3267219e04f9e67beea149315e86d9e9274
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/StreamWindowManager.ets
arkts
initialize
==================== 初始化 ==================== 完整的窗口初始化流程 @returns 屏幕尺寸
async initialize(): Promise<DisplaySize> { await this.initScreenSize(); await this.configureWindow(); await this.configureOrientation(); const size = await this.updateScreenSize(); return size; }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left initialize AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_t...
async initialize(): Promise<DisplaySize> { await this.initScreenSize(); await this.configureWindow(); await this.configureOrientation(); const size = await this.updateScreenSize(); return size; }
https://github.com/AlkaidLab/moonlight-harmony
c75c9c18fb86195484808cb2dc31435b73ef758b
github
Joker-x-dev/CoolMallArkTS
core/ui/src/main/ets/component/address/AddressActionButton.ets
arkts
build
构建地址操作按钮 @returns {void} 无返回值
build(): void { Row() { CommonIcon({ icon: this.iconResId, iconSize: this.iconSize, tintColor: this.iconColor }); } .width(this.buttonSize) .height(this.buttonSize) .backgroundColor(this.bgColor) .borderRadius(this.buttonSize / 2) .justifyContent(FlexAli...
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 { Row() { CommonIcon({ icon: this.iconResId, iconSize: this.iconSize, tintColor: this.iconColor }); } .width(this.buttonSize) .height(this.buttonSize) .backgroundColor(this.bgColor) .borderRadius(this.buttonSize / 2) .justifyContent(FlexAli...
https://github.com/Joker-x-dev/CoolMallArkTS
114aca8d51ac7b9e697d73eacd71ea8f348d025f
github
codelably/HCompass
core/testing/src/main/ets/TestContainerHelper.ets
arkts
registerMock
注册 Mock 服务到测试子容器 @template T 服务类型 @param key 服务标识符 @param mock Mock 服务实例 @throws 未调用 setup() 时抛出异常
registerMock<T>(key: ServiceKey, mock: T): void { if (!this.isSetup || !this.testContainer) { throw new Error("[TestContainerHelper] 请先调用 setup() 再注册 Mock 服务"); } this.testContainer.register<T>(key, () => mock); }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#identifier#Left registerMock AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#ERROR#Left AST#formal_parameters#Left AS...
registerMock<T>(key: ServiceKey, mock: T): void { if (!this.isSetup || !this.testContainer) { throw new Error("[TestContainerHelper] 请先调用 setup() 再注册 Mock 服务"); } this.testContainer.register<T>(key, () => mock); }
https://github.com/codelably/HCompass
f02434a03664071778254ab61116c0b79b3e1b47
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.url.ets
arkts
if
high surrogate
if (i + 1 >= len) { return true; }
AST#program#Left AST#if_statement#Left AST#if#Left if AST#if#Right AST#parenthesized_expression#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#binary_expression#Left AST#identifier#Left i AST#identifier#Right AST#+#Left + AST#+#Right AST#number#Left 1 AST#number#Right AST#binary_expression#Right AST#>=#Le...
if (i + 1 >= len) { return true; }
https://gitcode.com/iop123123/arkts-static-skills
515b10a4cbd98e638767021f237b4165072497ae
gitcode
tdcare/tdwebrtc
src/main/ets/utils/PermissionUtil.ets
arkts
checkAccessToken
检查是否授权 @param permission 待检查权限 @returns 授权状态
public static async checkAccessToken(permission: Permissions): Promise<abilityAccessCtrl.GrantStatus> { const atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager(); let grantStatus: abilityAccessCtrl.GrantStatus = abilityAccessCtrl.GrantStatus.PERMISSION_DENIED; let tokenId: number ...
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 checkAccessToken AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left p...
public static async checkAccessToken(permission: Permissions): Promise<abilityAccessCtrl.GrantStatus> { const atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager(); let grantStatus: abilityAccessCtrl.GrantStatus = abilityAccessCtrl.GrantStatus.PERMISSION_DENIED; let tokenId: number ...
https://github.com/tdcare/tdwebrtc
5259ab005023df22c620224bedba45f3075a242c
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/utils/ViewPortHandler.ets
arkts
canZoomInMoreX
Returns true if the chart is not yet fully zoomed in on the x-axis @return
public canZoomInMoreX(): boolean { return this.mScaleX < this.mMaxScaleX; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left canZoomInMoreX AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AS...
public canZoomInMoreX(): boolean { return this.mScaleX < this.mMaxScaleX; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
58fa55b5217c52d037ebef8071320ac6021327c6
gitee
openharmony/arkui_advanced_ui_component
atomicservicenavigation/source/atomicservicenavigation.ets
arkts
drawSingleGradient
单色渐变: @param context 画布上下文 @param primaryColor createLinearGradient初始颜色为primaryColor,结束颜色为底色 @param backgroundColor 颜色线性渐变的结束颜色
drawSingleGradient(context: CanvasRenderingContext2D, primaryColor: ResourceColor, backgroundColor: string): void { let height = this.navigationHeight * COLOR_RATIO_SIXTY_PERCENT; let grad1 = context.createLinearGradient(0, 0, 0, height); grad1.addColorStop(0, this.resourceColorToString(primaryColor))...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left drawSingleGradient 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#ident...
drawSingleGradient(context: CanvasRenderingContext2D, primaryColor: ResourceColor, backgroundColor: string): void { let height = this.navigationHeight * COLOR_RATIO_SIXTY_PERCENT; let grad1 = context.createLinearGradient(0, 0, 0, height); grad1.addColorStop(0, this.resourceColorToString(primaryColor))...
https://gitee.com/openharmony/arkui_advanced_ui_component.git
e3f97c3e4418e31ac763baa8c8be5dca774191eb
gitee
openharmony-sig/smartperf
device/device_ui/entry/src/main/ets/common/ui/detail/chart/utils/Utils.ets
arkts
calcTextWidth
/** * This method converts device specific pixels to density independent * pixels. NEEDS UTILS TO BE INITIALIZED BEFORE USAGE. * * @param px A value in px (pixels) unit. Which we need to convert into db * @return A float value to represent dp equivalent to px value public static float convertPixelsToDp(float px) { if (...
public static calcTextWidth(paint: Paint, demoText: string):number{ return demoText.length * paint.getTextSize() / 2; }
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 calcTextWidth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left paint AST#identifier#Right AST#:#Left : A...
public static calcTextWidth(paint: Paint, demoText: string):number{ return demoText.length * paint.getTextSize() / 2; }
https://gitee.com/openharmony-sig/smartperf.git
65f270c29a4a6e7c6aa39c2f1a68d6285a05d37f
gitee
CPF-ApplicationTPC/openharmony_tpc_samples
SwipeMenuListView/library/src/main/ets/components/SwipeMenuItemLayout.ets
arkts
aboutToUpdate
监听全局状态,如果其他item打开,则关闭自己
aboutToUpdate(_changedProps: Object) { const currentlyOpen = this.stateController.get(); if (this.isMenuOpen && currentlyOpen !== this.itemPosition) { logger.debug(`StateWatch - Global state changed: ${currentlyOpen} opened, current item ${this.itemPosition} needs to close`); this.smoothCloseMenu(...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToUpdate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left _changedProps AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Object AST#identifier#Right AST#ER...
aboutToUpdate(_changedProps: Object) { const currentlyOpen = this.stateController.get(); if (this.isMenuOpen && currentlyOpen !== this.itemPosition) { logger.debug(`StateWatch - Global state changed: ${currentlyOpen} opened, current item ${this.itemPosition} needs to close`); this.smoothCloseMenu(...
https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples
1c3da45f287b7bebeb2a818a7a36d146c64ffd6c
gitcode
dingzhilin1990/zhilinclaw
src/skills/SkillRegistry.ets
arkts
executeSkill
执行技能 @param name 技能名称 @param input 输入内容 @param context 上下文
public async executeSkill( name: string, input: string, context?: any ): Promise<SkillResult | null> { const wrapper = this.skills.get(name); if (!wrapper) { return { success: false, output: '', error: `技能不存在:${name}` }; } try { wrapper.callCo...
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 executeSkill AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#...
public async executeSkill( name: string, input: string, context?: any ): Promise<SkillResult | null> { const wrapper = this.skills.get(name); if (!wrapper) { return { success: false, output: '', error: `技能不存在:${name}` }; } try { wrapper.callCo...
https://github.com/dingzhilin1990/zhilinclaw
b6f3e264b8d5f91b0e343b150e81048c66f2b906
github
AetheriumSimulator/qemu-hmos
entry/src/main/ets/components/DownloadManager.ets
arkts
getAllTasks
获取所有任务
public getAllTasks(): DownloadTask[] { return Array.from(this.tasks.values()); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getAllTasks 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 DownloadTa...
public getAllTasks(): DownloadTask[] { return Array.from(this.tasks.values()); }
https://github.com/AetheriumSimulator/qemu-hmos
d893d277c646377646fe59a122aa61db469253ed
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets
arkts
keys
Creates and returns an iterator of buf keys (indices). @returns { IterableIterator<int> }
public keys(): IterableIterator<int> { return new BufferIteratorKeys(this); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left keys 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#:#Righ...
public keys(): IterableIterator<int> { return new BufferIteratorKeys(this); }
https://gitcode.com/iop123123/arkts-static-skills
e122582a887fcf68923cf9b0d01266d29fc2c618
gitcode
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/TagDAO.ets
arkts
getPopularTags
获取热门标签(按使用频率排序) @param userId 用户ID @param limit 返回数量限制 @returns 热门标签列表
static async getPopularTags(userId: number, limit: number = 10): Promise<Tag[]> { const store = DatabaseManager.getDatabase(); const sql = ` SELECT * FROM tags WHERE user_id = ? AND is_deleted = 0 ORDER BY usage_count DESC, tag_id DESC LIMIT ? `; let resultSet: relation...
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 getPopularTags AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : ...
static async getPopularTags(userId: number, limit: number = 10): Promise<Tag[]> { const store = DatabaseManager.getDatabase(); const sql = ` SELECT * FROM tags WHERE user_id = ? AND is_deleted = 0 ORDER BY usage_count DESC, tag_id DESC LIMIT ? `; let resultSet: relation...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
9e49ba4a585a1d3108ac081604c5b6281ac8bc0c
github
openharmony-sig/applications_clock
common/src/main/ets/manager/PageStateManager.ets
arkts
getClockHandsState
Obtains showHandsClock value. @return showHandsClock
async getClockHandsState(): Promise<boolean> { const preferences = await this.getPreferences(); const showHandsClock = await preferences.get(showHandsClockKey, true); LogUtil.info(TAG, 'get showHandsClock from Sp:' + showHandsClock); return Boolean(showHandsClock); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getClockHandsState AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#g...
async getClockHandsState(): Promise<boolean> { const preferences = await this.getPreferences(); const showHandsClock = await preferences.get(showHandsClockKey, true); LogUtil.info(TAG, 'get showHandsClock from Sp:' + showHandsClock); return Boolean(showHandsClock); }
https://gitee.com/openharmony-sig/applications_clock.git
0183aa9acad673d1fbaef55dcd6a1a6f8bd43904
gitee
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/model/SmartBudgetPlan.ets
arkts
simpleMovingAverage
简单移动平均
static simpleMovingAverage(data: number[], windowSize: number): number { if (data.length === 0) { return 0; } const actualWindow = Math.min(windowSize, data.length); let sum = 0; const startIndex = data.length - actualWindow; for (let i = startIndex; i < data.length; i++) { sum += ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left simpleMovingAverage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_ex...
static simpleMovingAverage(data: number[], windowSize: number): number { if (data.length === 0) { return 0; } const actualWindow = Math.min(windowSize, data.length); let sum = 0; const startIndex = data.length - actualWindow; for (let i = startIndex; i < data.length; i++) { sum += ...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
2ca101f59392a4e793804b13ed03800a78ab6cc3
github
openharmony/communication_bluetooth_service
test/example/bluetoothtest/entry/src/main/ets/pages/subManualApiTest/subBrTest/deviceFound.ets
arkts
showDisconnectDialog
Disconnect Dialog
showDisconnectDialog(deviceName: string , callback: () => void) { AlertDialog.show({ title : $r('app.string.bluetooth_disconnect') , message : $r("app.string.bluetooth_disconnect_device" , deviceName) , primaryButton : { value : $r('app.string.cancel') , action : () => { ...
AST#program#Left AST#ERROR#Left AST#identifier#Left showDisconnectDialog AST#identifier#Right AST#(#Left ( AST#(#Right AST#identifier#Left deviceName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , AST#,#Right AST#call_expression#Left AST...
showDisconnectDialog(deviceName: string , callback: () => void) { AlertDialog.show({ title : $r('app.string.bluetooth_disconnect') , message : $r("app.string.bluetooth_disconnect_device" , deviceName) , primaryButton : { value : $r('app.string.cancel') , action : () => { ...
https://gitee.com/openharmony/communication_bluetooth_service.git
6e872dd757c736a22f4c2f15768bf9db6c285e86
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/pages/MainMenuPage.ets
arkts
showDeleteMangaDialog
显示删除漫画确认对话框
private showDeleteMangaDialog(mangaId: string): void { const manga = this.findLibraryMangaById(mangaId); if (!manga) { logger.error(TAG, `未找到漫画ID为 ${mangaId} 的漫画`); this.resetSwipeState(); return; } if (this.isRemoteProviderManga(manga)) { this.getUIContext().showAlertDialog({...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left showDeleteMangaDialog AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left mangaId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string A...
private showDeleteMangaDialog(mangaId: string): void { const manga = this.findLibraryMangaById(mangaId); if (!manga) { logger.error(TAG, `未找到漫画ID为 ${mangaId} 的漫画`); this.resetSwipeState(); return; } if (this.isRemoteProviderManga(manga)) { this.getUIContext().showAlertDialog({...
https://github.com/DaLongZhuaZi/manxia
a77b104b9a11de8dc5c5db3007e39779701611de
github
Tlntin/home-cloud-shield
entry/src/main/ets/serviceextability/MyVpnExtAbility.ets
arkts
writeStatus
NOTE: `note` strings are fixed English (this process has no access to the in-app language override); the UI localizes them by exact match in Index.normalizeStatusSnapshot. When adding/changing a note here, add the matching i18n mapping there too, or it will surface in English.
private writeStatus(phase: string, running: boolean, note: string): void { this.lastPhase = phase; this.lastRunning = running; this.lastNote = note; this.lastStatusWriteMs = Date.now(); const snapshot: StatusSnapshot = { phase: phase, running: running, note: note, updatedAt...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left writeStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left phase AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ...
private writeStatus(phase: string, running: boolean, note: string): void { this.lastPhase = phase; this.lastRunning = running; this.lastNote = note; this.lastStatusWriteMs = Date.now(); const snapshot: StatusSnapshot = { phase: phase, running: running, note: note, updatedAt...
https://github.com/Tlntin/home-cloud-shield/blob/bfd8d549ccb3e55bdfc30fa7687b31d52e4c1cc0/entry/src/main/ets/serviceextability/MyVpnExtAbility.ets#L1683-L1699
0185cee9e440fa0ca9bd73832405741de22d405e
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/CombinedData.ets
arkts
getDataSetByHighlight
Get dataset for highlight @param highlight current highlight @return dataset related to highlight
public getDataSetByHighlight(highlight: Highlight): IBarLineScatterCandleBubbleDataSet<EntryOhos> | null { if (highlight.getDataIndex() >= this.getAllData().size()) return null; let data: BarLineScatterCandleBubbleData<IBarLineScatterCandleBubbleDataSet<EntryOhos>> = this.getDataByIndex(highlight.getDa...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getDataSetByHighlight AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left highlight AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ident...
public getDataSetByHighlight(highlight: Highlight): IBarLineScatterCandleBubbleDataSet<EntryOhos> | null { if (highlight.getDataIndex() >= this.getAllData().size()) return null; let data: BarLineScatterCandleBubbleData<IBarLineScatterCandleBubbleDataSet<EntryOhos>> = this.getDataByIndex(highlight.getDa...
https://gitee.com/openharmony-tpc/ohos_mpchart.git
6a09f6795528b3c77521af4410f046858a77ac9d
gitee
openharmony/applications_app_samples
code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/pages/NewLogin.ets
arkts
onUdpMessage
UDP直接订阅消息
onUdpMessage(): void { this.socketController?.onMessage((data: string) => { this.receiveMessage(data); }) this.sendData('connect success'); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onUdpMessage 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...
onUdpMessage(): void { this.socketController?.onMessage((data: string) => { this.receiveMessage(data); }) this.sendData('connect success'); }
https://github.com/openharmony/applications_app_samples
18b442f412e1366914a68a60ae470703629ed3a0
github
Harrisonls2004/WaterFlow
entry/src/main/ets/common/utils/CommentManager.ets
arkts
toggleReplyDislike
Toggle dislike on a reply
static async toggleReplyDislike(commentId: string, replyId: string, username: string): Promise<boolean> { try { if (!CommentManager.preferencesInstance) { console.error('Preferences not initialized'); return false; } const comments = await CommentManager.getAllComments(); ...
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 toggleReplyDislike AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left commentId AST#identifier#Right AST#ERROR#Left AST#:#...
static async toggleReplyDislike(commentId: string, replyId: string, username: string): Promise<boolean> { try { if (!CommentManager.preferencesInstance) { console.error('Preferences not initialized'); return false; } const comments = await CommentManager.getAllComments(); ...
https://github.com/Harrisonls2004/WaterFlow
5ffe9847dde8858d896775ca270470057274148d
github
openharmony/security_privacy_center
entry/src/main/ets/common/utils/RawFileUtil.ets
arkts
getRawFileByContext
Get the object of the specified JSON file @param context context @param fileName file name @return The file content in string format
public static async getRawFileByContext(context: Context, fileName: string): Promise<string> { Logger.info(TAG, `getFileContent. fileName: ${fileName}`); if (context === null || fileName === null) { Logger.error(TAG, `getFileContent failed.resourceManager or fileName is null.fileName:${fileName}`); ...
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 getRawFileByContext AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Lef...
public static async getRawFileByContext(context: Context, fileName: string): Promise<string> { Logger.info(TAG, `getFileContent. fileName: ${fileName}`); if (context === null || fileName === null) { Logger.error(TAG, `getFileContent failed.resourceManager or fileName is null.fileName:${fileName}`); ...
https://gitee.com/openharmony/security_privacy_center.git
efcacd7ae9f0ad941a9a30df107c8bc33f2bcae3
gitee
aimilin6688/KeePassHO
entry/src/main/ets/common/utils/KdbxUtils.ets
arkts
toggleFavorite
切换条目或分组的收藏状态 @param item 条目或分组 @returns 切换后是否收藏
public static toggleFavorite(item: KdbxEntry | KdbxGroup): boolean { if (!item.tags) { item.tags = []; } const index = item.tags.indexOf(KdbxUtils.FAVORITE_TAG); if (index >= 0) { // 取消收藏 item.tags.splice(index, 1); return false; } else { // 收藏 item.tags.push(Kd...
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 toggleFavorite AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left item AST#identifier#Right AST#:#Left : A...
public static toggleFavorite(item: KdbxEntry | KdbxGroup): boolean { if (!item.tags) { item.tags = []; } const index = item.tags.indexOf(KdbxUtils.FAVORITE_TAG); if (index >= 0) { // 取消收藏 item.tags.splice(index, 1); return false; } else { // 收藏 item.tags.push(Kd...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/KdbxUtils.ets#L457-L471
59844096cd7b20feba534abd813730c1b9e3c796
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/ArrayBlockingQueue.ets
arkts
capacity
Returns the capacity of a BlockingQueue. @returns { int } the capacity of the BlockingQueue.
override get capacity(): int { return this.capacitySize; }
AST#program#Left AST#ERROR#Left AST#override#Left override AST#override#Right AST#identifier#Left get AST#identifier#Right AST#call_expression#Left AST#identifier#Left capacity AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L...
override get capacity(): int { return this.capacitySize; }
https://gitcode.com/iop123123/arkts-static-skills
0788a1d353b250af9e9f758c300061798f6bfe15
gitcode
erosTeam/NextE
shared/src/main/ets/backup/BackupPreferencesAdapter.ets
arkts
exportPreferences
Non-secret keys → plaintext section.
static async exportPreferences(context: common.UIAbilityContext): Promise<SettingsMap> { return BackupPreferencesAdapter.dump(context, false) }
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 exportPreferences AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Lef...
static async exportPreferences(context: common.UIAbilityContext): Promise<SettingsMap> { return BackupPreferencesAdapter.dump(context, false) }
https://github.com/erosTeam/NextE
ef1a5172de1a5ea946dd43f99adc94f1d70a87b8
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebDAV/WebDAVNativeTest.ets
arkts
initClient
初始化测试客户端
async initClient(config: WebDAVNativeConfig): Promise<boolean> { try { logger.info(TAG, '初始化测试客户端...'); this.client = createWebDAVNativeClient(config); const result = await this.client.initialize(); logger.info(TAG, `客户端初始化结果: ${result}`); return result; } catch (error) { l...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left initClient AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left config AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS...
async initClient(config: WebDAVNativeConfig): Promise<boolean> { try { logger.info(TAG, '初始化测试客户端...'); this.client = createWebDAVNativeClient(config); const result = await this.client.initialize(); logger.info(TAG, `客户端初始化结果: ${result}`); return result; } catch (error) { l...
https://github.com/DaLongZhuaZi/manxia
543e23b74d29d848405cee2f8d3aacf3a05687fc
github
yang-kun-long/HarmonyAccounting
entry/src/main/ets/view/DialogComponent.ets
arkts
aboutToAppear
准备出现时更新输入金额和当前账户类型 该方法在组件即将出现时调用,用于更新组件的内部状态 主要功能是将新账户对象中的金额和账户类型文本更新到组件的当前状态中
aboutToAppear() { // 将新账户的金额转换为字符串并赋值给输入金额 this.inputAmount = this.newAccount.amount.toString(); // 将新账户的账户类型赋值给当前索引 this.curIndex = this.newAccount.accountType; // 将新账户的类型文本赋值给当前类型 this.curType = this.newAccount.typeText; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left...
aboutToAppear() { // 将新账户的金额转换为字符串并赋值给输入金额 this.inputAmount = this.newAccount.amount.toString(); // 将新账户的账户类型赋值给当前索引 this.curIndex = this.newAccount.accountType; // 将新账户的类型文本赋值给当前类型 this.curType = this.newAccount.typeText; }
https://github.com/yang-kun-long/HarmonyAccounting
9dacadb762c78c08e185110d27d8edc43dca4109
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
set
Assigns val as element on insertPos. @description Added to avoid (un)packing a single value into array to use overloaded set(byte[], insertPos) @param val value to set @param insertPos index to change
public set(insertPos: number, val: number): void { this.set(insertPos as int, val as double as int as byte) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left insertPos AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#...
public set(insertPos: number, val: number): void { this.set(insertPos as int, val as double as int as byte) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
195ff6b3b3167e819ff9e622f42360b986485873
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Download/DownloadManager.ets
arkts
getEBookTasks
获取电子书下载任务列表
public getEBookTasks(): DownloadTaskInfo[] { return Array.from(this.tasks.values()).filter( (task: DownloadTaskInfo) => task.taskType === DownloadTaskType.EBOOK ); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getEBookTasks 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 Download...
public getEBookTasks(): DownloadTaskInfo[] { return Array.from(this.tasks.values()).filter( (task: DownloadTaskInfo) => task.taskType === DownloadTaskType.EBOOK ); }
https://github.com/DaLongZhuaZi/manxia
3487dd6b36060b84117396d30b21f9575b0a40d2
github
LJ666-ui/harmony-health-care
entry/src/main/ets/ar/ARNavigationService.ets
arkts
removeEventListener
移除事件监听器
public removeEventListener( type: NavigationEventType, listener: (event: NavigationEvent) => void ): void { const listeners = this.eventListeners.get(type); if (listeners) { const index = listeners.indexOf(listener); if (index !== -1) { listeners.splice(index, 1); } } ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left removeEventListener AST#identifier#Right AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left NavigationEventType AST#identifier#Right...
public removeEventListener( type: NavigationEventType, listener: (event: NavigationEvent) => void ): void { const listeners = this.eventListeners.get(type); if (listeners) { const index = listeners.indexOf(listener); if (index !== -1) { listeners.splice(index, 1); } } ...
https://github.com/LJ666-ui/harmony-health-care
8fae3170836f1a2503c82d7484e7b76625aa5be8
github
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnSwitchViewModel.ets
arkts
aboutToDisappear
页面隐藏前清除定时器,防止页面销毁后回调执行
override aboutToDisappear(): void { this.clearLoadingTimer(); }
AST#program#Left AST#ERROR#Left AST#override#Left override AST#override#Right AST#call_expression#Left AST#identifier#Left aboutToDisappear 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...
override aboutToDisappear(): void { this.clearLoadingTimer(); }
https://github.com/codelably/tuniao-ui
3a1e1c4518fa59a4ff1af157e4b864254a79be58
github
Amaz1ny/HarmonyDO-public
entry/src/main/ets/models/Category.ets
arkts
colorValue
获取颜色值(带 # 前缀)
get colorValue(): string { return `#${this.color}`; }
AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left colorValue 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 ...
get colorValue(): string { return `#${this.color}`; }
https://github.com/Amaz1ny/HarmonyDO-public
4dc734db0edc286de55538dee96cc8829b406495
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebDAV/WebDAVAutoBackupScheduler.ets
arkts
startPeriodicCheck
启动定时检查
private startPeriodicCheck(): void { if (this.checkIntervalId !== null) { clearInterval(this.checkIntervalId); } // 每小时检查一次是否需要备份 const checkInterval = 60 * 60 * 1000; // 1小时 this.checkIntervalId = setInterval(() => { this.checkAndExecuteBackup(); }, checkInterval); l...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left startPeriodicCheck 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 A...
private startPeriodicCheck(): void { if (this.checkIntervalId !== null) { clearInterval(this.checkIntervalId); } // 每小时检查一次是否需要备份 const checkInterval = 60 * 60 * 1000; // 1小时 this.checkIntervalId = setInterval(() => { this.checkAndExecuteBackup(); }, checkInterval); l...
https://github.com/DaLongZhuaZi/manxia
c6efa76eb9e8eb4922c5b2856710b20109629756
github