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
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
of
Returns a new array from a set of elements. @param { FixedArray<number> } items - a set of elements to include in the new array object. @returns { Int32Array } - a new Int32Array @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static of(...items: FixedArray<number>): Int32Array { let res = new Int32Array(items.length.toInt()) res.ofNumber(stub.toValueArray(items)) return res }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#of#Left of AST#of#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#ERROR...
public static of(...items: FixedArray<number>): Int32Array { let res = new Int32Array(items.length.toInt()) res.ofNumber(stub.toValueArray(items)) return res }
https://gitcode.com/iop123123/arkts-static-skills
3fc1f229b932cf76c6da3adad9baec8a1d514605
gitcode
openharmony/codelabs
CommonEventAndNotification/AlarmClock/entry/src/main/ets/viewmodel/DetailViewModel.ets
arkts
transAlarmRepeatDayContent
Get DetailViewModel instance. @return instance public static getInstant() { if (this.instant == null) { this.instant = new DetailViewModel(); } return this.instant; } Conversion alarm repeat day content @param repeatDay number @return repeatContent string
public transAlarmRepeatDayContent(repeatDay: number): string{ let repeatContent: string = CommonConstants.DEFAULT_STRING_MONDAY;; switch (repeatDay) { case WeekDays.DEFAULT_NUMBER_MONDAY: repeatContent = CommonConstants.DEFAULT_STRING_MONDAY; break; case WeekDays.DEFAULT_NUMBER_TUE...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left transAlarmRepeatDayContent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left repeatDay AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left numb...
public transAlarmRepeatDayContent(repeatDay: number): string{ let repeatContent: string = CommonConstants.DEFAULT_STRING_MONDAY;; switch (repeatDay) { case WeekDays.DEFAULT_NUMBER_MONDAY: repeatContent = CommonConstants.DEFAULT_STRING_MONDAY; break; case WeekDays.DEFAULT_NUMBER_TUE...
https://gitee.com/openharmony/codelabs.git
3278a8fa09b17640dae545010fa84cee1ef7c021
gitee
kumaleap/ArkLuban
library/src/main/ets/luban/LubanUtils.ets
arkts
getFileSizeInKBSync
获取文件大小(KB)- 同步版本,只支持普通文件路径,不支持 URI @deprecated 建议使用异步版本 getFileSizeInKB @param filePath 文件路径(不支持 URI) @returns 文件大小(KB)
static getFileSizeInKBSync(filePath: string): number { try { // 检查是否为 URI if (LubanUtils.isUri(filePath)) { LogUtil.error('❌ getFileSizeInKBSync 不支持 URI,请使用异步版本 getFileSizeInKB'); return 0; } const size = fileIo.statSync(filePath).size; return Math.round(size / 1024)...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getFileSizeInKBSync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#s...
static getFileSizeInKBSync(filePath: string): number { try { // 检查是否为 URI if (LubanUtils.isUri(filePath)) { LogUtil.error('❌ getFileSizeInKBSync 不支持 URI,请使用异步版本 getFileSizeInKB'); return 0; } const size = fileIo.statSync(filePath).size; return Math.round(size / 1024)...
https://github.com/kumaleap/ArkLuban
0308468bea35fddb02ae33c239a69f35e419f5e8
github
Joker-x-dev/CoolMallArkTS
core/base/src/main/ets/viewmodel/BaseViewModel.ets
arkts
onHidden
页面隐藏完成 - 来自 NavDestination @param {VisibilityChangeReason} reason - 可见性变化原因 @returns {void} 无返回值
onHidden(reason: VisibilityChangeReason): void { }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onHidden AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left reason AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left VisibilityChangeReason AST#identifier#Right A...
onHidden(reason: VisibilityChangeReason): void { }
https://github.com/Joker-x-dev/CoolMallArkTS
456c1dacf04afa1b93a5aa6e47aa4cb3701b20f5
github
youyeyejie/ZhiXing_ActHub
entry/src/main/ets/core/services/FocusTimerEngine.ets
arkts
setupPhase
配置并启动一个新的阶段(工作或休息)
private setupPhase(duration: number, state: FocusState): void { this.totalSeconds = duration; this.remainingSeconds = duration; this.startTimestamp = Date.now(); this.expectedEndTime = this.startTimestamp + (duration * 1000); this.state = state; this.startTimer(); this.checkAndStartBackgro...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left setupPhase AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left duration AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#...
private setupPhase(duration: number, state: FocusState): void { this.totalSeconds = duration; this.remainingSeconds = duration; this.startTimestamp = Date.now(); this.expectedEndTime = this.startTimestamp + (duration * 1000); this.state = state; this.startTimer(); this.checkAndStartBackgro...
https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/core/services/FocusTimerEngine.ets#L144-L153
e8c47f3963951820a0b00dba82d589526be8c6e3
github
UnbalancedCat/ohos-ssh-core
ssh_lib/src/main/ets/core/SshClient.ets
arkts
sftpShutdown
Shutdown the SFTP subsystem.
async sftpShutdown(): Promise<void> { if (!this.handle) throw new SshError('Client is disposed', SshErrorCode.DISPOSED); try { await ssh.sftpShutdown(this.handle); } catch (err) { const msg = (err as Error).message ?? 'SFTP shutdown failed'; const error = new SshError(msg, this.classifyE...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left sftpShutdown AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#...
async sftpShutdown(): Promise<void> { if (!this.handle) throw new SshError('Client is disposed', SshErrorCode.DISPOSED); try { await ssh.sftpShutdown(this.handle); } catch (err) { const msg = (err as Error).message ?? 'SFTP shutdown failed'; const error = new SshError(msg, this.classifyE...
https://github.com/UnbalancedCat/ohos-ssh-core
e1d05ef00aed3dcf07e987818b3aad4c84f5abf7
github
codelably/tuniao-ui
core/tuniaoui/src/main/ets/utils/lunar.ets
arkts
getLeapMonth
获取农历年的闰月(0 表示无闰月) @param lunarYear 农历年 @returns 闰月月份,0 表示无闰月
static getLeapMonth(lunarYear: number): number { const info: number = LUNAR_INFO[lunarYear - 1900]; return info & 0x0F; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getLeapMonth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left lunarYear AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#...
static getLeapMonth(lunarYear: number): number { const info: number = LUNAR_INFO[lunarYear - 1900]; return info & 0x0F; }
https://github.com/codelably/tuniao-ui
c4b58b45bbb4caa842745a0e3158664ee3e35912
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Storage/SandboxManager.ets
arkts
initializeDirectories
初始化目录路径
private async initializeDirectories(): Promise<void> { if (!this.context) { throw new Error('Context未初始化'); } try { // 获取应用文件目录 - el2/base/files/ const filesDir = this.context.filesDir; this.directories.files = filesDir; this.directories.cache = `${filesDir}/cache`; ...
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 initializeDirectories AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#R...
private async initializeDirectories(): Promise<void> { if (!this.context) { throw new Error('Context未初始化'); } try { // 获取应用文件目录 - el2/base/files/ const filesDir = this.context.filesDir; this.directories.files = filesDir; this.directories.cache = `${filesDir}/cache`; ...
https://github.com/DaLongZhuaZi/manxia
f65dc2932bc38190f3f29adcf39227f281347e8e
github
honjow/Next2V
shared/src/main/ets/network/ApiService.ets
arkts
executeNodeIgnoreToggleWithCookie
Execute the node-ignore toggle (requires Cookie session). Visits the once-link, then re-reads the node page and returns the resulting ignored state so the caller's UI reflects the server truth.
async executeNodeIgnoreToggleWithCookie( cookie: string, nodeName: string, toggle: V2exToggleAction, ): Promise<boolean> { const cleanName = (nodeName || '').trim() if (!cookie) { throw ApiErrors.authRequired() } if (!cleanName) { throw ApiErrors.invalidNode() } const...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left executeNodeIgnoreToggleWithCookie AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left cookie AST#identifier#Right AST#type_annotati...
async executeNodeIgnoreToggleWithCookie( cookie: string, nodeName: string, toggle: V2exToggleAction, ): Promise<boolean> { const cleanName = (nodeName || '').trim() if (!cookie) { throw ApiErrors.authRequired() } if (!cleanName) { throw ApiErrors.invalidNode() } const...
https://github.com/honjow/Next2V
5f30443bdd861587f1e6dca3de2ad8f2f7f2e312
github
ibestservices/ibest-ui
library/src/main/ets/components/dateTimePicker/index.ets
arkts
formatValue
格式化数值
formatValue(value: number): string { return value < 10 ? "0" + value : (value + "") }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left formatValue 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 number AST#identifier#Right AST#)#Left ) AS...
formatValue(value: number): string { return value < 10 ? "0" + value : (value + "") }
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/dateTimePicker/index.ets#L159-L161
07b8af5d952b6c5d2628d780f1a884510a3cea84
github
openharmony/applications_notes
common/utils/src/main/ets/default/baseUtil/RdbStoreUtil.ets
arkts
createRdbStore
create db and table
createRdbStore(context: common.UIAbilityContext) { try { relationalStore.getRdbStore(context, SysDefData.dbInfo.db_name) .then(async (store) => { // add sys-def folder and note to AppStorage let folderDataArray: FolderData[] = []; let sysDefFolderArray = [SysDefData.sys...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left createRdbStore AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#L...
createRdbStore(context: common.UIAbilityContext) { try { relationalStore.getRdbStore(context, SysDefData.dbInfo.db_name) .then(async (store) => { // add sys-def folder and note to AppStorage let folderDataArray: FolderData[] = []; let sysDefFolderArray = [SysDefData.sys...
https://gitee.com/openharmony/applications_notes.git
75139ae55e9ab63ec54b103c303502bded005047
gitee
Countly/countly-sdk-hos
library/src/ohosTest/ets/test/Consent.test.ets
arkts
<arrow>
LocationApi
async (): Promise<void> => { await h.instance.location.setLocation('US', 'NYC', null, null); },
AST#program#Left AST#ERROR#Left AST#arrow_function#Left AST#async#Left async AST#async#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#Left AST#type_identifier#Left Promise AST#type_identifi...
async (): Promise<void> => { await h.instance.location.setLocation('US', 'NYC', null, null); },
https://github.com/Countly/countly-sdk-hos
f1aafd7a11e807a4e121b329c7171bbd253e1c96
github
openharmony/arkui_ace_engine
advanced_ui_component/treeview/source/treeview.ets
arkts
findParentNodeId
find parent node id @param currentNodeId current node id @returns parent node id
public findParentNodeId(currentNodeId: number): number { let current: NodeItem = new NodeItem(emptyNodeInfo); if (this.nodeIdNodeItemMap.has(currentNodeId)) { current = this.nodeIdNodeItemMap.get(currentNodeId) as NodeItem; } return current.parentNodeId; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left findParentNodeId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left currentNodeId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST...
public findParentNodeId(currentNodeId: number): number { let current: NodeItem = new NodeItem(emptyNodeInfo); if (this.nodeIdNodeItemMap.has(currentNodeId)) { current = this.nodeIdNodeItemMap.get(currentNodeId) as NodeItem; } return current.parentNodeId; }
https://gitee.com/openharmony/arkui_ace_engine.git
020c4e83ec96edf6540d343a65b9b942a25d890f
gitee
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test13_original_index.ets
arkts
applyTwice
--- Higher-order function (takes function arg) ---
function applyTwice(x: number, fn: (n: number) => number): number { let once: number = fn(x); let twice: number = fn(once); return twice; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left applyTwice 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 AS...
function applyTwice(x: number, fn: (n: number) => number): number { let once: number = fn(x); let twice: number = fn(once); return twice; }
https://github.com/miaochiahao/ark-ghidra
efdd5918c7ca177cb9e145fb23030149a34f85a4
github
openharmony-sig/ohos_axios
entry/src/main/ets/pages/Index.ets
arkts
settingClientCert
设置双向证书校验(无密码)
settingClientCert() { this.clear() this.showUrl = this.clientCert_noPsw this.startTime = new Date().getTime(); let path_ca = ''; // 根证书路径 let path_client = ''; // 客户端证书路径 let path_key = ''; // 客户端密码路径 // 获取根证书、客户端证书、客户端密码沙箱路径 try { let context: Context = getContext(this); ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left settingClientCert 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#...
settingClientCert() { this.clear() this.showUrl = this.clientCert_noPsw this.startTime = new Date().getTime(); let path_ca = ''; // 根证书路径 let path_client = ''; // 客户端证书路径 let path_key = ''; // 客户端密码路径 // 获取根证书、客户端证书、客户端密码沙箱路径 try { let context: Context = getContext(this); ...
https://gitee.com/openharmony-sig/ohos_axios.git
8c7cee43ccebbf6298579ace0a4aea4bf2f7fa5b
gitee
wuba/omni-ui
omni_component/src/main/ets/components/popup/Builder.ets
arkts
setArrowWidth
箭头宽度,单位:vp,气泡弹窗有效 @param arrowWidth @returns
setArrowWidth(arrowWidth: number): Builder { this.popupConfig.arrowWidth = arrowWidth return this }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setArrowWidth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left arrowWidth AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) AST...
setArrowWidth(arrowWidth: number): Builder { this.popupConfig.arrowWidth = arrowWidth return this }
https://github.com/wuba/omni-ui
aacf6c444ffcd7f632a27b554f073c70388caa8b
github
LJ666-ui/harmony-health-care
entry/src/main/ets/medicalimaging/ModelManager.ets
arkts
getModelStatus
获取模型状态 @param imagingType 影像类型 @returns 模型状态
getModelStatus(imagingType: ImagingType): ModelStatus { const info = this.modelInfoMap.get(imagingType); return info ? info.status : ModelStatus.NOT_LOADED; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getModelStatus 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#identifier#Left ImagingType AST#identifier#Right A...
getModelStatus(imagingType: ImagingType): ModelStatus { const info = this.modelInfoMap.get(imagingType); return info ? info.status : ModelStatus.NOT_LOADED; }
https://github.com/LJ666-ui/harmony-health-care
b4a15ada1967ad9fdd5303496dafd30b2375adca
github
honjow/Next2V
shared/src/main/ets/network/Socks5HttpClient.ets
arkts
parseResponse
─── Response parsing ────────────────────────────────────────────────────
private static parseResponse(raw: Uint8Array): ParsedResponse { const headerEnd = Socks5HttpClient.findHeaderTerminator(raw) if (headerEnd < 0) { throw new Error(`Malformed HTTP response: header terminator not found (bytes=${raw.length})`) } const headerText = Socks5HttpClient.decodeAscii(raw.su...
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 parseResponse AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left raw AST#identifier#Right AST#:#Left : ...
private static parseResponse(raw: Uint8Array): ParsedResponse { const headerEnd = Socks5HttpClient.findHeaderTerminator(raw) if (headerEnd < 0) { throw new Error(`Malformed HTTP response: header terminator not found (bytes=${raw.length})`) } const headerText = Socks5HttpClient.decodeAscii(raw.su...
https://github.com/honjow/Next2V
2184559fcbc7a4eb496351706c7e4edb967030c9
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/NvHttp.ets
arkts
isTransientNetworkError
判断错误是否属于「可重试的矬时网络错误」 覆盖:超时 / 连接拒绝 / 不可达 / DNS 解析失败 / TCP RST 不覆盖:证书错误 / 401 / 4xx / 其它协议类错误(避免掩盖真实问题) 实现上 HarmonyOS 错误消息始终为英文(即使中文设备), 不需担心本地化误判
static isTransientNetworkError(err: Error | string): boolean { const lower = (typeof err === 'string' ? err : err.message).toLowerCase(); return NvHttp.isTimeoutError(lower) || lower.includes('refused') || lower.includes('unreachable') || lower.includes('dns') || lower.includes('getadd...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isTransientNetworkError AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left err AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_ex...
static isTransientNetworkError(err: Error | string): boolean { const lower = (typeof err === 'string' ? err : err.message).toLowerCase(); return NvHttp.isTimeoutError(lower) || lower.includes('refused') || lower.includes('unreachable') || lower.includes('dns') || lower.includes('getadd...
https://github.com/AlkaidLab/moonlight-harmony
5542900afb0190bb0e52925abb5f02d3cef57934
github
HarmonyOS_Codelabs/arkts-intermediate-syntax
entry/src/main/ets/model/AirConditioner.ets
arkts
turnOff
实现抽象方法:关机逻辑
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
68aba2dcb6e6d16e0861aed25cf0528b515f4138
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/ComputerManager.ets
arkts
saveComputers
═══════════════════════════════════════════════════════════ 持久化(委托给 ComputerPersistence) ═══════════════════════════════════════════════════════════ 保存电脑列表到持久化存储
async saveComputers(): Promise<void> { await ComputerPersistence.saveComputers(this.computers); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left saveComputers 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#generi...
async saveComputers(): Promise<void> { await ComputerPersistence.saveComputers(this.computers); }
https://github.com/AlkaidLab/moonlight-harmony
04cfec98f405a2063c67ddf56e9d5d1403e98406
github
aimilin6688/KeePassHO
entry/src/main/ets/services/store/SyncSettingsService.ets
arkts
syncOnForeground
应用回到前台时触发同步 由 EntryAbility.onForeground() 调用
public static syncOnForeground(): void { if (SyncSettingsService.isSyncEnabled()) { DistributedKVService.sync(distributedKVStore.SyncMode.PUSH_PULL); } }
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 syncOnForeground AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS...
public static syncOnForeground(): void { if (SyncSettingsService.isSyncEnabled()) { DistributedKVService.sync(distributedKVStore.SyncMode.PUSH_PULL); } }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/store/SyncSettingsService.ets#L176-L180
736881e4fe40a63a0dcdcf256290354ba17b9727
github
openharmony/vendor_unionman
unionpi_tiger/sample_hzu/TV-adaptation/entry/src/main/ets/pages/Index4.ets
arkts
build
@State password: any = ''
build() { Column({ space: 10 }) { Image($r('app.media.icon')) .width('30%') .height('15%') .margin({ top: 10, bottom: 2 }) Text('登录界面') .fontSize(24) .fontWeight(FontWeight.Medium) .fontColor('#182431') TextInput({ placeholder: '账号' }) .max...
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() { Column({ space: 10 }) { Image($r('app.media.icon')) .width('30%') .height('15%') .margin({ top: 10, bottom: 2 }) Text('登录界面') .fontSize(24) .fontWeight(FontWeight.Medium) .fontColor('#182431') TextInput({ placeholder: '账号' }) .max...
https://gitee.com/openharmony/vendor_unionman.git
6732960ec391a252c29b19f1ff26d7014e533661
gitee
Vincent-Leon/zotero-harmony
entry/src/main/ets/api/ZoteroClient.ets
arkts
getCollections
GET /users/{uid}/collections. Returns one page of collections.
async getCollections(options?: ListOptions): Promise<PagedResult<ZoteroCollection>> { const uid = this.requireUserId(); const path = `/users/${uid}/collections${buildQuery(options)}`; const raw = await this.send(path, options !== undefined ? options.since : undefined); return { items: parseColle...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getCollections AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#optional_parameter#Left AST#identifier#Left options AST#identifier#Right AST#?#Left ? AST#?#Right AST#type_a...
async getCollections(options?: ListOptions): Promise<PagedResult<ZoteroCollection>> { const uid = this.requireUserId(); const path = `/users/${uid}/collections${buildQuery(options)}`; const raw = await this.send(path, options !== undefined ? options.since : undefined); return { items: parseColle...
https://github.com/Vincent-Leon/zotero-harmony
424ded025023ad6c90bd69deb4c99551c24c80ec
github
SummerKaze/HMOS-AppBundleNameForShared
entry/src/main/ets/utils/FullScreen.ets
arkts
disable
关闭沉浸式
static async disable() { try { // 获取上下文对象 const context = AppStorage.get<Context>('context') if (context) { // 获取最后一个窗口实例 const win = await window.getLastWindow(context) // 开启沉浸式 win.setWindowLayoutFullScreen(false) // 清空上方安全区高度 AppStorage.setOrCreate('t...
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 disable AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Ri...
static async disable() { try { // 获取上下文对象 const context = AppStorage.get<Context>('context') if (context) { // 获取最后一个窗口实例 const win = await window.getLastWindow(context) // 开启沉浸式 win.setWindowLayoutFullScreen(false) // 清空上方安全区高度 AppStorage.setOrCreate('t...
https://github.com/SummerKaze/HMOS-AppBundleNameForShared
76bad941f7b4914133074521e068f6c0056275d5
github
openharmony-sig/fluttertpc_qr_code_scanner
ohos/ohos/src/main/ets/components/plugin/libs/CameraService.ets
arkts
getCameraInfo
获取相机信息
getCameraInfo(front: boolean = false): number { if (!this.context) { return -1; } if (!this.cameraManager) { this.cameraManager = this.getCameraManager(this.context); } // 获取支持的相机设备对象 this.camerasDevices = this.cameraManager!.getSupportedCameras(); if (!this.camerasDevices) { ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCameraInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left front AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#identifier#Left boolean AS...
getCameraInfo(front: boolean = false): number { if (!this.context) { return -1; } if (!this.cameraManager) { this.cameraManager = this.getCameraManager(this.context); } // 获取支持的相机设备对象 this.camerasDevices = this.cameraManager!.getSupportedCameras(); if (!this.camerasDevices) { ...
https://gitee.com/openharmony-sig/fluttertpc_qr_code_scanner.git
a1bb47ba7b6e50e03beb6a465e4c88db0e68ec46
gitee
TDCQCX/ShiHuaMusic-Harmony
entry/src/main/ets/utils/StyleUtil.ets
arkts
getListItemStyle
获取列表项样式
static getListItemStyle(activated: boolean = false) { const theme = ThemeUtil.getCurrentThemeConfig(); const spacing = theme.spacing; return { backgroundColor: activated ? theme.colors.primaryVariant : theme.colors.surface, padding: `${spacing.md}px`, borderRadius: `${theme.borderRa...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getListItemStyle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left activated AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment...
static getListItemStyle(activated: boolean = false) { const theme = ThemeUtil.getCurrentThemeConfig(); const spacing = theme.spacing; return { backgroundColor: activated ? theme.colors.primaryVariant : theme.colors.surface, padding: `${spacing.md}px`, borderRadius: `${theme.borderRa...
https://github.com/TDCQCX/ShiHuaMusic-Harmony
d0462ff7405754006ff832cf0ed40dc7e98c276b
github
Joker-x-dev/CoolMallArkTS
core/ui/src/main/ets/component/goods/GoodsGridItem.ets
arkts
build
构建商品网格卡片 @returns {void} 无返回值
build(): void { Card({ heightValue: bp({ sm: 230, md: 250, lg: 270 }), paddingValue: $r("app.float.space_padding_small"), onTap: (): void => this.onItemClick(this.goods.id) }) { ColumnSpaceBetween({ heightValue: P100 }) { NetWorkImage({ model: this.goods.mainPic, ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#...
build(): void { Card({ heightValue: bp({ sm: 230, md: 250, lg: 270 }), paddingValue: $r("app.float.space_padding_small"), onTap: (): void => this.onItemClick(this.goods.id) }) { ColumnSpaceBetween({ heightValue: P100 }) { NetWorkImage({ model: this.goods.mainPic, ...
https://github.com/Joker-x-dev/CoolMallArkTS
2a53e11d7968e3eb3964e896a8b4a4436caef2b5
github
Dige945/EmoCollector
entry/src/main/ets/model/DBManager.ets
arkts
queryByDate
查询指定日期的所有记录 @param year 年份 @param month 月份(1-12) @param day 日期(1-31) @returns 返回该日期的所有 MoodData 数组
public async queryByDate(year: number, month: number, day: number): Promise<MoodData[]> { if (!this.rdbStore) { console.error('[DBManager] 数据库未初始化'); return []; } try { // 计算当天的开始时间戳(00:00:00) const startTime = new Date(year, month - 1, day, 0, 0, 0).getTime(); // 计算当天的结束时间戳...
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 queryByDate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left year AST#identifier#Right AST#:#Left : AST#:...
public async queryByDate(year: number, month: number, day: number): Promise<MoodData[]> { if (!this.rdbStore) { console.error('[DBManager] 数据库未初始化'); return []; } try { // 计算当天的开始时间戳(00:00:00) const startTime = new Date(year, month - 1, day, 0, 0, 0).getTime(); // 计算当天的结束时间戳...
https://github.com/Dige945/EmoCollector
5b8668c8efb596124de3cf096778682be3f066ae
github
the-wwyang/kids-learning-app
src/main/ets/services/LearningRecordService.ets
arkts
createAnswerRecord
创建答题记录 @param question 题目信息 @param userAnswer 用户答案 @param isCorrect 是否正确 @param difficulty 难度 @param duration 用时(秒) @param points 得分 @returns 答题记录
static createAnswerRecord( question: MathQuestion, userAnswer: string, isCorrect: boolean, difficulty: Difficulty, duration: number = 0, points: number = 0 ): AnswerRecord { return { id: LearningRecordService.generateRecordId(), question, userAnswer, isCorrect, ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createAnswerRecord AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left question AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie...
static createAnswerRecord( question: MathQuestion, userAnswer: string, isCorrect: boolean, difficulty: Difficulty, duration: number = 0, points: number = 0 ): AnswerRecord { return { id: LearningRecordService.generateRecordId(), question, userAnswer, isCorrect, ...
https://github.com/the-wwyang/kids-learning-app
c5929fae6d08150888aaa4ccdac0659a0ac9628e
github
LJ666-ui/harmony-health-care
entry/src/main/ets/utils/AccessibilityUtils.ets
arkts
hexToRgb
HEX颜色转RGB @param hex HEX颜色(如 #FFFFFF 或 #FFF) @returns RGB对象
public static hexToRgb(hex: string): RGB { // 移除#号 hex = hex.replace(/^#/, ''); // 处理简写形式(#FFF -> #FFFFFF) if (hex.length === 3) { hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2]; } // 解析RGB分量 const r = parseInt(hex.substring(0, 2), 16); const g = parseInt(hex...
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 hexToRgb AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left hex AST#identifier#Right AST#:#Left : AST#:#Ri...
public static hexToRgb(hex: string): RGB { // 移除#号 hex = hex.replace(/^#/, ''); // 处理简写形式(#FFF -> #FFFFFF) if (hex.length === 3) { hex = hex[0] + hex[0] + hex[1] + hex[1] + hex[2] + hex[2]; } // 解析RGB分量 const r = parseInt(hex.substring(0, 2), 16); const g = parseInt(hex...
https://github.com/LJ666-ui/harmony-health-care
cb30b4e36f59b82338ed332a00ee5fec4514ba4e
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Intl.ets
arkts
constructor
The Intl.NumberFormat() constructor creates Intl.NumberFormat objects. @param locales locale(s) from which to load formats and symbols for number formatting @param options options
public constructor(locales?: Intl.BCP47LanguageTag | Intl.BCP47LanguageTag[], options?: NumberFormatOptions) { // Set new options or default decimal style this.options = NumberFormat.assignOptionsDefault(options) if (locales == undefined) { if (options != und...
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#binary_expression#Left AST#member_expression#Left AST#identifier#Left locales AST#identifier#Right AST#ERROR#Left AST#?#Le...
public constructor(locales?: Intl.BCP47LanguageTag | Intl.BCP47LanguageTag[], options?: NumberFormatOptions) { // Set new options or default decimal style this.options = NumberFormat.assignOptionsDefault(options) if (locales == undefined) { if (options != und...
https://gitcode.com/iop123123/arkts-static-skills
275c88288e81e3fd7ee149c6046477e0427312f5
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/LRU.ets
arkts
clear
Clears all entries from the cache. @returns { void } @syscap SystemCapability.Utils.Lang @FaAndStageModel
public clear(): void { ConcurrencyHelpers.mutexLock(this.mutex); try { this.map.clear(); this.head = undefined; this.tail = undefined; this.size = 0; } finally { ConcurrencyHelpers.mutexUnlock(this.mutex); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left clear AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Rig...
public clear(): void { ConcurrencyHelpers.mutexLock(this.mutex); try { this.map.clear(); this.head = undefined; this.tail = undefined; this.size = 0; } finally { ConcurrencyHelpers.mutexUnlock(this.mutex); } }
https://gitcode.com/iop123123/arkts-static-skills
5b1eac8af86528a4c8fa4e2c97281198dc1a1867
gitcode
LJ666-ui/harmony-health-care
entry/src/main/ets/components/charts/base/BaseChart.ets
arkts
getRenderContext
获取渲染上下文
protected getRenderContext(): ChartRenderContext | null { if (!this.ctx) { return null; } return { ctx: this.ctx, width: this.config.width, height: this.config.height, plotArea: this.getPlotArea(), animationProgress: this.animationProgress, interaction: this....
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left getRenderContext 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_expre...
protected getRenderContext(): ChartRenderContext | null { if (!this.ctx) { return null; } return { ctx: this.ctx, width: this.config.width, height: this.config.height, plotArea: this.getPlotArea(), animationProgress: this.animationProgress, interaction: this....
https://github.com/LJ666-ui/harmony-health-care
355f618c416684790c94ea0821d5f2ebe3a5709d
github
openharmony-tpc/VCard
library/src/main/ets/components/VCardParserImpl_V21.ets
arkts
handleParams
params = ";" [ws] paramlist paramlist = paramlist [ws] ";" [ws] param / param param = "TYPE" [ws] "=" [ws] ptypeval / "VALUE" [ws] "=" [ws] pvalueval / "ENCODING" [ws] "=" [ws] pencodingval / "CHARSET" [ws] "=" [ws] charsetval / "LANGUAGE" [ws] "=" [ws] langval / "X-" word [ws] "=" [ws] word / knowntype
protected handleParams(propertyData: VCardProperty, params: string): void { const strArray: string[] = params.split("=", 2); if (strArray.length == 2) { const paramName: string = strArray[0].trim().toUpperCase(); let paramValue: string = strArray[1].trim(); if (pa...
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left handleParams AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left propertyData AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#id...
protected handleParams(propertyData: VCardProperty, params: string): void { const strArray: string[] = params.split("=", 2); if (strArray.length == 2) { const paramName: string = strArray[0].trim().toUpperCase(); let paramValue: string = strArray[1].trim(); if (pa...
https://gitee.com/openharmony-tpc/VCard.git
2ab56344d15e291ea6de0fafec2800fbc1f5a4e8
gitee
Amaz1ny/HarmonyDO-public
entry/src/main/ets/services/network/CfChallengeService.ets
arkts
verify
启动验证流程(如果已有验证在进行,复用同一个 Promise)
verify(): Promise<boolean> { const ctx: CfVerifyContext | null = this.verifyContext; if (this.isInCooldown()) { const remainingMs: number = this.getCooldownRemainingMs(); const canBypassCooldown: boolean = ctx !== null && !ctx.silent; if (!canBypassCooldown) { const caller: string = ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left verify AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left AST#identifier#Left Promise AST#identifier#Right...
verify(): Promise<boolean> { const ctx: CfVerifyContext | null = this.verifyContext; if (this.isInCooldown()) { const remainingMs: number = this.getCooldownRemainingMs(); const canBypassCooldown: boolean = ctx !== null && !ctx.silent; if (!canBypassCooldown) { const caller: string = ...
https://github.com/Amaz1ny/HarmonyDO-public
8aebe0b3b66a5e636c0106330c950eab3de05569
github
itrainhub/wu-ui
WuUI/wu_ui/src/main/ets/components/image/index.ets
arkts
handlePreviewImage
无预览图像设置时与原始图像一致
handlePreviewImage() { if (!this.previewImage) { this.previewImage = this.src } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left handlePreviewImage 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...
handlePreviewImage() { if (!this.previewImage) { this.previewImage = this.src } }
https://github.com/itrainhub/wu-ui
0fa0ee75a504408d3aa041eceb7687eaead91b04
github
aimilin6688/KeePassHO
entry/src/main/ets/services/CrashLogService.ets
arkts
ensureLogDir
确保日志目录存在
private async ensureLogDir(): Promise<void> { try { if (!this.logDirPath) { return; } const isExist = await fileIo.access(this.logDirPath); if (!isExist) { await fileIo.mkdir(this.logDirPath); hilog.info(DOMAIN, TAG, 'Created crash log directory'); } } cat...
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 ensureLogDir AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#...
private async ensureLogDir(): Promise<void> { try { if (!this.logDirPath) { return; } const isExist = await fileIo.access(this.logDirPath); if (!isExist) { await fileIo.mkdir(this.logDirPath); hilog.info(DOMAIN, TAG, 'Created crash log directory'); } } cat...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/CrashLogService.ets#L77-L91
a9a9335c05db4cf16df88d0177327204e655c337
github
Joker-x-dev/CoolMallArkTS
core/designsystem/src/main/ets/component/Row.ets
arkts
build
渲染布局 @returns {void} 无返回值 @example RowStartCenter() { Text("Hi"); }
build(): void { RowBase({ options: this.options, justifyContent: FlexAlign.Start, alignItems: VerticalAlign.Center, widthValue: this.widthValue, heightValue: this.heightValue, sizeValue: this.sizeValue, paddingValue: this.paddingValue, marginValue: this.marginValue,...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#...
build(): void { RowBase({ options: this.options, justifyContent: FlexAlign.Start, alignItems: VerticalAlign.Center, widthValue: this.widthValue, heightValue: this.heightValue, sizeValue: this.sizeValue, paddingValue: this.paddingValue, marginValue: this.marginValue,...
https://github.com/Joker-x-dev/CoolMallArkTS
f49d6175110f9b054b1e4252424c2c66db1c5050
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/BarDataSet.ets
arkts
getBarBorderWidth
Returns the width used for drawing borders around the bars. If borderWidth == 0, no border will be drawn. @return
public getBarBorderWidth(): number { return this.mBarBorderWidth; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getBarBorderWidth 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 getBarBorderWidth(): number { return this.mBarBorderWidth; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
f97517b79404c542c4d7a9a0b6c328cd0e13facd
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/EBookDataManager.ets
arkts
deleteFileIfExists
删除文件(如果存在)
private deleteFileIfExists(filePath: string): void { try { if (SafeFileUtils.accessSync(filePath)) { SafeFileUtils.unlinkSync(filePath); logger.info(TAG, `成功删除文件: ${filePath}`); } } catch (e) { logger.warn(TAG, `文件不存在或删除失败: ${filePath}`); } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left deleteFileIfExists AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST...
private deleteFileIfExists(filePath: string): void { try { if (SafeFileUtils.accessSync(filePath)) { SafeFileUtils.unlinkSync(filePath); logger.info(TAG, `成功删除文件: ${filePath}`); } } catch (e) { logger.warn(TAG, `文件不存在或删除失败: ${filePath}`); } }
https://github.com/DaLongZhuaZi/manxia
60fe120e8b6da6607d38292a858396537e9c5585
github
HarmonyOS_Samples/BestPracticeSnippets
Privacy/privacy/src/main/ets/pages/UrlListCheck.ets
arkts
checkUrl
Check Function
function checkUrl(surl: string): boolean { let tmpUrl = url.URL.parseURL(surl); hilog.info(0x0000, 'privacy', 'res.scheme:' + tmpUrl.protocol); // scheme hilog.info(0x0000, 'privacy', 'res.host:' + tmpUrl.host); // host hilog.info(0x0000, 'privacy', 'res.port:' + tmpUrl.port); // port hilog.info(0x0000, 'priv...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left checkUrl AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left surl AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right A...
function checkUrl(surl: string): boolean { let tmpUrl = url.URL.parseURL(surl); hilog.info(0x0000, 'privacy', 'res.scheme:' + tmpUrl.protocol); // scheme hilog.info(0x0000, 'privacy', 'res.host:' + tmpUrl.host); // host hilog.info(0x0000, 'privacy', 'res.port:' + tmpUrl.port); // port hilog.info(0x0000, 'priv...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
1f21b1fe92d3027ff0fe9c41afa13d2b1e428533
gitcode
aimilin6688/KeePassHO
entry/src/main/ets/common/utils/WebDavClient.ets
arkts
upload
上传文件 @param remoteUri @param fileBuffer @param progressCallback @returns
async upload(remoteUri: string, fileBuffer: ArrayBuffer, progressCallback?: (totalSize: number, transferredSize: number) => void): Promise<ResultInfo> { // 读取文件 const customHttpEventsHandler: rcp.HttpEventsHandler = { onUploadProgress: (totalSize: number, transferredSize: number) => { if (pr...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left upload AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left remoteUri AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST...
async upload(remoteUri: string, fileBuffer: ArrayBuffer, progressCallback?: (totalSize: number, transferredSize: number) => void): Promise<ResultInfo> { // 读取文件 const customHttpEventsHandler: rcp.HttpEventsHandler = { onUploadProgress: (totalSize: number, transferredSize: number) => { if (pr...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/WebDavClient.ets#L369-L385
2c4cb30fbb110e478de3b7ea04414a2e11c417aa
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/GamepadManager.ets
arkts
handleGCButtonEvent
处理 Game Controller Kit 按键事件
private handleGCButtonEvent(deviceId: string, buttonCode: number, isPressed: boolean): void { // 获取或创建设备状态 let state = this.gcDeviceStates.get(deviceId); if (!state) { state = this.createEmptyState(); this.gcDeviceStates.set(deviceId, state); } // 长按 Start 检测 (2312 = BUTTON_MENU/S...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleGCButtonEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left deviceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AS...
private handleGCButtonEvent(deviceId: string, buttonCode: number, isPressed: boolean): void { // 获取或创建设备状态 let state = this.gcDeviceStates.get(deviceId); if (!state) { state = this.createEmptyState(); this.gcDeviceStates.set(deviceId, state); } // 长按 Start 检测 (2312 = BUTTON_MENU/S...
https://github.com/AlkaidLab/moonlight-harmony
71a32ef848b311098241d9fc4ed5da9ed18b3fca
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/FTP/FTPNativeClient.ets
arkts
listWithResult
获取目录列表结果(保留错误信息)
async listWithResult(remotePath: string = '/'): Promise<FTPListResult> { if (!this.initialized) { await this.initialize(); } if (!nativeModule) { const message = `FTP Native模块未加载: ${nativeModuleError}`; logger.warn(TAG, message); return { success: false, message: m...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left listWithResult AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left remotePath AST#identifier#Righ...
async listWithResult(remotePath: string = '/'): Promise<FTPListResult> { if (!this.initialized) { await this.initialize(); } if (!nativeModule) { const message = `FTP Native模块未加载: ${nativeModuleError}`; logger.warn(TAG, message); return { success: false, message: m...
https://github.com/DaLongZhuaZi/manxia
d4ff3970041b4d4ddb6495b05387e3381a101afa
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/SettingsManager.ets
arkts
handleSchemaMigration
============================================================================ Schema 版本管理 ============================================================================ 处理 schema 版本迁移 Requirements: 12.6, 12.7
private async handleSchemaMigration(): Promise<void> { if (!this.dataPreferences) return; try { const storedVersion = await this.dataPreferences.get(SCHEMA_VERSION_KEY, 0) as number; if (storedVersion < CURRENT_SCHEMA_VERSION) { console.info(`${TAG} Migrating schema from v${storedVersion...
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 handleSchemaMigration AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#R...
private async handleSchemaMigration(): Promise<void> { if (!this.dataPreferences) return; try { const storedVersion = await this.dataPreferences.get(SCHEMA_VERSION_KEY, 0) as number; if (storedVersion < CURRENT_SCHEMA_VERSION) { console.info(`${TAG} Migrating schema from v${storedVersion...
https://github.com/richshaw2015/nds
1df1e42f4ac50d00e8fae2e3dc656ba74cb4e1c1
github
offlinecat-dev/OCNetORM
src/main/ets/query/QueryBuilder.ets
arkts
getOrderByColumns
获取排序子句 @returns 排序子句数组
getOrderByColumns(): Array<OrderByClause> { const cloned: Array<OrderByClause> = [] for (let i = 0; i < this.orderByColumns.length; i++) { const item = this.orderByColumns[i] cloned.push(new OrderByClause(item.column, item.direction)) } return cloned }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getOrderByColumns AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:...
getOrderByColumns(): Array<OrderByClause> { const cloned: Array<OrderByClause> = [] for (let i = 0; i < this.orderByColumns.length; i++) { const item = this.orderByColumns[i] cloned.push(new OrderByClause(item.column, item.direction)) } return cloned }
https://github.com/offlinecat-dev/OCNetORM
9f50406d58ff12eae373ee946178944995df54a9
github
openharmony-sig/commons-cli
library/src/main/ets/components/cli/HelpFormatter.ets
arkts
printHelp
Print the help for {@code options} with the specified command line syntax. This method prints help information to System.out. @param cmdLineSyntax the syntax for this application @param header the banner to display at the beginning of the help @param options the Options instance @param footer the banner to display at t...
public printHelp(cmdLineSyntax: string, header: string, options: Options, footer: string, autoUsage: boolean, width?: number, leftPad?: number, descPad?: number): void { if (cmdLineSyntax == null || cmdLineSyntax == "") { throw new Error("cmdLineSyntax not provided"); } if (!width...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left printHelp AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left cmdLineSyntax AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string...
public printHelp(cmdLineSyntax: string, header: string, options: Options, footer: string, autoUsage: boolean, width?: number, leftPad?: number, descPad?: number): void { if (cmdLineSyntax == null || cmdLineSyntax == "") { throw new Error("cmdLineSyntax not provided"); } if (!width...
https://gitee.com/openharmony-sig/commons-cli.git
255134c70b88d2b94c378e5d2b8c248e13fa09f0
gitee
Harrisonls2004/WaterFlow
entry/src/main/ets/common/utils/UserManager.ets
arkts
getAllUsernames
Get all registered usernames (for debugging).
static async getAllUsernames(): Promise<string[]> { if (!UserManager.dataPreferences) { return []; } try { const usersJson = await UserManager.dataPreferences.get(UserManager.KEY_USERS, '[]') as string; const users: IUser[] = JSON.parse(usersJson); return users.map(user => user.us...
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 getAllUsernames AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#...
static async getAllUsernames(): Promise<string[]> { if (!UserManager.dataPreferences) { return []; } try { const usersJson = await UserManager.dataPreferences.get(UserManager.KEY_USERS, '[]') as string; const users: IUser[] = JSON.parse(usersJson); return users.map(user => user.us...
https://github.com/Harrisonls2004/WaterFlow
fe5c5d4c04955a090199ef5d14cdd19ef71c2239
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Object.ets
arkts
fromEntries
Transforms key-value pairs into a Record. @static @param { Iterable<[PropertyKey, T]> } entries an Iterable object that contains key-value pairs @returns { Record<PropertyKey, T> } @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static fromEntries<T = Any>(entries: Iterable<[PropertyKey, T]>): Record<PropertyKey, T> { const result = new Record<PropertyKey, T>() const entriesIter = entries.$_iterator() let entriesIterResult = entriesIter.next() while (!entriesIterResult.done) { const entr...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#ERROR#Right AST#expression_statement#Left AST#binary_expression#Left AST#identifier#Left fromEntries AST#identifier#Right AST#<#Left < AST#<#Right AST#assignment_expression#Left AST#identifier#Lef...
public static fromEntries<T = Any>(entries: Iterable<[PropertyKey, T]>): Record<PropertyKey, T> { const result = new Record<PropertyKey, T>() const entriesIter = entries.$_iterator() let entriesIterResult = entriesIter.next() while (!entriesIterResult.done) { const entr...
https://gitcode.com/iop123123/arkts-static-skills
f4010e5ab743b9b065a64ab8f57451b78004adb5
gitcode
Delsin-Yu/JustPDF
entry/src/main/ets/pages/pdfview/PDFLinkJumpHistory.ets
arkts
recordJump
用户主动跳转到新页时调用;会清空前进栈。
recordJump(fromPageIndex: number, toPageIndex: number): void { if (fromPageIndex === toPageIndex) { return; } this.backStack.push(fromPageIndex); this.forwardStack = []; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left recordJump AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left fromPageIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , AST...
recordJump(fromPageIndex: number, toPageIndex: number): void { if (fromPageIndex === toPageIndex) { return; } this.backStack.push(fromPageIndex); this.forwardStack = []; }
https://github.com/Delsin-Yu/JustPDF/blob/07d9dd917e7592f584d67821fb06a7369bd3f15b/entry/src/main/ets/pages/pdfview/PDFLinkJumpHistory.ets#L12-L18
2ce6531af96fc977eb4a9f41fe16306fc5122067
github
HarmonyOS_Samples/MusicHome
features/player/src/main/ets/viewmodel/PlayerViewModel.ets
arkts
currentTrack
Current queue item projected to PlayerTrackUi, or undefined when queue empty.
public currentTrack(): PlayerTrackUi | undefined { return PlayerDataUtil.getCurrentTrackUi(this.appState); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left currentTrack AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left AS...
public currentTrack(): PlayerTrackUi | undefined { return PlayerDataUtil.getCurrentTrackUi(this.appState); }
https://gitcode.com/HarmonyOS_Samples/MusicHome
9f3c8faeb2b52a847a379ee561cbde23484237ff
gitcode
openharmony/arkui_ace_engine
advanced_ui_component_static/assembled_advanced_ui_component/@ohos.arkui.advanced.GridObjectSortComponent.ets
arkts
imageTextAddIcon
Adding a Region Icon in image_text Mode
imageTextAddIcon(select: GridObjectSortComponentItem): Resource { const clickAddIcon: boolean = this.clickAddBtn && this.content.id === select.id && this.gridComState; const icon = clickAddIcon ? $r('sys.symbol.minus_circle_fill') : $r('sys.symbol.plus_circle_fill'); return icon; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left imageTextAddIcon AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left select AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left GridObjectSortComponentItem AST#ident...
imageTextAddIcon(select: GridObjectSortComponentItem): Resource { const clickAddIcon: boolean = this.clickAddBtn && this.content.id === select.id && this.gridComState; const icon = clickAddIcon ? $r('sys.symbol.minus_circle_fill') : $r('sys.symbol.plus_circle_fill'); return icon; }
https://gitcode.com/openharmony/arkui_ace_engine
210e71fc1ff9ae43636d4f1e5daed737d4a13e49
gitcode
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/components/Legend.ets
arkts
getVerticalAlignment
returns the vertical alignment of the legend @return
public getVerticalAlignment(): LegendVerticalAlignment { return this.mVerticalAlignment; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getVerticalAlignment AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left L...
public getVerticalAlignment(): LegendVerticalAlignment { return this.mVerticalAlignment; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
4943c1f5bb95a9c8ffe402829d6d050f0741c8fc
gitee
openharmony/applications_app_samples
code/BasicFeature/Media/CustomScan/customscan/src/main/ets/viewmodel/CustomScanViewModel.ets
arkts
restartCustomScan
重新启动扫码 @returns {void}
async restartCustomScan(): Promise<void> { logger.info('restartCustomScan'); // 关闭存在的扫描结果对话框 this.closeScanResult(); // 根据窗口尺寸调整展示组件尺寸 await this.updateCameraCompSize(); // 调整相机surface尺寸 this.cameraCompSizeUpdateCb(this.cameraCompWidth, this.cameraCompHeight...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left restartCustomScan AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Rig...
async restartCustomScan(): Promise<void> { logger.info('restartCustomScan'); // 关闭存在的扫描结果对话框 this.closeScanResult(); // 根据窗口尺寸调整展示组件尺寸 await this.updateCameraCompSize(); // 调整相机surface尺寸 this.cameraCompSizeUpdateCb(this.cameraCompWidth, this.cameraCompHeight...
https://github.com/openharmony/applications_app_samples
845ad34a20f6f77ea1d2ff85cc108b06797f28b6
github
Amaz1ny/HarmonyDO-public
entry/src/main/ets/services/network/ApiClient.ets
arkts
getHttpClient
获取 HTTP 客户端(用于设置 cookies 等)
getHttpClient(): HttpClient { return this.http; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getHttpClient AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left HttpClient AST#identifier#Right AST#ERROR#Right ...
getHttpClient(): HttpClient { return this.http; }
https://github.com/Amaz1ny/HarmonyDO-public
e14bf0fc6f533db4a14b98a85d980bd2c40739c8
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/highlight/ChartHighlighter.ets
arkts
getClosestHighlightByPixel
Returns the Highlight of the DataSet that contains the closest value on the y-axis. @param closestValues contains two Highlight objects per DataSet closest to the selected x-position (determined by rounding up an down) @param x @param y @param axis the closest axis @param minSelectionDistance @re...
public getClosestHighlightByPixel(closestValues: JArrayList<Highlight>, x: number, y: number, axis: AxisDependency, minSelectionDistance: number): Highlight | null { let closest: Highlight | null = null; let distance: number = minSelectionDistance; for (let i: number ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getClosestHighlightByPixel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left closestValues AST#identifier#Right AST#ERROR#Left AST#:#L...
public getClosestHighlightByPixel(closestValues: JArrayList<Highlight>, x: number, y: number, axis: AxisDependency, minSelectionDistance: number): Highlight | null { let closest: Highlight | null = null; let distance: number = minSelectionDistance; for (let i: number ...
https://gitee.com/openharmony-tpc/ohos_mpchart.git
dce9c8cb748692e4fd955a20899e3022aa7bbbfa
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
constructor
Creates a copy of Uint32Array. @param { Uint32Array } other - data initializer @syscap SystemCapability.Utils.Lang @FaAndStageModel
public constructor(other: Uint32Array) { this.buffer = other.buffer.slice(other.byteOffset, other.byteOffset + other.byteLength) as ArrayBuffer this.byteLengthInt = other.byteLength this.lengthInt = other.length this.byteOffsetInt = 0 }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Uin...
public constructor(other: Uint32Array) { this.buffer = other.buffer.slice(other.byteOffset, other.byteOffset + other.byteLength) as ArrayBuffer this.byteLengthInt = other.byteLength this.lengthInt = other.length this.byteOffsetInt = 0 }
https://gitcode.com/iop123123/arkts-static-skills
ec12ce433234594ca0292e6a923ff0761cd03ce6
gitcode
zhubowen-bot/Bowen_ArkWeb_framework
entry/src/main/ets/delegate/WebDownloadFileImpl.ets
arkts
getInstance
单例访问入口
static getInstance(): WebDownloadFileHelper { return WebDownloadFileHelper.instance }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left WebDownloa...
static getInstance(): WebDownloadFileHelper { return WebDownloadFileHelper.instance }
https://github.com/zhubowen-bot/Bowen_ArkWeb_framework
fab8b988c617c8af049f3cb1a56531fd0cc9df07
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/animation/ChartAnimator.ets
arkts
getPhaseY
Gets the Y axis phase of the animation. @return float value of {@link #mPhaseY}
public getPhaseY(): number { return this.mPhaseY; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getPhaseY AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#numbe...
public getPhaseY(): number { return this.mPhaseY; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
52f38f8a6cecf53eed4218136c2581c7707fcd48
gitee
OHPG/FinSdk
plex/src/main/ets/api/UserApi.ets
arkts
signIn
Sign in to plex.tv with username/password and get auth token POST https://plex.tv/api/v2/users/signin?login=xxx&password=xxx
public async signIn(username: string, password: string): Promise<PlexAccount> { let params: PlexSignIn = { login: username, password: password } return this.apiClient.post({ url: "https://plex.tv", path: "/api/v2/users/signin", parameters: params }) }
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 signIn AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left username AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#...
public async signIn(username: string, password: string): Promise<PlexAccount> { let params: PlexSignIn = { login: username, password: password } return this.apiClient.post({ url: "https://plex.tv", path: "/api/v2/users/signin", parameters: params }) }
https://github.com/OHPG/FinSdk
c0c0940741268cd77fa34937c9de24444046a02f
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Box.ets
arkts
constructor
Creates a new FloatBox instance with the specified initial value. @param { float } value - The initial float value to be wrapped @syscap SystemCapability.Utils.Lang @FaAndStageModel
public constructor(value: float) { this.value = value; }
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 flo...
public constructor(value: float) { this.value = value; }
https://gitcode.com/iop123123/arkts-static-skills
c2851735e773b032fc5d3f9c4220a6a8c7ec7b01
gitcode
openharmony/codelabs
ETSUI/Habit/entry/src/main/ets/model/repository/RecordRepository.ets
arkts
isCheckedInToday
================================================================= 2. 首页 (Index) 专用 =================================================================
async isCheckedInToday(habitId: number): Promise<boolean> { const store = RdbHelper.getRdbStore(); if (!store) { return false; } const now = new Date(); now.setHours(0, 0, 0, 0); const todayStart = now.getTime(); let predicates = new relationalStore.RdbPredicates(CommonConstants.RECO...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left isCheckedInToday AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left habitId AST#identifier#Right AST#type_annotation#Left AST#:#Le...
async isCheckedInToday(habitId: number): Promise<boolean> { const store = RdbHelper.getRdbStore(); if (!store) { return false; } const now = new Date(); now.setHours(0, 0, 0, 0); const todayStart = now.getTime(); let predicates = new relationalStore.RdbPredicates(CommonConstants.RECO...
https://gitcode.com/openharmony/codelabs
ef707c7ec748ca7a42a4db15ff3d868e95cfdac2
gitcode
suibianqwe/Ehviewer_OHOS
entry/src/main/ets/entryability/EntryAbility.ets
arkts
updateBottomAvoidArea
Bottom avoid = max(TYPE_SYSTEM.bottom, TYPE_NAVIGATION_INDICATOR.bottom), kept as a session sticky-max so it survives the reader hiding the system bars (which reports 0).
private updateBottomAvoidArea(win: window.Window): void { let bottomPx = 0; try { bottomPx = Math.max(bottomPx, win.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).bottomRect.height); } catch (error) {} try { bottomPx = Math.max(bottomPx, win.getWindowAvoidArea(window....
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left updateBottomAvoidArea AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left win AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_e...
private updateBottomAvoidArea(win: window.Window): void { let bottomPx = 0; try { bottomPx = Math.max(bottomPx, win.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM).bottomRect.height); } catch (error) {} try { bottomPx = Math.max(bottomPx, win.getWindowAvoidArea(window....
https://github.com/suibianqwe/Ehviewer_OHOS
027402ed1cfcc752ea60a8d27e4b670d4c817f09
github
YANGZX22/Voot
entry/src/main/ets/services/PipSubtitleManager.ets
arkts
subtitleBuilder
Subtitle builder - used for PiP customUIController
@Builder function subtitleBuilder(params: SubtitleParams) { Column() { Text(params.text) .fontSize(params.fontSize) .fontColor(params.fontColor) .textAlign(TextAlign.Center) .maxLines(4) .textOverflow({ overflow: TextOverflow.Ellipsis }) .padding({ left: 12, right: 12, top: 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 subtitleBuilder AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#r...
@Builder function subtitleBuilder(params: SubtitleParams) { Column() { Text(params.text) .fontSize(params.fontSize) .fontColor(params.fontColor) .textAlign(TextAlign.Center) .maxLines(4) .textOverflow({ overflow: TextOverflow.Ellipsis }) .padding({ left: 12, right: 12, top: 8, ...
https://github.com/YANGZX22/Voot
9c86d172d1f19bb4f800513ca90f6fa788ef2984
github
terryma2024/happyword
harmonyos/entry/src/ohosTest/ets/test/WishlistFlow.ui.test.ets
arkts
readWishlistBalance
Read the current coin balance from WishlistPage's header text (`我的魔法币: N ✨`). Returns -1 when the component is missing so the caller can branch on "balance unknown".
async function readWishlistBalance(driver: Driver): Promise<number> { try { const t: Component | null = await driver.findComponent(ON.id('WishlistBalance')); if (t === null) { return -1; } const raw: string = await t.getText(); const match: RegExpMatchArray | null = raw.match(/(\d+)/);...
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left readWishlistBalance AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left driver AST#identifier#Right A...
async function readWishlistBalance(driver: Driver): Promise<number> { try { const t: Component | null = await driver.findComponent(ON.id('WishlistBalance')); if (t === null) { return -1; } const raw: string = await t.getText(); const match: RegExpMatchArray | null = raw.match(/(\d+)/);...
https://github.com/terryma2024/happyword
eaa2d1fd797da6bb1fd4c5ae72c507c8f745aac6
github
openharmony/codelabs
ETSUI/PassNote/entry/src/main/ets/pages/ProfilePage.ets
arkts
navigateToSchedule
跳转到课程表页面
navigateToSchedule() { router.pushUrl({ url: 'pages/SchedulePage' // 确保您已经在 main_pages.json 中配置了这个路径 }); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left navigateToSchedule 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...
navigateToSchedule() { router.pushUrl({ url: 'pages/SchedulePage' // 确保您已经在 main_pages.json 中配置了这个路径 }); }
https://gitcode.com/openharmony/codelabs
ad1b340952b8ef14b4656d3cf408b8fde88afb65
gitcode
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/SmartCategoryDAO.ets
arkts
updateMatchStats
更新规则匹配统计
static async updateMatchStats(ruleId: number, accuracy: number): Promise<boolean> { try { const store = DatabaseManager.getDatabase(); // 先获取当前统计 const rule = await SmartCategoryRuleDAO.getById(ruleId); if (!rule) { return false; } // 更新匹配次数和准确率(移动平均) const newM...
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 updateMatchStats AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ruleId AST#identifier#Right AST#:#Left ...
static async updateMatchStats(ruleId: number, accuracy: number): Promise<boolean> { try { const store = DatabaseManager.getDatabase(); // 先获取当前统计 const rule = await SmartCategoryRuleDAO.getById(ruleId); if (!rule) { return false; } // 更新匹配次数和准确率(移动平均) const newM...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
07887f6f33402f6550789c4901b03fb05b41b63a
github
Harrisonls2004/WaterFlow
entry/src/main/ets/common/utils/MessageManager.ets
arkts
getAllMessages
Get all messages.
private static async getAllMessages(): Promise<IMessage[]> { if (!MessageManager.dataPreferences) { Logger.warn('MessageManager', 'Preferences not initialized'); return []; } try { const messagesJson = await MessageManager.dataPreferences.get(MessageManager.KEY_MESSAGES, '[]') as string...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left getAllMessages AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#argume...
private static async getAllMessages(): Promise<IMessage[]> { if (!MessageManager.dataPreferences) { Logger.warn('MessageManager', 'Preferences not initialized'); return []; } try { const messagesJson = await MessageManager.dataPreferences.get(MessageManager.KEY_MESSAGES, '[]') as string...
https://github.com/Harrisonls2004/WaterFlow
dc3585cc14b8ea3d3a9de2c65d922c81541665a5
github
codelably/tuniao-ui
core/tuniaoui/src/main/ets/index.ets
arkts
getScreenAndAvoidSize
获取规避尺寸
private static getScreenAndAvoidSize() { try { const mainWindow: window.Window = TnUIInitializer.windowStage.getMainWindowSync(); const screenInfo: window.WindowProperties = mainWindow.getWindowProperties(); const avoidArea = mainWindow.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM); ...
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 getScreenAndAvoidSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#...
private static getScreenAndAvoidSize() { try { const mainWindow: window.Window = TnUIInitializer.windowStage.getMainWindowSync(); const screenInfo: window.WindowProperties = mainWindow.getWindowProperties(); const avoidArea = mainWindow.getWindowAvoidArea(window.AvoidAreaType.TYPE_SYSTEM); ...
https://github.com/codelably/tuniao-ui
52a1c737284e9f6830645e76f7f63e01a1ff08fa
github
harmonyos/codelabs
HarmonyOS_NEXT/OxHornCampus/entry/src/main/ets/controller/MapController.ets
arkts
pinchUpdate
When the map is pinched. @param event Kneading gesture event.
pinchUpdate(event: GestureEvent, callBack: Function): void { let scale = Number.parseFloat(event.scale.toFixed(Const.MAP_SCALE_ACCURACY)); let ratio = 1; if (this.previousScale !== scale) { if (event.scale < 1) { ratio = 1 / Const.MAP_ZOOM_RATIO; this.pinchCount--; } else { ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left pinchUpdate 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 GestureEvent AST#identifier#Right AST#,#Lef...
pinchUpdate(event: GestureEvent, callBack: Function): void { let scale = Number.parseFloat(event.scale.toFixed(Const.MAP_SCALE_ACCURACY)); let ratio = 1; if (this.previousScale !== scale) { if (event.scale < 1) { ratio = 1 / Const.MAP_ZOOM_RATIO; this.pinchCount--; } else { ...
https://gitee.com/harmonyos/codelabs.git
c322f46ddadac2ca29c203e9227f1cc5669a4877
gitee
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/LineDataSet.ets
arkts
getCircleSize
This function is deprecated because of unclarity. Use getCircleRadius instead. @Deprecated
public getCircleSize(): number { return this.getCircleRadius(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCircleSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#n...
public getCircleSize(): number { return this.getCircleRadius(); }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
d0713aa41d6f15346e5e522c9631c1f5c296a3e8
gitee
arkui-x/samples
CodeLab/Cases/feature/cardswiperanimation/src/main/ets/model/CardModel.ets
arkts
constructor
构造器 @param list
constructor(list: CardInfo[]) { this.list = list; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left list AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left...
constructor(list: CardInfo[]) { this.list = list; }
https://gitcode.com/arkui-x/samples
bad72eb4d523c53f452f298a1ca54b9c76dcdd26
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Class.ets
arkts
getSuper
Get the super class of a class @returns { Class | undefined } return the super class @syscap SystemCapability.Utils.Lang @FaAndStageModel
public getSuper(): Class | undefined { return this.superClass }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getSuper AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left AST#id...
public getSuper(): Class | undefined { return this.superClass }
https://gitcode.com/iop123123/arkts-static-skills
d0618d8342e63380bc3e3ff57450ab1d0a8abcfa
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/FontManager.ets
arkts
getCustomFonts
获取自定义字体列表
getCustomFonts(): CustomFont[] { return this.customFonts.slice(); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getCustomFonts AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ...
getCustomFonts(): CustomFont[] { return this.customFonts.slice(); }
https://github.com/DaLongZhuaZi/manxia
49107820173418570b7cd1f08a70c11e37d6533b
github
LongLiveY96/chatcube
entry/src/main/ets/services/PreferencesService.ets
arkts
setOnboardingCompleted
设置首次启动引导完成态
async setOnboardingCompleted(completed: boolean): Promise<void> { await this.setBoolean(PreferenceKeys.ONBOARDING_COMPLETED, completed) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left setOnboardingCompleted AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#...
async setOnboardingCompleted(completed: boolean): Promise<void> { await this.setBoolean(PreferenceKeys.ONBOARDING_COMPLETED, completed) }
https://github.com/LongLiveY96/chatcube
0c1f8662f7f0ada2ba3673274e25c933a6ea25c4
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/GamepadManager.ets
arkts
setGCButton2313ActionCallback
设置 2313 兼容键的自定义动作回调 @param callback 回调接口,包含各种自定义动作的处理函数
setGCButton2313ActionCallback(callback: GCButton2313ActionCallback | null): void { this.gcButton2313ActionCallback = callback; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setGCButton2313ActionCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#identifier#...
setGCButton2313ActionCallback(callback: GCButton2313ActionCallback | null): void { this.gcButton2313ActionCallback = callback; }
https://github.com/AlkaidLab/moonlight-harmony
9578916cc4cc5f7ad31aca675e2c0204669f6b46
github
openharmony-sig/ohos_pull_to_refresh
library/src/main/ets/components/PullToRefresh/PullToRefreshConfigurator.ets
arkts
setHasRefresh
上拉加载更多中时的文本
setHasRefresh(hasRefresh: boolean) { this.hasRefresh = hasRefresh; return this; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setHasRefresh AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left hasRefresh AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Righ...
setHasRefresh(hasRefresh: boolean) { this.hasRefresh = hasRefresh; return this; }
https://gitee.com/openharmony-sig/ohos_pull_to_refresh.git
0640b5ecc5807d184f4ef14b06beece5122ea257
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/ReflectConstructor.ets
arkts
equals
Compares whether the current constructor object is equal to another constructor object. @param { Constructor } other Another constructor object to compare with. @returns { boolean } Returns true if the two constructor objects are equal, otherwise returns false. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public equals(other: Constructor): boolean { return this.methodPtr == other.methodPtr }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left equals AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Construc...
public equals(other: Constructor): boolean { return this.methodPtr == other.methodPtr }
https://gitcode.com/iop123123/arkts-static-skills
9caedb854f81332dca441db8963eec75ae227069
gitcode
Joker-x-dev/HarmonyKit
feature/user/src/main/ets/viewmodel/ProfileViewModel.ets
arkts
getDisplayNickName
获取展示昵称 @returns {ResourceStr} 展示昵称
getDisplayNickName(): ResourceStr { const nickName: string = this.userState.getUserInfo().nickName?.trim() ?? ""; return nickName.length > 0 ? nickName : $r("app.string.user_profile_nickname_empty"); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getDisplayNickName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left ResourceStr AST#identifier#Right AST#ERROR#...
getDisplayNickName(): ResourceStr { const nickName: string = this.userState.getUserInfo().nickName?.trim() ?? ""; return nickName.length > 0 ? nickName : $r("app.string.user_profile_nickname_empty"); }
https://github.com/Joker-x-dev/HarmonyKit
7ee129eaab0b7a59be50b2796a6ab3490192126d
github
cpdd5201314/harmonyOS-music-app
products/phone/src/main/ets/pages/AlbumService.ets
arkts
getKGAlbumInfo
获取酷狗音乐专辑信息 @param albumId 专辑ID @returns Promise<AlbumInfo>
private static async getKGAlbumInfo(albumId: string): Promise<AlbumInfo> { const url = 'http://kmrserviceretry.kugou.com/container/v1/album?dfid=1tT5He3kxrNC4D29ad1MMb6F&mid=22945702112173152889429073101964063697&userid=0&appid=1005&clientver=11589'; const albumIdData: KGAlbumRequestData = { album_id: albumI...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left getKGAlbumInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left albumId AST#ide...
private static async getKGAlbumInfo(albumId: string): Promise<AlbumInfo> { const url = 'http://kmrserviceretry.kugou.com/container/v1/album?dfid=1tT5He3kxrNC4D29ad1MMb6F&mid=22945702112173152889429073101964063697&userid=0&appid=1005&clientver=11589'; const albumIdData: KGAlbumRequestData = { album_id: albumI...
https://github.com/cpdd5201314/harmonyOS-music-app
3f54b6a5803090aeefd9dfd28a3260a40176b36f
github
openharmony/codelabs
CommonEventAndNotification/AlarmClock/entry/src/main/ets/viewmodel/MainViewModel.ets
arkts
getNoonContent
Get noon content in MainViewModel. @param hour number @return content string
public getNoonContent(hour: number): string{ return (hour < CommonConstants.DEFAULT_TOTAL_HOUR ? MainConstant.DEFAULT_STRING_MORNING : MainConstant.DEFAULT_STRING_AFTERNOON); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getNoonContent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left hour AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left n...
public getNoonContent(hour: number): string{ return (hour < CommonConstants.DEFAULT_TOTAL_HOUR ? MainConstant.DEFAULT_STRING_MORNING : MainConstant.DEFAULT_STRING_AFTERNOON); }
https://gitee.com/openharmony/codelabs.git
4b9ef3f13136a50e0d55446fe7114f6223530272
gitee
apap6628114/nga_oh
entry/src/main/ets/common/utils/Logger.ets
arkts
warn
warn 级别日志(始终输出,受 LOG_ENABLED 控制)。 用于可恢复的异常、降级路径。
warn(format: string, ...args: Object[]): void { if (!LOG_ENABLED) { return; } hilog.warn(this.domain, this.tag, format, ...args); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left warn AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left format AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Ri...
warn(format: string, ...args: Object[]): void { if (!LOG_ENABLED) { return; } hilog.warn(this.domain, this.tag, format, ...args); }
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/common/utils/Logger.ets#L153-L158
218e7e8d80d9f75471ab2b7149f1d5649cbabb18
github
751496032/ZRouter
RouterApi/src/main/ets/api/RouterMgr.ets
arkts
registerNavStack
只能注册一次 @param stackName @param pathStack @param willShow
public registerNavStack(stackName: string = DEFAULT_STACK_NAME, pathStack: NavPathStack, willShow?: InterceptionShowCallback): void { this.navStackMgr.registerNavStack(stackName, pathStack, willShow) this.navStackMgr.updateCurrentStackName(stackName) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left registerNavStack AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left stackName AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment...
public registerNavStack(stackName: string = DEFAULT_STACK_NAME, pathStack: NavPathStack, willShow?: InterceptionShowCallback): void { this.navStackMgr.registerNavStack(stackName, pathStack, willShow) this.navStackMgr.updateCurrentStackName(stackName) }
https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/api/RouterMgr.ets#L173-L177
162c0c72a32c03c02a96300606491047fe04bcc8
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ets
arkts
encodeToStringSync
Synchronously encodes the input byte array into a Base64 encoded string. @param src The byte array to encode. @param options The encoding options (Base64 type). @returns A string containing the Base64 encoded result.
encodeToStringSync(src: Uint8Array, options?: Type): string { if (options === undefined) { options = Type.BASIC; } return Base64Helper.encodeBase64(src, options === Type.BASIC_URL_SAFE || options === Type.MIME_URL_SAFE, options === Type.MIME || options === Typ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left encodeToStringSync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left src AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Uint8Array AST#identifier#Right AST#,#...
encodeToStringSync(src: Uint8Array, options?: Type): string { if (options === undefined) { options = Type.BASIC; } return Base64Helper.encodeBase64(src, options === Type.BASIC_URL_SAFE || options === Type.MIME_URL_SAFE, options === Type.MIME || options === Typ...
https://gitcode.com/iop123123/arkts-static-skills
c50f4fa55674c56a2b77552a8c62a5805e6039d2
gitcode
aimilin6688/KeePassHO
entry/src/main/ets/common/utils/KdbxUtils.ets
arkts
isChildGroup
判断分组是否是子分组 @param parentGroup 父分组 @param childGroup 子分组 @returns 结果
public static isChildGroup(parentGroup: KdbxGroup, childGroup: KdbxGroup): boolean { if (parentGroup.groups.length === 0) { return false; } for (let group of parentGroup.groups) { if (group.uuid.id === childGroup.uuid.id) { return true; } if (KdbxUtils.isChildGroup(group, c...
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 isChildGroup AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left parentGroup AST#identifier#Right AST#ERROR#Left AST#:#Lef...
public static isChildGroup(parentGroup: KdbxGroup, childGroup: KdbxGroup): boolean { if (parentGroup.groups.length === 0) { return false; } for (let group of parentGroup.groups) { if (group.uuid.id === childGroup.uuid.id) { return true; } if (KdbxUtils.isChildGroup(group, c...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/KdbxUtils.ets#L128-L141
ba055efc6006bf4f8ab50baf6c0d92b13805a8cf
github
openharmony-sig/online_event
solution_student_challenge/基于OpenHarmony的OpenGit_潘骏翔/OpenGit/entry/src/main/ets/MainAbility/pages/repo/component/StateTag.ets
arkts
getText
根据类型获取文字内容
getText() { switch (this.state) { case State.Open: return $r('app.string.state_pr_open') break case State.Merged: return $r('app.string.state_pr_merged') break case State.Closed: return $r('app.string.state_pr_closed') break case IssueState.O...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getText 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#switch_statement#Left AST#swi...
getText() { switch (this.state) { case State.Open: return $r('app.string.state_pr_open') break case State.Merged: return $r('app.string.state_pr_merged') break case State.Closed: return $r('app.string.state_pr_closed') break case IssueState.O...
https://gitee.com/openharmony-sig/online_event.git
34445d725ba0d889146032c3741fd194a522e324
gitee
PollenWang6/HiXD
entry/src/main/ets/services/DormWaterService.ets
arkts
randStr
===== 工具 =====
private randStr(len: number): string { const chars: string = '0123456789'; let result: string = ''; for (let i = 0; i < len; i++) { result += chars.charAt(Math.floor(Math.random() * chars.length)); } return result; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left randStr AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left len AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number...
private randStr(len: number): string { const chars: string = '0123456789'; let result: string = ''; for (let i = 0; i < len; i++) { result += chars.charAt(Math.floor(Math.random() * chars.length)); } return result; }
https://github.com/PollenWang6/HiXD
b78abf8046e9b7b361530755a722bd11be034609
github
Joker-x-dev/CoolMallArkTS
core/network/src/main/ets/NetworkClient.ets
arkts
getAxios
获取 Axios 实例
public getAxios(): AxiosInstance { return this.axiosInstance; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getAxios AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left AxiosInstance...
public getAxios(): AxiosInstance { return this.axiosInstance; }
https://github.com/Joker-x-dev/CoolMallArkTS
37ceb576a0846d285aad962d84317fa0415f8a62
github
HarmonyOS_Samples/BestPracticeSnippets
HDRVivid/AVPlayer/MediaService/src/main/ets/utils/BackgroundTaskManager.ets
arkts
stopContinuousTask
cancel continuous task
public static stopContinuousTask(context?: common.UIAbilityContext): void { if (!context) { return; } backgroundTaskManager.stopBackgroundRunning(context).then(() => { Logger.info(TAG, 'stopBackgroundRunning succeeded'); }).catch((err: BusinessError) => { Logger.error(TAG, `stopBackg...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left stopContinuousTask AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#?#L...
public static stopContinuousTask(context?: common.UIAbilityContext): void { if (!context) { return; } backgroundTaskManager.stopBackgroundRunning(context).then(() => { Logger.info(TAG, 'stopBackgroundRunning succeeded'); }).catch((err: BusinessError) => { Logger.error(TAG, `stopBackg...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
f58278e7876a3597b5df6e9184f9499705fe2dc7
gitcode
offlinecat-dev/OCNetORM
src/main/ets/query/PredicateBuilder.ets
arkts
valueToString
将值转换为字符串(用于 LIKE 条件)
private static valueToString(value: ValueType | Array<ValueType> | null): string { if (value === null) { return '' } if (Array.isArray(value)) { return '' } if (typeof value === 'string') { return value } return String(value) }
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 valueToString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left ...
private static valueToString(value: ValueType | Array<ValueType> | null): string { if (value === null) { return '' } if (Array.isArray(value)) { return '' } if (typeof value === 'string') { return value } return String(value) }
https://github.com/offlinecat-dev/OCNetORM
a6e5c7ceb40c43468fdf46b0ec15dd01c6b1ffc5
github
aimilin6688/KeePassHO
entry/src/main/ets/services/TotpService.ets
arkts
generateHmac
生成HMAC @param key 密钥字节数组 @param counter 计数器值 @param algorithm 算法类型 @returns HMAC字节数组
private async generateHmac(key: Uint8Array, counter: number, algorithm: TotpAlgorithm): Promise<Uint8Array> { // 将计数器转换为8字节的大端字节数组 const counterBytes = new Uint8Array(8); for (let i = 7; i >= 0; i--) { counterBytes[i] = counter & 0xff; counter = counter >> 8; } // 选择HMAC算法 let hma...
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 generateHmac AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AS...
private async generateHmac(key: Uint8Array, counter: number, algorithm: TotpAlgorithm): Promise<Uint8Array> { // 将计数器转换为8字节的大端字节数组 const counterBytes = new Uint8Array(8); for (let i = 7; i >= 0; i--) { counterBytes[i] = counter & 0xff; counter = counter >> 8; } // 选择HMAC算法 let hma...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/TotpService.ets#L186-L225
d4b3a35cc1e0e3495c0760a15d7d1b443c077eee
github
PollenWang6/HiXD
entry/src/main/ets/services/SportService.ets
arkts
hasPassword
检查是否已设置体育密码
static hasPassword(): boolean { return PreferenceUtil.getString('sport_password').length > 0; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left hasPassword 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#b...
static hasPassword(): boolean { return PreferenceUtil.getString('sport_password').length > 0; }
https://github.com/PollenWang6/HiXD
9b783f95f8ed0039464516e6002c6c5be4527b8e
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Map.ets
arkts
get
Returns a value associated with key if present @param key the key to find in the Map @returns value if associated with key is present.
override get(key: K): V | undefined { const bucketIdx = this.getBucketIndex(key) let bucket = this.getBucketByIdx(bucketIdx) while (isLegalAt(bucket)) { if (Map.sameValueZero(getKeyAt<K>(this.data, bucket), key)) { return getValueAt<V>(this.data, bucket) ...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left override AST#identifier#Right AST#ERROR#Left AST#identifier#Left get AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left key AST#identifier#Right AST#ER...
override get(key: K): V | undefined { const bucketIdx = this.getBucketIndex(key) let bucket = this.getBucketByIdx(bucketIdx) while (isLegalAt(bucket)) { if (Map.sameValueZero(getKeyAt<K>(this.data, bucket), key)) { return getValueAt<V>(this.data, bucket) ...
https://gitcode.com/iop123123/arkts-static-skills
a0a11ed8e0bb9a79416ca90b3b6898e6cdfbd0df
gitcode
XHXYT/Pixark
entry/src/main/ets/common/utils/database/impl/IllustHistoryDao.ets
arkts
save
保存或更新历史记录(基于 pid 判重) 根据pid判断是否存在,存在则更新(如更新访问时间),不存在则新增 @param item 要保存的历史记录对象 @returns 操作影响的行数
async save(item: IllustHistoryInfo): Promise<number> { logger.debug('save item=' + JSON.stringify(item)) let existingItems = await this.queryByPid(item.pid) logger.debug('save existingItems = ' + JSON.stringify(existingItems)) let result: number = -1; if (existingItems && existingItems.length > 0)...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left save AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left item AST#identifier#Right AST#type_annotation#Left AST#:#Left : A...
async save(item: IllustHistoryInfo): Promise<number> { logger.debug('save item=' + JSON.stringify(item)) let existingItems = await this.queryByPid(item.pid) logger.debug('save existingItems = ' + JSON.stringify(existingItems)) let result: number = -1; if (existingItems && existingItems.length > 0)...
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/common/utils/database/impl/IllustHistoryDao.ets#L55-L71
c53fcb410ba4a550dd11abb3fb937a82bd4d1c5f
github
SMAT-Lab/Homecheck-Sec2026
test/unittest/sample/NoUnusedVars/ets/default.ets
arkts
getY
When a function definition destructures an array, unused entries from the array also cause warnings.
function getY([x,y1],h1) { return y1; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getY AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#array_pattern#Left AST#[#Left [ AST#[#Right AST#identifier#Left x AST#identifier#Right AST#,#Left...
function getY([x,y1],h1) { return y1; }
https://github.com/SMAT-Lab/Homecheck-Sec2026
a31e01bac46794e44fd40c722ea685b54fe2d18c
github
openharmony/codelabs
Distributed/DistributeDraw/entry/src/main/ets/common/utils/RemoteDeviceUtil.ets
arkts
startAbility
Start Ability. @param context Ability context. @param device Device information. @param positionList Position list.
startAbility(context: common.UIAbilityContext, device: deviceManager.DeviceInfo, positionList: Position[]): void { let wantValue: Want = { bundleName: context.abilityInfo.bundleName, abilityName: CommonConstants.ABILITY_NAME, deviceId: device.networkId, parameters: { positionList: ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left startAbility AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Left common AST#id...
startAbility(context: common.UIAbilityContext, device: deviceManager.DeviceInfo, positionList: Position[]): void { let wantValue: Want = { bundleName: context.abilityInfo.bundleName, abilityName: CommonConstants.ABILITY_NAME, deviceId: device.networkId, parameters: { positionList: ...
https://gitee.com/openharmony/codelabs.git
31dfbeb8bb68bbd344f1b21be6b8f20caab9b6fc
gitee
HarmonyOS_Samples/BestPracticeSnippets
OptimizationAppMemoryUsage/entry/src/main/ets/utils/LRUCacheUtil.ets
arkts
updateCapacity
Reset the capacity of lruCache
public updateCapacity(newCapacity: number): void { this.lruCache.updateCapacity(newCapacity); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left updateCapacity AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left newCapacity AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#num...
public updateCapacity(newCapacity: number): void { this.lruCache.updateCapacity(newCapacity); }
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
8e5a6219ff5eb2709445ca7ab5ccfcede007fd55
gitcode
openharmony/codelabs
ETSUI/Habit/entry/src/main/ets/model/ReminderHelper.ets
arkts
cancelReminder
取消指定的提醒
static async cancelReminder(reminderId: number) { if (reminderId < 0) { return; } try { await reminderAgentManager.cancelReminder(reminderId); console.info(`[ReminderHelper] 取消成功, ID: ${reminderId}`); } catch (err) { console.error(`[ReminderHelper] 取消失败: ${JSON.stringify(err)}`...
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 cancelReminder AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left reminderId AST#identifier#Right AST#ERROR#Left AST#:#Lef...
static async cancelReminder(reminderId: number) { if (reminderId < 0) { return; } try { await reminderAgentManager.cancelReminder(reminderId); console.info(`[ReminderHelper] 取消成功, ID: ${reminderId}`); } catch (err) { console.error(`[ReminderHelper] 取消失败: ${JSON.stringify(err)}`...
https://gitcode.com/openharmony/codelabs
a8fc6c7f3afee19f57bd4a3880045cc269bdf383
gitcode
Joker-x-dev/HarmonyKit
feature/main/src/main/ets/viewmodel/NavigationViewModel.ets
arkts
clearResult
清空回传结果 @returns {void} 无返回值
private clearResult(): void { this.resultTitle = ""; this.resultDescription = ""; this.hasResult = false; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left clearResult 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 clearResult(): void { this.resultTitle = ""; this.resultDescription = ""; this.hasResult = false; }
https://github.com/Joker-x-dev/HarmonyKit
d8dfa0785325304fd792f7f69d85cf382167003c
github