nwo
stringclasses
449 values
path
stringlengths
9
173
language
stringclasses
1 value
identifier
stringlengths
1
53
docstring
stringlengths
5
4.13k
function
stringlengths
10
87.2k
ast_function
stringlengths
351
354k
obf_function
stringlengths
10
87.2k
url
stringlengths
30
175
function_sha
stringlengths
40
40
source
stringclasses
3 values
openharmony-sig/FastBle
library/src/main/ets/bluetooth/BleConnector.ets
arkts
setCharacteristicNotification
notify setting
private setCharacteristicNotification(gatt: ble.GattClientDevice | null, characteristic: ble.BLECharacteristic, useCharacteristicDescriptor: boolean, enable: boolean, ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left setCharacteristicNotification AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left gatt AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST...
private setCharacteristicNotification(gatt: ble.GattClientDevice | null, characteristic: ble.BLECharacteristic, useCharacteristicDescriptor: boolean, enable: boolean, ...
https://gitee.com/openharmony-sig/FastBle.git
4b05ddd7234bc9342863256476d8e847381d6726
gitee
OHPG/FinMusic
entry/src/main/ets/player/LyricCache.ets
arkts
resolveWithCache
持久化模式:优先读缓存,未命中则拉取并写入
private async resolveWithCache(itemId: string, fetcher: () => Promise<LyricDto | undefined>): Promise<string | undefined> { let filePath = `${this.lrcDir}/${itemId}.lrc` // 缓存命中 if (FileTool.exists(filePath)) { return filePath } // 拉取并写入 return this.fetchAndWrite(filePath, fetcher) }
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 resolveWithCache AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left itemId AST#identifier#Right AST#:#Le...
private async resolveWithCache(itemId: string, fetcher: () => Promise<LyricDto | undefined>): Promise<string | undefined> { let filePath = `${this.lrcDir}/${itemId}.lrc` // 缓存命中 if (FileTool.exists(filePath)) { return filePath } // 拉取并写入 return this.fetchAndWrite(filePath, fetcher) }
https://github.com/OHPG/FinMusic
87843bc26b72ef895a4c9c4a7668cf30b0f08502
github
RedRackham-R/WanAndroidHarmoney
entry/src/main/ets/net/wanAPI/WanHttpClient.ets
arkts
coinList
获取个人积分获取列表,需要登录后访问 https://www.wanandroid.com//lg/coin/list/1/json @param index 下标从1开始 @returns
public coinList(index: number): Promise<AxiosResponse<IWanCommonResponse<IWanCommonListData<ICoinListInfo>>>> { return this.getRequest("/lg/coin/list/" + index + "/json") }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left coinList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number...
public coinList(index: number): Promise<AxiosResponse<IWanCommonResponse<IWanCommonListData<ICoinListInfo>>>> { return this.getRequest("/lg/coin/list/" + index + "/json") }
https://github.com/RedRackham-R/WanAndroidHarmoney
7f3ab175dab1e35e176cb40905580dc833bed7e5
github
David8Idira/AI-OA
packages/harmonyos/commons/src/main/ets/services/ApprovalService.ets
arkts
reject
拒绝审批 @param approvalId 审批ID @param nodeId 节点ID @param comment 拒绝原因
async reject(approvalId: string, nodeId: string, comment?: string): Promise<ApiResponse<any>> { return this.approvalAction({ approvalId, nodeId, action: 'reject', comment }) }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left reject AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left approvalId AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS...
async reject(approvalId: string, nodeId: string, comment?: string): Promise<ApiResponse<any>> { return this.approvalAction({ approvalId, nodeId, action: 'reject', comment }) }
https://github.com/David8Idira/AI-OA
dc432c89fc580d8b122e7e26a971d8c7a56018bf
github
xblLab/HarmonyProjectTemplate
commons/lib_account/src/main/ets/services/AccountApi.ets
arkts
getPrivacyInfo
查询隐私协议内容 @returns
public getPrivacyInfo() { return ProtocolData.privacyProtocol; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getPrivacyInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left ...
public getPrivacyInfo() { return ProtocolData.privacyProtocol; }
https://github.com/xblLab/HarmonyProjectTemplate
8f6ab8cd34bf9da836b639d5ab6fb31205302294
github
David8Idira/AI-OA
packages/harmonyos/commons/src/main/ets/services/AttendanceService.ets
arkts
applyLeave
============ 请假相关 ============ 申请请假 @param params 请假参数
async applyLeave(params: ApplyLeaveParams): Promise<ApiResponse<{ leaveId: string; approvalId?: string }>> { return this.client.post<{ leaveId: string; approvalId?: string }>('/api/v1/attendance/leave', params) }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left applyLeave AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left params AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS...
async applyLeave(params: ApplyLeaveParams): Promise<ApiResponse<{ leaveId: string; approvalId?: string }>> { return this.client.post<{ leaveId: string; approvalId?: string }>('/api/v1/attendance/leave', params) }
https://github.com/David8Idira/AI-OA
a90853659ff3a7fb075af295b0620ca83434d618
github
apap6628114/nga_oh
entry/src/main/ets/common/managers/ReplyManager.ets
arkts
compressImage
压缩图片(当前未实现,直接透传原数据)
async compressImage(data: ArrayBuffer): Promise<ArrayBuffer> { return data }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left compressImage AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left data AST#identifier#Right AST#type_annotation#Left AST#:#Left : A...
async compressImage(data: ArrayBuffer): Promise<ArrayBuffer> { return data }
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/common/managers/ReplyManager.ets#L263-L265
fd6d6922e94264b979b35e96c0bba208d18f2752
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoSourceParser.ets
arkts
parseBookSourceType
解析书源类型
private parseBookSourceType(type: ESObject): LegadoBookSourceType { if (typeof type === 'number') { switch (type) { case 0: return LegadoBookSourceType.TEXT; case 1: return LegadoBookSourceType.AUDIO; case 2: return LegadoBookSourceType.IMAGE; case 3: return LegadoBookSourceT...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseBookSourceType 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#identifie...
private parseBookSourceType(type: ESObject): LegadoBookSourceType { if (typeof type === 'number') { switch (type) { case 0: return LegadoBookSourceType.TEXT; case 1: return LegadoBookSourceType.AUDIO; case 2: return LegadoBookSourceType.IMAGE; case 3: return LegadoBookSourceT...
https://github.com/DaLongZhuaZi/manxia
1b42cf8d24947bf066d55537fcb3b960e7035de0
github
ibestservices/ibest-ui
library/src/main/ets/components/picker/index.ets
arkts
setValueByIndex
根据索引设置value
setValueByIndex(){ this.value = this.getColumns().map((item, index) => item[this.indexArr[index]]?.value ?? "") }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setValueByIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Le...
setValueByIndex(){ this.value = this.getColumns().map((item, index) => item[this.indexArr[index]]?.value ?? "") }
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/picker/index.ets#L551-L553
da38be54b7bb3a783c7e5bf4b38ebd08237b0e82
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/PieDataSet.ets
arkts
getValueLineWidth
When valuePosition is OutsideSlice, indicates line width @Override
public getValueLineWidth(): number { return this.mValueLineWidth; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getValueLineWidth 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 A...
public getValueLineWidth(): number { return this.mValueLineWidth; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
d4c27a1e7a13f8c3fbc7dd13810f7fa0d3f6a06d
gitee
nyzhhd/HMMusic
entry/src/main/ets/Utils/AVPlayerManager.ets
arkts
removeSong
列表移除歌曲
removeSong(index: number) { if (index == this.currentSong.playIndex) { // 删除的是正在播放的歌曲 if (this.currentSong.playList.length > 1) { // 列表里面有多首歌 this.currentSong.playList.splice(index, 1) if (this.currentSong.playIndex >= this.currentSong.playList.length) { this.currentS...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left removeSong 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#Right A...
removeSong(index: number) { if (index == this.currentSong.playIndex) { // 删除的是正在播放的歌曲 if (this.currentSong.playList.length > 1) { // 列表里面有多首歌 this.currentSong.playList.splice(index, 1) if (this.currentSong.playIndex >= this.currentSong.playList.length) { this.currentS...
https://github.com/nyzhhd/HMMusic
c0d4ad88a57e8853a58fd8a640a96a4c31627567
github
HarmonyOS_Codelabs/arkts-intermediate-syntax
entry/src/main/ets/model/SmartLock.ets
arkts
turnOff
实现抽象方法:关锁逻辑 延迟时间较短(100ms),符合锁具的实际响应速度
async turnOff(): Promise<void> { try { await delay(100); this.status = 'off'; logAction(`${this.getInfo()} 已关锁`); } catch(error) { console.error(`error: ${(error as Error).message}`); } }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left turnOff 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_type...
async turnOff(): Promise<void> { try { await delay(100); this.status = 'off'; logAction(`${this.getInfo()} 已关锁`); } catch(error) { console.error(`error: ${(error as Error).message}`); } }
https://gitcode.com/HarmonyOS_Codelabs/arkts-intermediate-syntax
d0df6e0c33033dbbd526164411db3225f6ef1efd
gitcode
erosTeam/NextE
feature/user/src/main/ets/viewmodel/FavoritesViewModel.ets
arkts
seedFavList
Seed selector metadata from the shared restored snapshot before the first network response.
seedFavList(favcats: Favcat[]): void { if (this.favList.length === 0 && favcats.length > 0) { this.mergeFavList(favcats) } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left seedFavList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left favcats AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left Favcat AST#...
seedFavList(favcats: Favcat[]): void { if (this.favList.length === 0 && favcats.length > 0) { this.mergeFavList(favcats) } }
https://github.com/erosTeam/NextE
c4a20958025765ea3ee95670c1bab9b899004fb1
github
tdcare/tdwebrtc
src/main/ets/MediaStream.ets
arkts
startPeriodicPliRequests
v30b: PLI 定时请求已移除(确认 Android 不响应 PLI) 保留空方法避免其他代码调用报错
private startPeriodicPliRequests(): void { // no-op: Android 不响应 PLI }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left startPeriodicPliRequests 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 startPeriodicPliRequests(): void { // no-op: Android 不响应 PLI }
https://github.com/tdcare/tdwebrtc
554eea61c150e908e8711d46078abf14b7cb6068
github
pangpang20/antennaPodHM
entry/src/main/ets/service/DatabaseService.ets
arkts
checkAndMigrateDatabase
检查并执行数据库迁移
private async checkAndMigrateDatabase(): Promise<void> { if (!this.rdbStore) return; try { // 获取当前数据库版本 const currentVersion = await this.getDatabaseVersion(); const targetVersion = Constants.DB_VERSION; console.info(`[DatabaseService] Current DB version: ${currentVersion}, Target ve...
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 checkAndMigrateDatabase AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression...
private async checkAndMigrateDatabase(): Promise<void> { if (!this.rdbStore) return; try { // 获取当前数据库版本 const currentVersion = await this.getDatabaseVersion(); const targetVersion = Constants.DB_VERSION; console.info(`[DatabaseService] Current DB version: ${currentVersion}, Target ve...
https://github.com/pangpang20/antennaPodHM
dba7789a082b6f84daa214190e73fd0d42b21daa
github
wuba/omni-ui
omni_component/src/main/ets/components/popup/OmniPopup.ets
arkts
setDismissOnBackPressed
全局设置-设置是否支持按返回键关闭弹窗 @param dismiss @returns
static setDismissOnBackPressed(dismiss: boolean) { Config.dismissOnBackPressed = dismiss }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setDismissOnBackPressed AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dismiss AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ident...
static setDismissOnBackPressed(dismiss: boolean) { Config.dismissOnBackPressed = dismiss }
https://github.com/wuba/omni-ui
dfd78d82bb733e50eec35ebc9ff2ac628544a98c
github
Cool_foolisher1/ArkTSRepository
GraphicalCode/commons/src/main/ets/viewmodel/BaseHomeViewModel.ets
arkts
handleColorModeChange
监听颜色模式变化 @param offsetParam OffsetParam
protected handleColorModeChange(offsetParam: OffsetParam) { const pageContextManager: PageContextManager = AppStorage.get(StorageKeyEnum.HOME_PAGE_CONTEXT) as PageContextManager if (pageContextManager.navPathStack.size() > 1) { return } const isDark: boolean = AppStorage.get(StorageK...
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left handleColorModeChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left offsetParam AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Righ...
protected handleColorModeChange(offsetParam: OffsetParam) { const pageContextManager: PageContextManager = AppStorage.get(StorageKeyEnum.HOME_PAGE_CONTEXT) as PageContextManager if (pageContextManager.navPathStack.size() > 1) { return } const isDark: boolean = AppStorage.get(StorageK...
https://gitcode.com/Cool_foolisher1/ArkTSRepository
8e4ddb3b41f64a4eed592c8ce1888754b53868fa
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
set
Copies all elements of arr to the current Uint8ClampedArray starting from insertPos. @param arr array to copy data from @param insertPos start index where data from arr will be inserted {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set}
public set(arr: number[], insertPos1: number): void { const insertPos = insertPos1 as int if (insertPos < 0 || insertPos + arr.length > this.length) { throw new RangeError("set(insertPos: int, arr: number[]): size of arr is greater than Uint8ClampedArray.length") } for (l...
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: number[], insertPos1: number): void { const insertPos = insertPos1 as int if (insertPos < 0 || insertPos + arr.length > this.length) { throw new RangeError("set(insertPos: int, arr: number[]): size of arr is greater than Uint8ClampedArray.length") } for (l...
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
018f31a22f97b387d0cd6bb07cdc1bfb8c1f6725
gitee
honjow/Next2V
feature/detail/src/main/ets/viewmodel/DetailViewModel.ets
arkts
publishVisibleReplies
Single chokepoint for pushing the visible list into the LazyForEach data source: any publish brings the on-screen list, the floor-lookup snapshot, and the loaded-count text back in sync with this.replies, so the held flag must clear here.
private publishVisibleReplies(): void { this.heldRepliesPublish = false this.publishedReplies = this.replies const visibleReplies = this.getVisibleReplies() this.refreshHotReplyCandidates() this.replyDataSource.setData(visibleReplies) this.repliesLoaded = this.replies.length }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left publishVisibleReplies AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right A...
private publishVisibleReplies(): void { this.heldRepliesPublish = false this.publishedReplies = this.replies const visibleReplies = this.getVisibleReplies() this.refreshHotReplyCandidates() this.replyDataSource.setData(visibleReplies) this.repliesLoaded = this.replies.length }
https://github.com/honjow/Next2V
bd4bfe5c42923cf78a07cc6615ee98b6c0ad8a24
github
LJ666-ui/harmony-health-care
entry/src/main/ets/ar/ARNavigationService.ets
arkts
constructor
私有构造函数(单例模式)
private constructor() { this.pathPlanner = PathPlanner.getInstance(); this.indoorLocator = IndoorLocator.getInstance(); this.arRenderer = ARRenderer.getInstance(); this.voiceGuide = VoiceGuide.getInstance(); this.navigationState = this.initNavigationState(); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left ...
private constructor() { this.pathPlanner = PathPlanner.getInstance(); this.indoorLocator = IndoorLocator.getInstance(); this.arRenderer = ARRenderer.getInstance(); this.voiceGuide = VoiceGuide.getInstance(); this.navigationState = this.initNavigationState(); }
https://github.com/LJ666-ui/harmony-health-care
f564e0bbd78b75b50a07d9b9892e9f7059469db6
github
openharmony/codelabs
ETSUI/CanvasComponent/entry/src/main/ets/pages/CanvasPage.ets
arkts
startAnimator
Start animator.
startAnimator() { let randomAngle = Math.round(Math.random() * CommonConstants.CIRCLE); // Obtaining prize information. this.prizeData = this.drawModel.showPrizeData(randomAngle); animateTo({ duration: CommonConstants.DURATION, curve: Curve.Ease, delay: 0, iterations: 1, ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left startAnimator 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...
startAnimator() { let randomAngle = Math.round(Math.random() * CommonConstants.CIRCLE); // Obtaining prize information. this.prizeData = this.drawModel.showPrizeData(randomAngle); animateTo({ duration: CommonConstants.DURATION, curve: Curve.Ease, delay: 0, iterations: 1, ...
https://gitee.com/openharmony/codelabs.git
a6a54e7cb2caed8ffc08d24cd00a8e14b6c9c43b
gitee
dingzhilin1990/zhilinclaw
src/security/OAuthGateway.ets
arkts
revokeSession
撤销会话(登出) @param providerId 提供商 ID
public async revokeSession(providerId: string): Promise<boolean> { const session = this.sessions.get(providerId); if (!session) { return false; } // 实际项目中应调用提供商的撤销端点 this.sessions.delete(providerId); // 记录审计日志 await this.securityContext.log({ action: 'revoke_session', e...
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 revokeSession AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left providerId AST#identifier#Right AST#ERROR#Left AST#:#Left...
public async revokeSession(providerId: string): Promise<boolean> { const session = this.sessions.get(providerId); if (!session) { return false; } // 实际项目中应调用提供商的撤销端点 this.sessions.delete(providerId); // 记录审计日志 await this.securityContext.log({ action: 'revoke_session', e...
https://github.com/dingzhilin1990/zhilinclaw
5fca38ef62c79e6e2f5a7e11d5dffd89896713a5
github
Nekofox-POT/LinMusic
entry/src/main/ets/package/files_manager/class_files_manager.ets
arkts
merge_map
文件管理器目录 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 函数库 // //////// Map整合(带自动排序) //
function merge_map(map_a: Map<string, string[]>, map_b: Map<string, string[]>): Map<string, string[]> { // 环境准备 // let tmp_map = new Map<string, string[]>() let result_map = new Map<string, string[]>() // 遍历A // map_a.forEach((value, key) => { if (!tmp_map.has(key)) { tmp_map.set(key, []) } ...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left merge_map AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left map_a AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right...
function merge_map(map_a: Map<string, string[]>, map_b: Map<string, string[]>): Map<string, string[]> { // 环境准备 // let tmp_map = new Map<string, string[]>() let result_map = new Map<string, string[]>() // 遍历A // map_a.forEach((value, key) => { if (!tmp_map.has(key)) { tmp_map.set(key, []) } ...
https://github.com/Nekofox-POT/LinMusic
c5e210d0d8b63d9432cfeb6d57d99788c8f4c2c3
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/UserSessionService.ets
arkts
getCurrentSession
获取当前会话信息 @returns 会话信息,未登录返回null
static async getCurrentSession(): Promise<SessionInfo | null> { // 如果内存中有会话,直接返回 if (UserSessionService.currentSession) { // 检查会话是否过期 if (UserSessionService.isSessionExpired()) { await UserSessionService.logout(); return null; } // 更新最后活跃时间 UserSessionService.curr...
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 getCurrentSession AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS...
static async getCurrentSession(): Promise<SessionInfo | null> { // 如果内存中有会话,直接返回 if (UserSessionService.currentSession) { // 检查会话是否过期 if (UserSessionService.isSessionExpired()) { await UserSessionService.logout(); return null; } // 更新最后活跃时间 UserSessionService.curr...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
59053b00ac9a3ef77d3b529cd0ccc53b9103fb74
github
openharmony/applications_call
entry/src/main/ets/common/components/FuncBtnGroup.ets
arkts
getBtnListCall
Get BtnList Based on CallStatus
getBtnListCall() { this.btnListDialing = this.mClone.clone(this.mBtnGroupConfig.btnGroupList); this.btnListDialing[1].isDisable = true this.btnListDialing[2].isDisable = true }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getBtnListCall AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Lef...
getBtnListCall() { this.btnListDialing = this.mClone.clone(this.mBtnGroupConfig.btnGroupList); this.btnListDialing[1].isDisable = true this.btnListDialing[2].isDisable = true }
https://gitee.com/openharmony/applications_call.git
39dce0cbd409d052fd50ba5387daf8d965f2b6e1
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Utils/WidgetDataSync.ets
arkts
buildFormData
构建卡片数据
private buildFormData(formId: string, dimension: number, dataStr: string): FormUpdateData { let goals: ReadingGoalData = { mangaGoalMinutes: 0, mangaReadMinutes: 0, ebookGoalMinutes: 0, ebookReadMinutes: 0, novelGoalMinutes: 0, novelReadMinutes: 0 }; let recentReads: RecentReadItem[] = [...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildFormData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left formId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le...
private buildFormData(formId: string, dimension: number, dataStr: string): FormUpdateData { let goals: ReadingGoalData = { mangaGoalMinutes: 0, mangaReadMinutes: 0, ebookGoalMinutes: 0, ebookReadMinutes: 0, novelGoalMinutes: 0, novelReadMinutes: 0 }; let recentReads: RecentReadItem[] = [...
https://github.com/DaLongZhuaZi/manxia
faee6d96d802d76fbf482efedf9a8ee808a63f47
github
Nekofox-POT/LinMusic
entry/src/main/ets/pages/setting/setting_about.ets
arkts
build
继承池 // //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 基础函数 // ////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// UI构建 // /////////
build() { Column() { Scroll() { Column() { // ---- 间隔 ---- Blank('56vp') // ---- 应用图标 ---- Image($r('app.media.icon_round')) .width('80vp').height('80vp') .borderRadius('18vp') Blank('16vp') // ---- 应用名称 ---- ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST...
build() { Column() { Scroll() { Column() { // ---- 间隔 ---- Blank('56vp') // ---- 应用图标 ---- Image($r('app.media.icon_round')) .width('80vp').height('80vp') .borderRadius('18vp') Blank('16vp') // ---- 应用名称 ---- ...
https://github.com/Nekofox-POT/LinMusic
9cd790feb8b2aee68bc373b56add2d89ef8a41e7
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/model/EventSourcing.ets
arkts
createCategorySnapshot
创建Category快照 @param category 分类对象 @param version 版本号
static createCategorySnapshot(category: Category, version: number): AggregateSnapshot { const categoryJson = JSON.stringify(category.toJSON()); return new AggregateSnapshot( 0, AGGREGATE_TYPE_CATEGORY, category.categoryId, version, categoryJson, '' ); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createCategorySnapshot AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left category AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ident...
static createCategorySnapshot(category: Category, version: number): AggregateSnapshot { const categoryJson = JSON.stringify(category.toJSON()); return new AggregateSnapshot( 0, AGGREGATE_TYPE_CATEGORY, category.categoryId, version, categoryJson, '' ); }
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
699c3fc28b4ca0a0be4d9e9116b549cf0ead957e
github
Yebingiscn/SweetVideo
entry/src/main/ets/utils/PiPWindowUtil.ets
arkts
disableAutoStart
在不希望触发画中画的场景(暂停、停止、离开页面等)关闭自动画中画。
static disableAutoStart() { if (PiPWindowUtil.pipController) { PiPWindowUtil.pipController.setAutoStartEnabled(false) } }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left disableAutoStart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Lef...
static disableAutoStart() { if (PiPWindowUtil.pipController) { PiPWindowUtil.pipController.setAutoStartEnabled(false) } }
https://github.com/Yebingiscn/SweetVideo
f6b4be86fed9fe8fc635ecdfe4c25591946802cb
github
Countly/countly-sdk-hos
library/src/main/ets/internal/modules/ModuleSessions.ets
arkts
setOrientationBaselineEmitter
Wire the post-begin_session orientation baseline emitter. Called once by `CountlyInstance` during construction. Implementations should read the platform display, gate on `trackOrientationChanges` + registration state, and call `viewsModule.updateOrientation(mode, true)` , the `true` bypasses the dedupe so every begin_s...
public setOrientationBaselineEmitter(emitter: () => void): void { this.orientationBaselineEmitter = emitter; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left setOrientationBaselineEmitter AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left emitter AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST...
public setOrientationBaselineEmitter(emitter: () => void): void { this.orientationBaselineEmitter = emitter; }
https://github.com/Countly/countly-sdk-hos
9a07fdb05d0b65cc6b63c615fd9d7a947c89bac8
github
openharmony/applications_app_samples
code/BasicFeature/Ability/AbilityRuntime/entry/src/main/ets/abilitylifecyclecallback/AbilityLifecycleCallback.ets
arkts
onWillNewWant
注册监听应用上下文的生命周期后,在UIAbility的[onNewWant]触发前回调。
onWillNewWant(ability) { hilog.info(DOMAIN, TAG, 'AbilityLifecycleCallback onWillNewWant'); },
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onWillNewWant AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left ability AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#ex...
onWillNewWant(ability) { hilog.info(DOMAIN, TAG, 'AbilityLifecycleCallback onWillNewWant'); },
https://github.com/openharmony/applications_app_samples
c000ffbb3dbe1855e2c4f91492c579cc33939132
github
terryma2024/happyword
harmonyos/entry/src/main/ets/services/CocosBattleBridge.ets
arkts
handleReady
── Inbound handlers ─────────────────────────────────────────────────────── battle/ready acts as a full scene reset (contract README): re-send init + state + question every time, including the synthetic ready that CocosEngineHost replays on page re-entry.
private handleReady(): void { if (this.engine.getState().status === BattleStatus.Ready) { this.engine.start(); } this.ready = true; if (this.callbacks.onReady !== undefined) { this.callbacks.onReady(); } this.sendInit(); this.sendState(); this.sendQuestion(); this.maybe...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleReady 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#express...
private handleReady(): void { if (this.engine.getState().status === BattleStatus.Ready) { this.engine.start(); } this.ready = true; if (this.callbacks.onReady !== undefined) { this.callbacks.onReady(); } this.sendInit(); this.sendState(); this.sendQuestion(); this.maybe...
https://github.com/terryma2024/happyword
52878e36337cd7303bfe1f116d5fb6e097a715ad
github
openharmony/codelabs
ETSUI/MemoTime/entry/src/main/ets/service/NotificationService.ets
arkts
sendTestNotification
发送即时测试通知
async sendTestNotification(): Promise<boolean> { if (!this.isEnabled) { Logger.warn(TAG, 'Notification is not enabled') return false } try { const notificationRequest: notificationManager.NotificationRequest = { id: Date.now() % 100000, content: { notificationC...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left sendTestNotification AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation...
async sendTestNotification(): Promise<boolean> { if (!this.isEnabled) { Logger.warn(TAG, 'Notification is not enabled') return false } try { const notificationRequest: notificationManager.NotificationRequest = { id: Date.now() % 100000, content: { notificationC...
https://gitcode.com/openharmony/codelabs
23baada362806787c99659b1941411bff71822c8
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Theme/ThemeColors.ets
arkts
updateColors
更新所有颜色值
updateColors(): void { const themeManager = ThemeManager.getInstance(); this.theme = themeManager.getActualThemeSync(); this.isDark = this.theme === ThemeType.DARK || this.theme === ThemeType.PRIVACY; // 主色系 this.primary = AppColors.primary; this.onPrimary = AppColors.onPrimary; this....
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateColors 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...
updateColors(): void { const themeManager = ThemeManager.getInstance(); this.theme = themeManager.getActualThemeSync(); this.isDark = this.theme === ThemeType.DARK || this.theme === ThemeType.PRIVACY; // 主色系 this.primary = AppColors.primary; this.onPrimary = AppColors.onPrimary; this....
https://github.com/DaLongZhuaZi/manxia
09a3c6cee8e885d7addc8fdbc22303947a0e90a8
github
awaLiny2333/Renameow
honk/src/main/ets/hosts/meowHonk.ets
arkts
dateFormatter
格式化日期对象为字符串。 @param d - 要格式化的日期对象。 @param dateCustomFormat - 是否使用自定义格式。如果为 true,则使用 textContent 参数作为格式模板;否则使用默认的 '$y-$m-$d' 格式。 @param textContent - 自定义格式字符串,可以包含占位符 '$y'(年份)、'$m'(月份)、'$d'(日期)。仅在 dateCustomFormat 为 true 时有效。 @param dateFixedLength - 是否将月份和日期格式化为固定两位长度。如果为 true,则月份和日期不足两位时补前导零。 @returns 格式化后的日期字符串。 @exa...
function dateFormatter(d: Date, dateCustomFormat: boolean, textContent: string, dateFixedLength: boolean) { let year = d.getFullYear().toString(); let month = (d.getMonth() + 1).toString(); let day = d.getDate().toString(); if (dateFixedLength) { month = month.length === 1 ? '0' + month : month; day = ...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left dateFormatter AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left d AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right...
function dateFormatter(d: Date, dateCustomFormat: boolean, textContent: string, dateFixedLength: boolean) { let year = d.getFullYear().toString(); let month = (d.getMonth() + 1).toString(); let day = d.getDate().toString(); if (dateFixedLength) { month = month.length === 1 ? '0' + month : month; day = ...
https://github.com/awaLiny2333/Renameow/blob/34617cc8dc8596061456d226ee717517ff41d25a/honk/src/main/ets/hosts/meowHonk.ets#L324-L347
71d5e7494359f7ed68c3d7cc67b8643606bb585d
github
openharmony/applications_contacts
entry/src/main/ets/presenter/contact/batchselectcontacts/BatchSelectContactsPresenter.ets
arkts
refreshPageMessage
Header Count Refresh Function
refreshPageMessage() { HiLog.i(TAG, 'refreshPageMessage start !') this.selectCount = this.selectedNumberMap.size; if (this.selectedNumberMap.size > 0) { this.selectDisabled = false; this.checkAllClickButtonStyle(); } else { this.selectDisabled = true; this.isSelectAll = false; ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left refreshPageMessage 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...
refreshPageMessage() { HiLog.i(TAG, 'refreshPageMessage start !') this.selectCount = this.selectedNumberMap.size; if (this.selectedNumberMap.size > 0) { this.selectDisabled = false; this.checkAllClickButtonStyle(); } else { this.selectDisabled = true; this.isSelectAll = false; ...
https://gitee.com/openharmony/applications_contacts.git
47d5494cd12703f3cb6c906c28190286301c0124
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Plugin/HSPPluginManager.ets
arkts
loadPluginConfig
加载插件配置
private async loadPluginConfig(moduleName: string): Promise<PluginConfig | null> { try { // 从HSP模块的资源中读取配置文件 const configPath = `@bundle:${moduleName}/resources/rawfile/plugin.json`; // 这里需要使用资源管理器API来读取HSP模块的资源 // 由于HarmonyOS的资源管理API限制,这里使用模拟实现 const mockConfig: PluginConfig ...
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 loadPluginConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left moduleName AST#identifier#Right AST#ERROR#Left AST#...
private async loadPluginConfig(moduleName: string): Promise<PluginConfig | null> { try { // 从HSP模块的资源中读取配置文件 const configPath = `@bundle:${moduleName}/resources/rawfile/plugin.json`; // 这里需要使用资源管理器API来读取HSP模块的资源 // 由于HarmonyOS的资源管理API限制,这里使用模拟实现 const mockConfig: PluginConfig ...
https://github.com/DaLongZhuaZi/manxia
03ada61cf4b34250b1f22d082b72bd66a9c59f17
github
Kira-Yagami-Light/Kira-Projects
TodoTask/entry/src/main/ets/data/database/CategoryDao.ets
arkts
deleteById
根据 ID 删除分类 @param id 分类 ID @returns Promise<number> 删除的行数
async deleteById(id: number): Promise<number> { const store = this.dbHelper.getRdbStore(); if (!store) { Logger.error(this.LOG_TAG, 'RdbStore is null'); throw new Error('Database not initialized'); } try { const predicates = new relationalStore.RdbPredicates(this.tableName); p...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left deleteById AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#...
async deleteById(id: number): Promise<number> { const store = this.dbHelper.getRdbStore(); if (!store) { Logger.error(this.LOG_TAG, 'RdbStore is null'); throw new Error('Database not initialized'); } try { const predicates = new relationalStore.RdbPredicates(this.tableName); p...
https://github.com/Kira-Yagami-Light/Kira-Projects
a4e39eed720051a8c07dc1728d740b1156543f04
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Jsonx.ets
arkts
setElement
Sets a JSON element in an object by key. @param {string} key - The key to set @param {JsonElement} value - The JSON element to set @throws {JsonTypeError} If this element is not an object
setElement(key: string, value: JsonElement): void { if (this.jsonType != JsonType.JsonObject) { this.setUndefined(); this.maybeObjectValues = new Map<string, JsonElement>(); } this.maybeObjectValues!.set(key, value) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setElement AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,...
setElement(key: string, value: JsonElement): void { if (this.jsonType != JsonType.JsonObject) { this.setUndefined(); this.maybeObjectValues = new Map<string, JsonElement>(); } this.maybeObjectValues!.set(key, value) }
https://gitcode.com/iop123123/arkts-static-skills
ead3da5a973faf34be3a55d7c140d129ead29d97
gitcode
openharmony/arkcompiler_taihe_ffi_gen
test/ani_union/user/main.ets
arkts
test_interface_Union_primitives1
定义 10 个测试函数
function test_interface_Union_primitives1() { let instance: UnionTest1.MyInterface = UnionTest1.getInterface(); instance.funcUnionPrimitive("Hello", true); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left test_interface_Union_primitives1 AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AST#{#Righ...
function test_interface_Union_primitives1() { let instance: UnionTest1.MyInterface = UnionTest1.getInterface(); instance.funcUnionPrimitive("Hello", true); }
https://gitcode.com/openharmony/arkcompiler_taihe_ffi_gen
c851142651ca6806e94c90f2b01dcdad64a4f5d4
gitcode
openharmony-sig/flutter_plus_plugins
packages/sensors_plus/sensors_plus/ohos/ohos/src/main/ets/components/plugin/SensorsPlusOhosPlugin.ets
arkts
listenLinearAccelerometer
user加速度计传感器
private listenLinearAccelerometer(): void { try { sensor.on(sensor.SensorId.LINEAR_ACCELEROMETER, (data: sensor.LinearAccelerometerResponse) => { if (this.event) { let arr: Array<number> = [3]; arr[0] = data.x; arr[1] = data.y; arr[2] = data.z; if (N...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left listenLinearAccelerometer 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#Rig...
private listenLinearAccelerometer(): void { try { sensor.on(sensor.SensorId.LINEAR_ACCELEROMETER, (data: sensor.LinearAccelerometerResponse) => { if (this.event) { let arr: Array<number> = [3]; arr[0] = data.x; arr[1] = data.y; arr[2] = data.z; if (N...
https://gitee.com/openharmony-sig/flutter_plus_plugins.git
03f949f1e7d8ec735ee83cebf7120294aaa4dd5b
gitee
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/GamepadManager.ets
arkts
scheduleGCAxisFlush
调度一次轴状态合并发送(同一 event loop tick 内多次轴回调只发 1 次,与 Android 一次 MotionEvent 一发一致)
private scheduleGCAxisFlush(): void { if (this.gcAxisFlushTimerId !== -1) { return; } this.gcAxisFlushTimerId = setTimeout(() => { this.gcAxisFlushTimerId = -1; this.flushGCAxisPending(); }, 0); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left scheduleGCAxisFlush 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...
private scheduleGCAxisFlush(): void { if (this.gcAxisFlushTimerId !== -1) { return; } this.gcAxisFlushTimerId = setTimeout(() => { this.gcAxisFlushTimerId = -1; this.flushGCAxisPending(); }, 0); }
https://github.com/AlkaidLab/moonlight-harmony
1c2967ce602948c56ebad30fabf44de023cf9755
github
offlinecat-dev/OCNetORM
src/main/ets/query/RelationLoadResult.ets
arkts
createFailure
创建失败的关联加载结果 @param relationName 关联名称 @param errorMessage 错误信息 @param duration 加载耗时(毫秒) @returns RelationLoadResult 实例
static createFailure(relationName: string, errorMessage: string, duration: number = 0): RelationLoadResult { const result = new RelationLoadResult(relationName) result.success = false result.errorMessage = errorMessage result.duration = duration return result }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createFailure AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left relationName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#str...
static createFailure(relationName: string, errorMessage: string, duration: number = 0): RelationLoadResult { const result = new RelationLoadResult(relationName) result.success = false result.errorMessage = errorMessage result.duration = duration return result }
https://github.com/offlinecat-dev/OCNetORM
a250bbe22e681b0278c09ae05886ee8f817eb016
github
Cool_foolisher1/ArkTSRepository
RandomNumberSimulator/entry/src/main/ets/components/random/RandomNumber.ets
arkts
fontSizeAndColorText
设置Text文本的字体大小和字体颜色 @param fontSize 字体大小 @param fontColor 字体颜色
@Extend(Text) function fontSizeAndColorText(fontSize: string | number | Resource, fontColor: ResourceColor) { .fontSize(fontSize) .fontColor(fontColor) .textAlign(TextAlign.Center) }
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#call_expression#Left AST#identifier#Left Extend AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left Text AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#R...
@Extend(Text) function fontSizeAndColorText(fontSize: string | number | Resource, fontColor: ResourceColor) { .fontSize(fontSize) .fontColor(fontColor) .textAlign(TextAlign.Center) }
https://gitcode.com/Cool_foolisher1/ArkTSRepository
aa1a901bfdeb30c69d99b113e94f6a3cc8fea079
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Task/BackgroundTaskManager.ets
arkts
flushProgressNotifications
串行刷新任务进度通知,避免旧通知在新通知之后落地,导致进度回退
private async flushProgressNotifications(task: InternalTask): Promise<void> { try { while (task.pendingProgressNotification) { if (task.status !== TaskStatus.RUNNING) { logger.info(TAG, `任务已不在运行态,丢弃残留进度通知:id=${task.id}`); task.pendingProgressNotification = undefined; br...
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 flushProgressNotifications AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left task AST#identifier#Right ...
private async flushProgressNotifications(task: InternalTask): Promise<void> { try { while (task.pendingProgressNotification) { if (task.status !== TaskStatus.RUNNING) { logger.info(TAG, `任务已不在运行态,丢弃残留进度通知:id=${task.id}`); task.pendingProgressNotification = undefined; br...
https://github.com/DaLongZhuaZi/manxia
5d2bf3290a463e2e2054f9bf677b212caf4e1395
github
openharmony-sig/ohos_axios
entry/src/main/ets/pages/Index.ets
arkts
settingResponseType
设置响应类型
settingResponseType() { this.clear() this.showUrl = this.getUrl this.startTime = new Date().getTime(); axios<string, AxiosResponse<string>, null>({ url: this.getUrl, method: 'get', responseType: 'array_buffer', connectTimeout: this.connectTimeout, readTimeout: this.readT...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left settingResponseType 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...
settingResponseType() { this.clear() this.showUrl = this.getUrl this.startTime = new Date().getTime(); axios<string, AxiosResponse<string>, null>({ url: this.getUrl, method: 'get', responseType: 'array_buffer', connectTimeout: this.connectTimeout, readTimeout: this.readT...
https://gitee.com/openharmony-sig/ohos_axios.git
635afd8aaa026ae5544a379e1ca16ecf09a17767
gitee
huaweicloud/huaweicloud-iot-device-sdk-arkts
huaweicloud_iot_device_library/src/main/ets/service/AbstractDevice.ets
arkts
addService
添加服务。用户基于AbstractService定义自己的设备服务,并添加到设备 @param serviceId 服务id,要和设备模型定义一致 @param deviceService 服务实例
public addService(serviceId: string, deviceService: AbstractService): void { deviceService.iotDevice = this; deviceService.serviceId = serviceId; if (!this.services.has(serviceId)) { this.services.set(serviceId, deviceService) } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addService AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left serviceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Ri...
public addService(serviceId: string, deviceService: AbstractService): void { deviceService.iotDevice = this; deviceService.serviceId = serviceId; if (!this.services.has(serviceId)) { this.services.set(serviceId, deviceService) } }
https://github.com/huaweicloud/huaweicloud-iot-device-sdk-arkts
2e8475d84aa5e721d9220b11e3b5d75ea3b777c5
github
XJTUWYD/ArkDiff
entry/src/main/ets/viewmodel/DiffSessionViewModel.ets
arkts
switchView
切换视图模式
switchView(mode: ViewMode): void { this.viewMode = mode; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left switchView AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left mode AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ViewMode AST#identifier#Right AST#)#Left ) AS...
switchView(mode: ViewMode): void { this.viewMode = mode; }
https://github.com/XJTUWYD/ArkDiff
a4fd64db221e93ec9682de69c4302bbdadc7ac87
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/WebViewContainerPage.ets
arkts
removeWebView
移除WebView
static removeWebView(sourceId: string): void { if (GlobalWebViewContainer.containerRef) { GlobalWebViewContainer.containerRef.removeWebView(sourceId); } else { logger.error(TAG, '容器引用未设置,无法移除WebView'); } }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left removeWebView AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#...
static removeWebView(sourceId: string): void { if (GlobalWebViewContainer.containerRef) { GlobalWebViewContainer.containerRef.removeWebView(sourceId); } else { logger.error(TAG, '容器引用未设置,无法移除WebView'); } }
https://github.com/DaLongZhuaZi/manxia
6fa7c400a9527fe4d9491c222b9e54e5d9224714
github
codelably/HCompass
packages/demo/src/main/ets/services/DemoNavSvcImpl.ets
arkts
toScreenAdaptDemo
跳转到屏幕适配示例页 @returns {void} 无返回值
toScreenAdaptDemo(): void { const navigation = getContainer().tryResolve<NavigationService>(CoreServiceKeys.NavigationService); navigation?.navigateTo(DemoRoutes.ScreenAdaptDemo); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toScreenAdaptDemo 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_...
toScreenAdaptDemo(): void { const navigation = getContainer().tryResolve<NavigationService>(CoreServiceKeys.NavigationService); navigation?.navigateTo(DemoRoutes.ScreenAdaptDemo); }
https://github.com/codelably/HCompass
fed8069eb93b4b49d3e58290bab7cd65203dea30
github
openharmony-sig/commons-cli
library/src/main/ets/components/cli/DefaultParser.ets
arkts
isLongOption
Tests if the token looks like a long option. @param token
private isLongOption(token: string): boolean{ if (token == null || !(token.indexOf("-") == 0) || token.length == 1) { return false; } let pos = token.indexOf("="); let t = pos == -1 ? token : token.substring(0, pos); if (!(this.getMatchingLongOptions(t).length() == 0)) { // long or p...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left isLongOption AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left token AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left...
private isLongOption(token: string): boolean{ if (token == null || !(token.indexOf("-") == 0) || token.length == 1) { return false; } let pos = token.indexOf("="); let t = pos == -1 ? token : token.substring(0, pos); if (!(this.getMatchingLongOptions(t).length() == 0)) { // long or p...
https://gitee.com/openharmony-sig/commons-cli.git
286ac39507a23402dffadbf7c2ef608344ba8a6d
gitee
codelably/HCompass
core/spatialization/oh_modules/@core/util/src/main/ets/logger/LoggerUtil.ets
arkts
error
错误级别日志 @param data 日志内容 @param tag 自定义标签
static error(data: Any, tag?: string) { Logger.log(LogLevel.ERROR, data, tag); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left error AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left data AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#...
static error(data: Any, tag?: string) { Logger.log(LogLevel.ERROR, data, tag); }
https://github.com/codelably/HCompass
0466ee8c4ffd17aa5ac15f607564d2cbeb8085f9
github
DaLongZhuaZi/manxia
entry/src/main/ets/components/PreloadManager.ets
arkts
addToQueue
添加到预加载队列
addToQueue(pageIndex: number, pageId: string, url: string, priority: number = 1): void { // 检查是否已经完成或正在加载 if (this.completed.has(pageIndex) || this.loading.has(pageIndex)) { return; } // 检查是否已在队列中 if (this.queue.has(pageIndex)) { // 更新优先级(取较高值) const existing = this.queue.get(pa...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addToQueue 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 , AST#,#R...
addToQueue(pageIndex: number, pageId: string, url: string, priority: number = 1): void { // 检查是否已经完成或正在加载 if (this.completed.has(pageIndex) || this.loading.has(pageIndex)) { return; } // 检查是否已在队列中 if (this.queue.has(pageIndex)) { // 更新优先级(取较高值) const existing = this.queue.get(pa...
https://github.com/DaLongZhuaZi/manxia
1968bf6adbbda55a724099dc30a7a46b56aefb56
github
David8Idira/AI-OA
packages/harmonyos/commons/src/main/ets/services/AttendanceService.ets
arkts
getLeaveRecords
获取请假记录 @param params 查询参数
async getLeaveRecords(params?: { status?: LeaveStatus type?: LeaveType startDate?: string endDate?: string page?: number pageSize?: number }): Promise<ApiResponse<{ records: LeaveRecord[]; total: number }>> { return this.client.get<{ records: LeaveRecord[]; total: number }>('/api/v1/atte...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getLeaveRecords AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#optional_parameter#Left AST#identifier#Left params AST#identifier#Right AST#?#Left ? AST#?#Right AST#type_a...
async getLeaveRecords(params?: { status?: LeaveStatus type?: LeaveType startDate?: string endDate?: string page?: number pageSize?: number }): Promise<ApiResponse<{ records: LeaveRecord[]; total: number }>> { return this.client.get<{ records: LeaveRecord[]; total: number }>('/api/v1/atte...
https://github.com/David8Idira/AI-OA
208daedc5ed7c720a1791ca80f6fd7e71f471501
github
David8Idira/AI-OA
packages/harmonyos/commons/src/main/ets/services/ApprovalService.ets
arkts
getApprovals
获取审批列表 @param params 查询参数
async getApprovals(params: ApprovalListParams): Promise<ApiResponse<{ approvals: Approval[]; total: number }>> { return this.client.get<{ approvals: Approval[]; total: number }>('/api/v1/approval/approvals', params as Record<string, any>) }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getApprovals AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left params AST#identifier#Right AST#type_annotation#Left AST#:#Left : ...
async getApprovals(params: ApprovalListParams): Promise<ApiResponse<{ approvals: Approval[]; total: number }>> { return this.client.get<{ approvals: Approval[]; total: number }>('/api/v1/approval/approvals', params as Record<string, any>) }
https://github.com/David8Idira/AI-OA
3f0401e3be1e2aafd1f1e4c4feaf59361e4715ef
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/String.ets
arkts
match
Retrieves the result of matching a string against a regular expression @param regexp a regular expression object @returns If the regexp.global is true, all results matching the complete regular expression will be returned, but capturing groups are not included Otherwise, only the first complete match and its related ca...
public match(regexp: RegExp) : String[] { let isGlobal = regexp.global; if (!isGlobal) { return regexp.exec(this).result; } regexp.lastIndex = 0; let matches = new ArrayAsListString(); while (true) { let result = regexp.exec(this); ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left match AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left regexp AST#identifier#Right AST#:#Left : AS...
public match(regexp: RegExp) : String[] { let isGlobal = regexp.global; if (!isGlobal) { return regexp.exec(this).result; } regexp.lastIndex = 0; let matches = new ArrayAsListString(); while (true) { let result = regexp.exec(this); ...
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
f3dc848c74135bcd4841b495067355ebfa0cecb7
gitee
revalue-o/HarmonyOS-Next-Hook-demo
source_codes/ArkTS-inject/entry/src/main/ets/utils/SecurityCheckUtil.ets
arkts
parseJWS
解析JWS格式的响应 JWS格式:header.payload.signature(三部分通过"."连接)
private static parseJWS(jwsString: string): JWSResult | null { try { console.log('[SecurityCheckUtil] Parsing JWS, length:', jwsString.length); const parts = jwsString.split('.'); if (parts.length !== 3) { console.error('[SecurityCheckUtil] Invalid JWS format, expected 3 parts, got:', p...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left parseJWS AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left jwsString AST#identifier#Right AST#ERROR#Left AST#:#Left :...
private static parseJWS(jwsString: string): JWSResult | null { try { console.log('[SecurityCheckUtil] Parsing JWS, length:', jwsString.length); const parts = jwsString.split('.'); if (parts.length !== 3) { console.error('[SecurityCheckUtil] Invalid JWS format, expected 3 parts, got:', p...
https://github.com/revalue-o/HarmonyOS-Next-Hook-demo
f4541af74671cf2575082a1e42158db9436fa074
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/StreamWindowManager.ets
arkts
toggleWindowMode
切换窗口/全屏模式(2in1 设备) 全屏 → 窗口化:退出沉浸式 + recover() 恢复悬浮窗 窗口化 → 全屏:隐藏装饰栏 + 沉浸式最大化
async toggleWindowMode(): Promise<void> { try { const win = await window.getLastWindow(this.context); if (this._isFullscreen) { // 先注册监听,再执行 recover,避免窗口恢复过程中的首个尺寸事件丢失 this.registerWindowSizeListener(win); await this.exitImmersiveFullscreen(win); try { await ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left toggleWindowMode 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#gen...
async toggleWindowMode(): Promise<void> { try { const win = await window.getLastWindow(this.context); if (this._isFullscreen) { // 先注册监听,再执行 recover,避免窗口恢复过程中的首个尺寸事件丢失 this.registerWindowSizeListener(win); await this.exitImmersiveFullscreen(win); try { await ...
https://github.com/AlkaidLab/moonlight-harmony
3ab8eb5243de450630210cb9092f9e38da67042c
github
aimilin6688/KeePassHO
entry/src/main/ets/components/ColorPickerDialog.ets
arkts
rgbToHsv
RGB颜色转HSV
function rgbToHsv(r: number, g: number, b: number): number[] { r = r / 255; g = g / 255; b = b / 255; const max: number = Math.max(r, g, b); const min: number = Math.min(r, g, b); const d: number = max - min; let h: number = 0; const s: number = max === 0 ? 0 : d / max; const v: number = max; if ...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left rgbToHsv AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left r AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#...
function rgbToHsv(r: number, g: number, b: number): number[] { r = r / 255; g = g / 255; b = b / 255; const max: number = Math.max(r, g, b); const min: number = Math.min(r, g, b); const d: number = max - min; let h: number = 0; const s: number = max === 0 ? 0 : d / max; const v: number = max; if ...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/components/ColorPickerDialog.ets#L83-L112
36c205e02560ff82b536984b230329c410cfd79d
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/WeakMap.ets
arkts
delete
The delete() method removes the specified element from a WeakMap object @param { K } key - The key of the element to remove @returns { boolean } Returns true if the element was successfully removed, returns false if the key does not exist @syscap SystemCapability.Utils.Lang
delete(key: K): boolean { const keyHash = Runtime.getHashCode(key) const keyRefs = this.keyHashToKeyRefs.get(keyHash) if (keyRefs === undefined) { return false } const keyRef = this.findKeyRef(keyRefs, key) if (keyRef === undefined) { return ...
AST#program#Left AST#ERROR#Left AST#delete#Left delete AST#delete#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left key AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#type_identifier#Left K AST#type_identifier#Right AST#type_annotation#...
delete(key: K): boolean { const keyHash = Runtime.getHashCode(key) const keyRefs = this.keyHashToKeyRefs.get(keyHash) if (keyRefs === undefined) { return false } const keyRef = this.findKeyRef(keyRefs, key) if (keyRef === undefined) { return ...
https://gitcode.com/iop123123/arkts-static-skills
c9f54d1cd513dc89953bf68ce73218a131a52444
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Boolean.ets
arkts
constructor
Constructs a new Boolean with provided bigint value @param { bigint } value value to construct class instance with @syscap SystemCapability.Utils.Lang @FaAndStageModel
public constructor(value: bigint) { this.value = value != new BigInt(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 value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left big...
public constructor(value: bigint) { this.value = value != new BigInt(0); }
https://gitcode.com/iop123123/arkts-static-skills
51db4ddb99807e02e26d5d245dd557923683709b
gitcode
LZZLHY/hlib
entry/src/main/ets/utils/AppRouter.ets
arkts
pop
出栈一项。
static pop(): void { const s: NavPathStack | null = AppRouter.stack; if (s === null) { return; } try { s.pop(); } catch (e) { Logger.w(TAG, `pop failed: ${(e as Error).message}`); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left pop 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#:#Right...
static pop(): void { const s: NavPathStack | null = AppRouter.stack; if (s === null) { return; } try { s.pop(); } catch (e) { Logger.w(TAG, `pop failed: ${(e as Error).message}`); } }
https://github.com/LZZLHY/hlib
0ea9ab7c633a15145b29085469bde6d11a51cdc4
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/TaskExecutor.ets
arkts
executeSequential
顺序执行步骤
private async executeSequential(task: TaskDefinition, context: TaskContext): Promise<void> { for (let i = 0; i < task.steps.length; i++) { context.currentStepIndex = i; const step = task.steps[i]; // 检查条件 if (step.condition && !this.evaluateCondition(step.condition, context)) { lo...
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 executeSequential AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left task AST#identifier#Right AST#:#Lef...
private async executeSequential(task: TaskDefinition, context: TaskContext): Promise<void> { for (let i = 0; i < task.steps.length; i++) { context.currentStepIndex = i; const step = task.steps[i]; // 检查条件 if (step.condition && !this.evaluateCondition(step.condition, context)) { lo...
https://github.com/DaLongZhuaZi/manxia
d548e5419bb06930fcab9d2806a15e84386f41ee
github
offlinecat-dev/OCNetORM
src/main/ets/query/SubQuery.ets
arkts
whereNull
添加 IS NULL 条件 @param column 列名 @returns 当前实例(支持链式调用)
whereNull(column: string): SubQuery { const condition = WhereCondition.isNull(column) condition.logicalOperator = LogicalOperator.AND this.conditions.push(condition) return this }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left whereNull AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left column AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST...
whereNull(column: string): SubQuery { const condition = WhereCondition.isNull(column) condition.logicalOperator = LogicalOperator.AND this.conditions.push(condition) return this }
https://github.com/offlinecat-dev/OCNetORM
d28f6dad6b0de4c4e55a858134b6a40e716bda3b
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/DiskCacheManager.ets
arkts
cleanExpiredCache
清理过期缓存
private async cleanExpiredCache(): Promise<void> { try { const now = Date.now(); const expiredKeys: string[] = []; const entries = Array.from(this.cacheIndex.entries()); for (let i = 0; i < entries.length; i++) { const key = entries[i][0]; const entry = entries[i][1]; ...
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 cleanExpiredCache AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right...
private async cleanExpiredCache(): Promise<void> { try { const now = Date.now(); const expiredKeys: string[] = []; const entries = Array.from(this.cacheIndex.entries()); for (let i = 0; i < entries.length; i++) { const key = entries[i][0]; const entry = entries[i][1]; ...
https://github.com/DaLongZhuaZi/manxia
2bea309c6fcfd5c99d976b42d66284715946d23e
github
HarmonyOS_Samples/sample_in_harmonyos
features/abilitycommon/src/main/ets/widget/viewmodel/UpdateFormData.ets
arkts
update
Invoke the viewModel to reconstruct the form data by formId. @param formId
public static update(formId: string): void { UpdateFormData.viewModel.sendEvent(new UpdateDataEvent(formId)); const formData: Record<string, string | ArticleListItem[]> = { 'cardList': UpdateFormData.viewModel.getState().cardList, } Logger.info(TAG, `click to check updateForm, formId: ${formId}`...
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 update AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left formId AST#identifier#Right AST#:#Left : AST#:#R...
public static update(formId: string): void { UpdateFormData.viewModel.sendEvent(new UpdateDataEvent(formId)); const formData: Record<string, string | ArticleListItem[]> = { 'cardList': UpdateFormData.viewModel.getState().cardList, } Logger.info(TAG, `click to check updateForm, formId: ${formId}`...
https://gitcode.com/HarmonyOS_Samples/sample_in_harmonyos
aa022a7524ea5fb355887a8d39e1a2f263ba490e
gitcode
Countly/countly-sdk-hos
library/src/main/ets/CountlyInstance.ets
arkts
maybeUpdateOrientationFromDisplay
Read orientation from the display directly. Wired into `ModuleSessions.beginSessionInternal` via `setOrientationBaselineEmitter` so a fresh baseline orientation event is emitted on every session begin, including session begins that follow a backgrounded rotation which `onConfigurationUpdated` never delivered (that call...
private maybeUpdateOrientationFromDisplay(forceSend: boolean): void { let mode: string = ''; try { const d: display.Display = display.getDefaultDisplaySync(); mode = d.height >= d.width ? 'portrait' : 'landscape'; } catch (err) { this.config.logger.d(`auto-orientation, display unavailabl...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left maybeUpdateOrientationFromDisplay AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left forceSend AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolea...
private maybeUpdateOrientationFromDisplay(forceSend: boolean): void { let mode: string = ''; try { const d: display.Display = display.getDefaultDisplaySync(); mode = d.height >= d.width ? 'portrait' : 'landscape'; } catch (err) { this.config.logger.d(`auto-orientation, display unavailabl...
https://github.com/Countly/countly-sdk-hos
db5bca74f42c176f9d5c17fc859124ef1caf23c1
github
jiwangyihao/FlameChase
entry/src/main/ets/pages/CoreflamesPage.ets
arkts
progressStrokeDashOffset
最大倒计时,单位为秒
@AnimatableExtend(Path) function progressStrokeDashOffset(progress: number) { .strokeDashOffset((30 - 240 * (progress % 1)) * Math.PI) // 调用系统属性接口,逐帧回调函数每帧修改可动画属性的值,实现逐帧布局的效果。 }
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#call_expression#Left AST#identifier#Left AnimatableExtend AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left Path AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_ex...
@AnimatableExtend(Path) function progressStrokeDashOffset(progress: number) { .strokeDashOffset((30 - 240 * (progress % 1)) * Math.PI) // 调用系统属性接口,逐帧回调函数每帧修改可动画属性的值,实现逐帧布局的效果。 }
https://github.com/jiwangyihao/FlameChase
d44717846e319c62edd1ea64d277e3267cd4d403
github
openharmony/testfwk_arkxtest
jsunit/src_static/module/assert/deepEquals/DeepTypeUtils.ets
arkts
isFunction
是否是function @param value
static isFunction<T>(value: T): boolean { return DeepTypeUtils.isA('Function', value); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#binary_expression#Left AST#identifier#Left isFunction AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Ri...
static isFunction<T>(value: T): boolean { return DeepTypeUtils.isA('Function', value); }
https://gitee.com/openharmony/testfwk_arkxtest.git
655075a10b0c87a2cf125659699b2b680c429c03
gitee
openharmony/codelabs
GraphicImage/GestureScreenshot/entry/src/main/ets/model/OffsetModel.ets
arkts
resetDefaultOffSet
Reset the offset to the default value.
public resetDefaultOffSet() { this.offsetXLeft = CommonConstant.DEFAULT_OFFSET_X_LEFT; this.offsetXRight = CommonConstant.DEFAULT_OFFSET_X_RIGHT; this.offsetYTop = CommonConstant.DEFAULT_OFFSET_Y_TOP; this.offsetYBottom = CommonConstant.DEFAULT_OFFSET_Y_BOTTOM; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left resetDefaultOffSet AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#L...
public resetDefaultOffSet() { this.offsetXLeft = CommonConstant.DEFAULT_OFFSET_X_LEFT; this.offsetXRight = CommonConstant.DEFAULT_OFFSET_X_RIGHT; this.offsetYTop = CommonConstant.DEFAULT_OFFSET_Y_TOP; this.offsetYBottom = CommonConstant.DEFAULT_OFFSET_Y_BOTTOM; }
https://gitee.com/openharmony/codelabs.git
caf45586373aaa96ca92781291d6e96e40ac0034
gitee
tdcare/tdwebrtc
src/main/ets/AudioPlayback.ets
arkts
write
写入 PCM 数据到播放缓冲区 @param pcmData PCM 16-bit LE 数据
public write(pcmData: ArrayBuffer): void { if (!this.isRunning) return; if (this.pendingBuffers.length >= this.MAX_PENDING) { // 丢弃最旧的数据,防止延迟积累 this.pendingBuffers.shift(); } this.pendingBuffers.push(pcmData); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left write AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pcmData AST#identifier#Right AST#:#Left : AST#:#Right AST#...
public write(pcmData: ArrayBuffer): void { if (!this.isRunning) return; if (this.pendingBuffers.length >= this.MAX_PENDING) { // 丢弃最旧的数据,防止延迟积累 this.pendingBuffers.shift(); } this.pendingBuffers.push(pcmData); }
https://github.com/tdcare/tdwebrtc
04a47478a0033ca5acdacbd8fde6f84059fd2eca
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/EnumConstant.ets
arkts
hasValue
hasValue @returns { boolean } get current object's hasValue @syscap SystemCapability.Utils.Lang @FaAndStageModel
public hasValue(): boolean { // TODO(shumilov-petr): not implemented return false }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left hasValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#bool...
public hasValue(): boolean { // TODO(shumilov-petr): not implemented return false }
https://gitcode.com/iop123123/arkts-static-skills
c5bbd04f6113b881f874b7d5ee30d891b7b19143
gitcode
offlinecat-dev/OCNetORM
src/main/ets/errors/QueryError.ets
arkts
constructor
构造函数 @param message 错误消息
constructor(message: string) { const sanitizedMessage = sanitizeErrorMessage(message) const context = new ErrorContext() context.operation = '构建子查询' context.details = sanitizedMessage super(`子查询构建失败: ${sanitizedMessage}`, ERROR_SUB_QUERY, context) this.name = 'SubQueryError' }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left message AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#...
constructor(message: string) { const sanitizedMessage = sanitizeErrorMessage(message) const context = new ErrorContext() context.operation = '构建子查询' context.details = sanitizedMessage super(`子查询构建失败: ${sanitizedMessage}`, ERROR_SUB_QUERY, context) this.name = 'SubQueryError' }
https://github.com/offlinecat-dev/OCNetORM
8d827933d5e42fab56b07743e604313c4190787a
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/AppStateService.ets
arkts
unsubscribe
取消订阅状态变化事件
unsubscribe(): void { emitter.off(APP_STATE_EVENT_ID); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left unsubscribe 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#...
unsubscribe(): void { emitter.off(APP_STATE_EVENT_ID); }
https://github.com/AlkaidLab/moonlight-harmony
313c5d372d26c1f66c51faeaeed547a9a2af2da6
github
aimilin6688/KeePassHO
entry/src/main/ets/workers/DatabaseSave.ets
arkts
saveDatabase
保存数据库 @param request 请求 @returns 结果 @throws Error 保存失败
private async saveDatabase(request: SaveDatabase, credentials: KdbxCredentials, kdbx?: Kdbx): Promise<FileContentInfo> { this.postMessage($r('app.string.save_saving')); let database: Kdbx = kdbx ? kdbx : await KdbxUtils.arrayBufferToKdbx(request.data, request, credentials); if (request.newPassword) { ...
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 saveDatabase AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left request AST#identifier#Right AST#:#Left ...
private async saveDatabase(request: SaveDatabase, credentials: KdbxCredentials, kdbx?: Kdbx): Promise<FileContentInfo> { this.postMessage($r('app.string.save_saving')); let database: Kdbx = kdbx ? kdbx : await KdbxUtils.arrayBufferToKdbx(request.data, request, credentials); if (request.newPassword) { ...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/workers/DatabaseSave.ets#L96-L129
895a68ee59d997818419c070b5069a5f889932f0
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/DataManager.ets
arkts
getFavoriteComicIdSet
[性能优化] 获取用户收藏漫画ID集合 用于批量书库加载时快速判断收藏状态,避免逐条重复读取收藏表
public async getFavoriteComicIdSet(userId: string): Promise<Set<string>> { const favoriteComicIds: Set<string> = new Set<string>(); try { const sql = 'SELECT comicId FROM favorite WHERE userId = ?'; const records: DatabaseRecord[] = await this.databaseManager.querySql(sql, [userId]); for (le...
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 getFavoriteComicIdSet AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#...
public async getFavoriteComicIdSet(userId: string): Promise<Set<string>> { const favoriteComicIds: Set<string> = new Set<string>(); try { const sql = 'SELECT comicId FROM favorite WHERE userId = ?'; const records: DatabaseRecord[] = await this.databaseManager.querySql(sql, [userId]); for (le...
https://github.com/DaLongZhuaZi/manxia
eb9a1d004b3edaf7bbb97aa0d79f1ca76e9e7101
github
offlinecat-dev/OCNetORM
src/main/ets/repository/BatchInsertOptions.ets
arkts
create
创建 BatchInsertOptions 实例的便捷方法 @param useTransaction 是否使用事务 @param executeHooks 是否执行钩子 @param executeValidation 是否执行数据验证 @returns BatchInsertOptions 实例
static create( useTransaction: boolean = true, executeHooks: boolean = true, executeValidation: boolean = true ): BatchInsertOptions { return new BatchInsertOptions(useTransaction, executeHooks, executeValidation) }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left create AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left useTransaction AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expr...
static create( useTransaction: boolean = true, executeHooks: boolean = true, executeValidation: boolean = true ): BatchInsertOptions { return new BatchInsertOptions(useTransaction, executeHooks, executeValidation) }
https://github.com/offlinecat-dev/OCNetORM
b7ac51276debd0b7e5524a965be846ab16360620
github
somnio-software/my-bot-pal
entry/src/main/ets/features/chat/view/pages/ChatPage.ets
arkts
aboutToAppear
Lifecycle method called when the view is about to appear. It checks for an initial query from the route parameters and sets up the initial messages accordingly.
aboutToAppear() { // If there is an initial query, add it as a user message and request a bot response if (this.initialQuery && this.initialQuery.trim().length > 0) { const userMessage = new ChatMessage(util.generateRandomUUID(), this.initialQuery, [], MessageType.TEXT, ApiMessageType.HUMAN); ...
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() { // If there is an initial query, add it as a user message and request a bot response if (this.initialQuery && this.initialQuery.trim().length > 0) { const userMessage = new ChatMessage(util.generateRandomUUID(), this.initialQuery, [], MessageType.TEXT, ApiMessageType.HUMAN); ...
https://github.com/somnio-software/my-bot-pal
7542b68b05475bd1c5792ec2e26cda05ceebdf72
github
Goway-Hui/harmonyos-next-dev
harmonyos-next-dev/assets/custom-component-template.ets
arkts
iconTextBuilder
==================== 3. 可复用函数式 Builder ====================
@Builder function iconTextBuilder(icon: Resource, text: string) { Row({ space: 8 }) { Image(icon) .width(20) .height(20) Text(text) .fontSize(15) } .padding(8) }
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Builder AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left iconTextBuilder AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#r...
@Builder function iconTextBuilder(icon: Resource, text: string) { Row({ space: 8 }) { Image(icon) .width(20) .height(20) Text(text) .fontSize(15) } .padding(8) }
https://github.com/Goway-Hui/harmonyos-next-dev
502fe95c12b6aa14ab9b8b431f1fc155359aef18
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/WebViewAuthManager.ets
arkts
applyCookiesToController
将已有Cookie应用到WebView控制器(在页面加载前调用)
async applyCookiesToController(sourceId: number, controller: webview.WebviewController): Promise<void> { try { const srcRecord = await this.dataManager.getComicSourceById(sourceId); if (!srcRecord) { logger.warn(TAG, `图源不存在,无法注入Cookie: sourceId=${sourceId}`); return; } co...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left applyCookiesToController AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceId AST#identifier#Right AST#type_annotation#Left...
async applyCookiesToController(sourceId: number, controller: webview.WebviewController): Promise<void> { try { const srcRecord = await this.dataManager.getComicSourceById(sourceId); if (!srcRecord) { logger.warn(TAG, `图源不存在,无法注入Cookie: sourceId=${sourceId}`); return; } co...
https://github.com/DaLongZhuaZi/manxia
65cec3ee878b67d11a425e7248cb48d2a589ae1d
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Distributed/DistributedFileManager.ets
arkts
getDistributedFilePath
从分布式沙箱读取文件路径
public getDistributedFilePath(fileName: string): string | null { if (!this.distributedRoot) return null; const path = `${this.getDistributedCachePath()}/${fileName}`; try { if (fileIo.accessSync(path)) { return path; } } catch (e) { logger.error(TAG, `Failed to access di...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getDistributedFilePath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left fileName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AS...
public getDistributedFilePath(fileName: string): string | null { if (!this.distributedRoot) return null; const path = `${this.getDistributedCachePath()}/${fileName}`; try { if (fileIo.accessSync(path)) { return path; } } catch (e) { logger.error(TAG, `Failed to access di...
https://github.com/DaLongZhuaZi/manxia
f72aa1d32b5424dce470ce965c172200061afc34
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets
arkts
setUTCSeconds
Sets the seconds for a specified date according to universal time. @param { int } value new seconds @returns { long } get new date value @syscap SystemCapability.Utils.Lang @FaAndStageModel
public setUTCSeconds(value: int): long { let sec = ecmaSecFromTime(this.ms); this.ms -= sec * msPerSecond; this.ms += value * msPerSecond; return this.ms; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setUTCSeconds AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifie...
public setUTCSeconds(value: int): long { let sec = ecmaSecFromTime(this.ms); this.ms -= sec * msPerSecond; this.ms += value * msPerSecond; return this.ms; }
https://gitcode.com/iop123123/arkts-static-skills
e28e8278dc2d5d28dff064d6f4c8d0f71efa62e4
gitcode
HarmonyOS_Samples/BestPracticeSnippets
SimpleChatList/entry/src/main/ets/pages/MaintainVisibleAreaContent.ets
arkts
addData
[Start Add_delete data]
public addData(index: number, data: TextClass): void { this.dataArray.splice(index, 0, data); this.notifyDataAdd(index); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number ...
public addData(index: number, data: TextClass): void { this.dataArray.splice(index, 0, data); this.notifyDataAdd(index); }
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
e294dccafca4bb15c98d4a6ad4d0fb97506158e5
gitcode
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test38_original_index.ets
arkts
makeAdder
--- Nested function references via closures ---
function makeAdder(x: number): (n: number) => number { return (n: number): number => { return n + x; }; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left makeAdder AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left x AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST...
function makeAdder(x: number): (n: number) => number { return (n: number): number => { return n + x; }; }
https://github.com/miaochiahao/ark-ghidra
b6684193b5306f703379ea937a51f061983775b1
github
HarmonyOS_Samples/guide-snippets
Ability/ApplicationContextDemo/entry/src/main/ets/entrylifecycleability/EntryLifecycleAbility.ets
arkts
onAbilityBackground
当UIAbility从前台转到后台时触发回调
onAbilityBackground(uiAbility) { hilog.info(DOMAIN_NUMBER, TAG, `onAbilityBackground uiAbility.launchWant: ${JSON.stringify(uiAbility.launchWant)}`); },
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onAbilityBackground AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left uiAbility AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Righ...
onAbilityBackground(uiAbility) { hilog.info(DOMAIN_NUMBER, TAG, `onAbilityBackground uiAbility.launchWant: ${JSON.stringify(uiAbility.launchWant)}`); },
https://gitcode.com/HarmonyOS_Samples/guide-snippets
33350f3a80aa8c04b7f99159f6b35216a7191ac9
gitcode
huaweicloud/huaweicloud-iot-device-sdk-arkts
huaweicloud_iot_device_library/src/main/ets/service/AbstractDevice.ets
arkts
onEvent
事件回调,由SDK自动调用 @param deviceEvents 设备事件
public onEvent(deviceEvents: DeviceEvents): void { }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left onEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left deviceEvents AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ...
public onEvent(deviceEvents: DeviceEvents): void { }
https://github.com/huaweicloud/huaweicloud-iot-device-sdk-arkts
9af71c7ea486a242131b4d51283f4ec9f7eb7e9f
github
HarmonyOS_Samples/MusicHome
features/recommendation/src/main/ets/view/PanelHeroBannerSection.ets
arkts
build
Horizontal scroll of panel hero cards built from the view model hero list.
build() { Scroll(this.bannerScroller) { Row({ space: 32 }) { ForEach(this.recommendViewModel.heroCards, (item: RecommendHeroCardUi, index?: number) => { Column() { this.PanelHeroBannerCard(item, index ?? 0); } }, (_item: RecommendHeroCardUi, index?: number) =>...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST...
build() { Scroll(this.bannerScroller) { Row({ space: 32 }) { ForEach(this.recommendViewModel.heroCards, (item: RecommendHeroCardUi, index?: number) => { Column() { this.PanelHeroBannerCard(item, index ?? 0); } }, (_item: RecommendHeroCardUi, index?: number) =>...
https://gitcode.com/HarmonyOS_Samples/MusicHome
307e830daad6d1c4b3c6d06575e04f7eaccf3d64
gitcode
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ets
arkts
contains
Checks whether a given range is within the current range. @param { ScopeHelper } range - A Scope range @returns { boolean } If the current range is within the given range return true,otherwise return false.
contains(range: ScopeHelper<T>): boolean { let lowerRes = range.getLower().compareTo(this._lowerLimit) let upperRes = this._upperLimit.compareTo(range.getUpper()) return lowerRes && upperRes }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left contains AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left range AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identifier#Left ScopeHelper ...
contains(range: ScopeHelper<T>): boolean { let lowerRes = range.getLower().compareTo(this._lowerLimit) let upperRes = this._upperLimit.compareTo(range.getUpper()) return lowerRes && upperRes }
https://gitcode.com/iop123123/arkts-static-skills
5814e1a61205405b5566eef1372dcadfdbc09875
gitcode
who7708/harmonyos-codelabs
HmosWorld/commons/common/src/main/ets/service/repository/ResourcesRepository.ets
arkts
getMoreArticle
Get next page articles @param pageNum @returns
getMoreArticle(pageNum: number): Promise<ResourcesData> { return this.funNetwork.getMoreResources(pageNum, ResourcesType.ARTICLE); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getMoreArticle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left pageNum AST#identifier...
getMoreArticle(pageNum: number): Promise<ResourcesData> { return this.funNetwork.getMoreResources(pageNum, ResourcesType.ARTICLE); }
https://github.com/who7708/harmonyos-codelabs
ae9d5d4bdc6cfe49db530d10095baa6c5cbb7398
github
iJcher/openharmony-app-znjj
entry/src/main/ets/tools/HWcloudHttp.ets
arkts
postCommands
命令下发使用的post请求
static postCommands(url: string, param: string | Object | ArrayBuffer, fn: Function) { // 每一个httpRequest对应一个HTTP请求任务,不可复用 let httpRequest = http.createHttp() let options: http.HttpRequestOptions = { method: http.RequestMethod.POST, // 当使用POST请求时此字段用于传递请求体内容,具体格式与服务端协商确定 extraData: ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left postCommands 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 stri...
static postCommands(url: string, param: string | Object | ArrayBuffer, fn: Function) { // 每一个httpRequest对应一个HTTP请求任务,不可复用 let httpRequest = http.createHttp() let options: http.HttpRequestOptions = { method: http.RequestMethod.POST, // 当使用POST请求时此字段用于传递请求体内容,具体格式与服务端协商确定 extraData: ...
https://github.com/iJcher/openharmony-app-znjj
320dbcb80b20c26e11bc9e9deff15f3321fbaac0
github
azhu0001/localsend-harmony
entry/src/main/ets/utils/FileProvider.ets
arkts
getTransferringNowSessionId
获取当前正在传输文件的sessionId @returns
static getTransferringNowSessionId(): string | undefined { return AppStorage.get(Keys.CURRENTLY_RECEIVING_SESSION) }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getTransferringNowSessionId 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_exp...
static getTransferringNowSessionId(): string | undefined { return AppStorage.get(Keys.CURRENTLY_RECEIVING_SESSION) }
https://gitcode.com/azhu0001/localsend-harmony
375398ded065e3a5042cd909a52c13d3c36e1b21
gitcode
openharmony/codelabs
Data/DeviceHealth/entry/src/main/ets/services/EventHubManager.ets
arkts
subscribeBatteryWarning
开启全局监听:电量不足信号
static async subscribeBatteryWarning(): Promise<void> { if (!EventHubManager.ctx) return; EventHubManager.ctx.eventHub.on(EventHubManager.EVENT_LOW_BATTERY, (soc: number) => { // 接收到信号后,直接调用之前封装好的弹窗 if (soc < 20){ DialogUtils.showNotice( '电量不足警告', `检测到系统电量已降至 ${soc}%,请...
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 subscribeBatteryWarning AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Ri...
static async subscribeBatteryWarning(): Promise<void> { if (!EventHubManager.ctx) return; EventHubManager.ctx.eventHub.on(EventHubManager.EVENT_LOW_BATTERY, (soc: number) => { // 接收到信号后,直接调用之前封装好的弹窗 if (soc < 20){ DialogUtils.showNotice( '电量不足警告', `检测到系统电量已降至 ${soc}%,请...
https://gitcode.com/openharmony/codelabs
a764a25d4369b123f9efd175d70933b9a0e852d5
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Console.ets
arkts
trace
Prints the current stack trace with an optional label Skips the first stack frame (the trace call itself) @param {Any[]} ...data - args to prints @returns {void}
public trace(...data: Any[]): void { this.log("Trace:", data) const stackT = StackTrace.provisionStackTrace(); for (let i = 1; i < stackT.length; ++i) { this.log(stackT[i]); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left trace AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#ERROR#Left AST#identifier#Left dat...
public trace(...data: Any[]): void { this.log("Trace:", data) const stackT = StackTrace.provisionStackTrace(); for (let i = 1; i < stackT.length; ++i) { this.log(stackT[i]); } }
https://gitcode.com/iop123123/arkts-static-skills
41680d4d0213afc6ceffe59e158c02cc85ccff6d
gitcode
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/services/RdpSessionManager.ets
arkts
isCharging
Check if device is charging
static isCharging(): boolean { try { const status: batteryInfo.BatteryChargeState = batteryInfo.chargingStatus; return status === batteryInfo.BatteryChargeState.ENABLE || status === batteryInfo.BatteryChargeState.FULL; } catch (error) { return false; } }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isCharging 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 isCharging(): boolean { try { const status: batteryInfo.BatteryChargeState = batteryInfo.chargingStatus; return status === batteryInfo.BatteryChargeState.ENABLE || status === batteryInfo.BatteryChargeState.FULL; } catch (error) { return false; } }
https://github.com/tangwengang-del/freerdp-harmonyos
25d41d0f91331949cf01641674f01b5111fb2d88
github
openharmony/arkui_ace_engine
examples/AdvancedBlendMode/entry/src/main/ets/pages/ListDataSource.ets
arkts
notifyDataDelete
通知控制器数据删除
notifyDataDelete(index: number): void { this.listeners.forEach(listener => { listener.onDataDelete(index); }); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left notifyDataDelete 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#Right AST#)#Left...
notifyDataDelete(index: number): void { this.listeners.forEach(listener => { listener.onDataDelete(index); }); }
https://gitcode.com/openharmony/arkui_ace_engine
9749a8a73bdbfb3f5b6e75e8525167518189ffdb
gitcode
HarmonyOS_Samples/BestPracticeSnippets
OptimizationAppDelay/entry/src/main/ets/pages/TabsNegativeExample.ets
arkts
build
[EndExclude tabs_negative_example]
build() { Column() { // [StartExclude tabs_negative_example] Row({ space: 10 }) { ForEach(this.list, (item: string, index: number) => { Text(item) .textAlign(TextAlign.Center) .fontSize(16) .height(32) .layoutWeight(1) .font...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST...
build() { Column() { // [StartExclude tabs_negative_example] Row({ space: 10 }) { ForEach(this.list, (item: string, index: number) => { Text(item) .textAlign(TextAlign.Center) .fontSize(16) .height(32) .layoutWeight(1) .font...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
c175da7fe1d95fc401c465af50835473015f9119
gitcode
Joker-x-dev/CoolMallArkTS
feature/user/src/main/ets/view/FootprintPage.ets
arkts
build
构建足迹页面 @returns {void} 无返回值
build() { AppNavDestination({ title: $r("app.string.footprint_title"), viewModel: this.vm, menus: this.vm.shouldShowClearAction() ? [ { value: "", icon: $r("app.media.ic_delete"), action: (): void => this.vm.showClearDialogModal() } ] : [] ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c...
build() { AppNavDestination({ title: $r("app.string.footprint_title"), viewModel: this.vm, menus: this.vm.shouldShowClearAction() ? [ { value: "", icon: $r("app.media.ic_delete"), action: (): void => this.vm.showClearDialogModal() } ] : [] ...
https://github.com/Joker-x-dev/CoolMallArkTS
c6411265024cfdc9cebef9b6ea0981dc5caaf3ae
github
openharmony/codelabs
ETSUI/PassNote/entry/src/main/ets/pages/GraphPassPage.ets
arkts
handleTouchStart
处理触摸开始
handleTouchStart(event: TouchEvent) { if (this.isVerifying) return; const t = event.touches[0]; this.isDrawing = true; this.checkTouchPoint({ x: t.x, y: t.y }); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left handleTouchStart 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#Left TouchEvent AST#identifi...
handleTouchStart(event: TouchEvent) { if (this.isVerifying) return; const t = event.touches[0]; this.isDrawing = true; this.checkTouchPoint({ x: t.x, y: t.y }); }
https://gitcode.com/openharmony/codelabs
12ca226162f53b9ceb44bb0c2e97eab6ca2c660d
gitcode
arkui-x/samples
CodeLab/Cases/feature/clickanimation/src/main/ets/components/ClickAnimationComponent.ets
arkts
<arrow>
获取动画效果
(transitionIn: boolean) => { // 入场动画结束后,从数据源移除数据 if (transitionIn) { this.data.shiftData(); } }
AST#program#Left AST#expression_statement#Left AST#arrow_function#Left AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left transitionIn AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left AST#boolean#Left boolean AST#boolean#Rig...
(transitionIn: boolean) => { // 入场动画结束后,从数据源移除数据 if (transitionIn) { this.data.shiftData(); } }
https://gitcode.com/arkui-x/samples
6ba162ef8ef23ab2259bb620d1c8ef157c6a9755
gitcode
LJ666-ui/harmony-health-care
entry/src/main/ets/medicalimaging/ModelManager.ets
arkts
updateModelStatus
更新模型状态 @param imagingType 影像类型 @param status 新状态 @param loadTime 加载时间 @param error 错误信息
private updateModelStatus( imagingType: ImagingType, status: ModelStatus, loadTime?: number, error?: string ): void { const info = this.modelInfoMap.get(imagingType); if (info) { info.status = status; if (loadTime !== undefined) { info.loadTime = loadTime; } i...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left updateModelStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left imagingType AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#iden...
private updateModelStatus( imagingType: ImagingType, status: ModelStatus, loadTime?: number, error?: string ): void { const info = this.modelInfoMap.get(imagingType); if (info) { info.status = status; if (loadTime !== undefined) { info.loadTime = loadTime; } i...
https://github.com/LJ666-ui/harmony-health-care
e06b5cbdb1a9e7cfb4bbe443a8a99194bf1f93e0
github