nwo
stringclasses
449 values
path
stringlengths
9
173
language
stringclasses
1 value
identifier
stringlengths
1
53
docstring
stringlengths
5
4.13k
function
stringlengths
10
87.2k
ast_function
stringlengths
351
354k
obf_function
stringlengths
10
87.2k
url
stringlengths
30
175
function_sha
stringlengths
40
40
source
stringclasses
3 values
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/Message.ets
arkts
getObject
Get the additional object of the message @returns { Any } Additional object data
public getObject(): Any { return this.obj; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getObject 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 Any AST#iden...
public getObject(): Any { return this.obj; }
https://gitcode.com/iop123123/arkts-static-skills
628c53d2f92e4f24abe5084aa130bad52d98f529
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/utils/CryptoUtil.ets
arkts
asn1Sequence
构造 ASN.1 SEQUENCE
private static asn1Sequence(contents: Uint8Array): Uint8Array { const len = CryptoUtil.encodeAsn1Length(contents.length); const result = new Uint8Array(1 + len.length + contents.length); result[0] = 0x30; // SEQUENCE tag result.set(len, 1); result.set(contents, 1 + len.length); return result; ...
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 asn1Sequence AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left contents AST#identifier#Right AST#:#Lef...
private static asn1Sequence(contents: Uint8Array): Uint8Array { const len = CryptoUtil.encodeAsn1Length(contents.length); const result = new Uint8Array(1 + len.length + contents.length); result[0] = 0x30; // SEQUENCE tag result.set(len, 1); result.set(contents, 1 + len.length); return result; ...
https://github.com/AlkaidLab/moonlight-harmony
833716c26ff3f3d6712b29f1f3a2c9cce85bf434
github
aimilin6688/KeePassHO
entry/src/main/ets/services/TotpService.ets
arkts
getInstance
获取TotpService单例
public static getInstance(): TotpService { if (!TotpService.instance) { TotpService.instance = new TotpService(); } return TotpService.instance; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L...
public static getInstance(): TotpService { if (!TotpService.instance) { TotpService.instance = new TotpService(); } return TotpService.instance; }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/TotpService.ets#L102-L107
2b6c580acd11542a5ab1e042ebe7d39fd2a19731
github
ASweetBite/HarmonyPulse
entry/src/main/ets/utils/managers/RdbManager.ets
arkts
updateSongLyric
更新歌曲的歌词信息到数据库
async updateSongLyric(songId: string, lyricPath: string, hasLyric: boolean): Promise<boolean> { if (!this.rdbStore) return false; const value: ValuesBucket = { 'lyricPath': lyricPath, 'hasLyric': hasLyric ? 1 : 0 }; let predicates = new relationalStore.RdbPredicates(this.tableNameSong); ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left updateSongLyric AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left songId AST#identifier#Right A...
async updateSongLyric(songId: string, lyricPath: string, hasLyric: boolean): Promise<boolean> { if (!this.rdbStore) return false; const value: ValuesBucket = { 'lyricPath': lyricPath, 'hasLyric': hasLyric ? 1 : 0 }; let predicates = new relationalStore.RdbPredicates(this.tableNameSong); ...
https://github.com/ASweetBite/HarmonyPulse/blob/a7fcf153a20bafa29ac1fb8c25743dd5350dc54c/entry/src/main/ets/utils/managers/RdbManager.ets#L221-L240
8101453014b966e4f80b84361adcc836564bc65a
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/DataManager.ets
arkts
updateContentPrivacy
通用方法:根据ID更新任意内容的隐私状态 [性能优化] 使用 UNION ALL 单条 SQL 检测类型,在线漫画改用 UPDATE 替代 DELETE+INSERT
public async updateContentPrivacy(contentId: string, isPrivate: boolean): Promise<boolean> { try { logger.info(TAG, `更新内容隐私状态: ${contentId}, isPrivate=${isPrivate}`); const now = Date.now(); const privacyValue = isPrivate ? 1 : 0; const contentType = await this.detectContentType(con...
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 updateContentPrivacy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left contentId AST#identifier#Right AST#ERROR#Left AST#...
public async updateContentPrivacy(contentId: string, isPrivate: boolean): Promise<boolean> { try { logger.info(TAG, `更新内容隐私状态: ${contentId}, isPrivate=${isPrivate}`); const now = Date.now(); const privacyValue = isPrivate ? 1 : 0; const contentType = await this.detectContentType(con...
https://github.com/DaLongZhuaZi/manxia
f7a7b87f7c5acb101b48f13f48205b30e1d462cb
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelChapterCacheManager.ets
arkts
clearChapterListCache
清理章节列表缓存(不删除章节正文缓存)
async clearChapterListCache(bookId: string): Promise<void> { try { await this.ensureInitialized(); const chapterListPath = `${this.getBookCacheDir(bookId)}/chapters_list.json`; if (await this.sandboxManager.exists(chapterListPath)) { await this.sandboxManager.deleteFile(chapterListPath);...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left clearChapterListCache AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left bookId AST#identifier#Right AST#type_annotation#Left AST#...
async clearChapterListCache(bookId: string): Promise<void> { try { await this.ensureInitialized(); const chapterListPath = `${this.getBookCacheDir(bookId)}/chapters_list.json`; if (await this.sandboxManager.exists(chapterListPath)) { await this.sandboxManager.deleteFile(chapterListPath);...
https://github.com/DaLongZhuaZi/manxia
759f817895b40a28643fce30128ca0090618d49a
github
Mydstiny/RemoteDeskHarmonyOS
entry/src/main/ets/components/TerminalEmulator.ets
arkts
getContent
获取当前可见区内容
getContent(): string { const lines: string[] = []; for (let r = 0; r < this.rows; r++) { const absR: number = this.viewOffset + r; if (absR >= this.buffer.length) { break; } let line: string = ''; for (let c = 0; c < this.cols; c++) { line += this.buffer[absR][c].ch; } lines.push...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getContent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement_b...
getContent(): string { const lines: string[] = []; for (let r = 0; r < this.rows; r++) { const absR: number = this.viewOffset + r; if (absR >= this.buffer.length) { break; } let line: string = ''; for (let c = 0; c < this.cols; c++) { line += this.buffer[absR][c].ch; } lines.push...
https://github.com/Mydstiny/RemoteDeskHarmonyOS
a2b9cda8b3b7abd2631322c8364730d69ce9f3e5
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Source/SuwayomiCacheManager.ets
arkts
isCoverCached
检查封面是否已缓存
public isCoverCached(mangaId: string, coverUrl: string): boolean { try { const cachePath = this.getCoverCachePath(mangaId, coverUrl); return this.isReadableFile(cachePath); } catch (_error) { return false; } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isCoverCached AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left mangaId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#R...
public isCoverCached(mangaId: string, coverUrl: string): boolean { try { const cachePath = this.getCoverCachePath(mangaId, coverUrl); return this.isReadableFile(cachePath); } catch (_error) { return false; } }
https://github.com/DaLongZhuaZi/manxia
74d67ed8a865743b33a9825197e4b412b0944392
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Debug/ConsolePanel.ets
arkts
addLogUpdateListener
--- 监听与刷新 ---
public addLogUpdateListener(listener: () => void): void { this.logUpdateListeners.push(listener); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left addLogUpdateListener AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left listener AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ...
public addLogUpdateListener(listener: () => void): void { this.logUpdateListeners.push(listener); }
https://github.com/DaLongZhuaZi/manxia
2296b19b6918e29069b9c38dcc730f18a1e1568f
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/DataConverter.ets
arkts
deepClone
深度克隆对象 @param obj - 要克隆的对象 @returns 克隆后的对象
static deepClone<T>(obj: T): T { if (obj === null || typeof obj !== 'object') { return obj; } try { return SafeUtils.parseObj(JSON.stringify(obj)); } catch (error) { logger.error(TAG, `深度克隆失败: ${error}`); return obj; } }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#binary_expression#Left AST#identifier#Left deepClone AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Rig...
static deepClone<T>(obj: T): T { if (obj === null || typeof obj !== 'object') { return obj; } try { return SafeUtils.parseObj(JSON.stringify(obj)); } catch (error) { logger.error(TAG, `深度克隆失败: ${error}`); return obj; } }
https://github.com/DaLongZhuaZi/manxia
b7c5bdc49d1aa38b88cb7ae923dd58c35c4aa0ad
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Date.ets
arkts
constructor
`Date` constructor. @param year @param month @param day @param hours @param minutes @see ECMA-262, 21.4.2.1 @description Initialize `Date` instance with year, month, day, hours and minutes given.
constructor(year: long, month: long, day: long, hours: long, minutes: long) { this.ms = ecmaMakeDate(ecmaMakeDay(year, month, day), ecmaMakeTime(hours, minutes, 0 as long, 0 as long)) this.TZOffset = Date.getLocalTimezoneOffset() }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left year AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left long AST#identifier#Right AST...
constructor(year: long, month: long, day: long, hours: long, minutes: long) { this.ms = ecmaMakeDate(ecmaMakeDay(year, month, day), ecmaMakeTime(hours, minutes, 0 as long, 0 as long)) this.TZOffset = Date.getLocalTimezoneOffset() }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
acb3869fe783671ae7418eabd8fbd3b2d4a70be7
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/DeepLinkRouter.ets
arkts
formatResult
── 格式化预览 ──
formatResult(result: DeepLinkResult): string { const routeName: string = result.route; if (result.route === 'search') { const r: DeepLinkSearchResult = result as DeepLinkSearchResult; return `[漫画] 搜索图源: ${r.sourceKey}\n搜索类型: ${r.searchType}\n搜索内容: ${r.query}`; } if (result.route === 'sour...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left formatResult AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left result AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left DeepLinkResult AST#identifier#Right AST#)...
formatResult(result: DeepLinkResult): string { const routeName: string = result.route; if (result.route === 'search') { const r: DeepLinkSearchResult = result as DeepLinkSearchResult; return `[漫画] 搜索图源: ${r.sourceKey}\n搜索类型: ${r.searchType}\n搜索内容: ${r.query}`; } if (result.route === 'sour...
https://github.com/DaLongZhuaZi/manxia
e8bf51e2eb738fefbdf863531cca8d30da1befd4
github
HarmonyOS_Samples/guide-snippets
ArkTS/ArkTSCompilationToolchain/ArkBytecode/FundamentalsAndNamingConventions/entry/src/main/ets/pages/Index.ets
arkts
bar
[End shared_Lexical] [Start patch_variables]
function bar(): void {} // 新增语句,编译补丁
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left bar 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_type#Left AS...
function bar(): void {} // 新增语句,编译补丁
https://gitcode.com/HarmonyOS_Samples/guide-snippets
3a8cb88f745df04eedd72efda27cd3eb4844f034
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/pages/DataManagementPage.ets
arkts
buildMergeDialogContent
构建漫画合并弹窗的自定义内容
@Builder function buildMergeDialogContent(param: UniversalDialogCustomContentParam): void { Column({ space: 12 }) { Text('检测到可能的重复漫画') .fontSize(18) .fontWeight(FontWeight.Bold) .fontFamily(asMergeDialogBuilderParam(param).appFontFamily) .fontColor(ThemeAwareHelper.getTestManagementThemedC...
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 buildMergeDialogContent AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Rig...
@Builder function buildMergeDialogContent(param: UniversalDialogCustomContentParam): void { Column({ space: 12 }) { Text('检测到可能的重复漫画') .fontSize(18) .fontWeight(FontWeight.Bold) .fontFamily(asMergeDialogBuilderParam(param).appFontFamily) .fontColor(ThemeAwareHelper.getTestManagementThemedC...
https://github.com/DaLongZhuaZi/manxia
20dbd59fc9ff91f63892d8c120f9a51ec171a463
github
openharmony-sig/flutter_sqflite
sqflite/ohos/src/main/ets/io/flutter/plugins/sqflite/DatabaseHelper.ets
arkts
openDatabase
/ 打开一个数据库(没有则创建)
public static async openDatabase(context: common.Context, call: MethodCall, result: MethodResult): Promise<number> { let id: number = -1; let dbPath: string = call.argument(Constant.PARAM_PATH); let dbPathNameList: string[] = dbPath.split('/'); let dbName: string = dbPathNameList[dbPathNameList.length...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left openDatabase AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left conte...
public static async openDatabase(context: common.Context, call: MethodCall, result: MethodResult): Promise<number> { let id: number = -1; let dbPath: string = call.argument(Constant.PARAM_PATH); let dbPathNameList: string[] = dbPath.split('/'); let dbName: string = dbPathNameList[dbPathNameList.length...
https://gitee.com/openharmony-sig/flutter_sqflite.git
bcb4ff73e99b62221668d1cccd2a890b6f93a806
gitee
cduestc-course/ArkLearn
entry/src/main/ets/pages/05/5.3.3re.ets
arkts
navItem
全局 Builder
@Builder function navItem(icon: ResourceStr, txt: string) { Column({ space: 10 }) { Image(icon) .width('80%') Text(txt) } .width('25%') .onClick(() => { AlertDialog.show({ message: '点了' + txt }) }) }
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 navItem AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_...
@Builder function navItem(icon: ResourceStr, txt: string) { Column({ space: 10 }) { Image(icon) .width('80%') Text(txt) } .width('25%') .onClick(() => { AlertDialog.show({ message: '点了' + txt }) }) }
https://github.com/cduestc-course/ArkLearn
68b609b7b1ad09f8843b77c4d3ac4ad31d23984b
github
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/BinaryEncodingVisitor.ets
arkts
visitRepeatedFloat
访问 repeated float 字段
visitRepeatedFloat(value: number[], fieldNumber: number): void { for (const item of value) { this.visitFloat(item, fieldNumber) } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitRepeatedFloat 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#subscript_expression#Left AST#identifier#Left number...
visitRepeatedFloat(value: number[], fieldNumber: number): void { for (const item of value) { this.visitFloat(item, fieldNumber) } }
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
e61e9913e606628471dbc3a04268d6a1e371fdb3
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Double.ets
arkts
compareTo
Compares this instance to other Double object The result is less than 0 if this instance lesser than provided object 0 if they are equal and greater than 0 otherwise. @param { Double } other Double object to compare with @returns { int } if the cur value > the other reutrn 0,otherwise return -1 @syscap SystemCapability...
public override compareTo(other: Double): int { if ((this.isNaN() && other.isNaN()) || (Math.abs(this.value - other) < Double.EPSILON)) { return 0; } if (this.isNaN() || this.value > other) { return 1; } return -1; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left compareTo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST...
public override compareTo(other: Double): int { if ((this.isNaN() && other.isNaN()) || (Math.abs(this.value - other) < Double.EPSILON)) { return 0; } if (this.isNaN() || this.value > other) { return 1; } return -1; }
https://gitcode.com/iop123123/arkts-static-skills
ba7e611774e23086c5e25daa36bd95dd5cbe5e57
gitcode
Countly/countly-sdk-hos
library/src/main/ets/CountlyConfig.ets
arkts
enablePreviousNameRecording
Record the previous event name (`cly_pen`) and current view name (`cly_cvn`) on every custom event. Adds navigation context to events.
public enablePreviousNameRecording(): ExperimentalConfig { this.previousNameRecording = true; return this; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left enablePreviousNameRecording 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...
public enablePreviousNameRecording(): ExperimentalConfig { this.previousNameRecording = true; return this; }
https://github.com/Countly/countly-sdk-hos
a5b6b65e2ca4308e038eebe1540e679f987459d1
github
pangpang20/antennaPodHM
entry/src/main/ets/service/PlayerService.ets
arkts
seek
跳转到指定位置(参数为秒,转换为毫秒传给 AVPlayer)
async seek(positionInSeconds: number): Promise<void> { if (this.avPlayer) { const positionInMs = Math.floor(positionInSeconds * 1000); console.info(`[PlayerService] Seeking to ${positionInSeconds}s (${positionInMs}ms)`); await this.avPlayer.seek(positionInMs); } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left seek AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left positionInSeconds AST#identifier#Right A...
async seek(positionInSeconds: number): Promise<void> { if (this.avPlayer) { const positionInMs = Math.floor(positionInSeconds * 1000); console.info(`[PlayerService] Seeking to ${positionInSeconds}s (${positionInMs}ms)`); await this.avPlayer.seek(positionInMs); } }
https://github.com/pangpang20/antennaPodHM
6e612bbe15115d5b32cd24a76ddb95e7078421e0
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
findLastIndex
Finds an index of the last element in the Uint8Array that satisfies the condition @param { function } fn - condition @returns { int } - the index of the last element that satisfies fn, -1 otherwise @syscap SystemCapability.Utils.Lang @FaAndStageModel
public findLastIndex(fn: (val: number, index: int, array: Uint8Array) => boolean): int { for (let i = this.lengthInt - 1; i >= 0; i--) { if (fn(this.getUnsafe(i).toDouble(), i, this)) { return i } } return -1 }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left findLastIndex 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 : ...
public findLastIndex(fn: (val: number, index: int, array: Uint8Array) => boolean): int { for (let i = this.lengthInt - 1; i >= 0; i--) { if (fn(this.getUnsafe(i).toDouble(), i, this)) { return i } } return -1 }
https://gitcode.com/iop123123/arkts-static-skills
17883ad0bbddab6dedb9e4e010906410fa246493
gitcode
killetom/ktretrofit
ktretrofit/src/main/ets/retrofit/Retrofit.ets
arkts
setConnectTimeout
Set the connection timeout for HTTP requests. @param timeout Timeout in milliseconds. @returns This builder instance for method chaining.
setConnectTimeout(timeout: number): RetrofitBuilder { // Create a new HttpClientBuilder with the existing client's configuration const newClientBuilder = new HttpClientBuilder(); // Add all existing interceptors from the current client if (typeof (this.client as any).interceptors === ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setConnectTimeout AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left timeout AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) AS...
setConnectTimeout(timeout: number): RetrofitBuilder { // Create a new HttpClientBuilder with the existing client's configuration const newClientBuilder = new HttpClientBuilder(); // Add all existing interceptors from the current client if (typeof (this.client as any).interceptors === ...
https://github.com/killetom/ktretrofit
004c47a579e4c7b28fc934fea683408d328d8ac6
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/ChartData.ets
arkts
clearValues
Clears this data object from all DataSets and removes all Entries. Don't forget to invalidate the chart after this.
clearValues(): void { if (this.mDataSets != null) { this.mDataSets.clear(); } this.notifyDataChanged(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clearValues 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#...
clearValues(): void { if (this.mDataSets != null) { this.mDataSets.clear(); } this.notifyDataChanged(); }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
fbde412832f8579b95cb424f382f263083a47b4b
gitee
openharmony-sig/applications_filemanager
entry/src/main/ets/pages/USBShowList.ets
arkts
rmdir
移除文件夹
rmdir() { usbModel.rmdir(this.selectData.uri,(status)=>{ if(status){ this.getDataList() } }) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left rmdir AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c...
rmdir() { usbModel.rmdir(this.selectData.uri,(status)=>{ if(status){ this.getDataList() } }) }
https://gitee.com/openharmony-sig/applications_filemanager.git
0643f2fad5f53524304bcbcbacf0f96744693f30
gitee
openharmony-sig/flutter_engine
shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/common/BackgroundBasicMessageChannel.ets
arkts
resizeChannelBuffer
Adjusts the number of messages that will get buffered when sending messages to channels that aren't fully set up yet. For example, the engine isn't running yet or the channel's message handler isn't set up on the Dart side yet.
resizeChannelBuffer(newSize: number): void { MessageChannelUtils.resizeChannelBuffer(this.messenger, this.name, newSize); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left resizeChannelBuffer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left newSize AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) ...
resizeChannelBuffer(newSize: number): void { MessageChannelUtils.resizeChannelBuffer(this.messenger, this.name, newSize); }
https://gitee.com/openharmony-sig/flutter_engine.git
d1dc8cd916b3fe96e7fa8bc1213993dc4058a181
gitee
ibestservices/ibest-ui
library/src/main/ets/components/picker/index.ets
arkts
getBaseOffset
获取初始位置
getBaseOffset(): number{ if(this.horizontal){ return this.leftWidth }else{ return this.itemCalcHeight * (this.visibleItemCount-1) / 2 } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getBaseOffset 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#ERROR#Right AST#statemen...
getBaseOffset(): number{ if(this.horizontal){ return this.leftWidth }else{ return this.itemCalcHeight * (this.visibleItemCount-1) / 2 } }
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/picker/index.ets#L463-L469
e511be2934d0983b5c8e6df4538ac2171d016d05
github
openharmony/codelabs
ETSUI/PositioningDemo/entry/src/main/ets/service/ReminderService.ets
arkts
getReminderHistory
获取提醒历史
getReminderHistory(): ReminderData[] { return this.reminderHistory; }
AST#program#Left AST#expression_statement#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getReminderHistory 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#id...
getReminderHistory(): ReminderData[] { return this.reminderHistory; }
https://gitcode.com/openharmony/codelabs
6f6aba3e407b2bb5b914f288c0cda6e8bd4842a0
gitcode
LJ666-ui/harmony-health-care
entry/src/main/ets/aiagent/ConversationMemory.ets
arkts
buildLLMContext
构建LLM上下文 @param history 对话历史 @returns LLM可用的上下文格式
buildLLMContext(history: ConversationContext): string { const messages = history.messages; let context = ''; for (const message of messages) { const role = message.role === 'user' ? '用户' : '助手'; context += `${role}:${message.content}\n`; } return context; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left buildLLMContext AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left history AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ConversationContext AST#identifier#Ri...
buildLLMContext(history: ConversationContext): string { const messages = history.messages; let context = ''; for (const message of messages) { const role = message.role === 'user' ? '用户' : '助手'; context += `${role}:${message.content}\n`; } return context; }
https://github.com/LJ666-ui/harmony-health-care
3ab7574065111342ffa0502f7b670d6e0c960b42
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/usbdriver/DualSenseController.ets
arkts
handleRead
处理输入报告
protected handleRead(buffer: Uint8Array): boolean { if (buffer.length < 10) { console.warn(`${TAG} 数据太短: ${buffer.length}`); return false; } // DualSense USB 报告格式 // https://controllers.fandom.com/wiki/Sony_DualSense const reportId = buffer[0]; let offset = 1; //...
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left handleRead AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left buffer AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier...
protected handleRead(buffer: Uint8Array): boolean { if (buffer.length < 10) { console.warn(`${TAG} 数据太短: ${buffer.length}`); return false; } // DualSense USB 报告格式 // https://controllers.fandom.com/wiki/Sony_DualSense const reportId = buffer[0]; let offset = 1; //...
https://github.com/AlkaidLab/moonlight-harmony
10a113aa8708fe79fc5558fd984a9f1857fbe05f
github
tdcare/tdwebrtc
src/main/ets/utils/NetworkUtil.ets
arkts
getSimSpnSync
获取指定卡槽SIM卡的服务提供商名称(Service Provider Name,SPN)。 @param slotId 卡槽ID(0-卡槽1、1-卡槽2)。 默认移动数据的SIM卡。 @returns
static getSimSpnSync(slotId?: number): string { slotId = slotId ?? NetworkUtil.getDefaultCellularDataSlotIdSync(); //默认移动数据的SIM卡 return sim.getSimSpnSync(slotId); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getSimSpnSync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left slotId AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#R...
static getSimSpnSync(slotId?: number): string { slotId = slotId ?? NetworkUtil.getDefaultCellularDataSlotIdSync(); //默认移动数据的SIM卡 return sim.getSimSpnSync(slotId); }
https://github.com/tdcare/tdwebrtc
585cdfab3c4202cc100dbdf0bf549b0a1c66ced8
github
PollenWang6/HiXD
entry/src/main/ets/pages/MainPage.ets
arkts
selectBgImage
选择背景图片
selectBgImage(): void { try { const photoSelectOptions = new photoAccessHelper.PhotoSelectOptions(); photoSelectOptions.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE; photoSelectOptions.maxSelectNumber = 1; const photoPicker = new photoAccessHelper.PhotoViewPicker(); pho...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left selectBgImage 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_bloc...
selectBgImage(): void { try { const photoSelectOptions = new photoAccessHelper.PhotoSelectOptions(); photoSelectOptions.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE; photoSelectOptions.maxSelectNumber = 1; const photoPicker = new photoAccessHelper.PhotoViewPicker(); pho...
https://github.com/PollenWang6/HiXD
e1fd2aeb318d342905e597c4d93c1539e445e1c5
github
openharmony-sig/flutter_sqflite
sqflite/ohos/src/main/ets/io/flutter/plugins/sqflite/DatabaseHelper.ets
arkts
debugMode
/ 设置debug模式,查看SQL查询,已弃用
public static async debugMode(call: MethodCall, result: MethodResult): Promise<void> { let on: boolean = call.args; result.success(null); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left debugMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left call AST...
public static async debugMode(call: MethodCall, result: MethodResult): Promise<void> { let on: boolean = call.args; result.success(null); }
https://gitee.com/openharmony-sig/flutter_sqflite.git
2c1fa645b5226ec599103344635c8f87ea0f677b
gitee
kumaleap/ArkLuban
library/src/main/ets/luban/Luban.ets
arkts
setOnError
设置压缩错误回调函数 @param callback 压缩出错时的回调函数 @returns 构建器实例
setOnError(callback: (error: Error) => void): LubanBuilder { this.config.onError = callback; return this; }
AST#program#Left AST#expression_statement#Left AST#identifier#Left setOnError AST#identifier#Right AST#ERROR#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#...
setOnError(callback: (error: Error) => void): LubanBuilder { this.config.onError = callback; return this; }
https://github.com/kumaleap/ArkLuban
41afe1c223a11db99c9ef684a1552fcc5165b095
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.LightWeightMap.ets
arkts
getValueAt
Gets the value at the specified index in the LightWeightMap @param index the index to get the value from @returns the value at the specified index @throws BusinessError if the index is out of range, the container is empty or the index exceeds Int.MAX_VALUE.
getValueAt(index: int): V { this.checkEmptyContainer(); this.checkRange(index, this.buckets.actualLength); return this.buckets.entryValues[index] as V; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getValueAt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left index AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#Right AST#ERROR#Right AST#)#Left ) AST#)#...
getValueAt(index: int): V { this.checkEmptyContainer(); this.checkRange(index, this.buckets.actualLength); return this.buckets.entryValues[index] as V; }
https://gitcode.com/iop123123/arkts-static-skills
da98043cd44bd5dbe64904de07c63a39fbf0dd35
gitcode
yanglfree/CopoHub-Multi
flutter/ohos/entry/src/main/ets/plugins/SharePlugin.ets
arkts
handleShareFiles
── shareFiles ──────────────────────────────────────────────────────────────
private handleShareFiles(call: MethodCall, result: MethodResult): void { const paths: string[] = (call.argument('paths') as string[]) ?? []; const mimeTypes: string[] = (call.argument('mimeTypes') as string[]) ?? []; const subject: string = (call.argument('subject') as string) ?? ''; const text: strin...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleShareFiles AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left call AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
private handleShareFiles(call: MethodCall, result: MethodResult): void { const paths: string[] = (call.argument('paths') as string[]) ?? []; const mimeTypes: string[] = (call.argument('mimeTypes') as string[]) ?? []; const subject: string = (call.argument('subject') as string) ?? ''; const text: strin...
https://github.com/yanglfree/CopoHub-Multi
d088496a5f9341d2f374b7e5423451ad0eaa8b2e
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.TreeSet.ets
arkts
remove
Remove an element from the TreeSet @param value: the value of the element which will be remove from the TreeSet @returns true if the element is successfully removed from the TreeSet
remove(value: T): boolean { if (this.has(value)) { this.treeMap.remove(value); return true; } else { return false; } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left remove AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#Right AST#ERROR#Right AST#)#Left ) AST#)#Right ...
remove(value: T): boolean { if (this.has(value)) { this.treeMap.remove(value); return true; } else { return false; } }
https://gitcode.com/iop123123/arkts-static-skills
8f9adc6e6b6c723b8ca7b91a414c08c148e06334
gitcode
LongLiveY96/chatcube
entry/src/main/ets/services/AIApiService.ets
arkts
parseAnthropicResponse
解析 Anthropic 响应
private parseAnthropicResponse(responseData: string): AIApiResult { const response = JSON.parse(responseData) as AnthropicResponse if (response.content !== undefined && response.content.length > 0) { let content = '' let reasoningContent = '' let imageData = '' let imageMimeType = '' ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseAnthropicResponse AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left responseData AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left st...
private parseAnthropicResponse(responseData: string): AIApiResult { const response = JSON.parse(responseData) as AnthropicResponse if (response.content !== undefined && response.content.length > 0) { let content = '' let reasoningContent = '' let imageData = '' let imageMimeType = '' ...
https://github.com/LongLiveY96/chatcube
2566411b33e509805a91c7057a6127997d4dfe8c
github
Cool_foolisher1/ArkTSRepository
GraphicalCode/commons/src/main/ets/util/StringUtil.ets
arkts
getFirstChar
获取传入字符串的首个字符 @param str string @returns 首个字符
public getFirstChar(str: string): string { // 若传入的字符串为空,则返回'' return str.charAt(0) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getFirstChar AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left stri...
public getFirstChar(str: string): string { // 若传入的字符串为空,则返回'' return str.charAt(0) }
https://gitcode.com/Cool_foolisher1/ArkTSRepository
2d82ffd6c1ebc8e8900d4dd55a23264cf3eb1938
gitcode
openharmony-sig/applications_calculator
feature/calculation/src/main/ets/model/ExpressionsDataSource.ets
arkts
refresh
refresh list @param expList target data source
public refresh(expList?: Array<LooseObject>): void { LogUtil.info(TAG, 'refresh!'); if (expList && expList.length > 0) { this.buildExpList(expList); } this.expList = expList || []; this.notifyDataReload(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left refresh AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left expList AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#L...
public refresh(expList?: Array<LooseObject>): void { LogUtil.info(TAG, 'refresh!'); if (expList && expList.length > 0) { this.buildExpList(expList); } this.expList = expList || []; this.notifyDataReload(); }
https://gitee.com/openharmony-sig/applications_calculator.git
3de0e2e4465c573df2fb36186ca5e6cbd93ddfc4
gitee
chendi126/harmonyOS-TCP
entry/src/main/ets/common/GlassStyles.ets
arkts
getStatusIndicatorBorderColor
获取状态指示器边框色
static getStatusIndicatorBorderColor(isActive: boolean = false): string { return isActive ? 'rgba(76, 175, 80, 0.3)' : 'rgba(158, 158, 158, 0.3)'; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getStatusIndicatorBorderColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left isActive AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AS...
static getStatusIndicatorBorderColor(isActive: boolean = false): string { return isActive ? 'rgba(76, 175, 80, 0.3)' : 'rgba(158, 158, 158, 0.3)'; }
https://github.com/chendi126/harmonyOS-TCP
6426b4a296ebfaa4419c1be2bd11013b0b442da0
github
Joker-x-dev/CoolMallArkTS
core/model/src/main/ets/request/Comment.ets
arkts
constructor
@param {Partial<Comment>} init - 初始化数据
constructor(init?: Partial<Comment>) { if (!init) return; this.score = init.score ?? this.score; this.content = init.content ?? this.content; this.images = init.images ?? this.images; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expres...
constructor(init?: Partial<Comment>) { if (!init) return; this.score = init.score ?? this.score; this.content = init.content ?? this.content; this.images = init.images ?? this.images; }
https://github.com/Joker-x-dev/CoolMallArkTS
f115c2192360c6fdf01293362cb3b821aaf5668c
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/BarLineChartBaseModel.ets
arkts
isPinchZoomEnabled
returns true if pinch-zoom is enabled, false if not @return
public isPinchZoomEnabled(): boolean { return this.mPinchZoomEnabled; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isPinchZoomEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolea...
public isPinchZoomEnabled(): boolean { return this.mPinchZoomEnabled; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
c71d23deb0b6afd7bd08ca22a97cdb9088e6d5ec
gitee
offlinecat-dev/OCNetORM
src/main/ets/core/HooksProcessor.ets
arkts
hasBeforeSaveHook
检查实体是否有 beforeSave 钩子 @param entityName 实体名称 @returns 是否有 beforeSave 钩子
hasBeforeSaveHook(entityName: string): boolean { return this.hasHook(entityName, 'beforeSave') }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasBeforeSaveHook AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left entityName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left )...
hasBeforeSaveHook(entityName: string): boolean { return this.hasHook(entityName, 'beforeSave') }
https://github.com/offlinecat-dev/OCNetORM
95e05b2d3e8edc22e0772ff8e72cadbedfccf2a6
github
arkui-x/samples
CodeLab/Cases/feature/foldablescreencases/src/main/ets/model/AVSessionModel.ets
arkts
setAVPlaybackState
设置AVSession实例状态 @returns {void}
setAVPlaybackState(): void { logger.info('avsession setAVPlaybackState', JSON.stringify(this.curState)); // TODO:知识点:设置AVSession当前状态 this.session?.setAVPlaybackState(this.curState, (err) => { if (err) { console.error(`Failed to set AVPlaybackState. Code: ${err.code}, message: ${err.message}`...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setAVPlaybackState 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...
setAVPlaybackState(): void { logger.info('avsession setAVPlaybackState', JSON.stringify(this.curState)); // TODO:知识点:设置AVSession当前状态 this.session?.setAVPlaybackState(this.curState, (err) => { if (err) { console.error(`Failed to set AVPlaybackState. Code: ${err.code}, message: ${err.message}`...
https://gitcode.com/arkui-x/samples
a81efbf50760e2a0232914d2d28b754dbabf2df4
gitcode
Yebingiscn/SweetVideo
entry/src/main/ets/utils/ToolsUtil.ets
arkts
routerWhere
点击视频跳转到播放器
static async routerWhere(pathStack: NavPathStack, uri: string, item: VideoMetadata, list: VideoMetadata[]) { if (uri === NavigationAddress.AV_PLAYER) { DataSyncUtil.lastPlayVideoIndex = list.findIndex(i => i.date === item?.date) } // 没有长宽的视频/音频系统播放器播不了 if (VideoInfoUtil.videoWidthAndHeightFormat...
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 routerWhere AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pathStack AST#identifier#Right AST#:#Left : ...
static async routerWhere(pathStack: NavPathStack, uri: string, item: VideoMetadata, list: VideoMetadata[]) { if (uri === NavigationAddress.AV_PLAYER) { DataSyncUtil.lastPlayVideoIndex = list.findIndex(i => i.date === item?.date) } // 没有长宽的视频/音频系统播放器播不了 if (VideoInfoUtil.videoWidthAndHeightFormat...
https://github.com/Yebingiscn/SweetVideo
2f3c34f336fcc313daac65b757a36a49f7b8a2d3
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Lifecycle/GlobalTaskCoordinator.ets
arkts
getActiveTaskCount
获取活跃任务数量
getActiveTaskCount(): number { return this.stats.totalTimers + this.stats.totalPromises; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getActiveTaskCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#sta...
getActiveTaskCount(): number { return this.stats.totalTimers + this.stats.totalPromises; }
https://github.com/DaLongZhuaZi/manxia
f4d419d201bafc68b3f83a99faf3cbf1b0f5d433
github
HarmonyOS_Samples/MultiVideoApplication
features/multivideosearch/src/main/ets/view/SearchContent.ets
arkts
getDividerPadding
Returns divider padding for discovery list based on breakpoint and item index.
getDividerPadding(breakpoint: WidthBreakpoint, index: number): string { if (breakpoint >= WidthBreakpoint.WIDTH_LG) { if (index % SearchConstants.SEARCH_LIST_LANES[0] !== 2) { return SearchConstants.SEARCH_RECOMMEND_DIVIDER_PADDING; } } else { if (index % SearchConstants.SEARCH_LIST_...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getDividerPadding AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left breakpoint AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left WidthBreakpoint AST#identifier#R...
getDividerPadding(breakpoint: WidthBreakpoint, index: number): string { if (breakpoint >= WidthBreakpoint.WIDTH_LG) { if (index % SearchConstants.SEARCH_LIST_LANES[0] !== 2) { return SearchConstants.SEARCH_RECOMMEND_DIVIDER_PADDING; } } else { if (index % SearchConstants.SEARCH_LIST_...
https://gitcode.com/HarmonyOS_Samples/MultiVideoApplication
c81930f21ba0391c1a1798ed021226b1b2e6b47f
gitcode
David8Idira/AI-OA
packages/harmonyos/commons/src/main/ets/data/api/ApiClient.ets
arkts
getMessages
获取消息列表
async getMessages(conversationId: string, params?: { page?: number; pageSize?: number; before?: number }): Promise<ApiResponse<any>> { return this.get<any>(`/api/im/conversations/${conversationId}/messages`, params) }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getMessages AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left conversationId AST#identifier#Right AST#type_annotation#Left AST#:#...
async getMessages(conversationId: string, params?: { page?: number; pageSize?: number; before?: number }): Promise<ApiResponse<any>> { return this.get<any>(`/api/im/conversations/${conversationId}/messages`, params) }
https://github.com/David8Idira/AI-OA
1cf96697a50203a98ac1528225d6c0048400050f
github
openharmony-sig/ohos_subsampling_scale_image_view
library/src/main/ets/components/MainPage/SubsamplingScaleImageView.ets
arkts
viewToSourceY
Convert screen to source y coordinate.
public viewToSourceY(vy: number): number { return (vy - this.offsetY) * this.scaledDensity / this.scale; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left viewToSourceY AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left vy AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left numb...
public viewToSourceY(vy: number): number { return (vy - this.offsetY) * this.scaledDensity / this.scale; }
https://gitee.com/openharmony-sig/ohos_subsampling_scale_image_view.git
af599ffdd35d1251ce597567c60f5cc553cec42d
gitee
AetheriumSimulator/qemu-hmos
entry/src/main/ets/utils/OneDriveManager.ets
arkts
getAccessInstructions
获取 VM 内访问 OneDrive 缓存的说明
public getAccessInstructions(mode: TransferMode): string[] { if (mode === TransferMode.RDP_REDIRECT) { return [ '1. 通过 RDP 连接到虚拟机', '2. 打开文件资源管理器', '3. 在地址栏输入: \\\\tsclient\\onedrive', '4. 即可访问鸿蒙设备上的 OneDrive 缓存目录', '5. 将 OneDrive 中的文件复制到此处,即可在鸿蒙设备上访问' ]; } ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getAccessInstructions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left mode AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier...
public getAccessInstructions(mode: TransferMode): string[] { if (mode === TransferMode.RDP_REDIRECT) { return [ '1. 通过 RDP 连接到虚拟机', '2. 打开文件资源管理器', '3. 在地址栏输入: \\\\tsclient\\onedrive', '4. 即可访问鸿蒙设备上的 OneDrive 缓存目录', '5. 将 OneDrive 中的文件复制到此处,即可在鸿蒙设备上访问' ]; } ...
https://github.com/AetheriumSimulator/qemu-hmos
a03cc0635ecdf049ae7a15fdaf63a91f7d1666b5
github
CLMC2025/Vignette
entry/src/main/ets/sync/DataExportImport.ets
arkts
constructor
解析后的用户操作状态
constructor(exportedWord: ExportedWord) { this.exportedWord = exportedWord; // 如果存在用户操作状态数据,则解析它 if (exportedWord.userActions) { const addedToBooksAtMap = new Map<string, number>(exportedWord.userActions.addedToBooksAt); this.userActions = new UserActions( exportedWord.userActions...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left exportedWord AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ExportedWord AST#iden...
constructor(exportedWord: ExportedWord) { this.exportedWord = exportedWord; // 如果存在用户操作状态数据,则解析它 if (exportedWord.userActions) { const addedToBooksAtMap = new Map<string, number>(exportedWord.userActions.addedToBooksAt); this.userActions = new UserActions( exportedWord.userActions...
https://github.com/CLMC2025/Vignette
62cdcf28295d446169f441cf404e4e063f0ba3eb
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets
arkts
toString
toString @returns {string} @throws {Error} - Input parameter error. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public override toString(): string { if (this.hasName()) { return this.getName() } return this.getLiteral() }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left toString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Le...
public override toString(): string { if (this.hasName()) { return this.getName() } return this.getLiteral() }
https://gitcode.com/iop123123/arkts-static-skills
57cbee13f941b70436e8610f21b261346ac61d24
gitcode
Explore-In-HMOS-Wearable/audio-player
entry/src/main/ets/core/services/AudioService.ets
arkts
getInstance
Ensure only one instance of this ViewModel is created
static getInstance() { if (!AudioService._instance) { AudioService._instance = new AudioService(AudioStatus.Undefined); } return AudioService._instance; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { A...
static getInstance() { if (!AudioService._instance) { AudioService._instance = new AudioService(AudioStatus.Undefined); } return AudioService._instance; }
https://github.com/Explore-In-HMOS-Wearable/audio-player
1aa8bb28e0f12705a9c98e21ee249cce75b46f1b
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Animation/AnimatedGridState.ets
arkts
getCurrentPositions
获取当前位置列表
public getCurrentPositions(): ItemPosition[] { return Array.from(this.currentPositions.values()); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCurrentPositions 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 It...
public getCurrentPositions(): ItemPosition[] { return Array.from(this.currentPositions.values()); }
https://github.com/DaLongZhuaZi/manxia
1d955f3b1ea2e380b1af034753e01127bd73cfd6
github
youyeyejie/ZhiXing_ActHub
entry/src/main/ets/core/services/FocusTimerEngine.ets
arkts
sendCompletionNotification
发送系统本地通知
private sendCompletionNotification(title: string, content: string): void { NotificationService.sendNotification(title, content); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left sendCompletionNotification AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left title AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#i...
private sendCompletionNotification(title: string, content: string): void { NotificationService.sendNotification(title, content); }
https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/core/services/FocusTimerEngine.ets#L217-L219
e51bbfdc4c962b165f9b11230485713d20d09e62
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
findLast
Finds the last element in the Uint8Array that satisfies the condition @param fn condition @returns the last element that satisfies fn
public findLast(fn: (val: number, index: int, array: Uint8Array) => boolean): number { for (let i = this.length - 1; i >= 0; --i) { let val = this.at(i) if (fn(val, i, this)) { return val } } throw new Error("Uint8Array.findLast: not implem...
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: number, index: int, array: Uint8Array) => boolean): number { for (let i = this.length - 1; i >= 0; --i) { let val = this.at(i) if (fn(val, i, this)) { return val } } throw new Error("Uint8Array.findLast: not implem...
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
87def4e50f7b56dc32092c7924c8d9ac2b7bdf5d
gitee
openharmony/codelabs
Data/PersonalAssistantPro/entry/src/main/ets/services/DataExportService.ets
arkts
generateJson
========================================== 2. CSV 生成器 ==========================================
private static async generateJson(contacts: Contact[], events: Event[], encrypt: boolean): Promise<string> { DataExportService.logger.info('Generating JSON...'); // 修复:显式使用接口类型定义对象字面量 const meta: ExportMeta = { version: '2.0', timestamp: Date.now(), device: 'HarmonyOS Mock Device', ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left generateJson AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left co...
private static async generateJson(contacts: Contact[], events: Event[], encrypt: boolean): Promise<string> { DataExportService.logger.info('Generating JSON...'); // 修复:显式使用接口类型定义对象字面量 const meta: ExportMeta = { version: '2.0', timestamp: Date.now(), device: 'HarmonyOS Mock Device', ...
https://gitcode.com/openharmony/codelabs
737981b546544468798fc3c071176ce123c8080a
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
with
Creates a copy with replaced value on index @param index @param value @returns an Uint8ClampedArray with replaced value on index
public with(index: number, value: number): Uint8ClampedArray { return this.with(index as int, value as number) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#ERROR#Right AST#with_statement#Left AST#with#Left with AST#with#Right AST#parenthesized_expression#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST...
public with(index: number, value: number): Uint8ClampedArray { return this.with(index as int, value as number) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
7e08558f854c20a4f00a6720b0638b12d4daa4d2
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/Double.ets
arkts
parseInt
parseInt(String) parses from String an integer of radix 10 @param s the string to convert @returns the result of parsing
public static parseInt(s: String): double { return Double.parseInt(s, 10); }
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 parseInt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left s AST#identifier#Right AST#:#Left : AST#:#Righ...
public static parseInt(s: String): double { return Double.parseInt(s, 10); }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
7f06598481be2a7084aa2d72358b6be61a1d382e
gitee
PollenWang6/HiXD
entry/src/main/ets/services/EhallService.ets
arkts
getNextSemesterCode
根据当前学期代码计算下学期代码 e.g. '2025-2026-2' → '2026-2027-1' or '2025-2026-1' → '2025-2026-2'
static getNextSemesterCode(current: string): string { const parts: string[] = current.split('-'); if (parts.length !== 3) return current; const y1: number = parseInt(parts[0]); const y2: number = parseInt(parts[1]); const term: number = parseInt(parts[2]); if (term === 1) { return y1 + '...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getNextSemesterCode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left current AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#st...
static getNextSemesterCode(current: string): string { const parts: string[] = current.split('-'); if (parts.length !== 3) return current; const y1: number = parseInt(parts[0]); const y2: number = parseInt(parts[1]); const term: number = parseInt(parts[2]); if (term === 1) { return y1 + '...
https://github.com/PollenWang6/HiXD
805a4b55f583754260a71cfc10d7e83208862249
github
picklerick422/zju-learning-assistant-OH
entry/src/main/ets/services/DownloadHistoryService.ets
arkts
loadAll
载入历史记录并重建为 DownloadTask(用于启动时填充 AppState.tasks)。
static loadAll(): DownloadTask[] { const records = DownloadHistoryService.readRaw(); const tasks: DownloadTask[] = []; for (const r of records) { const upload: Upload = { id: 0, reference_id: 0, file_name: r.fileName, course_name: r.courseName, path: r.path, ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left loadAll 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 DownloadTask A...
static loadAll(): DownloadTask[] { const records = DownloadHistoryService.readRaw(); const tasks: DownloadTask[] = []; for (const r of records) { const upload: Upload = { id: 0, reference_id: 0, file_name: r.fileName, course_name: r.courseName, path: r.path, ...
https://github.com/picklerick422/zju-learning-assistant-OH
eb39110f973b6b73d4ad24f7f4b2349c7c7a9ec2
github
Countly/countly-sdk-hos
library/src/main/ets/internal/modules/ModuleConsent.ets
arkts
resetForDeviceIdChangeNotMerged
Reset consents when device ID changes without merge. Does NOT schedule a consent snapshot request, the source tag documents that this flow belongs to the device-ID change path, not a developer decision.
public async resetForDeviceIdChangeNotMerged(): Promise<void> { const had: string[] = []; const keys: string[] = Object.keys(this.consent); for (let i = 0; i < keys.length; i++) { if (this.consent[keys[i]]) had.push(keys[i]); } if (had.length === 0) return; await this.core.notifyConsentW...
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 resetForDeviceIdChangeNotMerged AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expre...
public async resetForDeviceIdChangeNotMerged(): Promise<void> { const had: string[] = []; const keys: string[] = Object.keys(this.consent); for (let i = 0; i < keys.length; i++) { if (this.consent[keys[i]]) had.push(keys[i]); } if (had.length === 0) return; await this.core.notifyConsentW...
https://github.com/Countly/countly-sdk-hos
0e1dcca18649b98e1011cdf602c2a255b9688ede
github
2763981847/Clock-Alarm
entry/src/main/ets/model/ReminderService.ets
arkts
openNotificationPermission
请求开启通知权限。
public openNotificationPermission() { notification.requestEnableNotification().then(() => { Logger.info('开启通知权限成功'); }).catch((err: Error) => { Logger.error('开启通知权限失败,原因:' + JSON.stringify(err)); }); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left openNotificationPermission 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...
public openNotificationPermission() { notification.requestEnableNotification().then(() => { Logger.info('开启通知权限成功'); }).catch((err: Error) => { Logger.error('开启通知权限失败,原因:' + JSON.stringify(err)); }); }
https://github.com/2763981847/Clock-Alarm
58829719389d4bd2cb15a7c6d1c631ca79f2a7d0
github
Amaz1ny/HarmonyDO-public
entry/src/main/ets/common/utils/RouterManager.ets
arkts
pushImagePreview
打开图片预览
static pushImagePreview(urls: string[], initialIndex: number = 0): void { RouterManager.pushPath( RouteConstants.PAGE_IMAGE_PREVIEW, new ImagePreviewRouteParam(urls, initialIndex) as Object ); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left pushImagePreview AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left urls AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expre...
static pushImagePreview(urls: string[], initialIndex: number = 0): void { RouterManager.pushPath( RouteConstants.PAGE_IMAGE_PREVIEW, new ImagePreviewRouteParam(urls, initialIndex) as Object ); }
https://github.com/Amaz1ny/HarmonyDO-public
f504fbf9336efa98ad3ff8dd9d3b08e3c5c3b549
github
openharmony-tpc/XmlGraphicsBatik
library/src/main/ets/batik/SVGXMLChecker.ets
arkts
_readEqual
读取 '=' 字符 @see https://www.w3.org/TR/xml/ 2.8节 [25] Eq @return 是否读取到了'='字符
private _readEqual(): boolean{ this._readWhitespace(); if (this._svgStringReader!.readStringFast(XMLConstants.XML_EQ)) { this._readWhitespace(); return true; } return false; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left _readEqual 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 _readEqual(): boolean{ this._readWhitespace(); if (this._svgStringReader!.readStringFast(XMLConstants.XML_EQ)) { this._readWhitespace(); return true; } return false; }
https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git
5bb3eda86b90269e3dce16718a9382b7931d8f67
gitee
webabcd/HarmonyHttpServer
harmony_httpserver/src/main/ets/HttpServer.ets
arkts
handleHttpRequest
处理本地 http 请求(同步)
public handleHttpRequest(requestAndResponse: RequestAndResponse) { this.requestAndResponseAsync = undefined this.requestAndResponse = requestAndResponse }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left handleHttpRequest AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestAndResponse AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#...
public handleHttpRequest(requestAndResponse: RequestAndResponse) { this.requestAndResponseAsync = undefined this.requestAndResponse = requestAndResponse }
https://github.com/webabcd/HarmonyHttpServer
ecfa7351476377db711657d6c692d580d2495b9a
github
midori52000/ArkPilot
Agent/entry/src/main/ets/skills/SkillsBackendService.ets
arkts
resolveSourceDir
================================================================ 路径解析 ================================================================ 在解压后的仓库目录中定位 Skill 源目录 三级回退策略: 1. 直接匹配相对路径 2. 按名称递归查找(深度 ≤ 3) 3. 根目录有 SKILL.md 则使用根目录
private resolveSourceDir(root: string, rawDirectory: string): string | null { if (this.isRootSkillDirectory(rawDirectory)) { return this.isSkillDir(root) ? root : null; } // 1. 直接匹配 const direct = `${root}/${rawDirectory}`; if (this.isSkillDir(direct)) { return direct; } cons...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left resolveSourceDir AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left root AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
private resolveSourceDir(root: string, rawDirectory: string): string | null { if (this.isRootSkillDirectory(rawDirectory)) { return this.isSkillDir(root) ? root : null; } // 1. 直接匹配 const direct = `${root}/${rawDirectory}`; if (this.isSkillDir(direct)) { return direct; } cons...
https://github.com/midori52000/ArkPilot
a85eac2cc3da4d20241e8191fb04a426eeb8c56e
github
codelably/HCompass
core/network/src/main/ets/DefaultResponseParser.ets
arkts
getData
获取响应数据 @param response 原始响应数据 @returns 解析后的数据
getData(response: Unknown): T | null { if (!response || typeof response !== 'object') { return null; } const data = (response as Record<string, T>)[this.config.dataField]; return (data as T) ?? null; }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left response AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Unknown AST#identi...
getData(response: Unknown): T | null { if (!response || typeof response !== 'object') { return null; } const data = (response as Record<string, T>)[this.config.dataField]; return (data as T) ?? null; }
https://github.com/codelably/HCompass
f91ebabdb76154bf431789212b82affeca899d86
github
openharmony/codelabs
ETSUI/LifeTrack/entry/src/main/ets/services/StepCounterService.ets
arkts
notifyStepChange
通知所有监听器步数变化
private notifyStepChange(steps: number): void { this.listeners.forEach(listener => { try { listener(steps); } catch (error) { console.error('步数监听器执行错误:', error); } }); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left notifyStepChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left steps AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#...
private notifyStepChange(steps: number): void { this.listeners.forEach(listener => { try { listener(steps); } catch (error) { console.error('步数监听器执行错误:', error); } }); }
https://gitcode.com/openharmony/codelabs
5ad7842e0ee4802ca96b318b309099fe82248a81
gitcode
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/model/SessionState.ets
arkts
getConnectionDuration
Get connection duration in milliseconds
getConnectionDuration(): number { if (this.connectTime === 0) { return 0; } return Date.now() - this.connectTime; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getConnectionDuration 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#ERROR#Right AST#...
getConnectionDuration(): number { if (this.connectTime === 0) { return 0; } return Date.now() - this.connectTime; }
https://github.com/tangwengang-del/freerdp-harmonyos
55497ae9576bd691e6c6da8e44af253ab20dd936
github
DaLongZhuaZi/NGF
ngf_framework/src/main/ets/contentSource/facades/AuthInterceptorFacade.ets
arkts
onRequest
请求拦截:注入鉴权头 @param options 原始请求配置 @returns 注入鉴权头后的请求配置
async onRequest(options: NGFHttpRequestOptions): Promise<NGFHttpRequestOptions> { const token: string = this.tokenProvider(); if (token.length <= 0) { logger.debug(TAG, 'Token 为空,跳过注入'); return options; } const authHeaderValue: string = this.prefix + token; let updatedHeader: string; ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left onRequest AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left options AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS...
async onRequest(options: NGFHttpRequestOptions): Promise<NGFHttpRequestOptions> { const token: string = this.tokenProvider(); if (token.length <= 0) { logger.debug(TAG, 'Token 为空,跳过注入'); return options; } const authHeaderValue: string = this.prefix + token; let updatedHeader: string; ...
https://github.com/DaLongZhuaZi/NGF
ab4fa5e38df1a650469df4518626cd5cfdc480d2
github
FinalScave/SweetLine
platform/OHOS/sweetline/src/main/ets/Index.ets
arkts
analyzeIncremental
Incrementally re-analyze the text based on patch content @param range Change range of the patch @param newText Patched text @return Highlight result
public analyzeIncremental(range: TextRange, newText: string): DocumentHighlight { if (this.nativeHandle == 0) { return new DocumentHighlight(); } let buffer: Int32Array; if (range.start.index >= 0 && range.end.index >= 0) { buffer = lib.DocumentAnalyzer_AnalyzeChanges2(this.n...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left analyzeIncremental AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left range AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
public analyzeIncremental(range: TextRange, newText: string): DocumentHighlight { if (this.nativeHandle == 0) { return new DocumentHighlight(); } let buffer: Int32Array; if (range.start.index >= 0 && range.end.index >= 0) { buffer = lib.DocumentAnalyzer_AnalyzeChanges2(this.n...
https://github.com/FinalScave/SweetLine
abe059869fc4375bf5cd0850da5e8b91db5261d2
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Download/DownloadManager.ets
arkts
isEBookDownloaded
检查电子书是否已下载
public isEBookDownloaded(bookId: string): boolean { const task = this.getEBookTask(bookId); return task?.status === TaskStatus.COMPLETED; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isEBookDownloaded AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bookId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
public isEBookDownloaded(bookId: string): boolean { const task = this.getEBookTask(bookId); return task?.status === TaskStatus.COMPLETED; }
https://github.com/DaLongZhuaZi/manxia
fb417c02d55455f6ca935cfadb83e2295c2572a6
github
Dabing-0x19d/berverage_HarmonyOS6.0
entry/src/main/ets/entryformability/EntryFormAbility.ets
arkts
saveFormIdToPrefs
保存formId到Preferences
function saveFormIdToPrefs(prefs: preferences.Preferences, key: string, formId: string): void { try { let formIds: string[] = prefs.getSync(key, []) as string[]; if (!Array.isArray(formIds)) { formIds = []; } if (formIds.indexOf(formId) === -1) { formIds.push(formId); prefs.putSync(k...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left saveFormIdToPrefs AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left prefs AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST...
function saveFormIdToPrefs(prefs: preferences.Preferences, key: string, formId: string): void { try { let formIds: string[] = prefs.getSync(key, []) as string[]; if (!Array.isArray(formIds)) { formIds = []; } if (formIds.indexOf(formId) === -1) { formIds.push(formId); prefs.putSync(k...
https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0
6020bc730e6c93b7f10b7e22723064d930843371
github
openharmony-tpc/openharmony_tpc_samples
OhosVideoCache/library/src/main/ets/HttpProxyCacheServerBuilder.ets
arkts
setHeaderInjector
Add headers along the request to the server @param headerInjector to inject header base on url @return a builder
public setHeaderInjector(headerInjector: HeaderInjector): HttpProxyCacheServerBuilder { this.headerInjector = Preconditions.checkNotNull(headerInjector); return this; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setHeaderInjector AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left headerInjector AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#iden...
public setHeaderInjector(headerInjector: HeaderInjector): HttpProxyCacheServerBuilder { this.headerInjector = Preconditions.checkNotNull(headerInjector); return this; }
https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git
ce6a64fa359a4b9589102c8f1c6274afede938f5
gitee
HarmonyOS_Samples/BestPracticeSnippets
SimpleChatList/entry/src/main/ets/pages/ScrollToTheBottom.ets
arkts
build
[StartExclude Scroller]
build() { NavDestination() { // [EndExclude Scroller] // [Start initialIndex] List({ space: 20, initialIndex: this.arr.length - 1, scroller: this.scroller }) { // [StartExclude Scroller] ForEach(this.arr, (item: number) => { ListItem() { // [StartExclude in...
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() { NavDestination() { // [EndExclude Scroller] // [Start initialIndex] List({ space: 20, initialIndex: this.arr.length - 1, scroller: this.scroller }) { // [StartExclude Scroller] ForEach(this.arr, (item: number) => { ListItem() { // [StartExclude in...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
9e9520a5c0724579ff676caa5c19eb88cba5c432
gitcode
OMGCA/sakipay
sakipay_hmos/main/src/main/ets/services/HolidayCalendarService.ets
arkts
hasDataForYear
Returns true if holiday data is available for the given year.
public hasDataForYear(year: number): boolean { return this.calendars.has(year) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left hasDataForYear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left year AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left n...
public hasDataForYear(year: number): boolean { return this.calendars.has(year) }
https://github.com/OMGCA/sakipay
c0b50eff1d319d8d7658bcaec46c09540d6f74a2
github
Joker-x-dev/CoolMallArkTS
feature/order/src/main/ets/viewmodel/OrderConfirmViewModel.ets
arkts
navigateToAddressSelection
跳转到地址选择页面 @returns {void} 无返回值
navigateToAddressSelection(): void { UserNavigator.toAddressList(true) .then((result?: UserSelectAddressResult): void => { if (result?.address) { this.updateSelectedAddress(result.address); } }); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left navigateToAddressSelection 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#s...
navigateToAddressSelection(): void { UserNavigator.toAddressList(true) .then((result?: UserSelectAddressResult): void => { if (result?.address) { this.updateSelectedAddress(result.address); } }); }
https://github.com/Joker-x-dev/CoolMallArkTS
75f15b2729cf5e33ee1ebce99ade04683dacaf74
github
openharmony/applications_contacts
entry/src/main/ets/model/ContactAbilityModel.ets
arkts
getDisplayNamesFindUsually
DisplayName Query Favorite @param {string} DAHelper @param {Object} addParams Contact Information @param {Object} callBack Contact Information
async getDisplayNamesFindUsually(displayName: ValueType[], usuallyPhone: ValueType[], callBack: Function, context?: common.UIAbilityContext | Context) { HiLog.i(TAG, 'getDisplayNamesFindUsually start.'); if (context) { ContactRepository.getInstance().init(context); ContactRepository.getInstance(...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getDisplayNamesFindUsually AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left displayName AST#identifier#Right AST#type_a...
async getDisplayNamesFindUsually(displayName: ValueType[], usuallyPhone: ValueType[], callBack: Function, context?: common.UIAbilityContext | Context) { HiLog.i(TAG, 'getDisplayNamesFindUsually start.'); if (context) { ContactRepository.getInstance().init(context); ContactRepository.getInstance(...
https://gitee.com/openharmony/applications_contacts.git
77728183b732313c8a894fe6eda36992e7362d06
gitee
tdcare/tdwebrtc
src/main/ets/utils/NetworkUtil.ets
arkts
getSimStateSync
获取指定卡槽的SIM卡状态。 @param slotId 卡槽ID(0-卡槽1、1-卡槽2)。 默认移动数据的SIM卡。 @returns
static getSimStateSync(slotId?: number): sim.SimState { slotId = slotId ?? NetworkUtil.getDefaultCellularDataSlotIdSync(); //默认移动数据的SIM卡 return sim.getSimStateSync(slotId); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getSimStateSync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left slotId AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR...
static getSimStateSync(slotId?: number): sim.SimState { slotId = slotId ?? NetworkUtil.getDefaultCellularDataSlotIdSync(); //默认移动数据的SIM卡 return sim.getSimStateSync(slotId); }
https://github.com/tdcare/tdwebrtc
f657941096aad4e0252cb43e1463352558ecee7e
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.LightWeightSet.ets
arkts
entries
@returns an iterable of [v,v] pairs for every value `v` in the LightWeightSet.
entries(): IterableIterator<[T, T]> { return this.buckets.entries() }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left entries AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST...
entries(): IterableIterator<[T, T]> { return this.buckets.entries() }
https://gitcode.com/iop123123/arkts-static-skills
9136c22add3bbe038d815ea220cbde022583ec81
gitcode
Cool_foolisher1/ArkTSRepository
GraphicalCode/commons/src/main/ets/util/AppLinkUtil.ets
arkts
jumpApp
跳转App @param url 目标APP链接
public jumpApp(url: string, search: string) { const uiContext: UIContext = AppStorage.get<UIContext>(StorageKeyEnum.UI_CONTEXT) as UIContext const context: common.UIAbilityContext = uiContext.getHostContext() as common.UIAbilityContext // 使用Api20通过OpenLink拉起指定链接 const link: string = url + search c...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left jumpApp AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AS...
public jumpApp(url: string, search: string) { const uiContext: UIContext = AppStorage.get<UIContext>(StorageKeyEnum.UI_CONTEXT) as UIContext const context: common.UIAbilityContext = uiContext.getHostContext() as common.UIAbilityContext // 使用Api20通过OpenLink拉起指定链接 const link: string = url + search c...
https://gitcode.com/Cool_foolisher1/ArkTSRepository
d6761e6a568209d716853d75307ea5ce9647955a
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/TypeGuards.ets
arkts
assertNumber
类型断言辅助函数 - 数字 @param value - 要断言的值 @param context - 上下文信息 @returns 数字值 @throws 如果类型不匹配
static assertNumber(value: Object, context: string = 'value'): number { if (!TypeGuards.isNumber(value)) { const error = `${context} 必须是数字类型,实际类型: ${typeof value}`; logger.error(TAG, error); throw new Error(error); } return value as number; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left assertNumber 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 Ob...
static assertNumber(value: Object, context: string = 'value'): number { if (!TypeGuards.isNumber(value)) { const error = `${context} 必须是数字类型,实际类型: ${typeof value}`; logger.error(TAG, error); throw new Error(error); } return value as number; }
https://github.com/DaLongZhuaZi/manxia
a5410ea9679241308bec5ced6dd17fba825ddf9b
github
LYM15/FireflyCompanion
entry/src/main/ets/view/OrderList.ets
arkts
filterOrderData
数据筛选 根据 orderTypeId 过滤数据
filterOrderData(orderTypeId: number): OrderItemType[] { if(orderTypeId== 0){ return orderListData }else{ const filtered: OrderItemType[] = []; for (let i = 0; i < orderListData.length; i++) { const item = orderListData[i]; if (orderTypeId === item.mainGood.type) { f...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left filterOrderData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left orderTypeId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) ...
filterOrderData(orderTypeId: number): OrderItemType[] { if(orderTypeId== 0){ return orderListData }else{ const filtered: OrderItemType[] = []; for (let i = 0; i < orderListData.length; i++) { const item = orderListData[i]; if (orderTypeId === item.mainGood.type) { f...
https://github.com/LYM15/FireflyCompanion
cf32a1c8c17e87b9ce5b18d55d2553c1326adc33
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/ChineseConverter.ets
arkts
addCustomMapping
添加自定义映射
addCustomMapping(simplified: string, traditional: string): void { ChineseConverter.s2tMap.set(simplified, traditional); ChineseConverter.t2sMap.set(traditional, simplified); logger.debug(TAG, `添加自定义映射: ${simplified} <-> ${traditional}`); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addCustomMapping AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left simplified AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , ...
addCustomMapping(simplified: string, traditional: string): void { ChineseConverter.s2tMap.set(simplified, traditional); ChineseConverter.t2sMap.set(traditional, simplified); logger.debug(TAG, `添加自定义映射: ${simplified} <-> ${traditional}`); }
https://github.com/DaLongZhuaZi/manxia
a10787bb9f084404e86e3ba81eac2bd4ba2591df
github
openharmony/arkui_ace_engine
advanced_ui_component_static/assembled_advanced_ui_component/@ohos.arkui.advanced.TreeView.ets
arkts
emit
Triggers all callbacks of an event with parameters. @param event Registered Events. @param argument Parameters returned by the callback event. @since 10
public emit(event: TreeListenType, argument: CallbackParam) { if (this._events.get(event)) { const callback: ((callbackParam: CallbackParam) => void) | undefined = this._events.get(event) as ((callbackParam: CallbackParam) => void) | undefined; try { callback?.(argument); } catch...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left emit AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:#Left : AST#...
public emit(event: TreeListenType, argument: CallbackParam) { if (this._events.get(event)) { const callback: ((callbackParam: CallbackParam) => void) | undefined = this._events.get(event) as ((callbackParam: CallbackParam) => void) | undefined; try { callback?.(argument); } catch...
https://gitcode.com/openharmony/arkui_ace_engine
4a23e2d2e9c033acff33244eafe6b303a74ca5ab
gitcode
richshaw2015/nds
ohos/entry/src/main/ets/utils/GameManager.ets
arkts
removeFromRecentGames
从最近列表移除游戏
public async removeFromRecentGames(uri: string): Promise<void> { this.recentGames = this.recentGames.filter(game => game.uri !== uri); await this.saveRecentGames(); }
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 removeFromRecentGames AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uri AST#identifier#Right AST#:#Lef...
public async removeFromRecentGames(uri: string): Promise<void> { this.recentGames = this.recentGames.filter(game => game.uri !== uri); await this.saveRecentGames(); }
https://github.com/richshaw2015/nds
3720e2b1a6806c21adc6440b9333c125a6ec3d6c
github
CLMC2025/Vignette
entry/src/main/ets/context/OfflineContext.ets
arkts
addWord
添加词汇到数据库
addWord(word: string, pos: string = 'n.', meaning: string = ''): void { const wordInfo = new WordInfo(word, pos, meaning); this.wordDatabase.set(word.toLowerCase(), wordInfo); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addWord AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left word AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#R...
addWord(word: string, pos: string = 'n.', meaning: string = ''): void { const wordInfo = new WordInfo(word, pos, meaning); this.wordDatabase.set(word.toLowerCase(), wordInfo); }
https://github.com/CLMC2025/Vignette
f1eb35798b371df39cf61f8b197808b3a52d9e98
github
HarmonyOS_Samples/speech-kit-sample-TextReader_-arkts
entry/src/main/ets/pages/Index.ets
arkts
setEventListener
Setting Event Listening
setEventListener(){ TextReader.on('eventNotification', (event: TextReader.NotificationEvent) => { hilog.info(0x0001, TAG, `Notification event: ${JSON.stringify(event)}`) }) TextReader.on('eventPanel', (event: TextReader.PanelEvent) => { hilog.info(0x0001, TAG, `Panel event: ${JSON.stringify(...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setEventListener 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...
setEventListener(){ TextReader.on('eventNotification', (event: TextReader.NotificationEvent) => { hilog.info(0x0001, TAG, `Notification event: ${JSON.stringify(event)}`) }) TextReader.on('eventPanel', (event: TextReader.PanelEvent) => { hilog.info(0x0001, TAG, `Panel event: ${JSON.stringify(...
https://gitcode.com/HarmonyOS_Samples/speech-kit-sample-TextReader_-arkts
5280538d6e698d8dd1ad7178635997640290b162
gitcode
openharmony/vendor_unionman
unionpi_tiger/sample_hzu/WEILIAO/entry/src/main/ets/common/database/tables/ChatTable.ets
arkts
getRdbStore
通过charTable执行RS中的getRS,获取RS对象
getRdbStore(callback: Function = () => { }) { this.chatTable.getRdbStore(callback) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getRdbStore AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#identifier...
getRdbStore(callback: Function = () => { }) { this.chatTable.getRdbStore(callback) }
https://gitee.com/openharmony/vendor_unionman.git
9fb20e815f619f11b56b82f16fd6864d3e03a531
gitee
Joker-x-dev/CoolMallArkTS
feature/goods/src/main/ets/viewmodel/GoodsCategoryViewModel.ets
arkts
snapshotKeyboardAvoidMode
记录键盘避让模式 @param {KeyboardAvoidMode} mode - 当前模式 @returns {void} 无返回值
snapshotKeyboardAvoidMode(mode: KeyboardAvoidMode): void { this.previousKeyboardAvoidMode = mode; this.hasKeyboardAvoidModeSnapshot = true; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left snapshotKeyboardAvoidMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left mode AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left KeyboardAvoidMode AST#identifi...
snapshotKeyboardAvoidMode(mode: KeyboardAvoidMode): void { this.previousKeyboardAvoidMode = mode; this.hasKeyboardAvoidModeSnapshot = true; }
https://github.com/Joker-x-dev/CoolMallArkTS
58dd637d9e889a6cfc66b0d1d564651a8046772e
github
openharmony-sig/applications_clock
feature/alarmclock/src/main/ets/manager/AlarmServiceManager.ets
arkts
stopAudioWorker
stop Audio Worker
public async stopAudioWorker(isForce: boolean = false): Promise<void> { const isFiring = await AlarmStateManager.isFiring(); LogUtil.info(TAG, 'stopAudioWorker isFiring: ' + isFiring + ' isForce=' + isForce); if (isFiring && !isForce) { return; } if (this.workerInstance) { LogUtil.info...
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 stopAudioWorker AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left isForce AST#identifier#Right AST#:#Left ...
public async stopAudioWorker(isForce: boolean = false): Promise<void> { const isFiring = await AlarmStateManager.isFiring(); LogUtil.info(TAG, 'stopAudioWorker isFiring: ' + isFiring + ' isForce=' + isForce); if (isFiring && !isForce) { return; } if (this.workerInstance) { LogUtil.info...
https://gitee.com/openharmony-sig/applications_clock.git
098a52c595287411b8234937e35024e9d5973d26
gitee
mybricks/comlib-harmony-normal
packages/rt-arkts/comlib/src/main/ets/AiMusicPlayer.ets
arkts
playLrc
歌词滚动效果
playLrc(duration: number) { this.uiContext.animateTo({ duration: duration, finishCallbackType: FinishCallbackType.LOGICALLY, curve: Curve.Linear, iterations: 1, onFinish: () => { this.value = 0 MediaPlayer.currentIndex++; let currentLine = MediaPlayer.lyrics[M...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left playLrc AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left duration AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Lef...
playLrc(duration: number) { this.uiContext.animateTo({ duration: duration, finishCallbackType: FinishCallbackType.LOGICALLY, curve: Curve.Linear, iterations: 1, onFinish: () => { this.value = 0 MediaPlayer.currentIndex++; let currentLine = MediaPlayer.lyrics[M...
https://github.com/mybricks/comlib-harmony-normal
f5b9c5fc35a6bf9fa1a27ab37f93c180fd3a7a8d
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/OCRRecognitionDAO.ets
arkts
updateStatus
更新识别状态
static async updateStatus( recordId: number, status: 'pending' | 'processing' | 'success' | 'partial' | 'failed', errorMessage?: string ): Promise<boolean> { try { const store = DatabaseManager.getDatabase(); const values: relationalStore.ValuesBucket = { recognition_status: stat...
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 updateStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left recordId AST#identifier#Right AST#ERROR#Left AST#:#Left : ...
static async updateStatus( recordId: number, status: 'pending' | 'processing' | 'success' | 'partial' | 'failed', errorMessage?: string ): Promise<boolean> { try { const store = DatabaseManager.getDatabase(); const values: relationalStore.ValuesBucket = { recognition_status: stat...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
8b9e50b3d21a00390aeb2941f808959801fcf7e3
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/ComputerManager.ets
arkts
startPolling
启动状态轮询定时器 类似 Android 的 pollingThread
startPolling(): void { if (this.isPollingActive) { return; } this.isPollingActive = true; console.info('ComputerManager: 启动状态轮询'); // 重置离线计数:重新进入页面(如串流退出后)重新累计, // 避免历史计数让已恢复的 PC 仍被当作临近阈值、下一次失败立刻闪到离线 this.offlineCount.clear(); // 立即执行一次刷新,然后定时轮询 this.refreshAllComputer...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left startPolling AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Le...
startPolling(): void { if (this.isPollingActive) { return; } this.isPollingActive = true; console.info('ComputerManager: 启动状态轮询'); // 重置离线计数:重新进入页面(如串流退出后)重新累计, // 避免历史计数让已恢复的 PC 仍被当作临近阈值、下一次失败立刻闪到离线 this.offlineCount.clear(); // 立即执行一次刷新,然后定时轮询 this.refreshAllComputer...
https://github.com/AlkaidLab/moonlight-harmony
3f3c2b907b1655aab76ef50563075b80509c4c4c
github
arkui-x/samples
CodeLab/Cases/feature/clickanimation/src/main/ets/model/BasicDataSource.ets
arkts
shiftData
从数据头部移除一个元素
public shiftData(): void { this.originDataArray.shift(); this.notifyDataDelete(0); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left shiftData 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_s...
public shiftData(): void { this.originDataArray.shift(); this.notifyDataDelete(0); }
https://gitcode.com/arkui-x/samples
9d8814c6a36e20bd582b486711b2a2d0b110d3a4
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Animation/GlobalAnimationSystem.ets
arkts
getTargetStateForAnimationType
根据动画类型获取目标状态
private getTargetStateForAnimationType(animationType: AnimationType): AnimationState { switch (animationType) { case AnimationType.FADE_IN: return this.createFadeInState(); case AnimationType.FADE_OUT: return this.createFadeOutState(); case AnimationType.SLIDE_IN_LEFT: re...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getTargetStateForAnimationType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left animationType AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR...
private getTargetStateForAnimationType(animationType: AnimationType): AnimationState { switch (animationType) { case AnimationType.FADE_IN: return this.createFadeInState(); case AnimationType.FADE_OUT: return this.createFadeOutState(); case AnimationType.SLIDE_IN_LEFT: re...
https://github.com/DaLongZhuaZi/manxia
13d0e8777babc81f9354b4093ec3839558be8107
github
honjow/Next2V
feature/feed/src/main/ets/viewmodel/FeedViewModel.ets
arkts
triggerHaptic
HD haptic feedback
private triggerHaptic(): void { try { if (vibrator.isHdHapticSupported()) { vibrator.startVibration({ type: 'preset', effectId: 'haptic.effect.soft', count: 1, intensity: 60, }, { usage: 'physicalFeedback', }) } else { v...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left triggerHaptic 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#vo...
private triggerHaptic(): void { try { if (vibrator.isHdHapticSupported()) { vibrator.startVibration({ type: 'preset', effectId: 'haptic.effect.soft', count: 1, intensity: 60, }, { usage: 'physicalFeedback', }) } else { v...
https://github.com/honjow/Next2V
d4f7bc456d543757504ae97102663da125edc5bd
github
LJ666-ui/harmony-health-care
entry/src/main/ets/ar/ARNavigationService.ets
arkts
getCurrentWaypoint
获取当前途经点
private getCurrentWaypoint(): Waypoint | null { if (!this.navigationState.currentPath) return null; const index = this.navigationState.currentWaypointIndex; return this.navigationState.currentPath.waypoints[index] || null; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getCurrentWaypoint 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_expressio...
private getCurrentWaypoint(): Waypoint | null { if (!this.navigationState.currentPath) return null; const index = this.navigationState.currentWaypointIndex; return this.navigationState.currentPath.waypoints[index] || null; }
https://github.com/LJ666-ui/harmony-health-care
9187d12c3b9bcdee3a1942d372cf91050eb348be
github
ZestBox-18/kitebook-frontend
commons/kite_utils/src/main/ets/utils/database/DatabaseManager.ets
arkts
upgradeDatabase
升级数据库(带事务支持) @param currentVersion 当前版本 @param targetVersion 目标版本
private async upgradeDatabase(currentVersion: number, targetVersion: number): Promise<void> { Clog.log(TAG,`开始数据库升级: ${currentVersion} -> ${targetVersion}`); // 开始事务 await this.dbStore!.beginTransaction(); Clog.log(TAG,'数据库升级事务已开始'); try { const upgradeSqls = this.dbConfig.getUpgra...
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 upgradeDatabase AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left currentVersion AST#identifier#Right AST#ERROR#Left A...
private async upgradeDatabase(currentVersion: number, targetVersion: number): Promise<void> { Clog.log(TAG,`开始数据库升级: ${currentVersion} -> ${targetVersion}`); // 开始事务 await this.dbStore!.beginTransaction(); Clog.log(TAG,'数据库升级事务已开始'); try { const upgradeSqls = this.dbConfig.getUpgra...
https://github.com/ZestBox-18/kitebook-frontend
aea1ccb1969d3c0a10d12eb03f26bf2feb95d66b
github