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
LambdaYH/ScrcpyForHarmonyOS
app/src/main/ets/client/tools/ControlPacket.ets
arkts
createExpandSettingsPanel
============ TYPE_EXPAND_SETTINGS_PANEL (6) ============
static createExpandSettingsPanel(): ArrayBuffer { const buf = new ArrayBuffer(1); const view = new DataView(buf); view.setUint8(0, ControlMessageType.TYPE_EXPAND_SETTINGS_PANEL); return buf; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createExpandSettingsPanel 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#L...
static createExpandSettingsPanel(): ArrayBuffer { const buf = new ArrayBuffer(1); const view = new DataView(buf); view.setUint8(0, ControlMessageType.TYPE_EXPAND_SETTINGS_PANEL); return buf; }
https://github.com/LambdaYH/ScrcpyForHarmonyOS
8ce527dae56786280c77bc5f0fc8288d10c4484e
github
AetheriumSimulator/qemu-hmos
entry/src/main/ets/pages/Index.ets
arkts
getStatusDisplayName
状态显示名称 注意:paused 对应 QEMU 的 suspend,用户看到的是"暂停"
function getStatusDisplayName(status: VMStatus): string { switch (status) { case 'running': return '运行中' case 'stopped': return '已关机' case 'paused': return '暂停中' // QEMU suspend case 'backup': return '备份中' case 'creating': return '创建中' case 'preparing': return '准备中' case 'starting': retur...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getStatusDisplayName AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left status AST#identifier#Right AST#type_annotation#Left AST#:#Left :...
function getStatusDisplayName(status: VMStatus): string { switch (status) { case 'running': return '运行中' case 'stopped': return '已关机' case 'paused': return '暂停中' // QEMU suspend case 'backup': return '备份中' case 'creating': return '创建中' case 'preparing': return '准备中' case 'starting': retur...
https://github.com/AetheriumSimulator/qemu-hmos
763a77cc1ce67cb09e52d9d39a355ac004303630
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelDictRuleManager.ets
arkts
exportToJSON
导出规则为JSON
exportToJSON(): string { const allRules = this.getAllRules(); const exportData: Object[] = []; for (let i = 0; i < allRules.length; i++) { const rule = allRules[i]; const exportRule: Record<string, Object> = new Object() as Record<string, Object>; exportRule['name'] = rule.name; ex...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left exportToJSON AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement...
exportToJSON(): string { const allRules = this.getAllRules(); const exportData: Object[] = []; for (let i = 0; i < allRules.length; i++) { const rule = allRules[i]; const exportRule: Record<string, Object> = new Object() as Record<string, Object>; exportRule['name'] = rule.name; ex...
https://github.com/DaLongZhuaZi/manxia
80a3498c2e371cfb3f10985d2f6917e306d061ea
github
HarmonyOS_Codelabs/arkts-intermediate-syntax
entry/src/main/ets/services/LocalDeviceService.ets
arkts
getDevices
获取所有设备(原始数据) @returns Promise<T[]> 设备列表(带延迟模拟)
async getDevices(): Promise<T[]> { await delay(400); return [...this.devices]; // 返回拷贝,避免外部修改原始数据 }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getDevices AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_t...
async getDevices(): Promise<T[]> { await delay(400); return [...this.devices]; // 返回拷贝,避免外部修改原始数据 }
https://gitcode.com/HarmonyOS_Codelabs/arkts-intermediate-syntax
18e76bc48d8e122313a3d6546f7f8f596a4d58a0
gitcode
Delsin-Yu/JustPDF
entry/src/main/ets/components/PageInfo.ets
arkts
enforcePreviewBudget
限制全局预览光栅数量;优先淘汰 LRU 中队首且不在保护带内的页。
public enforcePreviewBudget(centerIndex: number, displayedPageIndices: number[]): void { const total = this.totalPageCount(); const maxSlots = Math.floor(this.maxPreviewSlotsForTotal(total) * this.previewBudgetMultiplier); const floorSlots = Math.max(6, Math.min(maxSlots, total)); let guard = 0;...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left enforcePreviewBudget AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left centerIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number A...
public enforcePreviewBudget(centerIndex: number, displayedPageIndices: number[]): void { const total = this.totalPageCount(); const maxSlots = Math.floor(this.maxPreviewSlotsForTotal(total) * this.previewBudgetMultiplier); const floorSlots = Math.max(6, Math.min(maxSlots, total)); let guard = 0;...
https://github.com/Delsin-Yu/JustPDF/blob/07d9dd917e7592f584d67821fb06a7369bd3f15b/entry/src/main/ets/components/PageInfo.ets#L946-L970
afb7885ebdad5d362ff333869e2b1baa54d07cb1
github
Joker-x-dev/CoolMallArkTS
core/data/src/main/ets/repository/LaunchStoreRepository.ets
arkts
loadGuideShown
读取引导页已展示状态 @returns {Promise<boolean>} 是否已展示
loadGuideShown(): Promise<boolean> { return this.dataSource.getGuideShown(); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left loadGuideShown AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Rig...
loadGuideShown(): Promise<boolean> { return this.dataSource.getGuideShown(); }
https://github.com/Joker-x-dev/CoolMallArkTS
a5182654726d7a49a07d8f9a9f5a0f33c3ac4e56
github
Tencent-RTC/TUIKit_Harmony
atomic_x/src/main/ets/call/common/CallStore.ets
arkts
switchCamera
切换摄像头
switchCamera(isFront: boolean): void { this.isFrontCamera = isFront; console.info(`[DeviceStore] 切换摄像头, 前置: ${isFront}`); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left switchCamera AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left isFront AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right AST#)#Left ...
switchCamera(isFront: boolean): void { this.isFrontCamera = isFront; console.info(`[DeviceStore] 切换摄像头, 前置: ${isFront}`); }
https://github.com/Tencent-RTC/TUIKit_Harmony
0d1a4be7d97d245a5468ad2dba571f21a6a51cd7
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Byte.ets
arkts
mul
Performs integral multiplication of this instance with provided one, returns the result as new instance @param { Byte } other Right hand side of the multiplication @returns { Byte } @syscap SystemCapability.Utils.Lang @FaAndStageModel
public mul(other: Byte): Byte { return (this.value * other.toByte()).toByte() }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left mul AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left other AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#iden...
public mul(other: Byte): Byte { return (this.value * other.toByte()).toByte() }
https://gitcode.com/iop123123/arkts-static-skills
8dd6d773d6b8e58f5d4fb354e79398bf35b1b3c2
gitcode
openharmony-sig/fluttertpc_camerawesome
ohos/ohos/src/main/ets/components/plugin/CameraAwesomeX.ets
arkts
setupCamera
初始化相机 @param sensor 传感器 @param aspectRatio 纵横比 @param zoom 焦距 @param mirrorFrontCamera 前置摄像头是否镜像拍照 @param enablePhysicalButton 启用物理按钮 @param flashMode 闪光模式 @param captureMode 捕捉模式 @param enableImageStream 启用图像流 @param exifPreferences exif首选项 @param result 返回结果
async setupCamera(sensor: string, aspectRatio: string, zoom: number, mirrorFrontCamera: boolean, enablePhysicalButton: boolean, flashMode: string, captureMode: string, enableImageStream: boolean, exifPreferences: ExifPreferences, result: Result<boolean>): Promise<void> { Logger.debug(TAG, '...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left setupCamera AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sensor AST#identifier#Right AST#type_annotation#Left AST#:...
async setupCamera(sensor: string, aspectRatio: string, zoom: number, mirrorFrontCamera: boolean, enablePhysicalButton: boolean, flashMode: string, captureMode: string, enableImageStream: boolean, exifPreferences: ExifPreferences, result: Result<boolean>): Promise<void> { Logger.debug(TAG, '...
https://gitee.com/openharmony-sig/fluttertpc_camerawesome.git
4066c41758c47a11eb538d09844e99cc56fcd870
gitee
openharmony/codelabs
Media/AudioPlayer/entry/src/main/ets/common/utils/CommonUtil.ets
arkts
formatDuration
Convert milliseconds to component second format. @param ms Milliseconds. @returns
public static formatDuration(ms: number): string { if (ms < 0) { ms = 0; } const secondPrecision = CommonConstants.SECOND_PRECISION; const secondDuration = ms / CommonConstants.SECOND_TO_MS; let min = Math.floor(secondDuration / CommonConstants.MIN_TO_SEC); let sec = Math.round(secondDur...
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 formatDuration AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ms AST#identifier#Right AST#:#Left : AST...
public static formatDuration(ms: number): string { if (ms < 0) { ms = 0; } const secondPrecision = CommonConstants.SECOND_PRECISION; const secondDuration = ms / CommonConstants.SECOND_TO_MS; let min = Math.floor(secondDuration / CommonConstants.MIN_TO_SEC); let sec = Math.round(secondDur...
https://gitee.com/openharmony/codelabs.git
a3c5bd7d3a7bc881cd583dda7dfa2761df2ced4b
gitee
webabcd/HarmonyDemo
entry/src/main/ets/pages/storage/AppFileDemo.ets
arkts
stat
stat(), statSync() - 获取指定路径的文件的详细信息 ino - 文件标识 size - 文件大小(单位:字节) atime - 上次访问文件内容时的时间戳 mtime - 上次修改文件内容时的时间戳 ctime - 上次修改文件状态时的时间戳 isDirectory() - 是否是目录 isFile() - 是否是文件
stat() { fs.stat(this.filePath, (err: BusinessError, stat: fs.Stat) => { if (err) { this.message = `errCode:${err.code}, errMessage:${err.message}` } else { this.message = `ino:${stat.ino}\n` this.message += `size:${stat.size}\n` this.message += `atime:${Helper.getTimes...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left stat 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#ca...
stat() { fs.stat(this.filePath, (err: BusinessError, stat: fs.Stat) => { if (err) { this.message = `errCode:${err.code}, errMessage:${err.message}` } else { this.message = `ino:${stat.ino}\n` this.message += `size:${stat.size}\n` this.message += `atime:${Helper.getTimes...
https://github.com/webabcd/HarmonyDemo
b867d61fbf31bb915d469f5cf420d578b5f03c4c
github
xblLab/HarmonyProjectTemplate
commons/lib_api/src/main/ets/services/MineService.ets
arkts
clearMyMarks
清空我的收藏 @returns
public clearMyMarks(): string[] { const mineUserInfo = this.queryAuthorRaw() as MyAuthor; mineUserInfo.myMarks = [] return mineUserInfo.myMarks }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left clearMyMarks 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#expressio...
public clearMyMarks(): string[] { const mineUserInfo = this.queryAuthorRaw() as MyAuthor; mineUserInfo.myMarks = [] return mineUserInfo.myMarks }
https://github.com/xblLab/HarmonyProjectTemplate
bb3cf875795845e87a6c9002ce5bb6df2a3417ab
github
openharmony-tpc/XmlGraphicsBatik
library/src/main/ets/batik/svggen/SVGRoot.ets
arkts
setViewBox
设置SVG图形的显示盒子 @param x 左上角x坐标 @param y 左上角y坐标 @param width 宽度 @param height 高度
public setViewBox(x: number, y: number, width: number, height: number): void{ let options:optionsType={x:x,y:y,width:width,height:height} this.attributesObj[SVGXMLConstants.SVG_VIEW_BOX_ATTRIBUTE] = options; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setViewBox AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left x AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number A...
public setViewBox(x: number, y: number, width: number, height: number): void{ let options:optionsType={x:x,y:y,width:width,height:height} this.attributesObj[SVGXMLConstants.SVG_VIEW_BOX_ATTRIBUTE] = options; }
https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git
9309a2981510d5b2a47b012b37fbb66b9dede640
gitee
offlinecat-dev/OCNetORM
example/UsageExample.ets
arkts
transactionWithOptionsExample
带配置的事务示例
async function transactionWithOptionsExample(): Promise<void> { const repository = new Repository('ArticleEntity') // 创建默认配置 const defaultOptions = TransactionOptions.createDefault() console.info(`默认超时: ${defaultOptions.timeout}ms`) // 只读事务 const readOnlyOptions = TransactionOptions.readOnly() console.i...
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left transactionWithOptionsExample AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annot...
async function transactionWithOptionsExample(): Promise<void> { const repository = new Repository('ArticleEntity') // 创建默认配置 const defaultOptions = TransactionOptions.createDefault() console.info(`默认超时: ${defaultOptions.timeout}ms`) // 只读事务 const readOnlyOptions = TransactionOptions.readOnly() console.i...
https://github.com/offlinecat-dev/OCNetORM
22c92e049e7c75f13f1bb967875ba3974a8d6cc4
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/ReflectInstanceMethod.ets
arkts
isAbstract
Checks if the method is an abstract method. @returns { boolean } Returns true if the method is abstract, otherwise returns false. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public isAbstract(): boolean { return (this.attributes & Attributes.ABSTRACT) != 0 }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isAbstract AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#bo...
public isAbstract(): boolean { return (this.attributes & Attributes.ABSTRACT) != 0 }
https://gitcode.com/iop123123/arkts-static-skills
c5c055f2868d43349c23a0e744d7d366262cc69b
gitcode
apap6628114/nga_oh
entry/src/main/ets/common/concurrency/Throttler.ets
arkts
release
释放 domain 的一个并发槽位,并唤醒等待队列中的下一个请求。 必须与 {@link acquire} 配对调用:每次 acquire 返回的请求执行完毕后 (无论成功/失败)都应调用一次,否则槽位泄漏导致后续请求永久阻塞。 @param domain - 限流维度(通常为请求域名)
release(domain: string): void { const bucket = this.getBucket(domain); if (bucket.concurrency <= 0) { return; } bucket.concurrency -= 1; if (bucket.waiters.length > 0) { this.tryDispatch(bucket); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left release AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left domain AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)...
release(domain: string): void { const bucket = this.getBucket(domain); if (bucket.concurrency <= 0) { return; } bucket.concurrency -= 1; if (bucket.waiters.length > 0) { this.tryDispatch(bucket); } }
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/common/concurrency/Throttler.ets#L121-L130
533c208e2e409b355187e2c46a81621db4f4d79a
github
Joker-x-dev/CoolMallArkTS
feature/auth/src/main/ets/viewmodel/LoginViewModel.ets
arkts
onAlipayLoginClick
支付宝登录点击 @returns {void} 无返回值
onAlipayLoginClick(): void { // 第三方登录暂未接入,等待后续实现 }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onAlipayLoginClick 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_express...
onAlipayLoginClick(): void { // 第三方登录暂未接入,等待后续实现 }
https://github.com/Joker-x-dev/CoolMallArkTS
1e50b079b2130591347877504f4e9647d20088c9
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Promise.ets
arkts
resolve
Create a resolved promise @returns { Promise<void> } resolved promise
static resolve(): Promise<void> { let p = new Promise<void>(); p.resolveImpl(undefined, false); return p; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left resolve AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#instantiation_expression#Left ...
static resolve(): Promise<void> { let p = new Promise<void>(); p.resolveImpl(undefined, false); return p; }
https://gitcode.com/iop123123/arkts-static-skills
96466b4aad7bf7df66caf85b4e05764897d82785
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Download/DownloadManager.ets
arkts
downloadTask
下载单个任务
private async downloadTask(taskId: string): Promise<void> { const task = this.tasks.get(taskId); if (!task) { logger.warn(TAG, `任务不存在: ${taskId}`); return; } const taskStartedAt: number = Date.now(); try { logger.info(TAG, `开始下载任务: ${taskId}`); task.status = TaskStatus.DOW...
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 downloadTask AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left taskId AST#identifier#Right AST#:#Left :...
private async downloadTask(taskId: string): Promise<void> { const task = this.tasks.get(taskId); if (!task) { logger.warn(TAG, `任务不存在: ${taskId}`); return; } const taskStartedAt: number = Date.now(); try { logger.info(TAG, `开始下载任务: ${taskId}`); task.status = TaskStatus.DOW...
https://github.com/DaLongZhuaZi/manxia
71f398f8f2935d13af4c6fe9840e9fd7e5d91975
github
openharmony/codelabs
Data/DeviceHealth/entry/src/main/ets/security/CryptoUtil.ets
arkts
stringToBytes
string -> Uint8Array
private static stringToBytes(str: string): Uint8Array { const bytes = new Uint8Array(str.length) for (let i = 0; i < str.length; i++) { bytes[i] = str.charCodeAt(i) } return bytes }
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 stringToBytes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : ...
private static stringToBytes(str: string): Uint8Array { const bytes = new Uint8Array(str.length) for (let i = 0; i < str.length; i++) { bytes[i] = str.charCodeAt(i) } return bytes }
https://gitcode.com/openharmony/codelabs
eb0ae836bee568485bae08acebde1376890c99fc
gitcode
openharmony-sig/ohos_video_trimmer
entry/src/main/ets/pages/FileUtils.ets
arkts
writeData
向path写入数据
writeData(path: string, content: ArrayBuffer | string) { try { let fd = fs.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE).fd let stat = fs.statSync(path) console.info("FileUtils - writeData size = " + stat.size + " path=" + path); fs.writeSync(fd, content, { offset: stat.size ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left writeData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST...
writeData(path: string, content: ArrayBuffer | string) { try { let fd = fs.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE).fd let stat = fs.statSync(path) console.info("FileUtils - writeData size = " + stat.size + " path=" + path); fs.writeSync(fd, content, { offset: stat.size ...
https://gitee.com/openharmony-sig/ohos_video_trimmer.git
0fc34cd36f3264aed9ba81a37a7cf0560ac3e1da
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/FontManager.ets
arkts
registerSavedCustomFonts
注册已保存的自定义字体
private async registerSavedCustomFonts(uiContext?: UIContext | null): Promise<void> { const targetUIContext: UIContext | null = uiContext ?? uiContextManager.getUIContext(); if (!targetUIContext) { this.customFonts.forEach((customFont: CustomFont) => { customFont.isRegistered = false; }); ...
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 registerSavedCustomFonts AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uiContext AST#identifier#Rig...
private async registerSavedCustomFonts(uiContext?: UIContext | null): Promise<void> { const targetUIContext: UIContext | null = uiContext ?? uiContextManager.getUIContext(); if (!targetUIContext) { this.customFonts.forEach((customFont: CustomFont) => { customFont.isRegistered = false; }); ...
https://github.com/DaLongZhuaZi/manxia
5af06750b7774d0efb5938a83fbf5535dd469918
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
constructor
Creates an Int16Array with respect to buf and byteOffset. @param buf data initializer @param byteOffset byte offset from begin of the buf
public constructor(buf: Buffer, byteOffset: int) { this(buf, byteOffset, buf.getByteLength() / Int16Array.BYTES_PER_ELEMENT) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left buf AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Buffe...
public constructor(buf: Buffer, byteOffset: int) { this(buf, byteOffset, buf.getByteLength() / Int16Array.BYTES_PER_ELEMENT) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
632dbd42221ff5819b7f4c9b3b57d4326c4cd05c
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/DataConverter.ets
arkts
toBoolean
安全转换布尔值 @param value - 输入值 @param defaultValue - 默认值 @returns 布尔值
static toBoolean(value: Object, defaultValue: boolean = false): boolean { if (value === null || value === undefined) { return defaultValue; } if (typeof value === 'boolean') { return value; } if (typeof value === 'string') { const normalized = value.toLowerCase().trim()...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left toBoolean 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 Objec...
static toBoolean(value: Object, defaultValue: boolean = false): boolean { if (value === null || value === undefined) { return defaultValue; } if (typeof value === 'boolean') { return value; } if (typeof value === 'string') { const normalized = value.toLowerCase().trim()...
https://github.com/DaLongZhuaZi/manxia
526e7371e233125cf13ff424e106af714ffd562e
github
aimilin6688/KeePassHO
entry/src/main/ets/common/utils/KdbxUtils.ets
arkts
toImgBase64Url
将图标数据转换为DataURL @param iconData 图标数据
public static toImgBase64Url(iconData: ArrayBuffer): string | null { return iconData ? 'data:image/png;base64,' + ByteUtils.bytesToBase64(iconData) : null; }
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 toImgBase64Url AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left iconData AST#identifier#Right AST#:#Left...
public static toImgBase64Url(iconData: ArrayBuffer): string | null { return iconData ? 'data:image/png;base64,' + ByteUtils.bytesToBase64(iconData) : null; }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/KdbxUtils.ets#L306-L308
fc7f19324bdad2a60a3219017aa90537b4e8d6fc
github
arkui-x/samples
CodeLab/Cases/feature/customscan/src/main/ets/viewmodel/CustomScanViewModel.ets
arkts
initScanData
自定义扫码数据初始化 @returns {void}
initScanData() { this.isScanLine = false; this.isScanned = false; this.scanResult = {} as ScanResults; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left initScanData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left ...
initScanData() { this.isScanLine = false; this.isScanned = false; this.scanResult = {} as ScanResults; }
https://gitcode.com/arkui-x/samples
fca3418391a2c6b029cc4c2b4a5f9fb0660c5b97
gitcode
openharmony/developtools_profiler
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/DataSet.ets
arkts
copy
@param dataSet
public copy(): DataSet<T> { return null; }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left copy AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right ...
public copy(): DataSet<T> { return null; }
https://gitee.com/openharmony/developtools_profiler.git
edcbd098efdd56056f984e7e6e1ceeaf7f62c9d3
gitee
NissonCX/CQU-HarmonyOS-AppDev-Course-Exp
entry/src/main/ets/pages/24Points.ets
arkts
startNewGame
开始新游戏
startNewGame() { // 清除之前的定时器 if (this.timerId !== -1) { clearInterval(this.timerId); this.timerId = -1; } // 重置游戏时间 this.startTime = Date.now(); this.currentTime = 0; // 启动计时器 this.timerId = setInterval(() => { if (!this.gameFinished) { this.currentT...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left startNewGame AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left ...
startNewGame() { // 清除之前的定时器 if (this.timerId !== -1) { clearInterval(this.timerId); this.timerId = -1; } // 重置游戏时间 this.startTime = Date.now(); this.currentTime = 0; // 启动计时器 this.timerId = setInterval(() => { if (!this.gameFinished) { this.currentT...
https://github.com/NissonCX/CQU-HarmonyOS-AppDev-Course-Exp
f2bbac3aead6ad060059f0ca5f69035467fb0981
github
qiuhaotc/HarmonyOSPlayground
entry/src/main/ets/database/RecurringBillDatabase.ets
arkts
insertGeneratedRecord
插入生成记录
async insertGeneratedRecord(record: GeneratedBillRecord): Promise<number> { if (!this.rdbStore) { throw new Error('数据库未初始化'); } const valueBucket: relationalStore.ValuesBucket = { 'recurringConfigId': record.recurringConfigId, 'generatedDate': record.generatedDate, 'billId': recor...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left insertGeneratedRecord AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left record AST#identifier#R...
async insertGeneratedRecord(record: GeneratedBillRecord): Promise<number> { if (!this.rdbStore) { throw new Error('数据库未初始化'); } const valueBucket: relationalStore.ValuesBucket = { 'recurringConfigId': record.recurringConfigId, 'generatedDate': record.generatedDate, 'billId': recor...
https://github.com/qiuhaotc/HarmonyOSPlayground
e9de44de2d12bf5b06f3b0fa9525eb4a64c72bb2
github
youyeyejie/ZhiXing_ActHub
entry/src/main/ets/app/AppNav.ets
arkts
syncOverlayState
根据栈状态刷新 hasOverlayRoute。
private syncOverlayState(): void { const pathNames = this.getAllPathName(); this.hasOverlayRoute = pathNames.length > 0; if (pathNames.length === 0) { this.clearDetailState(); } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left syncOverlayState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST...
private syncOverlayState(): void { const pathNames = this.getAllPathName(); this.hasOverlayRoute = pathNames.length > 0; if (pathNames.length === 0) { this.clearDetailState(); } }
https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/app/AppNav.ets#L159-L165
9bca42e9571a39c512a5d71e0fe2a087ccdddcac
github
harmonyos/codelabs
HarmonyOS_NEXT/Healthy_life/entry/src/main/ets/common/database/tables/TaskInfoApi.ets
arkts
insertData
insert taskInfo @param taskInfo @param callback
insertData(taskInfo: TaskInfo, callback: Function): void { const valueBucket = generateBucket(taskInfo); RdbUtils.insert('taskInfo', valueBucket).then(result => { callback(result); }); Logger.info('TaskInfoTable', `Insert taskInfo {${taskInfo.date}:${taskInfo.taskID}} finished.`); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left insertData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left taskInfo AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left TaskInfo AST#identifier#Right AST#,#Left ...
insertData(taskInfo: TaskInfo, callback: Function): void { const valueBucket = generateBucket(taskInfo); RdbUtils.insert('taskInfo', valueBucket).then(result => { callback(result); }); Logger.info('TaskInfoTable', `Insert taskInfo {${taskInfo.date}:${taskInfo.taskID}} finished.`); }
https://gitee.com/harmonyos/codelabs.git
57374e7deed80d4a7ad5b12be8cecf1e35c30819
gitee
erosTeam/NextE
shared/src/main/ets/constants/EhConstants.ets
arkts
categoryColor
Category name → its badge color (eros_fe ThemeColors.catColor, light/dark via app.color). Name is normalized (lowercase, letters only): 'Artist CG'→artistcg, 'Non-H'→nonh. Misc fallback.
static categoryColor(name: string): ResourceColor { if (EhConstants.catColorMap === null) { const m: Map<string, ResourceColor> = new Map<string, ResourceColor>() m.set('doujinshi', $r('app.color.cat_doujinshi')) m.set('manga', $r('app.color.cat_manga')) m.set('artistcg', $r('app.color.cat...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left categoryColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left st...
static categoryColor(name: string): ResourceColor { if (EhConstants.catColorMap === null) { const m: Map<string, ResourceColor> = new Map<string, ResourceColor>() m.set('doujinshi', $r('app.color.cat_doujinshi')) m.set('manga', $r('app.color.cat_manga')) m.set('artistcg', $r('app.color.cat...
https://github.com/erosTeam/NextE
0fd9e0b5daf2f8321b8915a5d8ab4187f32548f7
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/ThemeManager.ets
arkts
removeListener
移除主题变更监听器 @param listener 监听器回调函数
public removeListener(listener: (theme: NDSTheme) => void): void { const removed = this.listeners.delete(listener); if (removed) { console.info(`${TAG} Listener removed, total: ${this.listeners.size}`); } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left removeListener AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left listener AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#...
public removeListener(listener: (theme: NDSTheme) => void): void { const removed = this.listeners.delete(listener); if (removed) { console.info(`${TAG} Listener removed, total: ${this.listeners.size}`); } }
https://github.com/richshaw2015/nds
8115ad839654f693c9ed70d6be0856ebe60f83d2
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Lifecycle/CancellablePromise.ets
arkts
constructor
构造函数 @param executor 执行器函数
constructor(executor: CancellableExecutor<T>) { this.signal = new SimpleAbortSignal(); this.promise = new Promise<T>((resolve, reject) => { // 如果已经取消,直接拒绝 if (this.signal.aborted) { reject(new CancellationError(this.signal.reason)); return; } try { e...
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 executor AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identif...
constructor(executor: CancellableExecutor<T>) { this.signal = new SimpleAbortSignal(); this.promise = new Promise<T>((resolve, reject) => { // 如果已经取消,直接拒绝 if (this.signal.aborted) { reject(new CancellationError(this.signal.reason)); return; } try { e...
https://github.com/DaLongZhuaZi/manxia
6966d766ca020cd8a0cbb0d24ccba264fdde302b
github
openharmony-sig/arkui_composite_component
source/TreeView/TreeView.ets
arkts
getTreeListener
Obtains the EventBus object. @since 10
public getTreeListener(): TreeListener { return this.appEventBus; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getTreeListener 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 TreeLi...
public getTreeListener(): TreeListener { return this.appEventBus; }
https://gitee.com/openharmony-sig/arkui_composite_component.git
1a405f4654b118c48280429a063c660b04a33fcf
gitee
aimilin6688/KeePassHO
entry/src/main/ets/storage/onedrive/OneDriveClient.ets
arkts
convertAxiosResponse
转换Axios响应为HttpResponse @param response Axios响应 @returns HttpResponse
private convertAxiosResponse(response: AxiosResponse): HttpResponse { const headers: Record<string, string> = {}; if (response.headers) { const headerEntries = Object.entries(response.headers) as Array<[string, string]>; for (let i = 0; i < headerEntries.length; i++) { const key = headerEn...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left convertAxiosResponse AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left response AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#iden...
private convertAxiosResponse(response: AxiosResponse): HttpResponse { const headers: Record<string, string> = {}; if (response.headers) { const headerEntries = Object.entries(response.headers) as Array<[string, string]>; for (let i = 0; i < headerEntries.length; i++) { const key = headerEn...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/onedrive/OneDriveClient.ets#L351-L381
a2f1134a2d554b5e7e9c90c5d7a14936211bcb20
github
openharmony/developtools_profiler
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/charts/Chart.ets
arkts
setOnTouchListener
Set a new (e.g. custom) ChartTouchListener NOTE: make sure to setTouchEnabled(true); if you need touch gestures on the chart @param l @ts-ignore 泛型
public setOnTouchListener(l: ChartTouchListener) { this.mChartTouchListener = l; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setOnTouchListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left l AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ...
public setOnTouchListener(l: ChartTouchListener) { this.mChartTouchListener = l; }
https://gitee.com/openharmony/developtools_profiler.git
bf86780d7c06d1bc75550670c2bd760627f22dd4
gitee
OMGCA/sakipay
sakipay_hmos/main/src/main/ets/models/EarningsCalculator.ets
arkts
calculateTotalMonthEarnings
Sums the earnings for every working day in the entire month.
private calculateTotalMonthEarnings(date: Date): number { const year: number = date.getFullYear() const month: number = date.getMonth() const daysInMonth: number = new Date(year, month + 1, 0).getDate() let total: number = 0 for (let d: number = 1; d <= daysInMonth; d++) { const check: Date ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left calculateTotalMonthEarnings AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left date AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#i...
private calculateTotalMonthEarnings(date: Date): number { const year: number = date.getFullYear() const month: number = date.getMonth() const daysInMonth: number = new Date(year, month + 1, 0).getDate() let total: number = 0 for (let d: number = 1; d <= daysInMonth; d++) { const check: Date ...
https://github.com/OMGCA/sakipay
69284983c9a7a1419e3fc73499bbe0ce2cb228c3
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ArrayList.ets
arkts
trimToCurrentLength
Trims the capacity of the ArrayList to fit just the current size.
public trimToCurrentLength(): void { let newBuffer: Array<T> = new Array<T>(this.length, (i) => { return this.buffer[i]; }); this.capacity = this.length; this.buffer = newBuffer; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left trimToCurrentLength 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#ex...
public trimToCurrentLength(): void { let newBuffer: Array<T> = new Array<T>(this.length, (i) => { return this.buffer[i]; }); this.capacity = this.length; this.buffer = newBuffer; }
https://gitcode.com/iop123123/arkts-static-skills
38da2ff328117b4b6f292915f1c4da395bb57a88
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/ReflectInternals.ets
arkts
isDoubleType
Checks if the given Class object represents a double type (including boxed and primitive types). @static @param { Class } type The Class object to be checked. @returns { boolean } Returns true if it's a double type; otherwise returns false. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static isDoubleType(type: Class): boolean { return type === Types.BOXED_DOUBLE || type === Class.PRIMITIVE_DOUBLE }
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 isDoubleType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST...
public static isDoubleType(type: Class): boolean { return type === Types.BOXED_DOUBLE || type === Class.PRIMITIVE_DOUBLE }
https://gitcode.com/iop123123/arkts-static-skills
6ad3b06f2a09c485d92d242b9edf38344e29e6ae
gitcode
richshaw2015/nds
ohos/entry/src/main/ets/utils/PersistedUriManager.ets
arkts
parseUriToPath
简单解析 URI 到路径(备用方案)
private parseUriToPath(uri: string): string { if (uri.startsWith('file://docs/')) { return '/' + uri.substring('file://docs/'.length); } if (uri.startsWith('file://')) { const parts = uri.substring('file://'.length).split('/'); if (parts.length > 1) { return '/' + parts.slice(1)....
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseUriToPath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uri AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left...
private parseUriToPath(uri: string): string { if (uri.startsWith('file://docs/')) { return '/' + uri.substring('file://docs/'.length); } if (uri.startsWith('file://')) { const parts = uri.substring('file://'.length).split('/'); if (parts.length > 1) { return '/' + parts.slice(1)....
https://github.com/richshaw2015/nds
7956b6b9f684b65450e287f0208a5eb8a18ced0e
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Loaders/MangaDetailLoader.ets
arkts
saveOnlineMangaToDatabase
保存在线漫画到数据库(包含页面预取)
private async saveOnlineMangaToDatabase(manga: Manga, chapters: MangaChapter[], externalId: string): Promise<void> { try { // 获取作者信息 let authorStr = ''; if (manga.metadata && manga.metadata.authors && manga.metadata.authors.length > 0) { authorStr = manga.metadata.authors[0]; } ...
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 saveOnlineMangaToDatabase AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left manga AST#identifier#Right ...
private async saveOnlineMangaToDatabase(manga: Manga, chapters: MangaChapter[], externalId: string): Promise<void> { try { // 获取作者信息 let authorStr = ''; if (manga.metadata && manga.metadata.authors && manga.metadata.authors.length > 0) { authorStr = manga.metadata.authors[0]; } ...
https://github.com/DaLongZhuaZi/manxia
8849d8c16e239e8752b2ac317addd7bb06bc35c0
github
openharmony/codelabs
ETSUI/LifeBalance/entry/src/main/ets/pages/DietPage.ets
arkts
onUpdateData
添加监听回调函数
onUpdateData() { console.info('[DietPage] 监听到数据更新信号,正在刷新...'); this.refreshData(); // 重新加载数据库中的建议目标 }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onUpdateData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left ...
onUpdateData() { console.info('[DietPage] 监听到数据更新信号,正在刷新...'); this.refreshData(); // 重新加载数据库中的建议目标 }
https://gitcode.com/openharmony/codelabs
ec06cd498e015c9bc9bf17999e2950f7cb7f45b5
gitcode
openharmony-tpc/ImageKnife
library/src/main/ets/utils/FileUtils.ets
arkts
getInstance
单例实现FileUtils类
public static getInstance(): FileUtils { if (!FileUtils.sInstance) { FileUtils.sInstance = new FileUtils(); } return FileUtils.sInstance; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L...
public static getInstance(): FileUtils { if (!FileUtils.sInstance) { FileUtils.sInstance = new FileUtils(); } return FileUtils.sInstance; }
https://gitee.com/openharmony-tpc/ImageKnife.git
e4cac18d71c653164f4257d7a4262137dc04af78
gitee
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/clipboard/ClipboardSyncService.ets
arkts
writeRemoteImagePayload
解码并写入远端图片 payload 到本地剪贴板。统一处理 KIND_PNG 直接帧 与 KIND_REF 下载后的图片 blob。
private async writeRemoteImagePayload(payload: Uint8Array, source: string): Promise<void> { let claimedSelfWrite = false try { const pixelMap = await this.decodePngPayload(payload) this.pendingSelfWrites++ claimedSelfWrite = true this.writePixelMapToPasteboard(pixelMap) } catch (er...
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 writeRemoteImagePayload AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left payload AST#identifier#Right ...
private async writeRemoteImagePayload(payload: Uint8Array, source: string): Promise<void> { let claimedSelfWrite = false try { const pixelMap = await this.decodePngPayload(payload) this.pendingSelfWrites++ claimedSelfWrite = true this.writePixelMapToPasteboard(pixelMap) } catch (er...
https://github.com/AlkaidLab/moonlight-harmony
211269283efd8bf4a89ded4dd2dff11bca062930
github
the-wwyang/kids-learning-app
src/main/ets/services/QuestionGenerator.ets
arkts
getCountMaxNum
获取数数题最大数量 @param difficulty 难度等级 @returns 最大数量
private static getCountMaxNum(difficulty: Difficulty): number { const maxCounts: Record<Difficulty, number> = { [Difficulty.EASY]: 10, [Difficulty.MEDIUM]: 15, [Difficulty.HARD]: 20 }; return maxCounts[difficulty]; }
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 getCountMaxNum AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left difficulty AST#identifier#Right AST#:...
private static getCountMaxNum(difficulty: Difficulty): number { const maxCounts: Record<Difficulty, number> = { [Difficulty.EASY]: 10, [Difficulty.MEDIUM]: 15, [Difficulty.HARD]: 20 }; return maxCounts[difficulty]; }
https://github.com/the-wwyang/kids-learning-app
649010ef0081fa023cabe738e9011f35b3327c90
github
offlinecat-dev/OCNetORM
src/main/ets/query/QueryBuilder.ets
arkts
offset
设置 OFFSET @param count 偏移量 @returns 当前实例(支持链式调用)
offset(count: number): QueryBuilder { if (count < 0) { throw new InvalidConditionError('OFFSET', 'OFFSET 值不能为负数') } this.offsetValue = count return this }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left offset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left count AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) AST#)#R...
offset(count: number): QueryBuilder { if (count < 0) { throw new InvalidConditionError('OFFSET', 'OFFSET 值不能为负数') } this.offsetValue = count return this }
https://github.com/offlinecat-dev/OCNetORM
5024831a016ff848c53146cdcadac8827da0203a
github
aimilin6688/KeePassHO
entry/src/main/ets/common/oauth2/OAuth2TokenStorageService.ets
arkts
hasToken
检查是否存在令牌 @param config 存储配置
public async hasToken(config: OAuth2TokenStorageConfig): Promise<boolean> { this.init(); if (!this.preferences) { throw new Error('OAuth2TokenStorageService not initialized'); } try { const tokenKey = config.tokenKey || this.getDefaultTokenKey(config.provider); const tokenString = aw...
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 hasToken AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#...
public async hasToken(config: OAuth2TokenStorageConfig): Promise<boolean> { this.init(); if (!this.preferences) { throw new Error('OAuth2TokenStorageService not initialized'); } try { const tokenKey = config.tokenKey || this.getDefaultTokenKey(config.provider); const tokenString = aw...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/oauth2/OAuth2TokenStorageService.ets#L200-L213
0b13b2c53a241618170faa111d488b4202186a38
github
Octo-o-o-o/harmonyos-ai-workspace
tools/hooks/test-fixtures/BadSecurityKit.ets
arkts
logUser
SEC-002: 用 %{public} 输出 token
logUser(token: string): void { hilog.info(DOMAIN, 'auth', 'login token=%{public}s', token); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left logUser AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left token AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)#...
logUser(token: string): void { hilog.info(DOMAIN, 'auth', 'login token=%{public}s', token); }
https://github.com/Octo-o-o-o/harmonyos-ai-workspace
fe255436ce9a68811eb85e30114fde49bb0f2558
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test29_original_index.ets
arkts
testStringConcat
--- String.concat method ---
function testStringConcat(): string { let s: string = 'Hello'; s = s.concat(', '); s = s.concat('World'); s = s.concat('!'); return s; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testStringConcat AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined...
function testStringConcat(): string { let s: string = 'Hello'; s = s.concat(', '); s = s.concat('World'); s = s.concat('!'); return s; }
https://github.com/miaochiahao/ark-ghidra
6dca65895f58593744b4e6e452461ec0e3898803
github
honjow/Next2V
feature/feed/src/main/ets/viewmodel/FeedViewModel.ets
arkts
applyEmptyResult
Show the empty state and drop any stale cache so it never flashes on re-entry.
private async applyEmptyResult(error: object): Promise<void> { this.dataSource.setData([]) this.itemCount = 0 this.hasMore = false this.errorMessage = translateApiError(error) if (this.cacheSaver) { try { await this.cacheSaver([]) } catch (cacheError) { console.error('c...
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 applyEmptyResult AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left error AST#identifier#Right AST#:#Lef...
private async applyEmptyResult(error: object): Promise<void> { this.dataSource.setData([]) this.itemCount = 0 this.hasMore = false this.errorMessage = translateApiError(error) if (this.cacheSaver) { try { await this.cacheSaver([]) } catch (cacheError) { console.error('c...
https://github.com/honjow/Next2V
babb47b27bab45eb218b526d695454441e891641
github
HarmonyOS_Samples/BestPracticeSnippets
ImageEditTaskPool/entry/src/main/ets/view/AdjustContentView.ets
arkts
updatePixelMap
[StartExclude postProcess_start]
updatePixelMap(ret: ArrayBuffer) { const newPixel = this.pixelMap as image.PixelMap; newPixel.writeBufferToPixels(ret); this.pixelMap = newPixel; this.isPixelMapChange = !this.isPixelMapChange; this.deviceListDialogController.close(); this.postState = true; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left updatePixelMap AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ret AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ArrayBuffer AST#identifier#...
updatePixelMap(ret: ArrayBuffer) { const newPixel = this.pixelMap as image.PixelMap; newPixel.writeBufferToPixels(ret); this.pixelMap = newPixel; this.isPixelMapChange = !this.isPixelMapChange; this.deviceListDialogController.close(); this.postState = true; }
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
3c800296bbc64168a69cd14c5b971a552df3499c
gitcode
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets
arkts
lessThan
Return true if the value of this Decimal is less than `n`, otherwise return false. @param { Value } n {double | string | Decimal} @returns { boolean } the boolean type
public lessThan(n: Value): boolean { return this.comparedTo(n) < 0; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left lessThan AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left n AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Value AST#...
public lessThan(n: Value): boolean { return this.comparedTo(n) < 0; }
https://gitcode.com/iop123123/arkts-static-skills
3d2f746cef3e687d3d7d7cb2cee7c3b7982a1e61
gitcode
YANGZX22/Voot
entry/src/main/ets/services/PipSubtitleManager.ets
arkts
destroy
Destroy PiP controller
async destroy(): Promise<void> { if (this.pipController) { try { if (this.isPipRunning) { await this.pipController.stopPiP(); } this.pipController.off('stateChange'); this.pipController = null; } catch (err) { console.error(`${TAG} destroy error: ${JSO...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left destroy AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#L...
async destroy(): Promise<void> { if (this.pipController) { try { if (this.isPipRunning) { await this.pipController.stopPiP(); } this.pipController.off('stateChange'); this.pipController = null; } catch (err) { console.error(`${TAG} destroy error: ${JSO...
https://github.com/YANGZX22/Voot
de80fdad624418162c66f0401dc98e8cfeb8aa3f
github
the-wwyang/kids-learning-app
src/main/ets/utils/AudioManager.ets
arkts
preloadSounds
预加载音效
async preloadSounds(): Promise<void> { const preloadList = Array.from(this.soundConfigs.values()) .filter(config => config.preload); console.log(`Preloading ${preloadList.length} sounds...`); // TODO: 实际预加载音频文件 /* for (const config of preloadList) { const audioPlayer = await media.cr...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left preloadSounds 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 preloadSounds(): Promise<void> { const preloadList = Array.from(this.soundConfigs.values()) .filter(config => config.preload); console.log(`Preloading ${preloadList.length} sounds...`); // TODO: 实际预加载音频文件 /* for (const config of preloadList) { const audioPlayer = await media.cr...
https://github.com/the-wwyang/kids-learning-app
fae86ffefcfc784e7740fd7dcbd94ce1158ae0f2
github
offlinecat-dev/OCNetORM
src/main/ets/repository/Repository.ets
arkts
transaction
在事务中执行操作 如果回调函数执行成功,事务将被提交 如果回调函数抛出异常,事务将被回滚 @param callback 事务回调函数 @returns Promise<TransactionResult>
async transaction(callback: TransactionCallback): Promise<TransactionResult> { this.ensureNoNestedTransaction('transaction') return await this.transactionManager.transaction(async (store) => { const scopedRepository = this.createTransactionScopedRepository(store) await callback(scopedRepository) ...
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 transaction AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left callba...
async transaction(callback: TransactionCallback): Promise<TransactionResult> { this.ensureNoNestedTransaction('transaction') return await this.transactionManager.transaction(async (store) => { const scopedRepository = this.createTransactionScopedRepository(store) await callback(scopedRepository) ...
https://github.com/offlinecat-dev/OCNetORM
9a3071f5aa93156608883143c1f9554e5b25d62c
github
AetheriumSimulator/qemu-hmos
entry/src/main/ets/utils/RDPAuthManager.ets
arkts
connectWithCredentials
使用新凭据连接(首次连接或更新凭据)
public async connectWithCredentials( vmName: string, host: string, port: number, username: string, password: string, domain?: string, savePassword: boolean = true, autoConnect: boolean = true ): Promise<RDPSession | null> { // 保存凭据 const credential: RDPCredential = { vm...
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 connectWithCredentials AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left vmName AST#identifier#Right AST#:...
public async connectWithCredentials( vmName: string, host: string, port: number, username: string, password: string, domain?: string, savePassword: boolean = true, autoConnect: boolean = true ): Promise<RDPSession | null> { // 保存凭据 const credential: RDPCredential = { vm...
https://github.com/AetheriumSimulator/qemu-hmos
183714621bb525103346829ec3765298d0690f0b
github
qiuhaotc/HarmonyOSPlayground
entry/src/main/ets/database/BillDatabase.ets
arkts
queryBillsByYearMonth
按年月查询账单
async queryBillsByYearMonth(year: string, month: string): Promise<BillModel[]> { if (!this.rdbStore) { throw new Error('数据库未初始化'); } const yearMonth = `${year}-${month.padStart(2, '0')}`; const predicates = new relationalStore.RdbPredicates(this.TABLE_NAME); pred...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left queryBillsByYearMonth AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left year AST#identifier#Rig...
async queryBillsByYearMonth(year: string, month: string): Promise<BillModel[]> { if (!this.rdbStore) { throw new Error('数据库未初始化'); } const yearMonth = `${year}-${month.padStart(2, '0')}`; const predicates = new relationalStore.RdbPredicates(this.TABLE_NAME); pred...
https://github.com/qiuhaotc/HarmonyOSPlayground
953b3ca7126269aa943c865a62a6264d24b3fb48
github
XHXYT/Pixark
entry/src/main/ets/common/utils/ResourceUtil.ets
arkts
ensureContext
获取检查上下文是否就绪
private ensureContext(): common.UIAbilityContext { if (!this.context) { throw new Error('[ResourceUtils] Context 未初始化,请先调用 init() 方法'); } return this.context; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left ensureContext 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#member_expression#Lef...
private ensureContext(): common.UIAbilityContext { if (!this.context) { throw new Error('[ResourceUtils] Context 未初始化,请先调用 init() 方法'); } return this.context; }
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/common/utils/ResourceUtil.ets#L21-L26
c5cb0ac000f4d86a47fb20e0ced532e66c653f77
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/TypeGuards.ets
arkts
isNumber
检查值是否为数字 @param value - 要检查的值 @returns 是否为数字
static isNumber(value: Object): boolean { return typeof value === 'number' && !isNaN(value as number); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isNumber AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Object...
static isNumber(value: Object): boolean { return typeof value === 'number' && !isNaN(value as number); }
https://github.com/DaLongZhuaZi/manxia
140d7129abef2740561e9816a41ae359540952c1
github
openharmony-sig/applications_clock
common/src/main/ets/manager/AlarmManager.ets
arkts
searchAlarmInfo
并列查询 支持一起查 id、闹钟名称、启用状态、响铃时间段 @return 当前条件对应的闹钟列表
async searchAlarmInfo(entityId?: string, title?: string, enabled?: boolean, alarmTimeArr?: string[]): Promise<AlarmInfo[] | undefined> { const rdbStore = await this.getRdbStore(); let predicates = new dataRdb.RdbPredicates(ALARM_CLOCK_DATA_TABLE); if (entityId) { predicates = predicates.equalTo...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left searchAlarmInfo AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#optional_parameter#Left AST#identifier#Left entityId AST#identifier#Right AST#?#Left ? AST#?#Right AST#type...
async searchAlarmInfo(entityId?: string, title?: string, enabled?: boolean, alarmTimeArr?: string[]): Promise<AlarmInfo[] | undefined> { const rdbStore = await this.getRdbStore(); let predicates = new dataRdb.RdbPredicates(ALARM_CLOCK_DATA_TABLE); if (entityId) { predicates = predicates.equalTo...
https://gitee.com/openharmony-sig/applications_clock.git
1084314329d617ebc229ab81a5c6543b0ee63123
gitee
zmuxuny/ai-guardian-star
entry/src/main/ets/database/DatabaseHelper.ets
arkts
init
── 初始化入口(幂等,可多次调用)──────────────────────────
public async init(context: Context): Promise<void> { if (this.store !== undefined) return; // 已初始化,直接返回 if (this.initPromise !== undefined) return this.initPromise; // 初始化进行中,等待 this.initPromise = this._doInit(context); return this.initPromise; }
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 init AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Rig...
public async init(context: Context): Promise<void> { if (this.store !== undefined) return; // 已初始化,直接返回 if (this.initPromise !== undefined) return this.initPromise; // 初始化进行中,等待 this.initPromise = this._doInit(context); return this.initPromise; }
https://github.com/zmuxuny/ai-guardian-star/blob/87ab023d8b9aab4303a9fc1e97508e1f8ee01e07/entry/src/main/ets/database/DatabaseHelper.ets#L175-L181
1d86c0a0e7bd7428618a66193804ba4f886e0a1b
github
YANGZX22/Voot
entry/src/main/ets/services/SherpaWhisperMicService.ets
arkts
buildWaveform
Shared logic to merge current PCM chunks into a Float32Array.
private buildWaveform(clearBuffer: boolean, maxSamples?: number): Float32Array | null { if (this.pcmChunks.length === 0) { return null; } let totalLen = 0; for (const c of this.pcmChunks) { totalLen += c.length; } let sliceStart: number = 0; if (maxSamples !== undefined && to...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildWaveform AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left clearBuffer AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST...
private buildWaveform(clearBuffer: boolean, maxSamples?: number): Float32Array | null { if (this.pcmChunks.length === 0) { return null; } let totalLen = 0; for (const c of this.pcmChunks) { totalLen += c.length; } let sliceStart: number = 0; if (maxSamples !== undefined && to...
https://github.com/YANGZX22/Voot
264e0dfa94f6fdcacaf6e2464e42e2d1ec5c6e8c
github
CarGuo/GSYGithubAppOH
entry/src/main/ets/pages/UserDetailPage.ets
arkts
safeStr
安全字符串:把 null/undefined 兜底成 '',避免对 null 调 .length 直接崩。 GitHub API 对 description / language / full_name / bio / name 经常返回 null。
function safeStr(v: string | null | undefined): string { return (v === null || v === undefined) ? '' : v; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left safeStr AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left v AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#u...
function safeStr(v: string | null | undefined): string { return (v === null || v === undefined) ? '' : v; }
https://github.com/CarGuo/GSYGithubAppOH
6638ff993aaaadf7c3f9a0d29720ae2b756ecb58
github
CLMC2025/Vignette
entry/src/main/ets/vocabulary/UnknownWordHandler.ets
arkts
cleanupOldUnknownWords
清理旧的未知词汇记录
private cleanupOldUnknownWords(): void { const now = Date.now(); const maxAge = 30 * 24 * 60 * 60 * 1000; // 30天 const toDelete: string[] = []; this.unknownWords.forEach((info: UnknownWordInfo, word: string) => { if (now - info.timestamp > maxAge) { toDelete.push(word); } });...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left cleanupOldUnknownWords AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left vo...
private cleanupOldUnknownWords(): void { const now = Date.now(); const maxAge = 30 * 24 * 60 * 60 * 1000; // 30天 const toDelete: string[] = []; this.unknownWords.forEach((info: UnknownWordInfo, word: string) => { if (now - info.timestamp > maxAge) { toDelete.push(word); } });...
https://github.com/CLMC2025/Vignette
d5471fa0ed82ba1bb0cd4b1217984e7251a726bf
github
CPF-ApplicationTPC/openharmony_tpc_samples
SwipeMenuListView/library/src/main/ets/components/SwipeMenuList.ets
arkts
setCloseInterpolator
设置菜单关闭时的插值器 @param interpolator 插值器类型
setCloseInterpolator(interpolator: InterpolatorType): void { this.closeAnimationConfig.setInterpolator(interpolator); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setCloseInterpolator AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left interpolator AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left InterpolatorType AST#identi...
setCloseInterpolator(interpolator: InterpolatorType): void { this.closeAnimationConfig.setInterpolator(interpolator); }
https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples
6d53394265b3de0bc37bebdd732d21f075c40401
gitcode
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/ReminderDAO.ets
arkts
setActive
激活/停用提醒
static async setActive(reminderId: number, isActive: boolean): Promise<void> { const store = DatabaseManager.getDatabase(); const sql = `UPDATE ${Reminder.tableName} SET is_active = ?, updated_at = ? WHERE reminder_id = ?`; try { await store.executeSql(sql, [isAc...
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 setActive AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left reminderId AST#identifier#Right AST#ERROR#Left AST#:#Left : A...
static async setActive(reminderId: number, isActive: boolean): Promise<void> { const store = DatabaseManager.getDatabase(); const sql = `UPDATE ${Reminder.tableName} SET is_active = ?, updated_at = ? WHERE reminder_id = ?`; try { await store.executeSql(sql, [isAc...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
1ce8dc593881451a1a6d55da9c18b024ddb538c0
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.LinkedList.ets
arkts
addFirst
Adds an element to the beginning of the list. @param element The element to add.
public addFirst(element: T): void { this.insert(0, element); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addFirst AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left element AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#Rig...
public addFirst(element: T): void { this.insert(0, element); }
https://gitcode.com/iop123123/arkts-static-skills
453a8d9d38800138a4d4c567f1879ee8b142193c
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/TypeShelfManager.ets
arkts
getShelfRealItemCount
获取书架中的实际内容数量
getShelfRealItemCount(shelfId: string): number { return this.categoryManager.getCategoryItems(shelfId).length; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getShelfRealItemCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left shelfId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ...
getShelfRealItemCount(shelfId: string): number { return this.categoryManager.getCategoryItems(shelfId).length; }
https://github.com/DaLongZhuaZi/manxia
9d4261ca8cd811220ac8715853d72f0ed183966f
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/ReadingAnalyticsManager.ets
arkts
hasAskedPermission
是否已询问过用户权限
public hasAskedPermission(): boolean { return this.settings.hasAskedPermission; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left hasAskedPermission 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 boolea...
public hasAskedPermission(): boolean { return this.settings.hasAskedPermission; }
https://github.com/DaLongZhuaZi/manxia
2f5a9c15e48f16da379911bab014e39aa90d2b27
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Adapters/MangaTypeAdapter.ets
arkts
convertToManga
将旧的ComicInfo转换为新的Manga类型
static convertToManga(legacy: LegacyComicInfo, sourceName?: string): Manga { // 判断是本地漫画还是在线漫画 const isLocal = !legacy.sourceId && !legacy.externalId; if (isLocal) { // 本地漫画 return { id: legacy.id, sourceType: MangaSourceType.LOCAL, title: legacy.title, auth...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left convertToManga AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left legacy AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left...
static convertToManga(legacy: LegacyComicInfo, sourceName?: string): Manga { // 判断是本地漫画还是在线漫画 const isLocal = !legacy.sourceId && !legacy.externalId; if (isLocal) { // 本地漫画 return { id: legacy.id, sourceType: MangaSourceType.LOCAL, title: legacy.title, auth...
https://github.com/DaLongZhuaZi/manxia
4b46ec6c7d56a6e13b92672a140c6dd00ba2448d
github
openharmony-sig/FastBle
library/src/main/ets/BleManager.ets
arkts
stopIndicate
stop indicate, remove callback @param bleDevice @param uuid_service @param uuid_indicate @param useCharacteristicDescriptor @return
public stopIndicate(bleDevice: BleDevice, uuid_service: string, uuid_indicate: string, useCharacteristicDescriptor: boolean = false): boolean { if (this.multipleBluetoothController === null) { return false } let bleBluetooth: BleBluetooth | null = this.multipleBluetoothController.getBleBluetooth(bl...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left stopIndicate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bleDevice AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
public stopIndicate(bleDevice: BleDevice, uuid_service: string, uuid_indicate: string, useCharacteristicDescriptor: boolean = false): boolean { if (this.multipleBluetoothController === null) { return false } let bleBluetooth: BleBluetooth | null = this.multipleBluetoothController.getBleBluetooth(bl...
https://gitee.com/openharmony-sig/FastBle.git
919d1f09a4a4c3caf9eb4608eb0214f0f9370309
gitee
Amaz1ny/HarmonyDO-public
entry/src/main/ets/common/theme/ThemeManager.ets
arkts
hexWithAlpha
生成带透明度的颜色 @param hex 十六进制颜色 (不含 #) @param alpha 透明度 0-1
static hexWithAlpha(hex: string, alpha: number): string { const alphaHex: string = Math.round(alpha * 255).toString(16).padStart(2, '0'); let colorHex: string = hex; if (colorHex.startsWith('#')) { colorHex = colorHex.substring(1); } return `#${alphaHex}${colorHex}`; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left hexWithAlpha AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left hex AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left stri...
static hexWithAlpha(hex: string, alpha: number): string { const alphaHex: string = Math.round(alpha * 255).toString(16).padStart(2, '0'); let colorHex: string = hex; if (colorHex.startsWith('#')) { colorHex = colorHex.substring(1); } return `#${alphaHex}${colorHex}`; }
https://github.com/Amaz1ny/HarmonyDO-public
47ec2aad08dc2aa484a8a9677b5a9b82cf198c06
github
openharmony-tpc/openharmony_tpc_samples
dialogs/library/src/main/ets/components/progress/base/LVBase.ets
arkts
getAnimDrawTime
获取动画当前执行次数
getAnimDrawTime() { return this.animDrawTime; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getAnimDrawTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Le...
getAnimDrawTime() { return this.animDrawTime; }
https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git
8c0c1b6a17b469d1895b274d77b9728f32fc937e
gitee
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/StreamWindowManager.ets
arkts
setDecorVisible
设置窗口装饰栏(标题栏:放大/缩小/关闭按钮)可见性
private setDecorVisible(win: window.Window, visible: boolean): void { try { win.setWindowDecorVisible(visible); } catch (_e) {} }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left setDecorVisible 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_express...
private setDecorVisible(win: window.Window, visible: boolean): void { try { win.setWindowDecorVisible(visible); } catch (_e) {} }
https://github.com/AlkaidLab/moonlight-harmony
446b9c330bf89a5cbf692fa517e44a6822f6b337
github
David8Idira/AI-OA
packages/harmonyos/commons/src/main/ets/services/IMService.ets
arkts
getDrafts
获取草稿列表
async getDrafts(): Promise<ApiResponse<{ drafts: Draft[] }>> { return this.client.get<{ drafts: Draft[] }>('/api/v1/im/drafts') }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getDrafts 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_ty...
async getDrafts(): Promise<ApiResponse<{ drafts: Draft[] }>> { return this.client.get<{ drafts: Draft[] }>('/api/v1/im/drafts') }
https://github.com/David8Idira/AI-OA
fde589a0c353dc84d29926535dc7adf82e390df9
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/TagDAO.ets
arkts
mapRowToTag
将查询结果映射为 Tag 实例 @param resultSet 查询结果集 @returns Tag 对象
private static mapRowToTag(resultSet: relationalStore.ResultSet): Tag { const tag = new Tag(); tag.tagId = resultSet.getLong(resultSet.getColumnIndex('tag_id')); tag.userId = resultSet.getLong(resultSet.getColumnIndex('user_id')); tag.name = resultSet.getString(resultSet.getColumnIndex('name')); t...
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 mapRowToTag AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resultSet AST#identifier#Right AST#:#Lef...
private static mapRowToTag(resultSet: relationalStore.ResultSet): Tag { const tag = new Tag(); tag.tagId = resultSet.getLong(resultSet.getColumnIndex('tag_id')); tag.userId = resultSet.getLong(resultSet.getColumnIndex('user_id')); tag.name = resultSet.getString(resultSet.getColumnIndex('name')); t...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
1adb569fa8a769cae56b40185bf311b436f3276e
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/components/LimitLine.ets
arkts
getLineWidth
returns the width of limit line @return
public getLineWidth(): number { return this.mLineWidth; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getLineWidth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#nu...
public getLineWidth(): number { return this.mLineWidth; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
63351828844ecc2f950773238ec5e18c74fb3377
gitee
arkui-x/samples
CodeLab/Cases/feature/diggingholescreen/src/main/ets/components/mainpage/DiggingHoleScreen.ets
arkts
aboutToDisappear
退出当前页面时将窗口重新设置成初始状态
aboutToDisappear() { if (this.context !== undefined) { window.getLastWindow(this.context, async (err, data) => { if (err.code !== 0) { logger.error('DiggingHoleScreen', 'getLastWindow failed. error is:' + JSON.stringify(err)); return; } data.setWindowSystemBarEnab...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToDisappear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#L...
aboutToDisappear() { if (this.context !== undefined) { window.getLastWindow(this.context, async (err, data) => { if (err.code !== 0) { logger.error('DiggingHoleScreen', 'getLastWindow failed. error is:' + JSON.stringify(err)); return; } data.setWindowSystemBarEnab...
https://gitcode.com/arkui-x/samples
fb72cd9a39063d7939b40fed335d9c16188d228e
gitcode
ibestservices/ibest-ui
library/src/main/ets/components/checkboxGroup/index.ets
arkts
toggleAll
全选与反选
toggleAll(isSelectAll?: boolean) { if(typeof isSelectAll == 'boolean'){ if(isSelectAll){ this.activeList = this.allCheckNames }else { this.activeList = [] } }else{ this.activeList = this.allCheckNames.filter(item => !this.activeList.includes(item)) } this.onChange(this.activeList) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left toggleAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isSelectAll AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolea...
toggleAll(isSelectAll?: boolean) { if(typeof isSelectAll == 'boolean'){ if(isSelectAll){ this.activeList = this.allCheckNames }else { this.activeList = [] } }else{ this.activeList = this.allCheckNames.filter(item => !this.activeList.includes(item)) } this.onChange(this.activeList) }
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/checkboxGroup/index.ets#L117-L128
2f68af01f7ff844f8169bf1f982fcf62dd0c5233
github
Joker-x-dev/CoolMallArkTS
core/data/src/main/ets/repository/CouponRepository.ets
arkts
getUserCouponList
查询用户优惠券列表 @param params 查询参数 @returns 用户优惠券列表数据
async getUserCouponList(params: Record<string, Unknown>): Promise<NetworkResponse<Coupon[]>> { return this.networkDataSource.getUserCouponList(params); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getUserCouponList AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left params AST#identifier#Right AST#type_annotation#Left AST#:#Le...
async getUserCouponList(params: Record<string, Unknown>): Promise<NetworkResponse<Coupon[]>> { return this.networkDataSource.getUserCouponList(params); }
https://github.com/Joker-x-dev/CoolMallArkTS
0c2f217d511e929d0f1e9ec0aa782797af30ef6e
github
xujingbao/ruoyi-ai-quick-starter
ruoyi-harmony-app/products/default/src/main/ets/viewmodel/CatalogueViewModel.ets
arkts
getCatalogueData
Get Catalogue data. @return {Array<CatalogueItemData>} CatalogueData.
getCatalogueData(): CatalogueItemData[] { const catalogueData: CatalogueItemData[] = [new CatalogueItemData(0, $r('app.string.responsive_layout'), RESPONSIVE_ROUTE), new CatalogueItemData(1, $r('app.string.adaptive_layout'), ADAPTIVE_ROUTE), new CatalogueItemData(2, $r('app.string.system_cap...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getCatalogueData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left CatalogueItemDa...
getCatalogueData(): CatalogueItemData[] { const catalogueData: CatalogueItemData[] = [new CatalogueItemData(0, $r('app.string.responsive_layout'), RESPONSIVE_ROUTE), new CatalogueItemData(1, $r('app.string.adaptive_layout'), ADAPTIVE_ROUTE), new CatalogueItemData(2, $r('app.string.system_cap...
https://github.com/xujingbao/ruoyi-ai-quick-starter
9faefd5063d7876fdae708b61ab53560b5d787c1
github
yang-kun-long/HarmonyAccounting
entry/src/main/ets/common/database/tables/AccountTable.ets
arkts
insertData
插入数据到账户表格 @param account 要插入的账户数据 @param callback 回调函数,在数据插入完成后执行
insertData(account: AccountData, callback: Function) { const valueBucket: relationalStore.ValuesBucket = generateBucket(account); this.accountTable.insertData(valueBucket, callback); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left insertData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left account AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left AccountData AST#identifier#...
insertData(account: AccountData, callback: Function) { const valueBucket: relationalStore.ValuesBucket = generateBucket(account); this.accountTable.insertData(valueBucket, callback); }
https://github.com/yang-kun-long/HarmonyAccounting
fbc64f107f883b73a7aa95ce01d3dc357abb1499
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/ComputerManager.ets
arkts
pairComputer
与电脑配对(使用完整的 PairingManager,匹配 Android 配对流程)
async pairComputer(uuid: string): Promise<string> { const computer = this.computers.get(uuid); if (!computer) { throw new Error('电脑不存在'); } const pin = this.generatePin(); computer.pairState = PairState.NOT_PAIRED; try { const pairingManager = new PairingManager( selectBe...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left pairComputer AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left uuid AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS...
async pairComputer(uuid: string): Promise<string> { const computer = this.computers.get(uuid); if (!computer) { throw new Error('电脑不存在'); } const pin = this.generatePin(); computer.pairState = PairState.NOT_PAIRED; try { const pairingManager = new PairingManager( selectBe...
https://github.com/AlkaidLab/moonlight-harmony
1300ffb91129ecb8bf05f9799e8314a2467fc762
github
xiebyapps/ClipLink
entry/src/main/ets/services/SyncClipboardService.ets
arkts
putProfile
Upload clipboard profile to /SyncClipboard.json
async putProfile(profile: ProfileDto): Promise<void> { await this.httpClient.put('/SyncClipboard.json', profile); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left putProfile AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left profile AST#identifier#Right AST#type_annotation#Left AST#:#Left : A...
async putProfile(profile: ProfileDto): Promise<void> { await this.httpClient.put('/SyncClipboard.json', profile); }
https://github.com/xiebyapps/ClipLink
f2f70643b510255f96b263d3ce0de5050191fff2
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/RAManager.ets
arkts
onLeaderboardCompleted
排行榜完成回调
async onLeaderboardCompleted(leaderboardId: number, value: number): Promise<void> { if (!this.currentSession) return; await this.apiClient.submitLeaderboardEntry(leaderboardId, value); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left onLeaderboardCompleted AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left leaderboardId AST#iden...
async onLeaderboardCompleted(leaderboardId: number, value: number): Promise<void> { if (!this.currentSession) return; await this.apiClient.submitLeaderboardEntry(leaderboardId, value); }
https://github.com/richshaw2015/nds
d9ef4560f3ddfd917c8039699ff8a6315baff833
github
queueit/harmony-sdk
queueit_sdk/src/main/ets/view/QueueItViewManager.ets
arkts
tryOpenExternalUrl
--- Utility Methods (remain the same) ---
private async tryOpenExternalUrl(urlString: string): Promise<void> { Logger.warn(QueueItViewManager.TAG, `External URL opening not fully implemented for: ${urlString}`); try { let context = this.context as common.UIAbilityContext; let want: Want = { uri: urlSt...
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 tryOpenExternalUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left urlString AST#identifier#Right AST#ERROR#Left AST...
private async tryOpenExternalUrl(urlString: string): Promise<void> { Logger.warn(QueueItViewManager.TAG, `External URL opening not fully implemented for: ${urlString}`); try { let context = this.context as common.UIAbilityContext; let want: Want = { uri: urlSt...
https://github.com/queueit/harmony-sdk
0dc3ecc214c8b6ababf36f608c078c0e10af234b
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/model/SharedLedger.ets
arkts
applyRolePermissions
应用角色默认权限
applyRolePermissions(): void { this.setPermissions(this.getDefaultPermissions()); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left applyRolePermissions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#stateme...
applyRolePermissions(): void { this.setPermissions(this.getDefaultPermissions()); }
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
b82ff0df76a690697b114adc491c51d358f193ad
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/CloudSyncRecordDAO.ets
arkts
update
更新同步记录
static async update(record: CloudSyncRecord): Promise<void> { if (!record.validate()) { throw new Error('[CloudSyncRecordDAO] 更新失败,数据验证不通过'); } const store: relationalStore.RdbStore = DatabaseManager.getDatabase(); record.updatedAt = DAOHelper.now(); const valueBucket: relationalStore.Valu...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left update AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left record AST#identifier#Right AST#:#Left : AST#:#Ri...
static async update(record: CloudSyncRecord): Promise<void> { if (!record.validate()) { throw new Error('[CloudSyncRecordDAO] 更新失败,数据验证不通过'); } const store: relationalStore.RdbStore = DatabaseManager.getDatabase(); record.updatedAt = DAOHelper.now(); const valueBucket: relationalStore.Valu...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
09a10765fe6bf7a7e021075be6df22d86a98878d
github
Joker-x-dev/CoolMallArkTS
feature/launch/src/main/ets/view/SplashPage.ets
arkts
build
构建启动页 @returns {void} 无返回值
build() { AppNavDestination({ viewModel: this.vm, hideTitleBar: true, pageBackgroundColor: $r("app.color.bg_white") }) { this.SplashContent(); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c...
build() { AppNavDestination({ viewModel: this.vm, hideTitleBar: true, pageBackgroundColor: $r("app.color.bg_white") }) { this.SplashContent(); } }
https://github.com/Joker-x-dev/CoolMallArkTS
c675b6fc29361cd222ba84b682e8e2c79d77d78d
github
harmonyos/codelabs
HarmonyOS_NEXT/Healthy_life/entry/src/main/ets/common/database/tables/DayInfoApi.ets
arkts
query
Query dayInfo. @param date @param callback
query(date: string, callback: Function): void { let predicates: dataRdb.RdbPredicates = new dataRdb.RdbPredicates(Const.DAY_INFO.tableName ? Const.DAY_INFO.tableName : ''); predicates.equalTo('date', date); RdbUtils.query(predicates).then(resultSet => { let count = resultSet.rowCount; if (coun...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left query AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left date AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Rig...
query(date: string, callback: Function): void { let predicates: dataRdb.RdbPredicates = new dataRdb.RdbPredicates(Const.DAY_INFO.tableName ? Const.DAY_INFO.tableName : ''); predicates.equalTo('date', date); RdbUtils.query(predicates).then(resultSet => { let count = resultSet.rowCount; if (coun...
https://gitee.com/harmonyos/codelabs.git
8749d509b259d246c9ebcc06150ed38c4a0b8f81
gitee
AGenUI/AGenUI
platforms/harmony/agenui/src/main/ets/agenui/hybrid/HybridBaseView.ets
arkts
toInvokeArkTsView
Invokes an ArkTS view event. @param key Event key @param params Event parameters
public toInvokeArkTsView(key: string, params: HybridInvokeCallback) { this.onInvoke(key, params); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toInvokeArkTsView AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left...
public toInvokeArkTsView(key: string, params: HybridInvokeCallback) { this.onInvoke(key, params); }
https://github.com/AGenUI/AGenUI
5ce3fc7647a7f7ab352c96af7b23f8d565df7e49
github
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnSwitchViewModel.ets
arkts
toggleSquare
切换方形形状开关 @param value 新的开关状态
toggleSquare(value: boolean): void { this.switchSquare = value; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toggleSquare AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right AST#)#Left ) ...
toggleSquare(value: boolean): void { this.switchSquare = value; }
https://github.com/codelably/tuniao-ui
cc0ebd2835b1a2a4e84c2655398ecc8460a24f8b
github
the-wwyang/kids-learning-app
src/main/ets/services/ScoreService.ets
arkts
isDailyGoalCompleted
检查是否完成每日目标
public isDailyGoalCompleted(currentStars: number, dailyGoal: number = 20): boolean { return currentStars >= dailyGoal; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isDailyGoalCompleted AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left currentStars AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number ...
public isDailyGoalCompleted(currentStars: number, dailyGoal: number = 20): boolean { return currentStars >= dailyGoal; }
https://github.com/the-wwyang/kids-learning-app
45d2c01bce3a3222b864a2cd7c6a3ae79a5c7249
github
arkui-x/samples
CodeLab/Cases/feature/applicationexception/src/main/ets/model/PreferencesManager.ets
arkts
getFaultSign
获取数据异常标识
public static async getFaultSign(): Promise<void> { logger.info(TAG, `getFaultSign start`); let faultSign: boolean = false; // TODO:知识点:通过dataPreferencesManager.get方法获取异常标识 await dataPreferencesManager.getValue<boolean>('faultSign').then((data: boolean | null) => { if (data != null) { Ap...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left getFaultSign AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#R...
public static async getFaultSign(): Promise<void> { logger.info(TAG, `getFaultSign start`); let faultSign: boolean = false; // TODO:知识点:通过dataPreferencesManager.get方法获取异常标识 await dataPreferencesManager.getValue<boolean>('faultSign').then((data: boolean | null) => { if (data != null) { Ap...
https://gitcode.com/arkui-x/samples
7a0f83e6939f07d7949c4ad9da10af09352ee92e
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/usbdriver/DdkUsbPoller.ets
arkts
running
========== 实例方法 ==========
get running(): boolean { return this._running; }
AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left running AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right ...
get running(): boolean { return this._running; }
https://github.com/AlkaidLab/moonlight-harmony
0e3a480df5ac269a759104d8d643d1729205cc78
github
LJ666-ui/harmony-health-care
entry/src/main/ets/components/charts/base/BaseChart.ets
arkts
addDataListener
添加数据变更监听器
public addDataListener(listener: ChartDataChangeListener<T>): void { if (!this.dataListeners.includes(listener)) { this.dataListeners.push(listener); } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addDataListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left listener AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiatio...
public addDataListener(listener: ChartDataChangeListener<T>): void { if (!this.dataListeners.includes(listener)) { this.dataListeners.push(listener); } }
https://github.com/LJ666-ui/harmony-health-care
12d6638a4b1ee91c73d878358cfa8627e826cfbe
github
cpdd5201314/harmonyOS-music-app
products/phone/src/main/ets/pages/MusicApiClient.ets
arkts
getMusicPic
获取音乐封面图片
public static async getMusicPic(source: string, musicInfo: MusicInfo): Promise<string> { if (source !== 'local') { throw new Error(`不支持的音源(${source})获取封面`); } let songId = musicInfo.id ?? ''; if (!songId.startsWith('server_')) { throw new Error('不支持的本地文件'); } songId = songId.rep...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left getMusicPic AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left source...
public static async getMusicPic(source: string, musicInfo: MusicInfo): Promise<string> { if (source !== 'local') { throw new Error(`不支持的音源(${source})获取封面`); } let songId = musicInfo.id ?? ''; if (!songId.startsWith('server_')) { throw new Error('不支持的本地文件'); } songId = songId.rep...
https://github.com/cpdd5201314/harmonyOS-music-app
a7fc7cd2e159487c4ee9a2ba361e6c532afb0d7f
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/components/AxisBase.ets
arkts
setGridLineWidth
Sets the width of the grid lines that are drawn away from each axis label. @param width
public setGridLineWidth(width: number): void { this.mGridLineWidth = Utils.handleDataValues(width); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setGridLineWidth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left width AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
public setGridLineWidth(width: number): void { this.mGridLineWidth = Utils.handleDataValues(width); }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
86fdd5e20fffaeb2234858f2291ba9b1ae41b035
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
from
Creates an BigUint64Array from array-like argument @param o array-like object to initialize BigUint64Array @returns new BigUint64Array
public from(o: Object): BigUint64Array { throw new Error("BigUint64Array.from: not implemented") }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left from AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left o AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#R...
public from(o: Object): BigUint64Array { throw new Error("BigUint64Array.from: not implemented") }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
0b91b5559ebefec041735ec206e78200c27d76a0
gitee