nwo
stringclasses
449 values
path
stringlengths
9
173
language
stringclasses
1 value
identifier
stringlengths
1
53
docstring
stringlengths
5
4.13k
function
stringlengths
10
87.2k
ast_function
stringlengths
351
354k
obf_function
stringlengths
10
87.2k
url
stringlengths
30
175
function_sha
stringlengths
40
40
source
stringclasses
3 values
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Date.ets
arkts
parse
Parses a string representation of a date, and returns the number of milliseconds since January 1, 1970, 00:00:00 UTC or raises `InvalidDate` if the string is unrecognized or, in some cases, contains illegal date values (e.g. 2015-02-31). Only the @link{https://tc39.es/ecma262/#sec-date-time-string-format|ISO 8601 forma...
public static parse(dateStr: String): long throws { return Date.parseDateFromString(dateStr); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left parse AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left dateStr AST#identifier#Ri...
public static parse(dateStr: String): long throws { return Date.parseDateFromString(dateStr); }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
07f642e9ebf9b5d917ad8b50e92214a14ac0cf4f
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Debug/HidebugPerformanceCollector.ets
arkts
getPerformanceSummary
获取性能摘要
public getPerformanceSummary(): PerformanceSummary { const memoryUsage = this.history.memoryUsage; const cpuUsage = this.history.cpuUsage; const gcCount = this.history.gcCount; const heapSize = this.history.heapSize; if (memoryUsage.length === 0) { const emptyMemory: MemoryPerformanceSu...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getPerformanceSummary 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 ...
public getPerformanceSummary(): PerformanceSummary { const memoryUsage = this.history.memoryUsage; const cpuUsage = this.history.cpuUsage; const gcCount = this.history.gcCount; const heapSize = this.history.heapSize; if (memoryUsage.length === 0) { const emptyMemory: MemoryPerformanceSu...
https://github.com/DaLongZhuaZi/manxia
bd962553f882d0ea0e66dd1014560830e58e162c
github
aimilin6688/KeePassHO
entry/src/main/ets/storage/cache/CacheStorage.ets
arkts
writeToCache
写入文件到本地缓存(安全写入) 使用临时文件 + 原子重命名,确保写入失败不破坏原有缓存 @param cachePath 缓存文件路径 @param content 文件内容
private async writeToCache(cachePath: string, content: ArrayBuffer): Promise<void> { const tempPath = cachePath + '.tmp'; let file: fs.File | null = null; try { // 1. 确保目录存在 const cacheDir: string = CacheConstants.getCacheDir(); this.ensureCacheDir(cacheDir); // 2. 写入临时文件(使用 TRUN...
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 writeToCache AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left cachePath AST#identifier#Right AST#ERROR#Left AST#:#Lef...
private async writeToCache(cachePath: string, content: ArrayBuffer): Promise<void> { const tempPath = cachePath + '.tmp'; let file: fs.File | null = null; try { // 1. 确保目录存在 const cacheDir: string = CacheConstants.getCacheDir(); this.ensureCacheDir(cacheDir); // 2. 写入临时文件(使用 TRUN...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/cache/CacheStorage.ets#L237-L274
6c438bf30f110d9b162f9ba441216aba6438a008
github
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnDateTimePickerViewModel.ets
arkts
closeDatePicker
关闭日期选择器弹出层
closeDatePicker(): void { this.datePickerOpen = false; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left closeDatePicker AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bl...
closeDatePicker(): void { this.datePickerOpen = false; }
https://github.com/codelably/tuniao-ui
97b19b86fa1afcb268da6078af12d4096ef64c7b
github
openharmony-sig/flutter_sqflite
sqflite/ohos/src/main/ets/io/flutter/plugins/sqflite/Database.ets
arkts
update
/ update
public static update(operation: Operation, db: relationalStore.RdbStore): void { Database.doUpdate(operation, db); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left update AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left operation AST#identifier#Right AST#:#Left : AST#...
public static update(operation: Operation, db: relationalStore.RdbStore): void { Database.doUpdate(operation, db); }
https://gitee.com/openharmony-sig/flutter_sqflite.git
7691f44a03b3b5ef790e29055be4d26859f2d76c
gitee
LJ666-ui/harmony-health-care
entry/src/main/ets/ar/ARNavigationService.ets
arkts
updateNavigationState
更新导航状态
private updateNavigationState(currentPosition: Position3D): void { if (!this.navigationState.currentPath) return; // 计算剩余距离 const destination = this.currentDestination; if (destination) { this.navigationState.remainingDistance = this.pathPlanner.getDistance( currentPosition, des...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left updateNavigationState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left currentPosition AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#L...
private updateNavigationState(currentPosition: Position3D): void { if (!this.navigationState.currentPath) return; // 计算剩余距离 const destination = this.currentDestination; if (destination) { this.navigationState.remainingDistance = this.pathPlanner.getDistance( currentPosition, des...
https://github.com/LJ666-ui/harmony-health-care
15160d6682e6436d51577adac7483dd7477405a4
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
from
Creates an Int32Array from array-like argument @param o array-like object to initialize Int32Array @param mapFn function to apply for each @returns new Int32Array
public from(o: Object, mapFn: (e: Object) => int): Int32Array { let newF: (e: Object, index: int) => int = (e: Object, index: int): int => { return mapFn(e) } return this.from(o, newF) }
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, mapFn: (e: Object) => int): Int32Array { let newF: (e: Object, index: int) => int = (e: Object, index: int): int => { return mapFn(e) } return this.from(o, newF) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
ec85d6d0c9f198836ba354c9f882b31f4df789f4
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/TypeShelfManager.ets
arkts
getShelfItemIdsByType
获取书架中指定类型的内容ID列表
getShelfItemIdsByType(shelfId: string, contentType: ContentType): string[] { return this.categoryManager.getCategoryItemsByType(shelfId, contentType); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getShelfItemIdsByType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left shelfId AST#identifier#Right AST#ERROR#Lef...
getShelfItemIdsByType(shelfId: string, contentType: ContentType): string[] { return this.categoryManager.getCategoryItemsByType(shelfId, contentType); }
https://github.com/DaLongZhuaZi/manxia
454b071c0f199b0a68ae0b5b6414d01ef101ad08
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
set
Copies all elements of arr to the current Int8Array starting from insertPos. {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set} @param { FixedArray<byte> } arr - array to copy data from @param { int } insertPos - start index where data from arr will be inserted @thro...
public set(arr: FixedArray<byte>, insertPos: int): void { const offset = insertPos if (offset < 0 || offset + arr.length > this.lengthInt) { throw new RangeError("offset is out of bounds") } for (let i = 0; i < arr.length; ++i) { this.setUnsafe(offset + i, arr...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#...
public set(arr: FixedArray<byte>, insertPos: int): void { const offset = insertPos if (offset < 0 || offset + arr.length > this.lengthInt) { throw new RangeError("offset is out of bounds") } for (let i = 0; i < arr.length; ++i) { this.setUnsafe(offset + i, arr...
https://gitcode.com/iop123123/arkts-static-skills
2ce36d9c8581bd5b0fa28685ea5b50841ee84a39
gitcode
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ets
arkts
isArrayBuffer
Check whether the entered value is of arraybuffer type. @param { Object } value - A arraybuffer value @returns { boolean } Returns true if the value is a built-in ArrayBuffer instance. This does not include SharedArrayBuffer instances.
isArrayBuffer(value: Object): boolean { return value instanceof ArrayBuffer; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isArrayBuffer 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 AST#identifier#Right AST#)#Left ) ...
isArrayBuffer(value: Object): boolean { return value instanceof ArrayBuffer; }
https://gitcode.com/iop123123/arkts-static-skills
46e3291e4beb42633737482149b08e251a7d52e6
gitcode
HarmonyOS_Samples/BestPracticeSnippets
ArkTS_high_performance_segment/entry/src/main/ets/segment/segment2.ets
arkts
foo
Change to pass by parameters
function foo(array: Array<number>): number { array[0] = 1; return array[0] + array[1]; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left foo AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left array AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#g...
function foo(array: Array<number>): number { array[0] = 1; return array[0] + array[1]; }
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
305ba3ae9ede68ed97d5124e1676182d40fa2b6b
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
values
Returns array values iterator @returns { IterableIterator<BigInt> } - an iterator @syscap SystemCapability.Utils.Lang @FaAndStageModel
public values(): IterableIterator<BigInt> { return new BigInt64ArrayIterator(this) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left values 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_stat...
public values(): IterableIterator<BigInt> { return new BigInt64ArrayIterator(this) }
https://gitcode.com/iop123123/arkts-static-skills
7921a57d30a720e2d11a8bbc3dc853cf5b3129ce
gitcode
UnbalancedCat/ohos-ssh-core
entry/src/main/ets/pages/Index.ets
arkts
build
--- Build ---
build() { Column() { // ===== Title ===== Text($r('app.string.app_title')) .fontSize($r('app.float.title_font_size')) .fontWeight(FontWeight.Bold) .fontColor($r('app.color.title_text')) .margin({ top: 8, bottom: 6 }) // ===== Connection Section (collapsible, at t...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST...
build() { Column() { // ===== Title ===== Text($r('app.string.app_title')) .fontSize($r('app.float.title_font_size')) .fontWeight(FontWeight.Bold) .fontColor($r('app.color.title_text')) .margin({ top: 8, bottom: 6 }) // ===== Connection Section (collapsible, at t...
https://github.com/UnbalancedCat/ohos-ssh-core
d2b46a2f0bc2f0a42742b75071b448ec7f35c0f1
github
HarmonyCandies/image_cropper
image_cropper/src/main/ets/model/Geometry.ets
arkts
width
Getters for width and height
get width(): number { return this._dx; }
AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left width AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#E...
get width(): number { return this._dx; }
https://github.com/HarmonyCandies/image_cropper/blob/dd3664946b413166307b736a5763f998084364e1/image_cropper/src/main/ets/model/Geometry.ets#L198-L200
41aca8f1bff45fffc522a3029bc7667217e9f594
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/usbdriver/NativeHidController.ets
arkts
fallbackParseHidReport
TypeScript 后备 HID 解析器 用于原生解析器不可用时的通用 HID 手柄解析 通用手柄格式 (10字节): [0] = Report ID (通常是 0x01) [1] = Left Stick X (0x00-0xFF, 0x80 = center) [2] = Left Stick Y (0x00-0xFF, 0x80 = center) [3] = Right Stick X (0x00-0xFF, 0x80 = center) [4] = Right Stick Y (0x00-0xFF, 0x80 = center) [5] = Triggers/misc (varies) [6] = HAT/D-Pad (...
private fallbackParseHidReport(data: Uint8Array, hexStr: string): void { if (data.length < 9) { console.warn(`${TAG} HID 数据太短: ${data.length}`); return; } // 解析摇杆 (字节 1-4, 0x00-0xFF, 0x80=中心) // 转换为 -1.0 到 1.0 this.leftStickX = (data[1] - 128) / 127.0; this.leftStickY = (data[2] -...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left fallbackParseHidReport AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi...
private fallbackParseHidReport(data: Uint8Array, hexStr: string): void { if (data.length < 9) { console.warn(`${TAG} HID 数据太短: ${data.length}`); return; } // 解析摇杆 (字节 1-4, 0x00-0xFF, 0x80=中心) // 转换为 -1.0 到 1.0 this.leftStickX = (data[1] - 128) / 127.0; this.leftStickY = (data[2] -...
https://github.com/AlkaidLab/moonlight-harmony
253986e9743cd76dccea6bb4f9fa6556878f5ae7
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
findLast
/ === with element lambda functions === Finds the last element in the BigInt64Array that satisfies the condition @param { function } fn - condition @returns { BigInt } - the last element that satisfies fn @syscap SystemCapability.Utils.Lang @FaAndStageModel
public findLast(fn: (val: BigInt) => boolean): BigInt { let newF: (val: BigInt, index: int, array: BigInt64Array) => boolean = (val: BigInt, index: int, array: BigInt64Array): boolean => { return fn(val) } return new BigInt(this.findLast(newF)) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left findLast AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:...
public findLast(fn: (val: BigInt) => boolean): BigInt { let newF: (val: BigInt, index: int, array: BigInt64Array) => boolean = (val: BigInt, index: int, array: BigInt64Array): boolean => { return fn(val) } return new BigInt(this.findLast(newF)) }
https://gitcode.com/iop123123/arkts-static-skills
36936f04c7cba0c4d4c835f79d74cef59f79d8b9
gitcode
openharmony/codelabs
ETSUI/AccountApp/entry/src/main/ets/database/RdbHelper.ets
arkts
insertAppAccount
========================================== 账号记录表 (APP_ACCOUNT_TABLE) 操作 ========================================== [新增] 添加一条第三方账号记录 例如:存一个微信账号
public insertAppAccount(account: AppAccount): Promise<number> { return new Promise((resolve) => { if (!this.rdbStore) { resolve(-1); return; } try { this.rdbStore.insert('APP_ACCOUNT_TABLE', account.toValuesBucket(), (err, rowId) => { if (err) { console.error(`[RdbHelper...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left insertAppAccount 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#L...
public insertAppAccount(account: AppAccount): Promise<number> { return new Promise((resolve) => { if (!this.rdbStore) { resolve(-1); return; } try { this.rdbStore.insert('APP_ACCOUNT_TABLE', account.toValuesBucket(), (err, rowId) => { if (err) { console.error(`[RdbHelper...
https://gitcode.com/openharmony/codelabs
ac2b71eff23d633e68bcdc46f398b0deff2398f5
gitcode
Vincent-Leon/zotero-harmony
entry/src/main/ets/data/ItemRepository.ets
arkts
jsonToMap
Parsers below wrap the entire body in try/catch. Reason: JSON.parse can return null at runtime (`JSON.parse('null')`), but ArkTS types `Object` as non-null. Indexing into a null surface would crash; the catch keeps cache reads tolerant of corrupted blobs (we treat them as missing).
function jsonToMap(json: string | undefined): Map<string, string> { const map = new Map<string, string>(); if (json === undefined) { return map; } try { const parsed: Object = JSON.parse(json); if (Array.isArray(parsed)) { return map; } const obj = parsed as Record<string, Object>; ...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left jsonToMap AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left json AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right ...
function jsonToMap(json: string | undefined): Map<string, string> { const map = new Map<string, string>(); if (json === undefined) { return map; } try { const parsed: Object = JSON.parse(json); if (Array.isArray(parsed)) { return map; } const obj = parsed as Record<string, Object>; ...
https://github.com/Vincent-Leon/zotero-harmony
81a7a32232aa39d2bcca86c2e344f2b70b69cdd1
github
azhu0001/localsend-harmony
serve/src/main/ets/http/ContentType.ets
arkts
getDetailFromContentHeader
返回content-type中指定的参数 @param contentTypeHeader the entire content-type string @param pattern 获取特定字段值的正则表达式 @param defaultValue content-type的值 @group number @return 返回特定参数的值
private getDetailFromContentHeader(contentTypeHeader: string, pattern: RegExp, defaultValue: string, group: number): string { const matcher: RegExpExecArray | null = new RegExp(pattern).exec(contentTypeHeader); return matcher?.[group] ? matcher[group] : defaultValue; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getDetailFromContentHeader AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left contentTypeHeader AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#strin...
private getDetailFromContentHeader(contentTypeHeader: string, pattern: RegExp, defaultValue: string, group: number): string { const matcher: RegExpExecArray | null = new RegExp(pattern).exec(contentTypeHeader); return matcher?.[group] ? matcher[group] : defaultValue; }
https://gitcode.com/azhu0001/localsend-harmony
495db309206494e14ff01b81fbec90baa8efb576
gitcode
openharmony/update_update_app
feature/ota/src/main/ets/UpgradeAdapter.ets
arkts
getNotifyInstance
取提醒对象 @return 提醒对象
getNotifyInstance(): INotify { if (!this._notifyInstance) { this._notifyInstance = new NotificationHelper(); } return this._notifyInstance; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getNotifyInstance 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 INotify AST#identifier#Right AST#ERROR#Right...
getNotifyInstance(): INotify { if (!this._notifyInstance) { this._notifyInstance = new NotificationHelper(); } return this._notifyInstance; }
https://gitee.com/openharmony/update_update_app.git
6e5ffca8dfa9eba75f9d91b34732e43b62cb0c33
gitee
LongLiveY96/chatcube
entry/src/main/ets/utils/ThrottleUtil.ets
arkts
throttle
节流执行入口 @param content 新到达的流式文本片段 @param callback 触发 UI 更新的回调,参数为本次输出的字符片段
throttle(content: string, callback: (content: string) => void): void { this.pendingContent += content const now = Date.now() if (this.timerId !== -1) { clearTimeout(this.timerId) this.timerId = -1 } if (now - this.lastExecuteTime >= this.interval) { this.execute(callback) }...
AST#program#Left AST#ERROR#Left AST#identifier#Left throttle AST#identifier#Right AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left content AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Right AST#call_expression#Left AST#identi...
throttle(content: string, callback: (content: string) => void): void { this.pendingContent += content const now = Date.now() if (this.timerId !== -1) { clearTimeout(this.timerId) this.timerId = -1 } if (now - this.lastExecuteTime >= this.interval) { this.execute(callback) }...
https://github.com/LongLiveY96/chatcube
110c95ff730b12de3d9916486f734f1d47a4ef95
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/InputProcessor.ets
arkts
processGamepadAxis
处理手柄摇杆轴事件 将轴值根据 deadZone 转换为 D-Pad 方向输入。 追踪轴状态以避免重复触发相同方向的事件。 axisId 0 = 水平轴: 正值 -> RIGHT (key 4), 负值 -> LEFT (key 5) axisId 1 = 垂直轴: 正值 -> DOWN (key 7), 负值 -> UP (key 6) @param axisId 轴 ID (0=水平, 1=垂直) @param value 轴值 (-1.0 到 1.0) @returns ProcessResult 数组(可能包含释放旧方向 + 按下新方向)
processGamepadAxis(axisId: number, value: number): ProcessResult[] { const results: ProcessResult[] = [] // 确定当前方向: -1=负方向, 0=中立, 1=正方向 let currentDirection: number = 0 if (value >= this.axisDeadZone) { currentDirection = 1 } else if (value <= -this.axisDeadZone) { currentDirection = ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left processGamepadAxis AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left axisId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#L...
processGamepadAxis(axisId: number, value: number): ProcessResult[] { const results: ProcessResult[] = [] // 确定当前方向: -1=负方向, 0=中立, 1=正方向 let currentDirection: number = 0 if (value >= this.axisDeadZone) { currentDirection = 1 } else if (value <= -this.axisDeadZone) { currentDirection = ...
https://github.com/richshaw2015/nds
4667ed6835311146a7ba0870a86fc54ff3a34375
github
LongLiveY96/chatcube
entry/src/main/ets/services/HttpService.ets
arkts
streamPost
流式 POST 请求 关键: 流完成 / 出错 / 主动取消都必须 off + destroy。 官方 @ohos.net.http 文档明确要求每个 HttpRequest 实例使用完毕后调用 destroy() 释放 native 资源 (socket / 连接池 / 内部缓冲); off() 取消监听器闭包对 httpRequest 的强引用,防止 JS 端 GC 环。 多轮工具调用 / 深度推理场景下,如果不清理,每轮新建的 HttpRequest 都会泄漏,native 资源累积 到一定数量就会触发系统级 OOM kill, 应用闪退无 JS 异常日志。
streamPost( url: string, body: string, headers: Record<string, string>, onData: (chunk: ArrayBuffer) => void, onComplete?: (response: HttpResponse) => void, onError?: (error: string) => void ): http.HttpRequest { const httpRequest = http.createHttp() let dataEnded = false let re...
AST#ERROR#Left AST#identifier#Left streamPost AST#identifier#Right AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Right AST#ERROR#Left AST#identifier#Left body AST#identifier...
streamPost( url: string, body: string, headers: Record<string, string>, onData: (chunk: ArrayBuffer) => void, onComplete?: (response: HttpResponse) => void, onError?: (error: string) => void ): http.HttpRequest { const httpRequest = http.createHttp() let dataEnded = false let re...
https://github.com/LongLiveY96/chatcube
ff153f0d2eb3fca5dfb867d90cc54f0d6bfd8c98
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
from
Creates an array from an array-like object. @param { ArrayLike<T> } arrayLike - An array-like object to convert to an array. @param { function } mapfn - A mapping function to call on every element of the array. @returns { Uint32Array } - A new Uint32Array @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static from<T>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => number): Uint32Array { let res = new Uint32Array(arrayLike.length) // NOTE (ikorobkov): Please don't replace idx as int[1] with int-variable, because of value of single variable doesn't change (idx++) into lambda call by unkn...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#from#Left from AST#from#Right AST#ERROR#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identif...
public static from<T>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => number): Uint32Array { let res = new Uint32Array(arrayLike.length) // NOTE (ikorobkov): Please don't replace idx as int[1] with int-variable, because of value of single variable doesn't change (idx++) into lambda call by unkn...
https://gitcode.com/iop123123/arkts-static-skills
bfc48b0f973f6561cc0c0c3a43a9c2188c4c0226
gitcode
HarmonyOS_Samples/guide-snippets
Ability/AgentExtensionAbility/entry/src/main/ets/agentextability/AgentExtAbility.ets
arkts
onData
[EndExclude ability_agent_service_two] 接收数据
onData(proxy: common.AgentHostProxy, data: string) { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onData'); try { let replyData = 'reply message'; proxy.sendData(replyData); } catch (err) { let code = (err as BusinessError).code; let msg = (err as BusinessError).message; ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left proxy AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Left common...
onData(proxy: common.AgentHostProxy, data: string) { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onData'); try { let replyData = 'reply message'; proxy.sendData(replyData); } catch (err) { let code = (err as BusinessError).code; let msg = (err as BusinessError).message; ...
https://gitcode.com/HarmonyOS_Samples/guide-snippets
e653ff0ae5d774d823dbec0075ac1dcbb6ec61f9
gitcode
LJ666-ui/harmony-health-care
entry/src/main/ets/core/InfusionPumpController.ets
arkts
getDeviceStatus
获取输液泵设备状态
public async getDeviceStatus(deviceId: string): Promise<DeviceStatus> { let status = this.statusCache.get(deviceId); // 如果没有缓存状态,创建默认状态 if (!status) { const properties: Map<string, DeviceProperty> = new Map(); properties.set('flowRate', { key: 'flowRate', value: 50, un...
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 getDeviceStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left deviceId AST#identifier#Right AST#ERROR#Left AST#:#Left...
public async getDeviceStatus(deviceId: string): Promise<DeviceStatus> { let status = this.statusCache.get(deviceId); // 如果没有缓存状态,创建默认状态 if (!status) { const properties: Map<string, DeviceProperty> = new Map(); properties.set('flowRate', { key: 'flowRate', value: 50, un...
https://github.com/LJ666-ui/harmony-health-care
0de474c9bc84948a84f20e9356f79a9fa2e3f6e7
github
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/model/SessionState.ets
arkts
setPixelMap
Set the pixel map
setPixelMap(pixelMap: image.PixelMap | null): void { // Release old pixel map if exists if (this.pixelMap) { this.pixelMap.release(); } this.pixelMap = pixelMap; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setPixelMap AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#member_expression#Left AST#identifier#Left pixelMap AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left im...
setPixelMap(pixelMap: image.PixelMap | null): void { // Release old pixel map if exists if (this.pixelMap) { this.pixelMap.release(); } this.pixelMap = pixelMap; }
https://github.com/tangwengang-del/freerdp-harmonyos
9dcb09ce0c8701c1471cf444e670615f46e01f1a
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/ThemeManager.ets
arkts
setTheme
============================================================================ 主题切换和持久化方法 Requirements: 2.2, 2.5, 8.1, 8.3, 8.5 ============================================================================ 设置主题 @param themeId 主题 ID Requirements: 2.2, 2.5, 8.1, 8.5
public async setTheme(themeId: NDSThemeId): Promise<void> { // 验证主题 ID 是否有效 if (!this.isValidThemeId(themeId)) { console.error(`${TAG} Invalid theme ID: ${themeId}`); return; } // 如果主题没有变化,不做任何操作 if (this.currentThemeId === themeId) { console.info(`${TAG} Theme already set to: $...
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 setTheme AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left themeId AST#identifier#Right AST#:#Left : AST#:...
public async setTheme(themeId: NDSThemeId): Promise<void> { // 验证主题 ID 是否有效 if (!this.isValidThemeId(themeId)) { console.error(`${TAG} Invalid theme ID: ${themeId}`); return; } // 如果主题没有变化,不做任何操作 if (this.currentThemeId === themeId) { console.info(`${TAG} Theme already set to: $...
https://github.com/richshaw2015/nds
7e613b4202839b8f5ef7ad38a73f5c8923ac6e0d
github
openharmony/arkui_ace_engine
examples/ScrollableComponentTest/entry/src/main/ets/pages/List/Table/CommonDataSource.ets
arkts
clear
清空数据数组
clear() { this.originDataArray = [] this.notifyDataReload() }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clear 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#a...
clear() { this.originDataArray = [] this.notifyDataReload() }
https://gitee.com/openharmony/arkui_ace_engine.git
e0d4627082bd6df8d27781c23d737fe2b7b17333
gitee
pangpang20/antennaPodHM
entry/src/main/ets/pages/MainPage.ets
arkts
startSubscriptionUpdateTimer
开始订阅更新定时器 - 每5秒刷新集数
startSubscriptionUpdateTimer() { if (this.subscriptionUpdateTimer === -1) { this.subscriptionUpdateTimer = setInterval(() => { this.loadSubscriptions(); console.info('[MainPage] Subscription list refreshed'); }, 5000); } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left startSubscriptionUpdateTimer 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#state...
startSubscriptionUpdateTimer() { if (this.subscriptionUpdateTimer === -1) { this.subscriptionUpdateTimer = setInterval(() => { this.loadSubscriptions(); console.info('[MainPage] Subscription list refreshed'); }, 5000); } }
https://github.com/pangpang20/antennaPodHM
fd6709d9f1e2d5d5331beee9edd67512093d8b00
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/HorizontalBarChartModel.ets
arkts
getHighlightByTouchPoint
Returns the Highlight object (contains x-index and DataSet index) of the selected value at the given touch point inside the BarChart. @param x @param y @return
public getHighlightByTouchPoint(x: number, y: number): Highlight | null { if (this.mData == null) { if (this.mLogEnabled) { LogUtil.log(ChartModel.LOG_TAG, "Can't select by touch. No data set."); } return null; } else { let highLighter = this.getHighlighter(); if (highLi...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getHighlightByTouchPoint 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...
public getHighlightByTouchPoint(x: number, y: number): Highlight | null { if (this.mData == null) { if (this.mLogEnabled) { LogUtil.log(ChartModel.LOG_TAG, "Can't select by touch. No data set."); } return null; } else { let highLighter = this.getHighlighter(); if (highLi...
https://gitee.com/openharmony-tpc/ohos_mpchart.git
1040bd9c28a9b1657e8feffcacd562d3f36f76b6
gitee
UnbalancedCat/ohos-ssh-core
ssh_lib/src/main/ets/core/SshClient.ets
arkts
resizePty
Resize the interactive shell's pseudo-terminal (PTY).
resizePty(cols: number, rows: number): void { if (!this.handle) return; if (this.state !== SshState.CONNECTED) return; try { ssh.resizePty(this.handle, cols, rows); } catch (err) { const msg = (err as Error).message ?? 'Resize failed'; this.emit('error', new SshError(msg, this.class...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left resizePty AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left cols AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left , AST#,...
resizePty(cols: number, rows: number): void { if (!this.handle) return; if (this.state !== SshState.CONNECTED) return; try { ssh.resizePty(this.handle, cols, rows); } catch (err) { const msg = (err as Error).message ?? 'Resize failed'; this.emit('error', new SshError(msg, this.class...
https://github.com/UnbalancedCat/ohos-ssh-core
d80c6fe69c1a2478a7a5c8c1c13a4cbdf8a5ae81
github
picklerick422/zju-learning-assistant-OH
entry/src/main/ets/services/WindowService.ets
arkts
startDrag
自定义标题栏拖拽:在顶栏 onTouch 回调里调用。
static startDrag(event: TouchEvent): void { if (event.type === TouchType.Down && WindowService.win) { WindowService.win.startMoving().catch((err: BusinessError) => { hilog.warn(DOMAIN, TAG, 'startMoving failed: code=%{public}d', err.code); }); } }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left startDrag AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Touch...
static startDrag(event: TouchEvent): void { if (event.type === TouchType.Down && WindowService.win) { WindowService.win.startMoving().catch((err: BusinessError) => { hilog.warn(DOMAIN, TAG, 'startMoving failed: code=%{public}d', err.code); }); } }
https://github.com/picklerick422/zju-learning-assistant-OH
95c659a50f506290c946ab4b5ad557d15b447e21
github
NissonCX/CQU-HarmonyOS-APP-Dev-Final
entry/src/main/ets/utils/ExportManager.ets
arkts
generateJSONContent
生成 JSON 格式内容
private async generateJSONContent(dataType: ExportDataType): Promise<string> { let data: ExportJsonData; switch (dataType) { case ExportDataType.HEALTH_RECORDS: data = { exportTime: new Date().toISOString(), dataType: 'health_records', records: await this.dataManag...
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 generateJSONContent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dataType AST#identifier#Right AST...
private async generateJSONContent(dataType: ExportDataType): Promise<string> { let data: ExportJsonData; switch (dataType) { case ExportDataType.HEALTH_RECORDS: data = { exportTime: new Date().toISOString(), dataType: 'health_records', records: await this.dataManag...
https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final
0f53d7d2fed26d745d7a873dca8fce17a4dda83f
github
CPF-ApplicationTPC/openharmony_tpc_samples
SwipeMenuListView/library/src/main/ets/utils/AnimationInterpolator.ets
arkts
linear
线性插值器 匀速动画
static linear(): curves.ICurve { return curves.cubicBezierCurve(0, 0, 1, 1); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left linear 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#Left AST#iden...
static linear(): curves.ICurve { return curves.cubicBezierCurve(0, 0, 1, 1); }
https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples
0c690e3993f3717f40cf5b88564915450aabf214
gitcode
openharmony-tpc/XmlGraphicsBatik
library/src/main/ets/batik/svggen/SVGSpecifiedFormat.ets
arkts
addElementsText
添加当前节点的文本(不覆盖原有文本) @param text 文本
public addElementsText(text: string): void{ let objKeys: string[] = Object.keys(this._formatResultObj); let indexOfKey = objKeys.indexOf(SVGAttrConstants.ATTR_KEY_ELEMENTS); this._textObj[SVGAttrConstants.ATTR_KEY_TYPE] = SVGAttrConstants.ATTR_KEY_OR_VALUE_TEXT; this._textObj[SVGAttrConstants.ATTR_KEY...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addElementsText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ...
public addElementsText(text: string): void{ let objKeys: string[] = Object.keys(this._formatResultObj); let indexOfKey = objKeys.indexOf(SVGAttrConstants.ATTR_KEY_ELEMENTS); this._textObj[SVGAttrConstants.ATTR_KEY_TYPE] = SVGAttrConstants.ATTR_KEY_OR_VALUE_TEXT; this._textObj[SVGAttrConstants.ATTR_KEY...
https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git
a64c99e7be558f892cdb953827d94134afc123c0
gitee
webabcd/HarmonyDemo
entry/src/main/ets/entryability/EntryAbility.ets
arkts
onNewWant
当 UIAbility 已经启动了,之后再次启动时(热启动)
onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void { MyLog.d(`ability onNewWant, parameters:${JSON.stringify((want.parameters))}`); this.handleCard(want) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onNewWant AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Want AST#identifier#Right AST#,#Left , AST#,#R...
onNewWant(want: Want, launchParam: AbilityConstant.LaunchParam): void { MyLog.d(`ability onNewWant, parameters:${JSON.stringify((want.parameters))}`); this.handleCard(want) }
https://github.com/webabcd/HarmonyDemo
5491e4273a0ba175fd35aa8fb55be51cd19a34c0
github
HarmonyOS_Samples/sample_in_harmonyos
common/src/main/ets/util/FuzzyMatchUtil.ets
arkts
LongestCommonSubString
Find the longest common sub-string (not sub-sequence!) @returns <Number>
public static LongestCommonSubString(strA: string, strB: string): number { const m: number = strA.length; const n: number = strB.length; if (m == 0 || n == 0) { return 0; } else if (strA == strB) { // Case insensitive situation, therefore, == sign can be used. return strA.length; ...
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 LongestCommonSubString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left strA AST#identifier#Right AST#:#...
public static LongestCommonSubString(strA: string, strB: string): number { const m: number = strA.length; const n: number = strB.length; if (m == 0 || n == 0) { return 0; } else if (strA == strB) { // Case insensitive situation, therefore, == sign can be used. return strA.length; ...
https://gitcode.com/HarmonyOS_Samples/sample_in_harmonyos
5d5efd492542e604c2f5ecb788a77da24f59c6fb
gitcode
apap6628114/nga_oh
entry/src/main/ets/parser/nga/html-thread/ScanState.ets
arkts
extractBalancedBraces
提取以 `{` 开头、`{}` 平衡的 JSON 对象字面量子串(含外层 `{}`)。 与通用扫描的差异: - 仅 `"` 视为字符串引号(NGA JS 对象常含 `'` 包裹的字符串,按 JSON 语义处理) - 转义仅对 JSON 标准字符集跳过,其余 `\x` 不跳过 - 起始处跳过前导空白再匹配 `{` @param html 源字符串 @param startPos 开始扫描位置(跳过前导空白后须命中 `{`) @returns 含外层 `{}` 的子串;未匹配到平衡的 `{}` 时返回空串
function extractBalancedBraces(html: string, startPos: number): string { let pos: number = startPos; while (pos < html.length && (html[pos] === ' ' || html[pos] === '\n' || html[pos] === '\r' || html[pos] === '\t')) { pos++; } if (pos >= html.length || html[pos] !== '{') { return ''; } let depth...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left extractBalancedBraces AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left html AST#identifier#Right AST#type_annotation#Left AST#:#Left : ...
function extractBalancedBraces(html: string, startPos: number): string { let pos: number = startPos; while (pos < html.length && (html[pos] === ' ' || html[pos] === '\n' || html[pos] === '\r' || html[pos] === '\t')) { pos++; } if (pos >= html.length || html[pos] !== '{') { return ''; } let depth...
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/parser/nga/html-thread/ScanState.ets#L37-L82
a9c2a849e2eb65d501901a13964711b8f02bc09e
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/EventSourcingService.ets
arkts
applyEvent
应用事件到状态
private static applyEvent(state: Record<string, Object>, event: DomainEvent): Record<string, Object> { const payload: Record<string, Object> = JSON.parse(event.payloadJson) as Record<string, Object>; // 创建新状态对象,手动复制属性 const newState: Record<string, Object> = {}; const keys = Object.keys(state); fo...
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 applyEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left state AST#identifier#Right AST#:#Left : A...
private static applyEvent(state: Record<string, Object>, event: DomainEvent): Record<string, Object> { const payload: Record<string, Object> = JSON.parse(event.payloadJson) as Record<string, Object>; // 创建新状态对象,手动复制属性 const newState: Record<string, Object> = {}; const keys = Object.keys(state); fo...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
b7bf8419a294acdfc81ad8949ad8ca9d8722d5ce
github
erosTeam/NextE
shared/src/main/ets/i18n/AppStrings.ets
arkts
setOverrideLocale
Pin (or clear) an override locale for immediate language switching. Empty locale = follow system (drop the override). Returns the applied locale ('' when cleared).
static setOverrideLocale(locale: string): string { if (locale.length === 0 || !AppStrings.context) { AppStrings.overrideResMgr = null return locale } try { const config: resourceManager.Configuration = AppStrings.context.resourceManager.getOverrideConfiguration() config.loc...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setOverrideLocale AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left locale AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
static setOverrideLocale(locale: string): string { if (locale.length === 0 || !AppStrings.context) { AppStrings.overrideResMgr = null return locale } try { const config: resourceManager.Configuration = AppStrings.context.resourceManager.getOverrideConfiguration() config.loc...
https://github.com/erosTeam/NextE
ec769a7b2363fa8b9839154973106ae8aad95cd8
github
Xiwei753/xiezuoruanjian
apps/harmony/entry/src/main/ets/common/AdaptiveContext.ets
arkts
getCurrentState
获取当前响应式状态(返回副本)
getCurrentState(): AdaptiveState { return { widthVp: this.state.widthVp, heightVp: this.state.heightVp, layoutPlan: this.state.layoutPlan, sizeClass: this.state.sizeClass, isTwoPane: this.state.isTwoPane, contentMaxWidth: this.state.contentMaxWidth, pagePadding: this.stat...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCurrentState 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 AdaptiveState AST#identifier#Right AST#ERROR#R...
getCurrentState(): AdaptiveState { return { widthVp: this.state.widthVp, heightVp: this.state.heightVp, layoutPlan: this.state.layoutPlan, sizeClass: this.state.sizeClass, isTwoPane: this.state.isTwoPane, contentMaxWidth: this.state.contentMaxWidth, pagePadding: this.stat...
https://github.com/Xiwei753/xiezuoruanjian
297aad2a62a39284b9abc6231e502a036c2676f2
github
arkui-x/samples
CodeLab/Cases/feature/fitfordarkmode/src/main/ets/view/FitForDarkMode.ets
arkts
onColorModeChange
@Watch回调函数,监听颜色模式刷新状态变量
onColorModeChange(): void { this.banner = setBanner(this.currentMode); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onColorModeChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_...
onColorModeChange(): void { this.banner = setBanner(this.currentMode); }
https://gitcode.com/arkui-x/samples
2a6f7fa6c02376da108727c6acb4380f58ef637e
gitcode
arkui-x/samples
CodeLab/Cases/feature/customscan/src/main/ets/components/CommonCodeLayout.ets
arkts
selected
二维码位置的样式
@Extend(Image) function selected(scanState: boolean, x: number, y: number) { .width(40) .height(40) .position({ x: x, y: y }) .markAnchor({ x: 20, y: 20 }) .visibility(scanState ? Visibility.Visible : Visibility.Hidden) .draggable(false) }
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#call_expression#Left AST#identifier#Left Extend AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left Image AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#...
@Extend(Image) function selected(scanState: boolean, x: number, y: number) { .width(40) .height(40) .position({ x: x, y: y }) .markAnchor({ x: 20, y: 20 }) .visibility(scanState ? Visibility.Visible : Visibility.Hidden) .draggable(false) }
https://gitcode.com/arkui-x/samples
a6824a7b9870158df94a42ea6e039eb617f6575d
gitcode
openharmony-sig/ohos_banner
library/src/main/ets/component/Banner.ets
arkts
resolveBoundValue
边界值处理
resolveBoundValue() { // bannerMargin 边界值处理 let targetLength = 0 if (this.vertical) { targetLength = this.swiperHeight; } else { targetLength = this.swiperWidth; } let minValue = 0; let maxValue = targetLength * 0.3 if (this.bannerMargin.left < minValue) { this.ban...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left resolveBoundValue 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#...
resolveBoundValue() { // bannerMargin 边界值处理 let targetLength = 0 if (this.vertical) { targetLength = this.swiperHeight; } else { targetLength = this.swiperWidth; } let minValue = 0; let maxValue = targetLength * 0.3 if (this.bannerMargin.left < minValue) { this.ban...
https://gitee.com/openharmony-sig/ohos_banner.git
248f30738b39d8f3e414405a6ca2dd415ad4c1e6
gitee
AetheriumSimulator/qemu-hmos
entry/src/main/ets/common/VNCConnection.ets
arkts
removeSocketEvents
移除Socket事件监听
private removeSocketEvents(): void { if (!this.tcpSocket) return; this.tcpSocket.off('connect'); this.tcpSocket.off('message'); this.tcpSocket.off('close'); this.tcpSocket.off('error'); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left removeSocketEvents AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void A...
private removeSocketEvents(): void { if (!this.tcpSocket) return; this.tcpSocket.off('connect'); this.tcpSocket.off('message'); this.tcpSocket.off('close'); this.tcpSocket.off('error'); }
https://github.com/AetheriumSimulator/qemu-hmos
8e743265124320c9e9fd361d82a6a2d1420d017f
github
Eklps/harmony-mall-perf
entry/src/main/ets/viewmodel/CartModel.ets
arkts
removeFromCart
从购物车移除商品
static removeFromCart(itemId: string) { let cartList = AppStorage.get<CartItemType[]>('cartList') || []; cartList = cartList.filter(cartItem => cartItem.goods.id !== itemId); AppStorage.setOrCreate('cartList', cartList); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left removeFromCart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left itemId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left...
static removeFromCart(itemId: string) { let cartList = AppStorage.get<CartItemType[]>('cartList') || []; cartList = cartList.filter(cartItem => cartItem.goods.id !== itemId); AppStorage.setOrCreate('cartList', cartList); }
https://github.com/Eklps/harmony-mall-perf
191968a8af84a1d077d4ace86f11a7525b253b0b
github
openharmony/applications_contacts
entry/src/main/ets/presenter/contact/detail/DetailPresenter.ets
arkts
removeCallLog
Delete call records based on the ID set.
removeCallLog(ids: number[]) { HiLog.i(TAG, 'removeCallLog'); globalThis.DataWorker.sendRequest('deleteCallLogsById', { context: globalThis.context, ids: ids }, (data: number | undefined) => { HiLog.i(TAG, 'removeCallLog Success'); }); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left removeCallLog AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ids AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Lef...
removeCallLog(ids: number[]) { HiLog.i(TAG, 'removeCallLog'); globalThis.DataWorker.sendRequest('deleteCallLogsById', { context: globalThis.context, ids: ids }, (data: number | undefined) => { HiLog.i(TAG, 'removeCallLog Success'); }); }
https://gitee.com/openharmony/applications_contacts.git
20510dd0cfc5eed4cc2a365688397698b98d88c6
gitee
openharmony/codelabs
ETSUI/PositioningDemo/entry/src/main/ets/service/ReminderService.ets
arkts
checkRegularReminders
检查定期运动提醒
private checkRegularReminders(): void { const config = this.settings.getReminderConfig(ReminderType.REGULAR_SPORT); if (config && config.enabled && config.interval) { const now = Date.now(); if (now - this.state.lastRegularReminder >= config.interval * 1000) { this.triggerReminder(Reminder...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left checkRegularReminders 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 voi...
private checkRegularReminders(): void { const config = this.settings.getReminderConfig(ReminderType.REGULAR_SPORT); if (config && config.enabled && config.interval) { const now = Date.now(); if (now - this.state.lastRegularReminder >= config.interval * 1000) { this.triggerReminder(Reminder...
https://gitcode.com/openharmony/codelabs
d68e3de3cf5af2fb595ab3d7e816f00c9591053a
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/TaskExecutor.ets
arkts
applyOutputMapping
应用输出参数映射
private applyOutputMapping( mapping: Record<string, string>, data: Object, context: TaskContext ): void { const outputVars = Object.keys(mapping); for (let i = 0; i < outputVars.length; i++) { const outputVar: string = outputVars[i]; const extractExpr: string = mapping[outputVar]; ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left applyOutputMapping AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left mapping AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instant...
private applyOutputMapping( mapping: Record<string, string>, data: Object, context: TaskContext ): void { const outputVars = Object.keys(mapping); for (let i = 0; i < outputVars.length; i++) { const outputVar: string = outputVars[i]; const extractExpr: string = mapping[outputVar]; ...
https://github.com/DaLongZhuaZi/manxia
c497cee0405bc2732a5b41513191d0c88a8ac88d
github
openharmony/codelabs
Distributed/HandleGameApplication/GameEtsOpenHarmony/entry/src/main/ets/MainAbility/pages/index.ets
arkts
onDisconnectCallback
Service异常死亡的回调
function onDisconnectCallback(element) { console.log('[game]connectRemoteService onDisconnectCallback') prompt.showToast({ message: "onDisconnectCallback " }); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left onDisconnectCallback AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left element AST#identifier#Right AST#required_parameter#Right AST#)#L...
function onDisconnectCallback(element) { console.log('[game]connectRemoteService onDisconnectCallback') prompt.showToast({ message: "onDisconnectCallback " }); }
https://gitee.com/openharmony/codelabs.git
201f6cb1ca777079c23393fb2e69ff522efe7e2a
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Services/DataService.ets
arkts
getUserProfile
==================== 用户配置服务 ==================== 获取用户配置
public async getUserProfile(): Promise<UserProfile> { try { const favorites = await this.dataManager.getUserFavorites(this.currentUserId); const readHistory = await this.dataManager.getUserReadHistory(this.currentUserId); const downloadTasks = await this.dataManager.getDownloadTasks(); ...
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 getUserProfile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:...
public async getUserProfile(): Promise<UserProfile> { try { const favorites = await this.dataManager.getUserFavorites(this.currentUserId); const readHistory = await this.dataManager.getUserReadHistory(this.currentUserId); const downloadTasks = await this.dataManager.getDownloadTasks(); ...
https://github.com/DaLongZhuaZi/manxia
edb352cc957be515f6b84b426f3c6480ef7e7197
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/DataManager.ets
arkts
isSourceLoggedIn
检查用户是否已登录(通过检查cookie是否存在)
async isSourceLoggedIn(sourceId: number): Promise<boolean> { try { const source = await this.getComicSourceById(sourceId); if (!source || !source.cookies) { return false; } const cookiesStr = String(source.cookies); return cookiesStr.length > 0 && cookiesStr !== '[]'; ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left isSourceLoggedIn AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceId AST#identifier#Right AST#type_annotation#Left AST#:#L...
async isSourceLoggedIn(sourceId: number): Promise<boolean> { try { const source = await this.getComicSourceById(sourceId); if (!source || !source.cookies) { return false; } const cookiesStr = String(source.cookies); return cookiesStr.length > 0 && cookiesStr !== '[]'; ...
https://github.com/DaLongZhuaZi/manxia
a022db62b1b72da1d6aed6fcbbf0346f362dbbc0
github
qiuhaotc/HarmonyOSPlayground
entry/src/main/ets/utils/DateUtil.ets
arkts
getCurrentYear
获取当前年份
static getCurrentYear(): string { return String(new Date().getFullYear()); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getCurrentYear 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#...
static getCurrentYear(): string { return String(new Date().getFullYear()); }
https://github.com/qiuhaotc/HarmonyOSPlayground
37db07986a66f74d10a0c3e43cbeb9ef219fa17a
github
aimilin6688/KeePassHO
entry/src/main/ets/common/utils/Sm4Utils.ets
arkts
initKey
初始化密码,16进制的字符串 @returns
public static initKey(): string { // 如果已经初始化过,则直接返回 if (Sm4Utils.SM4_KEY != undefined) { return Sm4Utils.SM4_KEY.getText(); } // 关键资产中查询是否存在 let key = AssetUtils.querySync(Sm4Utils.ASSET_SM4_KEY_NAME); if (key != undefined) { Sm4Utils.SM4_KEY = ProtectedValue.fromString(key); ...
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 initKey AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left ...
public static initKey(): string { // 如果已经初始化过,则直接返回 if (Sm4Utils.SM4_KEY != undefined) { return Sm4Utils.SM4_KEY.getText(); } // 关键资产中查询是否存在 let key = AssetUtils.querySync(Sm4Utils.ASSET_SM4_KEY_NAME); if (key != undefined) { Sm4Utils.SM4_KEY = ProtectedValue.fromString(key); ...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/Sm4Utils.ets#L41-L58
41d4a37b284ec4d530b56136d67808d701837f66
github
CLMC2025/Vignette
entry/src/main/ets/vocabulary/SnowballSystem.ets
arkts
determineAssociationType
确定关联类型
private determineAssociationType(word1: string, word2: string): AssociationType { // 简化实现:基于词首字母和长度 const w1 = word1.toLowerCase(); const w2 = word2.toLowerCase(); // 相同词性关联 if (w1.length === w2.length && Math.abs(w1.charCodeAt(0) - w2.charCodeAt(0)) < 5) { return AssociationType.SEMANTIC; ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left determineAssociationType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left word1 AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ide...
private determineAssociationType(word1: string, word2: string): AssociationType { // 简化实现:基于词首字母和长度 const w1 = word1.toLowerCase(); const w2 = word2.toLowerCase(); // 相同词性关联 if (w1.length === w2.length && Math.abs(w1.charCodeAt(0) - w2.charCodeAt(0)) < 5) { return AssociationType.SEMANTIC; ...
https://github.com/CLMC2025/Vignette
0023d61e05e2ff92516fd8f49287be85c8405eb0
github
awaLiny2333/Renameow
honk/src/main/ets/hosts/meowHonk.ets
arkts
hasDuplicateResultName
检测 meowFile 数组中是否有重复的 resultName @param arr - meowFile 对象数组 @returns 存在重复的 resultName 返回 那个 name 的下标[],否则返回 undefined @author DeepSeek Web @ Feb 27 2026
function hasDuplicateResultName(arr: meowFile[]) { const indexMap = new Map<string, number[]>(); for (let i = 0; i < arr.length; i++) { const name = arr[i].resultName; if (!indexMap.has(name)) { indexMap.set(name, []); } indexMap.get(name)!.push(i); } const duplicateGroups: number[][] = [...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left hasDuplicateResultName AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left arr AST#identifier#Right AST#type_annotation#Left AST#:#Left : ...
function hasDuplicateResultName(arr: meowFile[]) { const indexMap = new Map<string, number[]>(); for (let i = 0; i < arr.length; i++) { const name = arr[i].resultName; if (!indexMap.has(name)) { indexMap.set(name, []); } indexMap.get(name)!.push(i); } const duplicateGroups: number[][] = [...
https://github.com/awaLiny2333/Renameow/blob/34617cc8dc8596061456d226ee717517ff41d25a/honk/src/main/ets/hosts/meowHonk.ets#L258-L276
7d45356d695cb985bbcda39fb1fff506d3f230a5
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test57_original_index.ets
arkts
processNumbers
--- Higher-order map/filter chain ---
function processNumbers(nums: number[]): string { let filtered: number[] = nums.filter((n: number): boolean => { return n > 3; }); let mapped: number[] = filtered.map((n: number): number => { return n * n; }); let total: number = mapped.reduce((acc: number, n: number): number => { return acc + n; ...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left processNumbers AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left nums AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#R...
function processNumbers(nums: number[]): string { let filtered: number[] = nums.filter((n: number): boolean => { return n > 3; }); let mapped: number[] = filtered.map((n: number): number => { return n * n; }); let total: number = mapped.reduce((acc: number, n: number): number => { return acc + n; ...
https://github.com/miaochiahao/ark-ghidra
ecdd8a40c56f8104f3629bf8a8dbda66e9b24916
github
Joker-x-dev/CoolMallArkTS
feature/cs/src/main/ets/navigation/CsGraph.ets
arkts
register
注册客服模块导航路由
register(): void { RouteBuild.register(CsRoutes.Chat, wrapBuilder(ChatNav)); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left register AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Lef...
register(): void { RouteBuild.register(CsRoutes.Chat, wrapBuilder(ChatNav)); }
https://github.com/Joker-x-dev/CoolMallArkTS
d2d14404172a8db11f25908c6e4aa7131999d23a
github
openharmony-sig/ohos_danmaku_flame_master
library/src/main/ets/components/common/master/flame/danmaku/danmaku/model/ohos/DanmakuContext.ets
arkts
setScrollSpeedFactor
���õ�Ļ�����ٶ�ϵ��,ֻ�Թ�����Ļ��Ч @param p @return
public setScrollSpeedFactor(p: number): DanmakuContext{ if (this.scrollSpeedFactor != p) { this.scrollSpeedFactor = p; this.mDanmakuFactory.updateDurationFactor(p); this.mGlobalFlagValues.updateMeasureFlag(); this.mGlobalFlagValues.updateVisibleFlag(); this.notifyConfigureChanged(Dan...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setScrollSpeedFactor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left p AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
public setScrollSpeedFactor(p: number): DanmakuContext{ if (this.scrollSpeedFactor != p) { this.scrollSpeedFactor = p; this.mDanmakuFactory.updateDurationFactor(p); this.mGlobalFlagValues.updateMeasureFlag(); this.mGlobalFlagValues.updateVisibleFlag(); this.notifyConfigureChanged(Dan...
https://gitee.com/openharmony-sig/ohos_danmaku_flame_master.git
00ffebd1a15214cfb0510c03304ad36497986f87
gitee
offlinecat-dev/OCNetORM
src/main/ets/query/AggregateResult.ets
arkts
getRow
获取指定索引的结果行 @param index 索引 @returns 结果行,索引越界返回 null
getRow(index: number): AggregateRow | null { if (index < 0 || index >= this.rows.length) { return null } return this.rows[index] }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getRow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number...
getRow(index: number): AggregateRow | null { if (index < 0 || index >= this.rows.length) { return null } return this.rows[index] }
https://github.com/offlinecat-dev/OCNetORM
ede6718cbf77eaab7f4134d11385e01249d44fbe
github
HarmonyCandies/image_cropper
image_cropper/src/main/ets/common/ImageCropperLayerPainter.ets
arkts
paintCorners
/ Draw corners of the crop area
protected paintCorners(config: ImageCropperLayerPainterConfig): void { const cropRect = config.cropRect; const cornerSize = config.cornerSize; const cornerWidth = cornerSize.width; const cornerHeight = cornerSize.height; const canvas = config.canvas; canvas.save(); canvas.fillStyle = conf...
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left paintCorners AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi...
protected paintCorners(config: ImageCropperLayerPainterConfig): void { const cropRect = config.cropRect; const cornerSize = config.cornerSize; const cornerWidth = cornerSize.width; const cornerHeight = cornerSize.height; const canvas = config.canvas; canvas.save(); canvas.fillStyle = conf...
https://github.com/HarmonyCandies/image_cropper/blob/dd3664946b413166307b736a5763f998084364e1/image_cropper/src/main/ets/common/ImageCropperLayerPainter.ets#L22-L76
425fd9443ee56f2e0af48a8db2060dc5ca0a6194
github
openharmony-tpc/openharmony_tpc_samples
dialogs/library/src/main/ets/components/progress/LVCircularRing/LVCircularRing.ets
arkts
runNextFunction
为了保证执行方法在canvas的onReay之后 如果onReady未初始化,则将最新的绘制生命周期绑定到onReadNext上 待onReady执行的时候执行 @param nextFunction 下一个方法
runNextFunction(nextFunction: () => void) { if (!this.canvasHasReady) { // canvas未初始化完成 this.onReadyNext = nextFunction; } else { nextFunction(); } }
AST#program#Left AST#ERROR#Left AST#identifier#Left runNextFunction AST#identifier#Right AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left nextFunction AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right ...
runNextFunction(nextFunction: () => void) { if (!this.canvasHasReady) { // canvas未初始化完成 this.onReadyNext = nextFunction; } else { nextFunction(); } }
https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git
9887851b2bcdca68a67e1d22408af896dd542f2d
gitee
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/StreamingSession.ets
arkts
startAbr
--------------------------------------------------------------------------- 智能码率 (ABR) --------------------------------------------------------------------------- 启动智能码率调节
async startAbr(mode: string): Promise<void> { if (!this.nvHttp || !this.config) return; if (this.abrService) return; // 已启动 this.abrService = new AdaptiveBitrateService(this.nvHttp); await this.abrService.checkCapabilities(); await this.abrService.start( this.config.bitrate, mode, ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left startAbr AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left mode AST#identifier#Right AST#type_a...
async startAbr(mode: string): Promise<void> { if (!this.nvHttp || !this.config) return; if (this.abrService) return; // 已启动 this.abrService = new AdaptiveBitrateService(this.nvHttp); await this.abrService.checkCapabilities(); await this.abrService.start( this.config.bitrate, mode, ...
https://github.com/AlkaidLab/moonlight-harmony
e6543dffcba90eb684d8597f896fca8c04e8d244
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/usbdriver/AbstractXboxController.ets
arkts
tryDdkPath
尝试通过 USB DDK 路径启动控制器 DDK 完全绕过 usbManager,需要在 claimInterface 之前调用 @returns 是否成功
private tryDdkPath(): boolean { console.info(`${TAG} 尝试 DDK 路径...`); // Step 1: 初始化 DDK const initResult = DdkUsbPoller.init(); if (initResult.code !== 0) { console.warn(`${TAG} DDK init 失败: ${initResult.error}`); return false; } // Step 2: 通过 DDK 查找设备 let ddkDeviceId: number...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left tryDdkPath 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...
private tryDdkPath(): boolean { console.info(`${TAG} 尝试 DDK 路径...`); // Step 1: 初始化 DDK const initResult = DdkUsbPoller.init(); if (initResult.code !== 0) { console.warn(`${TAG} DDK init 失败: ${initResult.error}`); return false; } // Step 2: 通过 DDK 查找设备 let ddkDeviceId: number...
https://github.com/AlkaidLab/moonlight-harmony
ff7dab11ce66f57e0f65dd40a2b146821daf08f6
github
honjow/Next2V
shared/src/main/ets/services/AutoDailyCheckinService.ets
arkts
cookieAttemptIdentity
A length+hash fingerprint of the cookie — for the diagnostic log only (never persisted as state).
private static cookieAttemptIdentity(cookie: string): string { const clean = (cookie || '').trim() let hash = 2166136261 for (let i = 0; i < clean.length; i += 1) { hash ^= clean.charCodeAt(i) hash = Math.imul(hash, 16777619) >>> 0 } return `${clean.length}:${hash.toString(16)}` }
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 cookieAttemptIdentity AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left cookie AST#identifier#Right AS...
private static cookieAttemptIdentity(cookie: string): string { const clean = (cookie || '').trim() let hash = 2166136261 for (let i = 0; i < clean.length; i += 1) { hash ^= clean.charCodeAt(i) hash = Math.imul(hash, 16777619) >>> 0 } return `${clean.length}:${hash.toString(16)}` }
https://github.com/honjow/Next2V
fbc3cf18004227f79a790f934ec682e2c119b69e
github
richshaw2015/nds
ohos/entry/src/main/ets/types/MelonDSNative.ets
arkts
clearCustomScreenRects
清除自定义屏幕矩形,恢复自动布局计算
static clearCustomScreenRects(): boolean { return MelonDSNative.native.clearCustomScreenRects(); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left clearCustomScreenRects 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 bo...
static clearCustomScreenRects(): boolean { return MelonDSNative.native.clearCustomScreenRects(); }
https://github.com/richshaw2015/nds
cf0398f3a3a0cfc23394fdb99d3fb15a9db460da
github
openharmony/codelabs
ETSUI/HarmonyPhotoAlbum/entry/src/main/ets/service/PhotoService.ets
arkts
parseResultSet
解析查询结果集(提取公共逻辑) @param resultSet 查询结果集 @returns PhotoModel[] 图片列表
private parseResultSet(resultSet: relationalStore.ResultSet): PhotoModel[] { let count = resultSet.rowCount; console.info(`[PhotoService] 查询到 ${count} 条记录`); let result: PhotoModel[] = []; if (count === 0) { resultSet.close(); return result; } resultSet.goToFirstRow(); do { ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseResultSet AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resultSet AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_ex...
private parseResultSet(resultSet: relationalStore.ResultSet): PhotoModel[] { let count = resultSet.rowCount; console.info(`[PhotoService] 查询到 ${count} 条记录`); let result: PhotoModel[] = []; if (count === 0) { resultSet.close(); return result; } resultSet.goToFirstRow(); do { ...
https://gitcode.com/openharmony/codelabs
ddf236b21a354277229e7a33340ffcfbffd1690a
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/EAWorker.ets
arkts
constructor
NOTE(panferovi): make this constructor private
protected constructor(worker: MainWorker) { this.worker = worker; this.loopStarted.set(true); EAWorker.workers.set(this.worker.getWorkerId(), this); }
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#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 worker AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie...
protected constructor(worker: MainWorker) { this.worker = worker; this.loopStarted.set(true); EAWorker.workers.set(this.worker.getWorkerId(), this); }
https://gitcode.com/iop123123/arkts-static-skills
c9e72a5e660598ace31dfc45d65e24971c263d2b
gitcode
LJ666-ui/harmony-health-care
entry/src/main/ets/common/accessibility/AccessibilityConfig.ets
arkts
getFontSize
获取当前字体大小
public getFontSize(): number { if (this.settings.elderlyMode) { return 20; } else if (this.settings.largeFontMode) { return 18; } return this.settings.baseFontSize; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getFontSize 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#num...
public getFontSize(): number { if (this.settings.elderlyMode) { return 20; } else if (this.settings.largeFontMode) { return 18; } return this.settings.baseFontSize; }
https://github.com/LJ666-ui/harmony-health-care
cb7db2ddf9a3dae247d214e0863ad995378014da
github
ZestBox-18/kitebook-frontend
commons/data_core/src/main/ets/services/BudgetManager.ets
arkts
getBudgetByCategory
查询指定月份某个分类的预算。
static async getBudgetByCategory(month: string, category: string): Promise<BudgetBean | null> { const predicates = new relationalStore.RdbPredicates(TABLE_NAME); predicates.equalTo('month', month); predicates.equalTo('category', category); return new Promise<BudgetBean | null>((resolve, reject) => { ...
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 getBudgetByCategory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left month AST#identifier#Right AST#:#Lef...
static async getBudgetByCategory(month: string, category: string): Promise<BudgetBean | null> { const predicates = new relationalStore.RdbPredicates(TABLE_NAME); predicates.equalTo('month', month); predicates.equalTo('category', category); return new Promise<BudgetBean | null>((resolve, reject) => { ...
https://github.com/ZestBox-18/kitebook-frontend
d1b065b604b829d09d45e07b26177b1216e28575
github
CLMC2025/Vignette
entry/src/main/ets/ui/Animations.ets
arkts
CardFlip
卡片翻转动画组件
@Builder function CardFlip( key: string, duration: number = 600, progress: number ): void { Stack() { // 正面 Column() { // 正面内容直接嵌入 } .width('100%') .height('100%') .rotate({ angle: progress < 0.5 ? progress * 180 : 180, centerX: '50%', centerY: '50%' }) .o...
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Builder AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left CardFlip AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required...
@Builder function CardFlip( key: string, duration: number = 600, progress: number ): void { Stack() { // 正面 Column() { // 正面内容直接嵌入 } .width('100%') .height('100%') .rotate({ angle: progress < 0.5 ? progress * 180 : 180, centerX: '50%', centerY: '50%' }) .o...
https://github.com/CLMC2025/Vignette
a4809594f74d2d4cbaa15c7180586e09d8602592
github
openharmony/security_privacy_center
entry/src/main/ets/common/utils/HiSysEventUtil.ets
arkts
reportLocationFlagClick
Access My Location Information Switch Click on Dotting Event @params { checkedState } Position information switch status; 1: On 0: Off
static async reportLocationFlagClick(checkedState: number) { let versionName: string = await GetSelfBundleInfoUtils.getVersionName(); let eventParams: Record<string, string | number> = { 'PNAMEID': HiSysEventConstant.BUNDLE_NAME, 'PVERSIONID': versionName, 'NEW_CHECKED_STATE': checkedState, ...
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 reportLocationFlagClick AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left checkedState AST#identifier#Right AST#ERROR#Lef...
static async reportLocationFlagClick(checkedState: number) { let versionName: string = await GetSelfBundleInfoUtils.getVersionName(); let eventParams: Record<string, string | number> = { 'PNAMEID': HiSysEventConstant.BUNDLE_NAME, 'PVERSIONID': versionName, 'NEW_CHECKED_STATE': checkedState, ...
https://gitee.com/openharmony/security_privacy_center.git
bf675fd79b663a96fd07fff846e197485fbd9a17
gitee
yuyu5333/Healthy_life
entry/src/main/ets/view/CustomDialogWidget.ets
arkts
setHobbiesValue
Set hobbies value @param {HobbyItem[]} hobby item array
setHobbiesValue(hobbyItems: HobbyItem[]) { if (CommonUtils.isEmptyArr(hobbyItems)) { Logger.error(CommonConstants.TAG_HOME, 'hobbyItems length is 0'); return; } let hobbiesText: string = ''; hobbiesText = hobbyItems.filter((isCheckItem: HobbyItem) => isCheckItem?.isChecked) .map<stri...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setHobbiesValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left hobbyItems AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#ident...
setHobbiesValue(hobbyItems: HobbyItem[]) { if (CommonUtils.isEmptyArr(hobbyItems)) { Logger.error(CommonConstants.TAG_HOME, 'hobbyItems length is 0'); return; } let hobbiesText: string = ''; hobbiesText = hobbyItems.filter((isCheckItem: HobbyItem) => isCheckItem?.isChecked) .map<stri...
https://github.com/yuyu5333/Healthy_life
65aff4820177dfc0f0812970b132b5b50afdc34d
github
openharmony-tpc/ohos_coap
libcoap/src/main/ets/components/mainpage/CoapClient.ets
arkts
setRepeatCount
客户端设置重试请求次数 @param repeatCount 重试请求次数,必须1-255之间
setRepeatCount(repeatCount: number) { if (0 >= repeatCount || repeatCount > 255) { console.log("repeatCount set error"); return; } this.coapClient.setRepeatCount(repeatCount, this.classId); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setRepeatCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left repeatCount AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right...
setRepeatCount(repeatCount: number) { if (0 >= repeatCount || repeatCount > 255) { console.log("repeatCount set error"); return; } this.coapClient.setRepeatCount(repeatCount, this.classId); }
https://gitee.com/openharmony-tpc/ohos_coap.git
9e02ebc01e1835f3355db37adf1a5f5564eed263
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/AsyncLinkedConcurrentQueue.ets
arkts
constructor
Constructs an empty list node. @syscap SystemCapability.Utils.Lang
public constructor() { }
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#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { A...
public constructor() { }
https://gitcode.com/iop123123/arkts-static-skills
80dfff0e23d0c095d4562b983f68dc8fa9c20a52
gitcode
aimilin6688/KeePassHO
entry/src/main/ets/services/ScanService.ets
arkts
scanTotpQrCode
扫描TOTP二维码 @returns 扫码结果Promise,如果成功且内容是有效的TOTP URI,则解析为TOTP配置
public async scanTotpQrCode(): Promise<ScanResult> { try { // 启动扫码 const scanResult = await this.startScan(); if (!scanResult.success) { return scanResult; } const content = scanResult.content; // 检查是否是TOTP URI if (content && content.startsWith('otpauth://totp/...
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 scanTotpQrCode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:...
public async scanTotpQrCode(): Promise<ScanResult> { try { // 启动扫码 const scanResult = await this.startScan(); if (!scanResult.success) { return scanResult; } const content = scanResult.content; // 检查是否是TOTP URI if (content && content.startsWith('otpauth://totp/...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/ScanService.ets#L59-L87
025a304d5863f5210f33d9b55915f110dff5bca8
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test29_original_index.ets
arkts
httpMethodLabel
--- Switch expression emulation (lookup pattern) ---
function httpMethodLabel(method: string): string { if (method === 'GET') { return 'Read'; } if (method === 'POST') { return 'Create'; } if (method === 'PUT') { return 'Update'; } if (method === 'DELETE') { return 'Remove'; } return 'Unknown'; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left httpMethodLabel AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left method AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#...
function httpMethodLabel(method: string): string { if (method === 'GET') { return 'Read'; } if (method === 'POST') { return 'Create'; } if (method === 'PUT') { return 'Update'; } if (method === 'DELETE') { return 'Remove'; } return 'Unknown'; }
https://github.com/miaochiahao/ark-ghidra
7a44691f3e387e1010599bb067e5d1f568f13f95
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Workflow/WorkflowCapabilities.ets
arkts
applyPagination
应用分页能力
applyPagination( context: WorkflowContext, response?: Object ): PaginationResult | null { const capability = context.capabilities.get('pagination'); if (!capability) { return null; } const config = capability as PaginationConfig; const sourceKey = `source_${context.sourceId}`; ...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left applyPagination AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#...
applyPagination( context: WorkflowContext, response?: Object ): PaginationResult | null { const capability = context.capabilities.get('pagination'); if (!capability) { return null; } const config = capability as PaginationConfig; const sourceKey = `source_${context.sourceId}`; ...
https://github.com/DaLongZhuaZi/manxia
967b8f06844442d4fcc0c425fc84662a602f698a
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Database/DatabaseManager.ets
arkts
batchInsert
批量插入记录 @param tableName 表名 @param records 记录数组 @param conflictResolution 冲突解决策略:'REPLACE'=替换, 'IGNORE'=忽略, 'FAIL'=失败(默认)
public async batchInsert<T extends DatabaseRecord>( tableName: string, records: T[], conflictResolution: 'REPLACE' | 'IGNORE' | 'FAIL' = 'FAIL' ): Promise<number[]> { const store = this.getStore(); const rowIds: number[] = []; try { store.beginTransaction(); for (le...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#ERROR#Right AST#expression_statement#Left AST#identifier#Left batchInsert AST#identifier#Right AST#ERROR#Left AST#<#Left < AST#<#Right AST#type_identifier#Left T AST#type_identifier#Right AST#exten...
public async batchInsert<T extends DatabaseRecord>( tableName: string, records: T[], conflictResolution: 'REPLACE' | 'IGNORE' | 'FAIL' = 'FAIL' ): Promise<number[]> { const store = this.getStore(); const rowIds: number[] = []; try { store.beginTransaction(); for (le...
https://github.com/DaLongZhuaZi/manxia
2949ebff587252875c04c3a289843fcfe1c12f59
github
Vsolon0401/MallShopping
common/src/main/ets/service/ShoppingCartService.ets
arkts
addCartItem
添加商品到购物车 @param cartItem @returns
async addCartItem(cartItem: CartItem) { return Request.post('/cart/add', cartItem) }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left addCartItem AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left cartItem AST#identifier#Right AST#type_annotation#Left AST#:#Left :...
async addCartItem(cartItem: CartItem) { return Request.post('/cart/add', cartItem) }
https://github.com/Vsolon0401/MallShopping
1dcd6a5cbe689b706811e0160bfc2ab4325c8198
github
HarmonyOS_Samples/MusicHome
features/recommendation/src/main/ets/util/RecommendDataUtil.ets
arkts
getHeroCards
Fetches hero cards from the music DB and maps them to UI models. @returns Hero card UI list for banners.
public static getHeroCards(): RecommendHeroCardUi[] { return MusicDbApi.getInstance().getHeroCards().map((dto) => RecommendDataUtil.mapHeroDtoToUi(dto)); }
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 getHeroCards AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#...
public static getHeroCards(): RecommendHeroCardUi[] { return MusicDbApi.getInstance().getHeroCards().map((dto) => RecommendDataUtil.mapHeroDtoToUi(dto)); }
https://gitcode.com/HarmonyOS_Samples/MusicHome
04cdc881e6185c5e88633565da0d2f29b1d856a0
gitcode
Joker-x-dev/CoolMallArkTS
core/result/src/main/ets/RequestHelper.ets
arkts
execute
执行请求,可 await 或 .then,默认仅返回 data @returns {Promise<T>} data Promise
async execute(): Promise<T> { return this.runInternal(false); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left execute AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_type...
async execute(): Promise<T> { return this.runInternal(false); }
https://github.com/Joker-x-dev/CoolMallArkTS
786a805a4cb7ca6ed13b752375d36e7a58aa2aa5
github
honjow/Next2V
feature/detail/src/main/ets/viewmodel/DetailViewModel.ets
arkts
applyMergedTopicDetail
Cached and network replacements use one application point so user-action overlays are applied before the topic/reply data sources can render a default false/empty first frame. Does NOT push to replyDataSource — load() uses it alone when holding the publish for a follow-up preload.
private applyMergedTopicDetail(topic: V2exTopic | null, replies: V2exReply[]): void { const merged = CacheMergeCoordinator.mergeTopicDetail(topic, replies, this.actionOverlay) this.topic = merged.topic this.replies = merged.replies }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left applyMergedTopicDetail AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left topic AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binar...
private applyMergedTopicDetail(topic: V2exTopic | null, replies: V2exReply[]): void { const merged = CacheMergeCoordinator.mergeTopicDetail(topic, replies, this.actionOverlay) this.topic = merged.topic this.replies = merged.replies }
https://github.com/honjow/Next2V
c193d1849b7df69c3f6a43c34f6509bd28353e8c
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/TouchInputHandler.ets
arkts
handleMultiTouchEvent
处理多点触控事件(DIRECT 模式) 支持高采样率:处理历史触摸点 + 当前触摸点
private handleMultiTouchEvent(event: TouchEvent): void { const touches = event.touches; const changedTouches = event.changedTouches; const areaWidth = event.target.area.width as number; const areaHeight = event.target.area.height as number; switch (event.type) { case TouchType.Down: ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleMultiTouchEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi...
private handleMultiTouchEvent(event: TouchEvent): void { const touches = event.touches; const changedTouches = event.changedTouches; const areaWidth = event.target.area.width as number; const areaHeight = event.target.area.height as number; switch (event.type) { case TouchType.Down: ...
https://github.com/AlkaidLab/moonlight-harmony
698ae1bc1e35469004d9e3347d98dd2cdfa81f52
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/components/XAxis.ets
arkts
setLabelRotationAngle
sets the angle for drawing the X axis labels (in degrees) @param angle the angle in degrees
public setLabelRotationAngle(angle: number): void { this.mLabelRotationAngle = angle; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setLabelRotationAngle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left angle AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie...
public setLabelRotationAngle(angle: number): void { this.mLabelRotationAngle = angle; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
a129433b29ad8489d45b57e9aedcb7a11a687015
gitee
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/BarLineChartBaseModel.ets
arkts
getMinOffset
Gets the minimum offset (padding) around the chart, defaults to 15.f
public getMinOffset(): number { return this.mMinOffset; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getMinOffset 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 getMinOffset(): number { return this.mMinOffset; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
e9d7f3b8c2e2726a415d9b7c6709eceb157dbf9d
gitee
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test28_original_index.ets
arkts
testMemoization
--- Memoization (manual cache) ---
function testMemoization(): string { let cache: Map<number, number> = new Map<number, number>(); // Compute square with cache let key: number = 5; let cached: number | undefined = cache.get(key); if (cached === undefined) { cached = key * key; cache.set(key, cached); } let r1: number = cached; /...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testMemoization 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 testMemoization(): string { let cache: Map<number, number> = new Map<number, number>(); // Compute square with cache let key: number = 5; let cached: number | undefined = cache.get(key); if (cached === undefined) { cached = key * key; cache.set(key, cached); } let r1: number = cached; /...
https://github.com/miaochiahao/ark-ghidra
b543b024b610df5f473281a660c98d7c62f45244
github
XJTUWYD/ArkDiff
entry/src/main/ets/utils/BreakpointUtil.ets
arkts
sync
同步当前断点
private sync(): void { if (this.lgListener?.matches) { this.set(Breakpoint.LG); return; } if (this.mdListener?.matches) { this.set(Breakpoint.MD); return; } this.set(Breakpoint.SM); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left private AST#identifier#Right AST#ERROR#Left AST#identifier#Left sync AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Rig...
private sync(): void { if (this.lgListener?.matches) { this.set(Breakpoint.LG); return; } if (this.mdListener?.matches) { this.set(Breakpoint.MD); return; } this.set(Breakpoint.SM); }
https://github.com/XJTUWYD/ArkDiff
0d882007201219efb5c4f693839545e9f222424a
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/DataManager.ets
arkts
stopTimers
停止定时任务
private stopTimers(): void { if (this.backupTimer) { clearInterval(this.backupTimer); this.backupTimer = null; } if (this.syncTimer) { clearInterval(this.syncTimer); this.syncTimer = null; } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left stopTimers 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#...
private stopTimers(): void { if (this.backupTimer) { clearInterval(this.backupTimer); this.backupTimer = null; } if (this.syncTimer) { clearInterval(this.syncTimer); this.syncTimer = null; } }
https://github.com/DaLongZhuaZi/manxia
d522aa166fce5ac52e0bee561f126d6ff2c30025
github
azhu0001/localsend-harmony
entry/src/main/ets/eventbus/EventBus.ets
arkts
on
持续订阅指定的事件,并在接收到该事件时,执行对应的回调处理函数。
on(name: number, callback: (eventData: emitter.EventData) => void) { let event: emitter.InnerEvent = { eventId: name, //事件ID priority: emitter.EventPriority.IMMEDIATE //事件立即被投递 } emitter.on(event, callback) }
AST#program#Left AST#ERROR#Left AST#identifier#Left on AST#identifier#Right AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left , AST#,#Right AST#binary_expression#Left AST#call_expressi...
on(name: number, callback: (eventData: emitter.EventData) => void) { let event: emitter.InnerEvent = { eventId: name, //事件ID priority: emitter.EventPriority.IMMEDIATE //事件立即被投递 } emitter.on(event, callback) }
https://gitcode.com/azhu0001/localsend-harmony
f629dc015b9fbe3bdc3daea84413c9b2b0d806c9
gitcode
qiuhaotc/HarmonyOSPlayground
entry/src/main/ets/pages/StatisticsPage.ets
arkts
prepareChartData
准备图表数据
prepareChartData() { // 准备柱状图数据 if (this.statisticsMode === 'month') { // 按月:固定显示当月所有天数 const daysInMonth = this.getDaysInMonth(parseInt(this.selectedYear), parseInt(this.selectedMonth)); const dailyStatsMap = BillStatisticsUtil.getDailyStatistics(this.bills); ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left prepareChartData 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...
prepareChartData() { // 准备柱状图数据 if (this.statisticsMode === 'month') { // 按月:固定显示当月所有天数 const daysInMonth = this.getDaysInMonth(parseInt(this.selectedYear), parseInt(this.selectedMonth)); const dailyStatsMap = BillStatisticsUtil.getDailyStatistics(this.bills); ...
https://github.com/qiuhaotc/HarmonyOSPlayground
da62ba240c6507134f65b37b136af8e5ef414292
github
JackJiang2011/harmonychat
entry/src/main/ets/pages/utils/ToolKits.ets
arkts
getLocalUserUid
返回本地用户UID. @returns local uid
static getLocalUserUid(): string | undefined { return ClientCoreSDK.getInstance().currentLoginInfo?.loginUserId }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getLocalUserUid AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left...
static getLocalUserUid(): string | undefined { return ClientCoreSDK.getInstance().currentLoginInfo?.loginUserId }
https://github.com/JackJiang2011/harmonychat
de3484f6698bf5a50638edeae220495731e409f8
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets
arkts
readUInt16BE
Reads an unsigned 16-bit integer from the buffer at the specified offset using big-endian format @param {int} [offset=0] - Number of bytes to skip before reading @returns {long} The read value
public readUInt16BE(offset: int = 0): long { let lengthOffset: int = this.length - 2; if (offset < 0 || offset > lengthOffset) { throw createBusinessError(OutOfBoundsErrorCodeId, `The value of "offset" is out of range. ` + `It must be >= 0 and <= ${len...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left readUInt16BE AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left offset AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expres...
public readUInt16BE(offset: int = 0): long { let lengthOffset: int = this.length - 2; if (offset < 0 || offset > lengthOffset) { throw createBusinessError(OutOfBoundsErrorCodeId, `The value of "offset" is out of range. ` + `It must be >= 0 and <= ${len...
https://gitcode.com/iop123123/arkts-static-skills
aad0ed8666de1b7cc6d253871d0fc8ef42383ecf
gitcode
openharmony/codelabs
ETSUI/LifeTrack/entry/src/main/ets/pages/CalendarPage.ets
arkts
getEventsForSelectedDate
获取选中日期的事件
getEventsForSelectedDate(): CalendarEvent[] { const selectedDateStr = this.selectedDate.toDateString() const selectedTimestamp = this.selectedDate.getTime(); // 1. 获取直接在该日期开始的事件 const directEvents = this.events.filter(event => { const eventDate = CalendarUtils.timestampToDate(event.startTime); ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getEventsForSelectedDate 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 Calenda...
getEventsForSelectedDate(): CalendarEvent[] { const selectedDateStr = this.selectedDate.toDateString() const selectedTimestamp = this.selectedDate.getTime(); // 1. 获取直接在该日期开始的事件 const directEvents = this.events.filter(event => { const eventDate = CalendarUtils.timestampToDate(event.startTime); ...
https://gitcode.com/openharmony/codelabs
ac1f14e5d252ec105f404ef354f5cabd652e07da
gitcode
terryma2024/happyword
harmonyos/entry/src/main/ets/services/LearningRecorder.ets
arkts
statsForTest
Read the in-memory stats list. Test seam used by both the unit tests and TodayAdventureBuilder so the latter does not need a private accessor on WrongAnswerStore.
statsForTest(): WordStat[] { return this.snapshot.stats.slice(); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left statsForTest AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right...
statsForTest(): WordStat[] { return this.snapshot.stats.slice(); }
https://github.com/terryma2024/happyword
2801f98c34b2666918858c2e0bddafb32cd646e0
github
egavrin/arkts_agent_kit
examples/fslib/src/tests/fslib.test.ets
arkts
testTruncate
--- truncate ---
function testTruncate(): void { ensureSetup() let fs = new FileSystem() let fpath: string = TMPDIR + "/trunc.txt" fs.writeText(fpath, "long data here") fs.truncate(fpath, 4) arktest.assertEQ(fs.readText(fpath), "long") fs.remove(fpath) }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testTruncate 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_typ...
function testTruncate(): void { ensureSetup() let fs = new FileSystem() let fpath: string = TMPDIR + "/trunc.txt" fs.writeText(fpath, "long data here") fs.truncate(fpath, 4) arktest.assertEQ(fs.readText(fpath), "long") fs.remove(fpath) }
https://gitcode.com/egavrin/arkts_agent_kit
da119298cce66de5522bca23f59dcfe7eef59ed6
gitcode
the-wwyang/kids-learning-app
src/main/ets/services/AchievementService.ets
arkts
groupAchievementsByLevel
按等级分组成就 @param achievements 成就列表 @returns 按等级分组的成就
static groupAchievementsByLevel(achievements: Achievement[]): Map<number, Achievement[]> { const grouped = new Map<number, Achievement[]>(); for (const achievement of achievements) { const level = achievement.level; if (!grouped.has(level)) { grouped.set(level, []); } grouped....
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left groupAchievementsByLevel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left achievements AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST...
static groupAchievementsByLevel(achievements: Achievement[]): Map<number, Achievement[]> { const grouped = new Map<number, Achievement[]>(); for (const achievement of achievements) { const level = achievement.level; if (!grouped.has(level)) { grouped.set(level, []); } grouped....
https://github.com/the-wwyang/kids-learning-app
57c4d14ba04c7ceeb8fb575dac5e2dd05a8587f8
github
DaLongZhuaZi/manxia
entry/src/main/ets/libs/htmlparser/HtmlParserLogger.ets
arkts
parseStart
解析开始日志
static parseStart(htmlLength: number): void { if (HtmlParserLogger._enabled && HtmlParserLogger._debugEnabled) { logger.debug(TAG, `开始解析 HTML,长度: ${htmlLength} 字符`); } }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left parseStart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left htmlLength AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#R...
static parseStart(htmlLength: number): void { if (HtmlParserLogger._enabled && HtmlParserLogger._debugEnabled) { logger.debug(TAG, `开始解析 HTML,长度: ${htmlLength} 字符`); } }
https://github.com/DaLongZhuaZi/manxia
ce47c4c1ddc07d109c31497f0faaf781041c0c6c
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test34_original_index.ets
arkts
testMultiArray
--- Multidimensional array (manual) ---
function testMultiArray(): string { let grid: number[][] = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]; let sum: number = 0; for (let i: number = 0; i < grid.length; i++) { let row: number[] = grid[i]; for (let j: number = 0; j < row.length; j++) { sum = sum + row[j]; } } return String(sum); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testMultiArray AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_t...
function testMultiArray(): string { let grid: number[][] = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]; let sum: number = 0; for (let i: number = 0; i < grid.length; i++) { let row: number[] = grid[i]; for (let j: number = 0; j < row.length; j++) { sum = sum + row[j]; } } return String(sum); }
https://github.com/miaochiahao/ark-ghidra
eae7de1abb18c95b87af89f67520088772fdb6ac
github