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
apap6628114/nga_oh
entry/src/main/ets/service/NgaClient.ets
arkts
executeWithRetry
统一的「首次请求 + 失败后遍历 DOMAINS 重试 + ngaThrottler acquire/release」执行器。 ngaRequest(轮换域名)与 ngaGetHtmlText(固定域名,不轮换)逻辑同构,差异仅在 调用方传入的 baseUrl:传空字符串时重试遍历 DOMAINS 轮换;传非空字符串(如 DOMAINS[activeDomainIndex])时重试始终命中该域名,行为与原实现逐字等价。 header 构造逻辑统一:User-Agent + X-User-Agent + extraHeaders(可选) + Cookie(可选) + POST 时的 Content-Type/Content-Lengt...
async function executeWithRetry( path: string, params: Record<string, string>, method: http.RequestMethod, body: string, cookies: Cookies | undefined, extraHeaders: Record<string, string> | undefined, baseUrl: string, skipContentLength: boolean = false ): Promise<HttpResponse> { const resolvedBaseUrl:...
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left executeWithRetry AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left path AST#identifier#Right AST#ty...
async function executeWithRetry( path: string, params: Record<string, string>, method: http.RequestMethod, body: string, cookies: Cookies | undefined, extraHeaders: Record<string, string> | undefined, baseUrl: string, skipContentLength: boolean = false ): Promise<HttpResponse> { const resolvedBaseUrl:...
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/service/NgaClient.ets#L206-L287
d65ef4ad71983e2a13940e37b254e67b8dbdf1fc
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test31_original_index.ets
arkts
testStringPad
--- String padStart / padEnd ---
function testStringPad(): string { let s: string = '42'; let padded: string = s.padStart(6, '0'); let right: string = s.padEnd(6, '-'); return padded + '|' + right; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testStringPad 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_ty...
function testStringPad(): string { let s: string = '42'; let padded: string = s.padStart(6, '0'); let right: string = s.padEnd(6, '-'); return padded + '|' + right; }
https://github.com/miaochiahao/ark-ghidra
0a86b69704134b4f14484cb7556cb98581fba0fc
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Parsers/PdfToMangaImporter.ets
arkts
writeComicInfoXml
写入ComicInfo.xml文件
private async writeComicInfoXml(chapterDir: string, comicInfo: PdfComicInfo): Promise<void> { try { const xmlContent = this.generateComicInfoXml(comicInfo); const xmlPath = `${chapterDir}/ComicInfo.xml`; const file = SafeFileUtils.openSync(xmlPath, fileIo.OpenMode.CREATE | fileIo.OpenMode.WRITE...
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 writeComicInfoXml AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left chapterDir AST#identifier#Right AST#ERROR#Left AST...
private async writeComicInfoXml(chapterDir: string, comicInfo: PdfComicInfo): Promise<void> { try { const xmlContent = this.generateComicInfoXml(comicInfo); const xmlPath = `${chapterDir}/ComicInfo.xml`; const file = SafeFileUtils.openSync(xmlPath, fileIo.OpenMode.CREATE | fileIo.OpenMode.WRITE...
https://github.com/DaLongZhuaZi/manxia
6c23bc0829034a4bed3386fa04292226fa6117b5
github
Octo-o-o-o/harmonyos-ai-workspace
tools/hooks/test-fixtures/BadRuntimePitfalls.ets
arkts
fetchData
ARKTS-AWAIT-TRY: 全文没有 try 块但有 await
async function fetchData(url: string): Promise<string> { const resp = await fetch(url); // ← codeLinter 会报 Function may throw return await resp.text(); }
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left fetchData AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left url AST#identifier#Right AST#type_annot...
async function fetchData(url: string): Promise<string> { const resp = await fetch(url); // ← codeLinter 会报 Function may throw return await resp.text(); }
https://github.com/Octo-o-o-o/harmonyos-ai-workspace
d89bd4d6846698606dae0363776f17bf0e40cb27
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Char.ets
arkts
isInBasicMultilingualPlane
isInBasicMultilingualPlane() checks if the underlying char is in Basic Multilingual Plane. See UTF-16 for more details. @returns { boolean } @syscap SystemCapability.Utils.Lang @FaAndStageModel
public isInBasicMultilingualPlane(): boolean { return Char.isInBasicMultilingualPlane(this.value); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isInBasicMultilingualPlane 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#Lef...
public isInBasicMultilingualPlane(): boolean { return Char.isInBasicMultilingualPlane(this.value); }
https://gitcode.com/iop123123/arkts-static-skills
38ad4164b6b71d54a6b6a469b6b6b21d9b825b18
gitcode
harmonyos/codelabs
HarmonyOS_NEXT/Healthy_life/entry/src/main/ets/common/database/tables/GlobalInfoApi.ets
arkts
updateData
Update globalInfo. @param globalInfo @param callback
updateData(globalInfo: GlobalInfo, callback: Function): void { const valueBucket = generateBucket(globalInfo); let predicates = new dataRdb.RdbPredicates(Const.GLOBAL_INFO.tableName ? Const.GLOBAL_INFO.tableName : ''); predicates.equalTo('id', 0); RdbUtils.update(valueBucket, predicates).then((result:...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left globalInfo AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left GlobalInfo AST#identifier#Right AST#,#L...
updateData(globalInfo: GlobalInfo, callback: Function): void { const valueBucket = generateBucket(globalInfo); let predicates = new dataRdb.RdbPredicates(Const.GLOBAL_INFO.tableName ? Const.GLOBAL_INFO.tableName : ''); predicates.equalTo('id', 0); RdbUtils.update(valueBucket, predicates).then((result:...
https://gitee.com/harmonyos/codelabs.git
0e2cdaf6f2b74ed725ecaddfa32eb906ab0f7cf7
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
subarray
Creates a Int16Array with the same underlying ArrayBuffer @param begin start index, inclusive @param end last index, exclusive @returns new Int16Array with the same underlying ArrayBuffer
public subarray(begin: number, end: number): Int16Array { return this.subarray(begin as int, end as int) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left subarray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left begin AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number...
public subarray(begin: number, end: number): Int16Array { return this.subarray(begin as int, end as int) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
560bce65f6c01716fe50a468356f067c025e3acf
gitee
RedRackham-R/WanAndroidHarmoney
entry/src/main/ets/global/model/GlobalUserDBModel.ets
arkts
updateUserInfo
更新用户信息 @param id @param user_info
async updateUserInfo(id: number, user_info: string) { let predicates = new relationalStore.RdbPredicates(this.TABLE_USER) predicates.equalTo("id", id) try { //更新login_state let rowNum = await this.store.update({ "user_info": user_info }, predicates) } catch (err) { } }
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left updateUserInfo AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_annotation#Left AST#:#...
async updateUserInfo(id: number, user_info: string) { let predicates = new relationalStore.RdbPredicates(this.TABLE_USER) predicates.equalTo("id", id) try { //更新login_state let rowNum = await this.store.update({ "user_info": user_info }, predicates) } catch (err) { } }
https://github.com/RedRackham-R/WanAndroidHarmoney
ef09ff0faccf891932cd99cb88bb0602729e888b
github
Nekofox-POT/LinMusic
entry/src/main/ets/pages/start/step_a.ets
arkts
aboutToAppear
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 基础函数 // //////////
aboutToAppear(): void { // 标题先渐变进入 setTimeout(() => { this.showTitle = true }, 80) // 选项跟随 setTimeout(() => { this.showOptions = true }, 360) // 按钮最后 setTimeout(() => { this.showButton = true }, 640) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#{#Left { AST#{#Right AST#comme...
aboutToAppear(): void { // 标题先渐变进入 setTimeout(() => { this.showTitle = true }, 80) // 选项跟随 setTimeout(() => { this.showOptions = true }, 360) // 按钮最后 setTimeout(() => { this.showButton = true }, 640) }
https://github.com/Nekofox-POT/LinMusic
bd675f611e8e17ffc17b84e722b775db97f6ab93
github
openharmony/multimedia_camera_framework
frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/mode/CameraService.ets
arkts
releaseCamera
释放会话及其相关参数
async releaseCamera(): Promise<void> { Logger.info(TAG, 'releaseCamera is called'); try { await this.previewOutput?.release(); } catch (error) { let err = error as BusinessError; Logger.error(TAG, `previewOutput release fail: error: ${JSON.stringify(err)}`); } finally { this.pr...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left releaseCamera 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 A...
async releaseCamera(): Promise<void> { Logger.info(TAG, 'releaseCamera is called'); try { await this.previewOutput?.release(); } catch (error) { let err = error as BusinessError; Logger.error(TAG, `previewOutput release fail: error: ${JSON.stringify(err)}`); } finally { this.pr...
https://gitee.com/openharmony/multimedia_camera_framework.git
661e908574543876d6213c8bb6dc8b4b07cc2d7a
gitee
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/TouchInputHandler.ets
arkts
setMode
获取绝对鼠标管理器 设置触摸模式 切换模式时主动清理 MOUSE 模式遗留状态并释放可能卡住的左/右键, 避免 Cancel 事件丢失或 ArkUI 命中测试抖动导致的"左键卡按下" 进而让后续自定义右键等动作在主机端被忽略。 对于目标端本就松开的按键,多发一次 RELEASE 是无副作用的 no-op。
setMode(mode: TouchInputMode): void { if (this.mode === TouchInputMode.MOUSE && mode !== TouchInputMode.MOUSE) { this.resetMouseState(true); } this.mode = mode; console.info(`TouchInputHandler: 模式切换为 ${mode}`); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setMode 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 TouchInputMode AST#identifier#Right AST#)#Left )...
setMode(mode: TouchInputMode): void { if (this.mode === TouchInputMode.MOUSE && mode !== TouchInputMode.MOUSE) { this.resetMouseState(true); } this.mode = mode; console.info(`TouchInputHandler: 模式切换为 ${mode}`); }
https://github.com/AlkaidLab/moonlight-harmony
b45f29d88590d037f9b3c25cac7d44cc1be1b172
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/ResponsiveLayout.ets
arkts
logCurrentLayout
日志输出当前布局参数
public static logCurrentLayout(): void { const params = ResponsiveLayoutHelper.getLayoutParams(); const deviceInfo = ResponsiveLayoutHelper.deviceManager.getDeviceInfo(); logger.info(TAG, `当前布局参数: ${JSON.stringify({ breakpoint: deviceInfo.breakpoint, orientation: deviceInfo.orientation, ...
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 logCurrentLayout AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS...
public static logCurrentLayout(): void { const params = ResponsiveLayoutHelper.getLayoutParams(); const deviceInfo = ResponsiveLayoutHelper.deviceManager.getDeviceInfo(); logger.info(TAG, `当前布局参数: ${JSON.stringify({ breakpoint: deviceInfo.breakpoint, orientation: deviceInfo.orientation, ...
https://github.com/DaLongZhuaZi/manxia
6174f38d695c299fa2072a462fde60567c220d41
github
honjow/Next2V
shared/src/main/ets/network/ApiService.ets
arkts
unblockMemberWithCookie
Unblock a single member (requires Cookie session). Used by the blocked-list page where only memberId/username are known and the full member snapshot is not needed. The member page is the once-token source: `actions.blockPath` is toggle-shaped — when the member is currently blocked it already IS the `/unblock/...` link;...
async unblockMemberWithCookie(cookie: string, memberId: number, username: string): Promise<void> { if (!cookie) { throw ApiErrors.authRequired() } const cleanName = (username || '').trim() if (memberId <= 0 && !cleanName) { throw ApiErrors.missingUserAction() } const snapshot = awa...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left unblockMemberWithCookie AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left cookie AST#identifier...
async unblockMemberWithCookie(cookie: string, memberId: number, username: string): Promise<void> { if (!cookie) { throw ApiErrors.authRequired() } const cleanName = (username || '').trim() if (memberId <= 0 && !cleanName) { throw ApiErrors.missingUserAction() } const snapshot = awa...
https://github.com/honjow/Next2V
426b8cabc62aeb4beec305f28c46ce6a28124966
github
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/hosts/userdata/keyshortcuts/classes/meowKeyboardMan.ets
arkts
apply
Apply the key bindings. Note that this function really does its job 100 ms after calling it, as it needs some time to flush (unbind) the existing component key shortcuts.
apply(index: number, fromStrings: string[]) { if (fromStrings.length == 0) { meow(`fromStrings is empty. meowKeyboardMan.apply() REJECTED!`, 'meowKeyboardMan][apply', meowLevel.WARN); return; } this.shortcuts[index].fromArray([]); // Unbind existing key binds setTimeout(() => { this...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left apply AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#...
apply(index: number, fromStrings: string[]) { if (fromStrings.length == 0) { meow(`fromStrings is empty. meowKeyboardMan.apply() REJECTED!`, 'meowKeyboardMan][apply', meowLevel.WARN); return; } this.shortcuts[index].fromArray([]); // Unbind existing key binds setTimeout(() => { this...
https://github.com/awaLiny2333/LinysBrowser_NEXT
d63a8d89934ee28d71869ac90085fac63a584d34
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/RadarChartModel.ets
arkts
setWebLineWidthInner
Sets the width of the web lines that are in between the lines coming from the center. @param width
public setWebLineWidthInner(width: number): void { this.mInnerWebLineWidth = Utils.handleDataValues(width); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setWebLineWidthInner AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left width AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier...
public setWebLineWidthInner(width: number): void { this.mInnerWebLineWidth = Utils.handleDataValues(width); }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
082804afc442985013ea156146e6354a3f8eeedf
gitee
openharmony/applications_app_samples
code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/controller/LoginController.ets
arkts
sendData
TCP 和 TLS发送消息 @param data
public sendData(data: string): void { this.mSocket?.sendData(data); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left sendData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string ...
public sendData(data: string): void { this.mSocket?.sendData(data); }
https://github.com/openharmony/applications_app_samples
e232506af36b3cb8d5139c523e0e30d5d0c7caa0
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
slice
Creates a slice of current Float32 with all elements. @returns a new Float32Array with elements of current Float32Array
public slice(): Float32Array { return new Float32Array(this) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left slice AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Rig...
public slice(): Float32Array { return new Float32Array(this) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
59c010525b40c4638ca6026be7ee4093bce48e53
gitee
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/StreamingSession.ets
arkts
setDecoderStartedCallback
设置"视频解码器已启动"回调(对应 native drStart)。 此回调在 LiStartConnection 内部、首帧渲染前触发,比 session.start() resolve 更早。 UI 可以借此提前隐藏 loading 蒙层,让用户更快看到画面。
setDecoderStartedCallback(callback: (() => void) | null): void { this.decoderStartedCallback = callback; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setDecoderStartedCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#(#Left ( AST#(#Right AST#formal...
setDecoderStartedCallback(callback: (() => void) | null): void { this.decoderStartedCallback = callback; }
https://github.com/AlkaidLab/moonlight-harmony
e164873b7d6097d227d97b8c6bca4e875767a24d
github
zmuxuny/ai-guardian-star
entry/src/main/ets/database/DatabaseHelper.ets
arkts
migrateDatabase
── 数据库版本迁移 ────────────────────────────
private async migrateDatabase(): Promise<void> { if (!this.store) return; // ArkDB 官方推荐使用 store.version 进行版本管理 let currentVersion = this.store.version; hilog.info(DOMAIN, TAG, `数据库当前版本: ${currentVersion}`); // 直接无条件执行所有建表语句,利用 IF NOT EXISTS 保证安全。 // 这能防范由于先前版本号或事务错误导致表未正常建立,却又升了版本号的死锁问题。 ...
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 migrateDatabase AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A...
private async migrateDatabase(): Promise<void> { if (!this.store) return; // ArkDB 官方推荐使用 store.version 进行版本管理 let currentVersion = this.store.version; hilog.info(DOMAIN, TAG, `数据库当前版本: ${currentVersion}`); // 直接无条件执行所有建表语句,利用 IF NOT EXISTS 保证安全。 // 这能防范由于先前版本号或事务错误导致表未正常建立,却又升了版本号的死锁问题。 ...
https://github.com/zmuxuny/ai-guardian-star/blob/87ab023d8b9aab4303a9fc1e97508e1f8ee01e07/entry/src/main/ets/database/DatabaseHelper.ets#L204-L261
bcfe50fcf2f9ce3f26212029b3e4fa356a2cdfa5
github
HunZiLei/ArkTS_PokePomodoro
entry/src/main/ets/pages/customCpt/home.ets
arkts
touchMoveLoadMore
============================================加载更多================================================== 手指移动,处理加载更多
touchMoveLoadMore(event:TouchEvent) { // 因为加载更多是在列表后面新增一个item,当一屏能够展示全部列表,endIndex 为 length+1 if (this.endIndex == this.listNews.length - 1 || this.endIndex == this.listNews.length) { // 滑动的偏移量 this.offsetY = event.touches[0].y - this.downY if (Math.abs(this.offsetY) > vp2px(this.loadMoreHei...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left touchMoveLoadMore AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left TouchEvent AST#identif...
touchMoveLoadMore(event:TouchEvent) { // 因为加载更多是在列表后面新增一个item,当一屏能够展示全部列表,endIndex 为 length+1 if (this.endIndex == this.listNews.length - 1 || this.endIndex == this.listNews.length) { // 滑动的偏移量 this.offsetY = event.touches[0].y - this.downY if (Math.abs(this.offsetY) > vp2px(this.loadMoreHei...
https://github.com/HunZiLei/ArkTS_PokePomodoro
473d5fbcf85da8462e5c9256febe2a47aa95795b
github
cpdd5201314/harmonyOS-music-app
products/phone/src/main/ets/pages/MusicSearchService.ets
arkts
searchFromQQ
QQ音乐搜索实现 - 修复版
private async searchFromQQ(keyword: string, page: number, limit: number): Promise<SearchResult> { const httpRequest = http.createHttp() try { // 构建请求体数据 const comm: QQComm = { ct: 11, cv: '1003006', v: '1003006', os_ver: '12', phonetype: '0', device...
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 searchFromQQ AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left keyword AST#identifier#Right AST#ERROR#Left AST#:#Left ...
private async searchFromQQ(keyword: string, page: number, limit: number): Promise<SearchResult> { const httpRequest = http.createHttp() try { // 构建请求体数据 const comm: QQComm = { ct: 11, cv: '1003006', v: '1003006', os_ver: '12', phonetype: '0', device...
https://github.com/cpdd5201314/harmonyOS-music-app
6d3e7f839abb3ccbe25ce7ab06457617f5adbe28
github
Amaz1ny/HarmonyDO-public
entry/src/main/ets/services/network/ApiClient.ets
arkts
getPostRaw
获取帖子 raw(/posts/{id}.json → raw) 失败时返回空字符串,供导出流程兜底
async getPostRaw(postId: number): Promise<string> { if (postId <= 0) { return ''; } try { const rawText: string = await this.http.get(ApiConstants.postDetail(postId)); const json: Record<string, Object> = JSON.parse(rawText) as Record<string, Object>; const rawVal = json['raw']; ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getPostRaw AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left postId AST#identifier#Right AST#ty...
async getPostRaw(postId: number): Promise<string> { if (postId <= 0) { return ''; } try { const rawText: string = await this.http.get(ApiConstants.postDetail(postId)); const json: Record<string, Object> = JSON.parse(rawText) as Record<string, Object>; const rawVal = json['raw']; ...
https://github.com/Amaz1ny/HarmonyDO-public
724d3d79482f5c444c2750c46188e39078735363
github
apap6628114/nga_oh
entry/src/main/ets/store/settings/domain/ThemeSettings.ets
arkts
applyCurrentTheme
按当前 theme 应用颜色模式与状态栏样式
applyCurrentTheme(): void { let theme: string = this.ctx.state.theme if (theme === 'original' || theme === 'white') { theme = 'light' } let mode: number let effectiveTheme: string if (theme === 'system') { mode = ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET effectiveThe...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left applyCurrentTheme 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_...
applyCurrentTheme(): void { let theme: string = this.ctx.state.theme if (theme === 'original' || theme === 'white') { theme = 'light' } let mode: number let effectiveTheme: string if (theme === 'system') { mode = ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET effectiveThe...
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/store/settings/domain/ThemeSettings.ets#L31-L61
cf1c795088c65a16e956c7227773047127fc70ba
github
darcycui/DarcyHarmonyNext
entry/src/main/ets/learn/Person.ets
arkts
constructor
构造函数实现
constructor(name: string = "", supername: string = "") { // 调用父类构造函数 super(); this.name = name; this.supername = supername; }
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 name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#identifier#Lef...
constructor(name: string = "", supername: string = "") { // 调用父类构造函数 super(); this.name = name; this.supername = supername; }
https://github.com/darcycui/DarcyHarmonyNext/blob/241d0ee75929f6b3f9e1fe5b550acf6c9533c15c/entry/src/main/ets/learn/Person.ets#L24-L29
34695683bf3cb97eedd5b6f2abeb1fb6d1b31853
github
openharmony-sig/fluttertpc_flutter_qr_reader
ohos/src/main/ets/me/hetian/flutter_qr_reader/components/viewmodel/CustomScanViewModel.ets
arkts
stopCustomScan
停止自定义扫码 @returns {void}
stopCustomScan(): void { try { customScan.stop().then(() => { }).catch((error: BusinessError) => { Log.e(TAG, 'stop failed error: ' + JSON.stringify(error)); }).finally(() => { this.scanIsStart = false; }) } catch (error) { Log.e(TAG, 'Catch: stop error= ' + JSON....
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left stopCustomScan 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_blo...
stopCustomScan(): void { try { customScan.stop().then(() => { }).catch((error: BusinessError) => { Log.e(TAG, 'stop failed error: ' + JSON.stringify(error)); }).finally(() => { this.scanIsStart = false; }) } catch (error) { Log.e(TAG, 'Catch: stop error= ' + JSON....
https://gitee.com/openharmony-sig/fluttertpc_flutter_qr_reader.git
b162e54e9e101ecd90b33b24f422ed78089217b7
gitee
Cool_foolisher1/ArkTSRepository
RandomNumberSimulator/entry/src/main/ets/components/ball/RedBlueBall.ets
arkts
ballText
球号文本 @param fontSize 字体大小 @param borderRadius 边框圆角
@Extend(Text) function ballText(fontSize: string | number | Resource = 30, borderRadius: Length | BorderRadiuses | LocalizedBorderRadiuses = 30, ballColor: ResourceColor = $r('app.color.lightest_orange')) { .fontSize(fontSize) .borderRadius(borderRadius) .backgroundColor(ballColor) .textAlign(TextAlign.Cent...
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#call_expression#Left AST#identifier#Left Extend AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left Text AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#R...
@Extend(Text) function ballText(fontSize: string | number | Resource = 30, borderRadius: Length | BorderRadiuses | LocalizedBorderRadiuses = 30, ballColor: ResourceColor = $r('app.color.lightest_orange')) { .fontSize(fontSize) .borderRadius(borderRadius) .backgroundColor(ballColor) .textAlign(TextAlign.Cent...
https://gitcode.com/Cool_foolisher1/ArkTSRepository
2a16c8edffbdecbd015b8ee4ee8f5320335069d5
gitcode
AetheriumSimulator/qemu-hmos
entry/src/main/ets/common/VNCConnection.ets
arkts
createMouseEvent
创建鼠标事件消息
static createMouseEvent(x: number, y: number, buttonMask: number): ArrayBuffer { const buffer = new ArrayBuffer(6); const view = new DataView(buffer); view.setUint8(0, 5); // PointerEvent message type view.setUint8(1, buttonMask); // Button mask view.setUint16(2, x, false); // X position (big...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createMouseEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left x AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left nu...
static createMouseEvent(x: number, y: number, buttonMask: number): ArrayBuffer { const buffer = new ArrayBuffer(6); const view = new DataView(buffer); view.setUint8(0, 5); // PointerEvent message type view.setUint8(1, buttonMask); // Button mask view.setUint16(2, x, false); // X position (big...
https://github.com/AetheriumSimulator/qemu-hmos
b48ea94c2e3ef4eb522272470c4b2f8a6a9ab57b
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
set
Copies all elements of arr to the current Int16Array. @param arr array to copy data from
public set(arr: short[]): void { this.set(arr, 0) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#...
public set(arr: short[]): void { this.set(arr, 0) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
8be4e6b4a113cf393674221c830d1948e0bd2891
gitee
harmonyos/codelabs
HarmonyOS_NEXT/LoginDemo/entry/src/main/ets/common/utils/CommonUtils.ets
arkts
loginCheckNative
Native login account and password. @param {string} account account @param {string} password password @return {string} return check result
private loginCheckNative(account: string, password: string): string { let check: string = libCheckNapi.nativeCheck(account, password); return check; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left loginCheckNative AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left account AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#st...
private loginCheckNative(account: string, password: string): string { let check: string = libCheckNapi.nativeCheck(account, password); return check; }
https://gitee.com/harmonyos/codelabs.git
69fde8c7e8c827ce8514e11f2cdd7c59b596ec7b
gitee
openharmony/codelabs
Data/DeviceHealth/entry/src/main/ets/services/EventHubManager.ets
arkts
subscribeAll
开启所有监听
static async subscribeAll(): Promise<void> { EventHubManager.subscribeBatteryWarning(); EventHubManager.subscribeStorageWarning(); }
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 subscribeAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L...
static async subscribeAll(): Promise<void> { EventHubManager.subscribeBatteryWarning(); EventHubManager.subscribeStorageWarning(); }
https://gitcode.com/openharmony/codelabs
1b848a33e28102fbfd71fa2ffb0632eba3849ebc
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/libs/htmlparser/HtmlParserLogger.ets
arkts
isEnabled
是否启用日志
static isEnabled(): boolean { return HtmlParserLogger._enabled; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isEnabled 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#boo...
static isEnabled(): boolean { return HtmlParserLogger._enabled; }
https://github.com/DaLongZhuaZi/manxia
1eaacbaefa26541b2b38cd5b80e4d0fc1b9c42ad
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/ChartModel.ets
arkts
init
initialize all paints and stuff
protected init() { // initialize the utils this.mAnimator = new ChartAnimator(this); Utils.init(); this.mMaxHighlightDistance = Utils.handleDataValues(500); this.mDescription = new Description(); this.mLegend = new Legend(); this.mLegendRenderer = new LegendRenderer(this.mViewPortHandler,...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left protected AST#identifier#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;...
protected init() { // initialize the utils this.mAnimator = new ChartAnimator(this); Utils.init(); this.mMaxHighlightDistance = Utils.handleDataValues(500); this.mDescription = new Description(); this.mLegend = new Legend(); this.mLegendRenderer = new LegendRenderer(this.mViewPortHandler,...
https://gitee.com/openharmony-tpc/ohos_mpchart.git
c5d29ed1514bcb582981123da073aa7879bee642
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/String.ets
arkts
join
Concatenates the specified string array by inserting the specified separator between all elements. @param { String[] } strings string array @param { String } delim separator between all elements @throws { NullPointerError } if strings param is null, if delim param is null @returns newly created string from string array...
public static join(strings: String[], delim: String): String { return String.join(strings, delim, '', ''); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left join AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left strings AST...
public static join(strings: String[], delim: String): String { return String.join(strings, delim, '', ''); }
https://gitcode.com/iop123123/arkts-static-skills
41ccb248f00bd652d60d92701f573ad7b8b87f04
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Array.ets
arkts
shift
Removes the first element from an array and returns that removed element. This method changes the length of the array. @returns { T | undefined } The removed element from the array; undefined if the array is empty. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public shift(): T | undefined { const len: int = this.actualLength if(len == 0) { return undefined } let obj: T = this.$_get_unsafe(0) copyToFastWithBarriers(this.buffer, this.buffer, 0, 1, len) this.popImpl() return obj }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left shift AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#ca...
public shift(): T | undefined { const len: int = this.actualLength if(len == 0) { return undefined } let obj: T = this.$_get_unsafe(0) copyToFastWithBarriers(this.buffer, this.buffer, 0, 1, len) this.popImpl() return obj }
https://gitcode.com/iop123123/arkts-static-skills
12af4f34ff4858c27525528051922f10eb08c8d7
gitcode
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test22_original_index.ets
arkts
testStringCase
=== Round 22: String case conversion, Number static methods, JSON round-trip, Object.keys, Math.min/max, early return, switch-like if-else, string compare, function composition, 2D array flatten, boolean negation chains === --- String case conversion ---
function testStringCase(): string { let s: string = 'Hello World'; let upper: string = s.toUpperCase(); let lower: string = s.toLowerCase(); return upper + '|' + lower; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testStringCase AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_t...
function testStringCase(): string { let s: string = 'Hello World'; let upper: string = s.toUpperCase(); let lower: string = s.toLowerCase(); return upper + '|' + lower; }
https://github.com/miaochiahao/ark-ghidra
5de3a62d7554cd7dd5e7ef594c4cf4c242b282d1
github
LJ666-ui/harmony-health-care
entry/src/main/ets/utils/EventPersistenceManager.ets
arkts
recordBrowse
==================== 浏览记录辅助 =====================
async recordBrowse(browseType: string, targetId: number, targetTitle: string, sourcePage: string): Promise<number> { try { const values: relationalStore.ValuesBucket = {}; values[COLUMN_BROWSE_TYPE] = browseType; values[COLUMN_TARGET_ID] = targetId; values[COL_TARGET_TITLE] = targetTitle; ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left recordBrowse AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left browseType AST#identifier#Right AST#type_annotation#Left AST#:#Lef...
async recordBrowse(browseType: string, targetId: number, targetTitle: string, sourcePage: string): Promise<number> { try { const values: relationalStore.ValuesBucket = {}; values[COLUMN_BROWSE_TYPE] = browseType; values[COLUMN_TARGET_ID] = targetId; values[COL_TARGET_TITLE] = targetTitle; ...
https://github.com/LJ666-ui/harmony-health-care
70cff49d4283fc544ff798b474c57a802e998daf
github
openharmony/codelabs
ETSUI/MemoTime/entry/src/main/ets/pages/ScheduleEditPage.ets
arkts
confirmEndTime
确认结束时间
confirmEndTime(): void { const date = new Date(this.scheduleEndTime) date.setHours(this.tempHour, this.tempMinute, 0, 0) this.scheduleEndTime = date.getTime() this.showEndTimePicker = false }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left confirmEndTime 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_blo...
confirmEndTime(): void { const date = new Date(this.scheduleEndTime) date.setHours(this.tempHour, this.tempMinute, 0, 0) this.scheduleEndTime = date.getTime() this.showEndTimePicker = false }
https://gitcode.com/openharmony/codelabs
2b2d487d4f041245c653ae77df3611bd39661118
gitcode
NissonCX/CQU-HarmonyOS-APP-Dev-Final
entry/src/main/ets/utils/DataManager.ets
arkts
getAllReminders
获取所有提醒设置
async getAllReminders(): Promise<ReminderSettings[]> { try { const data = await this.dataPreferences?.get(KEY_REMINDERS, '[]') as string; return JSON.parse(data) as ReminderSettings[]; } catch (error) { console.error('获取提醒设置失败:', JSON.stringify(error)); return []; } }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getAllReminders AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#gene...
async getAllReminders(): Promise<ReminderSettings[]> { try { const data = await this.dataPreferences?.get(KEY_REMINDERS, '[]') as string; return JSON.parse(data) as ReminderSettings[]; } catch (error) { console.error('获取提醒设置失败:', JSON.stringify(error)); return []; } }
https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final
3ad2aa9656abaa148e9925f42fa964d7954c4f25
github
Mydstiny/RemoteDeskHarmonyOS
entry/src/main/ets/services/CloudStore.ets
arkts
init
初始化数据库 + 开启云同步
async init(context: common.Context): Promise<void> { if (this.initialized) { return; } // 初始化表级同步状态 for (let i = 0; i < TABLES.length; i++) { this.tableStatus[TABLES[i]] = new TableSyncStatus(); } try { const config: relationalStore.StoreConfig = { name: DB_NAME + '.db', ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#Right AST#type_an...
async init(context: common.Context): Promise<void> { if (this.initialized) { return; } // 初始化表级同步状态 for (let i = 0; i < TABLES.length; i++) { this.tableStatus[TABLES[i]] = new TableSyncStatus(); } try { const config: relationalStore.StoreConfig = { name: DB_NAME + '.db', ...
https://github.com/Mydstiny/RemoteDeskHarmonyOS
7b22b3a99af28d8ecc7336fad2b0e9f48a71985a
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Loading/LoadingStateManager.ets
arkts
getMemoryUsage
获取内存使用量
private getMemoryUsage(): number { return 0; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getMemoryUsage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number A...
private getMemoryUsage(): number { return 0; }
https://github.com/DaLongZhuaZi/manxia
6e6dab2951b7b021ba2ef73d0a828367a8665bb7
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/06.conversions_and_contexts/01.kinds_of_conversion/03.narrowing_primitive_conversion/n_prim.ets
arkts
main
--- desc: |- 22 specific conversions on primitive types are called the narrowing primitive conversions: - short to byte or char - char to byte or short - int to byte, short, or char - long to byte, short, char, or int - float to byte, short, char, int, or long - double to byte, short, char, int, long, or float ---
function main(): int { {%- for t in case['types'] %} let src_{{loop.index}}: {{t.stype}} = {{t.src|safe}}; if ((src_{{loop.index}} as {{t.dtype}}) != ({{t.dst|safe}}) ) { return 1; } {% endfor %} return 0; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main 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#type_identifier#Left i...
function main(): int { {%- for t in case['types'] %} let src_{{loop.index}}: {{t.stype}} = {{t.src|safe}}; if ((src_{{loop.index}} as {{t.dtype}}) != ({{t.dst|safe}}) ) { return 1; } {% endfor %} return 0; }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
9d086b393e7d035b26972f4ab605f24cc01631ec
gitee
openharmony-sig/ohos_apng
library/src/main/ets/Apng.ets
arkts
removeMemoryCache
清除指定内存缓存
removeMemoryCache(src?: ResourceStr | Uint8Array) { let key = DefaultEngineKey.generateMemoryKey(src) this.memoryCache.remove(key); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left removeMemoryCache AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left src AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expressi...
removeMemoryCache(src?: ResourceStr | Uint8Array) { let key = DefaultEngineKey.generateMemoryKey(src) this.memoryCache.remove(key); }
https://gitee.com/openharmony-sig/ohos_apng.git
167fdf152f0c11e7a202e5b8ea36a7f6adf6b425
gitee
openharmony/codelabs
Data/DeviceHealth/entry/src/main/ets/security/CryptoUtil.ets
arkts
bytesToString
Uint8Array -> string Safe reversible encoding
private static bytesToString(bytes: Uint8Array): string { let result = '' for (let i = 0; i < bytes.length; i++) { result += String.fromCharCode(bytes[i]) } 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 bytesToString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bytes AST#identifier#Right AST#:#Left ...
private static bytesToString(bytes: Uint8Array): string { let result = '' for (let i = 0; i < bytes.length; i++) { result += String.fromCharCode(bytes[i]) } return result }
https://gitcode.com/openharmony/codelabs
265b49baf568aaeb9a40d9f26d52a8f0c3c24666
gitcode
openharmony/arkui_ace_engine
examples/ScrollableComponentTest/entry/src/main/ets/pages/List/DragAndDropSorting/ListItemGroup.ets
arkts
needOffset
注意: 示例实现只能处理占一行节点中间固定4个其他节点的场景
needOffset(item: string): boolean { let index = this.getIndex(item); // 变大节点之前 if (index <= this.bigIndex) { return false; } // 一行节点变大,后面的整体下移 if (this.bigIndex % 5 === 0) { return index > this.bigIndex; } // 变大节点后面的组(中间隔了一个一行节点),整体下移 let thisGroup = Math.floor(this.big...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left needOffset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left item AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#...
needOffset(item: string): boolean { let index = this.getIndex(item); // 变大节点之前 if (index <= this.bigIndex) { return false; } // 一行节点变大,后面的整体下移 if (this.bigIndex % 5 === 0) { return index > this.bigIndex; } // 变大节点后面的组(中间隔了一个一行节点),整体下移 let thisGroup = Math.floor(this.big...
https://gitee.com/openharmony/arkui_ace_engine.git
2b38598efb3e40e53b85e19fa210ccd7bf60f44f
gitee
apap6628114/nga_oh
entry/src/main/ets/store/SettingsStore.ets
arkts
reset
重置为用户默认设置(切换/登出时调用)
reset(): void { this.state = new SettingsState() this.ctx.state = this.state this.socialListSettings.reset() this.filterKeywordSettings.reset() this.noteSettings.reset() super.reset() }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left reset 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#Left A...
reset(): void { this.state = new SettingsState() this.ctx.state = this.state this.socialListSettings.reset() this.filterKeywordSettings.reset() this.noteSettings.reset() super.reset() }
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/store/SettingsStore.ets#L74-L81
80f109386b786df9ee6ba7123889e3802ec7a283
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
slice
Creates a slice of current Float32Array using range [begin, end) {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/sliceFromTo} @param { int } [begin] - start index to be taken into slice @param { int } [end] - last index to be taken into slice @returns { Float32Array } ...
public slice(begin?: int, end?: int): Float32Array { return this.sliceFromTo(begin ?? 0, end ?? this.lengthInt) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left slice AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left begin AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#...
public slice(begin?: int, end?: int): Float32Array { return this.sliceFromTo(begin ?? 0, end ?? this.lengthInt) }
https://gitcode.com/iop123123/arkts-static-skills
2e47b4cbce09bb91f79c429984fd51737ae09128
gitcode
richshaw2015/nds
ohos/entry/src/test/InputMappingProperty.test.ets
arkts
generateUnmappedKeyCode
Generate a keyCode that is NOT in the given mappings.
function generateUnmappedKeyCode(rng: PRNG, mappings: KeyMappingEntry[]): number { const mappedCodes = new Set(mappings.map((m: KeyMappingEntry) => m.keyCode)); let code: number; do { code = rng.nextInt(1000, 9999); } while (mappedCodes.has(code)); return code; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left generateUnmappedKeyCode AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left rng AST#identifier#Right AST#type_annotation#Left AST#:#Left :...
function generateUnmappedKeyCode(rng: PRNG, mappings: KeyMappingEntry[]): number { const mappedCodes = new Set(mappings.map((m: KeyMappingEntry) => m.keyCode)); let code: number; do { code = rng.nextInt(1000, 9999); } while (mappedCodes.has(code)); return code; }
https://github.com/richshaw2015/nds
ebdb4a258df6afce7d7787a9069580dff92a8acc
github
SMAT-Lab/PhantomRendering
Harmoney_Next-Tiktok/entry/src/main/ets/components/VideoComp.ets
arkts
onVideoPlayer
在视频播放时触发
onVideoPlayer() { emitter.on(Constants.GLOBAL_VIDEO_CONTROLLER_PLAYER, () => { //调用观察索引变化的方法 确保播放的视频索引和当前索引一致 this.updateActiveIndex() }) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onVideoPlayer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left...
onVideoPlayer() { emitter.on(Constants.GLOBAL_VIDEO_CONTROLLER_PLAYER, () => { //调用观察索引变化的方法 确保播放的视频索引和当前索引一致 this.updateActiveIndex() }) }
https://github.com/SMAT-Lab/PhantomRendering
f50ec84a4b85631efca0429b800b574c7390c532
github
openharmony-sig/flutter_engine
shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/ohos/FlutterAbilityAndEntryDelegate.ets
arkts
shouldDispatchAppLifecycleState
生命周期回调结束
shouldDispatchAppLifecycleState(): boolean { if (!this.isHost) { return this.isAttached; } if (this.host == null) { return false; } return this.host.shouldDispatchAppLifecycleState() && this.isAttached; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left shouldDispatchAppLifecycleState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERR...
shouldDispatchAppLifecycleState(): boolean { if (!this.isHost) { return this.isAttached; } if (this.host == null) { return false; } return this.host.shouldDispatchAppLifecycleState() && this.isAttached; }
https://gitee.com/openharmony-sig/flutter_engine.git
3fff10019000b38fd2a6fcf871e97170cd715a19
gitee
HarmonyOS_Codelabs/arkts-basic-syntax-demo
entry/src/main/ets/pages/BasicPage.ets
arkts
makeMilkTea
函数 函数声明 显示指定函数返回类型为字符串
function makeMilkTea(flavor: string, sweetness: string): string { return `A cup of ${flavor} milk tea with ${sweetness}`; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left makeMilkTea AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left flavor AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Ri...
function makeMilkTea(flavor: string, sweetness: string): string { return `A cup of ${flavor} milk tea with ${sweetness}`; }
https://gitcode.com/HarmonyOS_Codelabs/arkts-basic-syntax-demo
6fb2d31c8af98be548bfc72d541082de031bd934
gitcode
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/OCRRecognitionService.ets
arkts
searchRecognitions
搜索识别记录
static async searchRecognitions( userId: number, keyword: string, limit: number = 30 ): Promise<OCRRecognitionRecord[]> { try { return await OCRRecognitionRecordDAO.search(userId, keyword, limit); } catch (error) { console.error('[OCRRecognitionService] 搜索识别记录失败:', error); retu...
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 searchRecognitions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Lef...
static async searchRecognitions( userId: number, keyword: string, limit: number = 30 ): Promise<OCRRecognitionRecord[]> { try { return await OCRRecognitionRecordDAO.search(userId, keyword, limit); } catch (error) { console.error('[OCRRecognitionService] 搜索识别记录失败:', error); retu...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
1a5856488318158b91afdded27bd80e67e0ccf25
github
fbinba3955/Flymby
main/src/main/ets/pages/Index.ets
arkts
aboutToAppear
Emby服务器列表
aboutToAppear(): void { let context = getContext(this) as common.UIAbilityContext this.mWindow = context.windowStage.getMainWindowSync() this.preferencesManager = new PreferencesManager(getContext()) this.init() this.initWindowEvent() // 横竖屏切换,先不注册,监听事件有问题 }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc...
aboutToAppear(): void { let context = getContext(this) as common.UIAbilityContext this.mWindow = context.windowStage.getMainWindowSync() this.preferencesManager = new PreferencesManager(getContext()) this.init() this.initWindowEvent() // 横竖屏切换,先不注册,监听事件有问题 }
https://github.com/fbinba3955/Flymby
43c9885cba71c5df9bdad761f777b8d950cac577
github
Joker-x-dev/CoolMallArkTS
feature/order/src/main/ets/viewmodel/OrderDetailViewModel.ets
arkts
showConfirmReceiveDialog
显示确认收货弹窗 @returns {void} 无返回值
showConfirmReceiveDialog(): void { this.showConfirmDialog = true; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left showConfirmReceiveDialog 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#sta...
showConfirmReceiveDialog(): void { this.showConfirmDialog = true; }
https://github.com/Joker-x-dev/CoolMallArkTS
7f2837b46c80463c7c612e678f01bddc2ef4d519
github
HarmonyOS_Samples/HarmonyOSComponentUXExamples
products/phone/src/main/ets/components/action/button/components/IconButton.ets
arkts
sectionTitleStyle
Reusable text style extension for section subtitles.
@Extend(Text) function sectionTitleStyle() { .fontSize($r('sys.float.Subtitle_S')) .fontColor($r('sys.color.font_secondary')) .lineHeight(SizeToken.SIZE_NUM_19) .fontWeight(FontWeight.Medium) .width(SizeToken.SIZE_PERCENT_100) .margin({ top: PaddingToken.PADDING_12VP }) }
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#call_expression#Left AST#identifier#Left Extend AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left Text AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#R...
@Extend(Text) function sectionTitleStyle() { .fontSize($r('sys.float.Subtitle_S')) .fontColor($r('sys.color.font_secondary')) .lineHeight(SizeToken.SIZE_NUM_19) .fontWeight(FontWeight.Medium) .width(SizeToken.SIZE_PERCENT_100) .margin({ top: PaddingToken.PADDING_12VP }) }
https://gitcode.com/HarmonyOS_Samples/HarmonyOSComponentUXExamples
14bcfd483fc885f15776f5ccc6905d27862c9e38
gitcode
openharmony/vendor_unionman
unionpi_tiger/sample_hzu/videoPlayer/entry/src/main/ets/view/VideoPlaySlider.ets
arkts
iconOnClick
图标点击回调
iconOnClick() { if(this.isPlay === true) { this.controller.pause() this.isPlay = false; this.isOpacity = false; return; } if(this.flag === true) { this.controller.start(); this.isPlay = true; this.isOpacity = true; } else { this.isLoading = true; /...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left iconOnClick AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A...
iconOnClick() { if(this.isPlay === true) { this.controller.pause() this.isPlay = false; this.isOpacity = false; return; } if(this.flag === true) { this.controller.start(); this.isPlay = true; this.isOpacity = true; } else { this.isLoading = true; /...
https://gitee.com/openharmony/vendor_unionman.git
ef48a40eca8da801eb3dbaf9465de850ee7b82b4
gitee
openharmony/codelabs
Data/DeviceHealth/entry/src/main/ets/security/SecurityService.ets
arkts
encryptLogFields
Encrypt sensitive fields of event log
static encryptLogFields(log: PlainEventLog): EncryptedEventLogRow { const encryptedDetail: EncryptedData | null = log.detail ? CryptoUtil.encrypt(log.detail) : null const encryptedExtra: EncryptedData | null = log.extra ? CryptoUtil.encrypt(log.extra) : null return { type: ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left encryptLogFields AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left log AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ...
static encryptLogFields(log: PlainEventLog): EncryptedEventLogRow { const encryptedDetail: EncryptedData | null = log.detail ? CryptoUtil.encrypt(log.detail) : null const encryptedExtra: EncryptedData | null = log.extra ? CryptoUtil.encrypt(log.extra) : null return { type: ...
https://gitcode.com/openharmony/codelabs
be672e99caf48c1572fa3368d92d401b3c11d860
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Error.ets
arkts
$_invoke
Constructs a new error instance with provided message and options @param { String } [message] - Error text @param { ErrorOptions } [options] - Error options @returns { Error } - Newly created Error instance @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
static $_invoke(message?: String, options?: ErrorOptions): Error { return new Error(message, options) }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left $_invoke AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left message AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#identifier#...
static $_invoke(message?: String, options?: ErrorOptions): Error { return new Error(message, options) }
https://gitcode.com/iop123123/arkts-static-skills
aaea43c67d475ee4d21284b0e20d3b1fab70a9ae
gitcode
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/BarLineChartBaseModel.ets
arkts
setDragXEnabled
Set this to true to enable dragging on the X axis @param enabled
public setDragXEnabled(enabled: boolean): void { this.mDragXEnabled = enabled; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setDragXEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le...
public setDragXEnabled(enabled: boolean): void { this.mDragXEnabled = enabled; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
d1423aa2287835cfc8b993a4caf28a0fa8c5be24
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Map.ets
arkts
delete
Removes an Entry with specified key from the Map @param k the key to remove
delete(k: K): void { this.tree = removeFromTree(this.tree, k); }
AST#program#Left AST#expression_statement#Left AST#unary_expression#Left AST#delete#Left delete AST#delete#Right AST#ERROR#Left AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left k AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#type_identifier...
delete(k: K): void { this.tree = removeFromTree(this.tree, k); }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
ad1fea18231e17ae0ceaf394a9d5370a80d4d6e8
gitee
openharmony/codelabs
ETSUI/SchoolTimeTable/entry/src/main/ets/utils/DateUtils.ets
arkts
isCurrentWeek
修改方法签名和逻辑
static isCurrentWeek(currentWeek: number, startWeek: number, endWeek: number): boolean { // 只要当前周在开始和结束周之间即可,不再判断单双 return currentWeek >= startWeek && currentWeek <= endWeek; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isCurrentWeek AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left currentWeek AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#numb...
static isCurrentWeek(currentWeek: number, startWeek: number, endWeek: number): boolean { // 只要当前周在开始和结束周之间即可,不再判断单双 return currentWeek >= startWeek && currentWeek <= endWeek; }
https://gitcode.com/openharmony/codelabs
8950dfb1442c8fc8112fd33747c149192d36159f
gitcode
CPF-ApplicationTPC/openharmony_tpc_samples
SwipeMenuListView/library/src/main/ets/utils/SwipeMenuListUtils.ets
arkts
getResourceManager
获取资源管理器 @param context 上下文对象 @returns ResourceManager 资源管理器
public static getResourceManager(context?: common.UIAbilityContext): resourceManager.ResourceManager | undefined { return context?.resourceManager; }
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 getResourceManager AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#?#L...
public static getResourceManager(context?: common.UIAbilityContext): resourceManager.ResourceManager | undefined { return context?.resourceManager; }
https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples
0713eecd64c4e86b6b17058b195be02b7649c79e
gitcode
Explore-In-HMOS-Wearable/how-to-use-uiability-lifecycle
entry/src/main/ets/pages/Index.ets
arkts
updateLog
Updates the log list by retrieving the latest lifecycle logs.
updateLog() { this.logs = [...LifeCycleLog.getAll()]; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left updateLog AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AST...
updateLog() { this.logs = [...LifeCycleLog.getAll()]; }
https://github.com/Explore-In-HMOS-Wearable/how-to-use-uiability-lifecycle
add26fb276998d625f2f4bd045e804c424c41989
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/PaginationHandler.ets
arkts
getCurrentPage
获取当前页码
getCurrentPage(sourceId: string): number { const state = this.paginationStates.get(sourceId); return state ? state.currentPage : 1; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCurrentPage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST#...
getCurrentPage(sourceId: string): number { const state = this.paginationStates.get(sourceId); return state ? state.currentPage : 1; }
https://github.com/DaLongZhuaZi/manxia
b7c9349a27709da41ff71d8fdb891207f1ed9f7b
github
openharmony/applications_contacts
entry/src/main/ets/model/ContactAbilityModel.ets
arkts
organizationContact
Save the position information of the contact company to the database. @param {Object} addParams Contact Information @param {string} DAHelper Database path @param {string} result Contact ID @param {string} uri Database address
organizationContact(addParams: ContactInfo, DAHelper: dataShare.DataShareHelper, result: string, uri: string) { let company = ''; let position = ''; if (addParams.company != undefined && addParams.company.length > 0) { company = addParams.company; } if (addParams.position != undefined && add...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left organizationContact AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left addParams AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ContactInfo AST#...
organizationContact(addParams: ContactInfo, DAHelper: dataShare.DataShareHelper, result: string, uri: string) { let company = ''; let position = ''; if (addParams.company != undefined && addParams.company.length > 0) { company = addParams.company; } if (addParams.position != undefined && add...
https://gitee.com/openharmony/applications_contacts.git
02d85c8a124882475e16bdb346e93f34fd5836d3
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/PermanentImageCacheManager.ets
arkts
initCachePaths
初始化缓存路径
private initCachePaths(reason: string): boolean { try { const context = uiContextManager.getAbilityContext(); if (!context) { if (!this.pendingContextLogged) { logger.debug(TAG, `Context未初始化,缓存路径等待后续按需初始化: reason=${reason}`); this.pendingContextLogged = true; } ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left initCachePaths AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left reason AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
private initCachePaths(reason: string): boolean { try { const context = uiContextManager.getAbilityContext(); if (!context) { if (!this.pendingContextLogged) { logger.debug(TAG, `Context未初始化,缓存路径等待后续按需初始化: reason=${reason}`); this.pendingContextLogged = true; } ...
https://github.com/DaLongZhuaZi/manxia
364ee5e379b055ef9f7315a845803bcdfa77be13
github
PollenWang6/HiXD
entry/src/main/ets/services/CasLoginService.ets
arkts
checkAndAutoLogin
========== 自动登录(TGC 优先 → 密码兜底)========== 不依赖持久化标记,直接用 HTTP 检测真实登录状态 返回值:true=已登录,false=需要手动登录
async checkAndAutoLogin(): Promise<boolean> { // Step 1: TGC 自动恢复(已有 cookie,无需密码) try { const restored: boolean = await this.tryAutoRestoreLogin(); if (restored) { console.info(TAG, 'checkAndAutoLogin: TGC restored OK'); // Log TGC health for diagnostics const tgc = this.ht...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left checkAndAutoLogin AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#ge...
async checkAndAutoLogin(): Promise<boolean> { // Step 1: TGC 自动恢复(已有 cookie,无需密码) try { const restored: boolean = await this.tryAutoRestoreLogin(); if (restored) { console.info(TAG, 'checkAndAutoLogin: TGC restored OK'); // Log TGC health for diagnostics const tgc = this.ht...
https://github.com/PollenWang6/HiXD
59bb32b61485c894b843f602c4f415a4088fed2f
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Set.ets
arkts
values
Returns elements from the Set as an array @returns an array of Set values
values(): ValuesIterator<K> { return this.map.keys(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left values AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#...
values(): ValuesIterator<K> { return this.map.keys(); }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
c5f609d22e446bdc5b74695b34207c625713db8c
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/EBookDataManager.ets
arkts
getPrivateEBooks
[新增] 获取隐私电子书列表 @returns Promise<EBook[]> 隐私电子书列表
public async getPrivateEBooks(): Promise<EBook[]> { try { const sql = `SELECT * FROM ebook_info WHERE isPrivate = 1 ORDER BY lastUpdateTime DESC`; const records = await this.dbManager.querySql(sql, []); const ebooks: EBook[] = []; for (const record of records) { const ebook ...
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 getPrivateEBooks AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST...
public async getPrivateEBooks(): Promise<EBook[]> { try { const sql = `SELECT * FROM ebook_info WHERE isPrivate = 1 ORDER BY lastUpdateTime DESC`; const records = await this.dbManager.querySql(sql, []); const ebooks: EBook[] = []; for (const record of records) { const ebook ...
https://github.com/DaLongZhuaZi/manxia
bc4142678a7f038c9045187538aee22c45f121c1
github
pangpang20/antennaPodHM
entry/src/main/ets/service/PlayerService.ets
arkts
startBackgroundTask
开始后台任务
private async startBackgroundTask(): Promise<void> { if (this.isBackgroundRunning || !this.context) { return; } try { const wantAgentInfo: wantAgent.WantAgentInfo = { wants: [ { bundleName: 'com.pangpang.antennapodhm', abilityName: 'EntryAbility' ...
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 startBackgroundTask AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Rig...
private async startBackgroundTask(): Promise<void> { if (this.isBackgroundRunning || !this.context) { return; } try { const wantAgentInfo: wantAgent.WantAgentInfo = { wants: [ { bundleName: 'com.pangpang.antennapodhm', abilityName: 'EntryAbility' ...
https://github.com/pangpang20/antennaPodHM
9dce18bf7aa5476e6d3f42728449a7826fad1a70
github
the-wwyang/kids-learning-app
src/main/ets/utils/AudioManager.ets
arkts
registerSound
注册音效配置
private registerSound(config: SoundConfig): void { this.soundConfigs.set(config.type, config); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left registerSound AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le...
private registerSound(config: SoundConfig): void { this.soundConfigs.set(config.type, config); }
https://github.com/the-wwyang/kids-learning-app
84297e57fb996afabccaf755c97415ba1bf771f9
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Lifecycle/CancellablePromise.ets
arkts
race
等待任一 Promise 完成(支持取消)
static race<T>(promises: Array<CancellablePromise<T>>): CancellablePromise<T> { return new CancellablePromise<T>((resolve, reject, signal) => { if (signal.aborted) { reject(new CancellationError(signal.reason)); return; } signal.addEventListener('abort', () => { pr...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left race AST#identifier#Right AST#ERROR#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Righ...
static race<T>(promises: Array<CancellablePromise<T>>): CancellablePromise<T> { return new CancellablePromise<T>((resolve, reject, signal) => { if (signal.aborted) { reject(new CancellationError(signal.reason)); return; } signal.addEventListener('abort', () => { pr...
https://github.com/DaLongZhuaZi/manxia
8d704eb95d39ab52e4f754ca350c1bbe2748258d
github
jjjjjjava/ffmpeg_tools
src/main/ets/ffmpeg/FFmpegFactory.ets
arkts
imageScale
图片缩放 @param input 输入图片路径 @param output 输出图片路径 @param width 目标宽度 @param height 目标高度(-1 表示保持宽高比)
public static imageScale(input: string, output: string, width: number, height: number = -1): string[] { return [ 'ffmpeg', '-i', input, '-vf', `scale=${width}:${height}`, '-q:v', '2', '-y', output ]; }
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 imageScale AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left input AST#identifier#Right AST#:#Left : AST#...
public static imageScale(input: string, output: string, width: number, height: number = -1): string[] { return [ 'ffmpeg', '-i', input, '-vf', `scale=${width}:${height}`, '-q:v', '2', '-y', output ]; }
https://github.com/jjjjjjava/ffmpeg_tools
cb7f7f84c1d264d30de48fe32c99c50e36ea2de9
github
DaLongZhuaZi/manxia
entry/src/main/ets/components/BookOpenTransition.ets
arkts
aboutToAppear
是否为系统资源图片(网络图片或app.media资源) ========== 生命周期 ==========
aboutToAppear(): void { logger.info(TAG, `组件初始化,模式: ${this.mode}, type=${this.contentType}, ebookBackground=${this.ebookBackground ? `有(色=${this.ebookBackground.backgroundColor}, 图=${this.ebookBackground.backgroundImagePath || '无'})` : '无'}`); this.resetLoadingProgress(); // 初始化当前位置为封面位置 this.currentX...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc...
aboutToAppear(): void { logger.info(TAG, `组件初始化,模式: ${this.mode}, type=${this.contentType}, ebookBackground=${this.ebookBackground ? `有(色=${this.ebookBackground.backgroundColor}, 图=${this.ebookBackground.backgroundImagePath || '无'})` : '无'}`); this.resetLoadingProgress(); // 初始化当前位置为封面位置 this.currentX...
https://github.com/DaLongZhuaZi/manxia
e7cfbb5f02499e86d231b3c3ec5b675727e23c84
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelDataManager.ets
arkts
getSFWBooks
[新增] 获取SFW(非NSFW)小说列表 @returns Promise<NovelBook[]> SFW小说列表
async getSFWBooks(): Promise<NovelBook[]> { const store = this.getStore(); const rs = await store.querySql( 'SELECT * FROM novel_book WHERE (isNSFW = 0 OR isNSFW IS NULL) ORDER BY lastReadTime DESC' ); return this.parseBookResults(rs); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getSFWBooks AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_...
async getSFWBooks(): Promise<NovelBook[]> { const store = this.getStore(); const rs = await store.querySql( 'SELECT * FROM novel_book WHERE (isNSFW = 0 OR isNSFW IS NULL) ORDER BY lastReadTime DESC' ); return this.parseBookResults(rs); }
https://github.com/DaLongZhuaZi/manxia
c499def449170aade1457da85a3515715111c70a
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Source/SuwayomiCacheManager.ets
arkts
isSourceIconCached
检查图源图标是否已缓存
public isSourceIconCached(sourceId: string, iconUrl: string): boolean { try { const cachePath = this.getSourceIconCachePath(sourceId, iconUrl); 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 isSourceIconCached AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#st...
public isSourceIconCached(sourceId: string, iconUrl: string): boolean { try { const cachePath = this.getSourceIconCachePath(sourceId, iconUrl); return this.isReadableFile(cachePath); } catch (_error) { return false; } }
https://github.com/DaLongZhuaZi/manxia
d6e32b9613fda94567d21913d5be499fc71a9ea3
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Boolean.ets
arkts
negate
Inverts this instance value @returns { Boolean } The logical negation of this Boolean instance @syscap SystemCapability.Utils.Lang @FaAndStageModel
public negate(): Boolean { return new Boolean(!this.value) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left negate 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 Boolean AST#ide...
public negate(): Boolean { return new Boolean(!this.value) }
https://gitcode.com/iop123123/arkts-static-skills
74736f24b11eabe738ee34e344a6ea23ae47affd
gitcode
the-wwyang/kids-learning-app
src/main/ets/storage/UserSettingsStorageService.ets
arkts
importSettings
从JSON字符串导入设置 @param jsonString JSON字符串
static async importSettings(jsonString: string): Promise<void> { try { const settings = JSON.parse(jsonString) as UserSettings; await UserSettingsStorageService.saveSettings(settings); console.log('[UserSettingsStorage] Settings imported'); } catch (error) { console.error('[UserSetting...
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 importSettings AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left jsonString AST#identifier#Right AST#ERROR#Left AST#:#Lef...
static async importSettings(jsonString: string): Promise<void> { try { const settings = JSON.parse(jsonString) as UserSettings; await UserSettingsStorageService.saveSettings(settings); console.log('[UserSettingsStorage] Settings imported'); } catch (error) { console.error('[UserSetting...
https://github.com/the-wwyang/kids-learning-app
82c61c7a939383290b64425a0890a24f1ff8bab4
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Source/SuwayomiSource.ets
arkts
getNormalizedServerUrl
规范化服务器地址,确保不以 / 结尾
private getNormalizedServerUrl(): string { const rawServerUrl = (this.config.serverUrl || '').trim(); if (!rawServerUrl) { return ''; } const hasScheme = /^[a-zA-Z][a-zA-Z0-9+\-.]*:\/\//.test(rawServerUrl); const withScheme = hasScheme ? rawServerUrl : `http://${rawServerUrl}`; return w...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getNormalizedServerUrl 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 ...
private getNormalizedServerUrl(): string { const rawServerUrl = (this.config.serverUrl || '').trim(); if (!rawServerUrl) { return ''; } const hasScheme = /^[a-zA-Z][a-zA-Z0-9+\-.]*:\/\//.test(rawServerUrl); const withScheme = hasScheme ? rawServerUrl : `http://${rawServerUrl}`; return w...
https://github.com/DaLongZhuaZi/manxia
a3477f5315105a564368934406dbae12360c7a63
github
honjow/Next2V
shared/src/main/ets/network/ApiService.ets
arkts
getNodeByName
Get node detail by name
async getNodeByName(name: string): Promise<V2exNode> { return this.http.get<V2exNode>( `${ApiConstants.API_NODE_SHOW}?${ApiService.queryParam('name', name)}`, ) }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getNodeByName AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left name AST#identifier#Right AST#type_annotation#Left AST#:#Left : A...
async getNodeByName(name: string): Promise<V2exNode> { return this.http.get<V2exNode>( `${ApiConstants.API_NODE_SHOW}?${ApiService.queryParam('name', name)}`, ) }
https://github.com/honjow/Next2V
b852e141b1075c17544d8429722e0629102f89e0
github
ASweetBite/HarmonyPulse
entry/src/main/ets/utils/services/MusicShareService.ets
arkts
shareSongs
分享多首歌曲 @param songs 歌曲数组
async shareSongs(songs: SongItemType[]): Promise<void> { if (!this.context) { console.error("MusicShareService: Context is null"); return; } if (!songs || songs.length === 0) { console.warn("MusicShareService: 分享列表为空"); return; } try { console.info(`MusicShareServic...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left shareSongs AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left songs AST#identifier#Right AST#typ...
async shareSongs(songs: SongItemType[]): Promise<void> { if (!this.context) { console.error("MusicShareService: Context is null"); return; } if (!songs || songs.length === 0) { console.warn("MusicShareService: 分享列表为空"); return; } try { console.info(`MusicShareServic...
https://github.com/ASweetBite/HarmonyPulse/blob/a7fcf153a20bafa29ac1fb8c25743dd5350dc54c/entry/src/main/ets/utils/services/MusicShareService.ets#L105-L166
ded2d62ad718e553d3153afff2fc7f77c703d108
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets
arkts
toTimeString
Returns the time portion of a `Date` object interpreted in the local timezone in English. @returns { string } get new date value @syscap SystemCapability.Utils.Lang @FaAndStageModel
public toTimeString(): string { return this.timeString() + " " + this.timeZoneString(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toTimeString 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#st...
public toTimeString(): string { return this.timeString() + " " + this.timeZoneString(); }
https://gitcode.com/iop123123/arkts-static-skills
4d812c78053c1223d3e4f36f58e3c0e051c1d657
gitcode
webabcd/HarmonyDemo
entry/src/main/ets/pages/component/progress/SliderDemo.ets
arkts
applyContent
返回指定的自定义 Slider
applyContent() : WrappedBuilder<[SliderConfiguration]> { return wrapBuilder(buildSlider) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left applyContent 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#binary_expression#L...
applyContent() : WrappedBuilder<[SliderConfiguration]> { return wrapBuilder(buildSlider) }
https://github.com/webabcd/HarmonyDemo
b580e5d3c11943fd089e8a33a8a4329fa75de87b
github
LJ666-ui/harmony-health-care
entry/src/main/ets/utils/AccessibilityUtils.ets
arkts
getHue
计算颜色色相 @param color 颜色 @returns 色相值(0-360)
public static getHue(color: string): number { const rgb = this.parseColor(color); const r = rgb.r / 255; const g = rgb.g / 255; const b = rgb.b / 255; const max = Math.max(r, g, b); const min = Math.min(r, g, b); const diff = max - min; if (diff === 0) { return 0; // 灰色...
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 getHue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left color AST#identifier#Right AST#:#Left : AST#:#Ri...
public static getHue(color: string): number { const rgb = this.parseColor(color); const r = rgb.r / 255; const g = rgb.g / 255; const b = rgb.b / 255; const max = Math.max(r, g, b); const min = Math.min(r, g, b); const diff = max - min; if (diff === 0) { return 0; // 灰色...
https://github.com/LJ666-ui/harmony-health-care
612a0d5cf275c99590f8585c4ee589fdda36900f
github
erosTeam/NextE
shared/src/main/ets/network/EhError.ets
arkts
kindOf
Read the kind off a caught value; anything that is not an EhError maps to Unknown.
static kindOf(err: Object): EhErrorKind { const e = err as EhError return e !== null && e !== undefined && e.isEhError === true ? e.kind : EhErrorKind.Unknown }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left kindOf AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left err AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Object AST...
static kindOf(err: Object): EhErrorKind { const e = err as EhError return e !== null && e !== undefined && e.isEhError === true ? e.kind : EhErrorKind.Unknown }
https://github.com/erosTeam/NextE
1e061a65251fad70bb008b6153aff032c696490c
github
harmonyos/codelabs
HarmonyOS_NEXT/LoginDemo/entry/src/main/ets/viewmodel/MainViewModel.ets
arkts
getListImageData
Get data of the list. @return {Array<PageResource>} secondGridData.
public getListImageData(): Array<ItemData> { let secondGridData: Array<ItemData> = []; LIST_IMAGE_DATA.forEach((itemData: ItemData, index: number) => { let data: ItemData = { id: index, title: itemData.title, img: itemData.img, others: itemData.others, clickPrompt...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getListImageData 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#expre...
public getListImageData(): Array<ItemData> { let secondGridData: Array<ItemData> = []; LIST_IMAGE_DATA.forEach((itemData: ItemData, index: number) => { let data: ItemData = { id: index, title: itemData.title, img: itemData.img, others: itemData.others, clickPrompt...
https://gitee.com/harmonyos/codelabs.git
3455932f8a39f9ac24a2c19d7c520ad60f599d16
gitee
killetom/ktretrofit
ktretrofit/src/main/ets/retrofit/util/Semaphore.ets
arkts
acquire
Acquire a permit from the semaphore. If no permit is available, this will block until a permit becomes available. Note: This uses a busy-waiting approach, which is not ideal but works for the current use case.
acquire(): void { if (this.count > 0) { this.count--; return; } // Use a busy-waiting approach to simulate blocking // In a real application, you might want to use a more sophisticated approach let acquired = false; const startTime = Date.now(); const timeout = 30000; // 30 se...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left acquire 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#Left...
acquire(): void { if (this.count > 0) { this.count--; return; } // Use a busy-waiting approach to simulate blocking // In a real application, you might want to use a more sophisticated approach let acquired = false; const startTime = Date.now(); const timeout = 30000; // 30 se...
https://github.com/killetom/ktretrofit
884f13e5502db4db8eaf8416637dc28258b12677
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/WebViewSourceManager.ets
arkts
removeEngineByName
通过图源名称移除MangaSourceEngine缓存 用于图源被删除或更新时清理旧缓存
removeEngineByName(sourceName: string): void { if (this.mangaEngines.has(sourceName)) { logger.info(TAG, `移除MangaSourceEngine缓存: "${sourceName}"`); this.mangaEngines.delete(sourceName); // 同时清理sourceIdToName映射 const entries = Array.from(this.sourceIdToName.entries()); for (con...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left removeEngineByName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ...
removeEngineByName(sourceName: string): void { if (this.mangaEngines.has(sourceName)) { logger.info(TAG, `移除MangaSourceEngine缓存: "${sourceName}"`); this.mangaEngines.delete(sourceName); // 同时清理sourceIdToName映射 const entries = Array.from(this.sourceIdToName.entries()); for (con...
https://github.com/DaLongZhuaZi/manxia
ecf821d76dedbac469440d2c49444cffffbce32d
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/DataManager.ets
arkts
searchComicsByChapterTitle
按章节标题搜索关联的漫画(返回唯一漫画列表)
public async searchComicsByChapterTitle(keyword: string): Promise<ComicInfo[]> { try { const chapterRecords = await this.databaseManager.query( 'chapter', undefined, 'title LIKE ?', [`%${keyword}%`], 'chapterNumber ASC' ); // 收集唯一的漫画ID const comicId...
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 searchComicsByChapterTitle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left keyword AST#identifier#Right AST#ERROR#Left ...
public async searchComicsByChapterTitle(keyword: string): Promise<ComicInfo[]> { try { const chapterRecords = await this.databaseManager.query( 'chapter', undefined, 'title LIKE ?', [`%${keyword}%`], 'chapterNumber ASC' ); // 收集唯一的漫画ID const comicId...
https://github.com/DaLongZhuaZi/manxia
4850f7fd24167f99e097b21605e316f46fcd3bfc
github
arkui-x/samples
CodeLab/Cases/feature/customscan/src/main/ets/viewmodel/CustomScanViewModel.ets
arkts
updateCameraCompSize
更新相机流展示组件(XComponent)的尺寸 @returns {void}
async updateCameraCompSize(): Promise<void> { // 通过窗口属性修改组件宽高 let windowSize: window.Size | null = this.scanSize.setWindowSize(); if (windowSize) { this.scanSize.setScanXComponentSize(true, windowSize) this.cameraCompWidth = this.scanSize.xComponentSize.width; this.cameraCompHeight = th...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left updateCameraCompSize AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#...
async updateCameraCompSize(): Promise<void> { // 通过窗口属性修改组件宽高 let windowSize: window.Size | null = this.scanSize.setWindowSize(); if (windowSize) { this.scanSize.setScanXComponentSize(true, windowSize) this.cameraCompWidth = this.scanSize.xComponentSize.width; this.cameraCompHeight = th...
https://gitcode.com/arkui-x/samples
e2476237ff209486f1017c249d79e50a5acf18f1
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
constructor
Creates an Uint8ClampedArray from FixedArray<int> @param { FixedArray<int> } numbers - data initializer @syscap SystemCapability.Utils.Lang @FaAndStageModel
public constructor(numbers: FixedArray<int>) { this(numbers.length) for (let i: int = 0; i < this.lengthInt; ++i) { this.setUnsafeClamp(i, numbers[i].toInt()) } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left numbers AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_exp...
public constructor(numbers: FixedArray<int>) { this(numbers.length) for (let i: int = 0; i < this.lengthInt; ++i) { this.setUnsafeClamp(i, numbers[i].toInt()) } }
https://gitcode.com/iop123123/arkts-static-skills
b411af278474b925d15c15b5930b0ead0741d9ac
gitcode
arkui-x/samples
CodeLab/Cases/feature/clockin/src/main/ets/components/ClockInComponent.ets
arkts
removeLocationListener
移除用户位置监听。
removeLocationListener() { geoLocationManager.off('locationChange'); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left removeLocationListener 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_b...
removeLocationListener() { geoLocationManager.off('locationChange'); }
https://gitcode.com/arkui-x/samples
0258319615836e1560931bcf6ad0e84e4b58e9df
gitcode
openharmony-sig/fluttertpc_camerawesome
ohos/ohos/src/main/ets/components/cameraX/CameraState.ets
arkts
getAllPriveiwSize
获取支持的所有分辨率 @returns
getAllPriveiwSize(): PreviewSize[] { let psList: Array<PreviewSize> = [] for (let pf of this.previewProfilesArray!!) { psList.push(new PreviewSize(pf.size.width, pf.size.height)) } return psList }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getAllPriveiwSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left PreviewSize AS...
getAllPriveiwSize(): PreviewSize[] { let psList: Array<PreviewSize> = [] for (let pf of this.previewProfilesArray!!) { psList.push(new PreviewSize(pf.size.width, pf.size.height)) } return psList }
https://gitee.com/openharmony-sig/fluttertpc_camerawesome.git
064e0c15997119d96317b91026304dc2879428a2
gitee
Joker-x-dev/CoolMallArkTS
feature/goods/src/main/ets/viewmodel/GoodsCategoryViewModel.ets
arkts
onSortClick
处理排序点击事件 @param {SortType} sortType - 点击的排序类型 @returns {void} 无返回值
onSortClick(sortType: SortType): void { const isSameType: boolean = this.currentSortType === sortType; const stateFlow: SortState[] = GoodsCategoryViewModel.SORT_STATE_FLOW_MAP.get(sortType) ?? [SortState.NONE]; const currentState: SortState = isSameType ? this.currentSortState : SortState.NONE; const...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onSortClick AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left sortType AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left SortType AST#identifier#Right AST#)#Left...
onSortClick(sortType: SortType): void { const isSameType: boolean = this.currentSortType === sortType; const stateFlow: SortState[] = GoodsCategoryViewModel.SORT_STATE_FLOW_MAP.get(sortType) ?? [SortState.NONE]; const currentState: SortState = isSameType ? this.currentSortState : SortState.NONE; const...
https://github.com/Joker-x-dev/CoolMallArkTS
de2e9f598921ec5ecb6536cec2a5fe06ba8b1eaf
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
set
Copies all elements of arr to the current Float32Array starting from insertPos. {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set} @param { FixedArray<number> } arr - array to copy data from @param { int } insertPos - start index where data from arr will be inserted ...
public set(arr: FixedArray<number>, insertPos: int): void { const offset = insertPos if (offset < 0 || offset + arr.length > this.lengthInt) { throw new RangeError("offset is out of bounds") } for (let i = 0; i < arr.length; ++i) { this.setUnsafe(offset + i, a...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#...
public set(arr: FixedArray<number>, insertPos: int): void { const offset = insertPos if (offset < 0 || offset + arr.length > this.lengthInt) { throw new RangeError("offset is out of bounds") } for (let i = 0; i < arr.length; ++i) { this.setUnsafe(offset + i, a...
https://gitcode.com/iop123123/arkts-static-skills
cb85f5f2a3fd0c311069b57b8853e4602266bf65
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/PermanentImageCacheManager.ets
arkts
checkAndCleanTempCache
检查并清理临时缓存
private async checkAndCleanTempCache(sourceId: number, maxSize: number): Promise<void> { try { const sourceTempPath = `${this.tempCachePath}/source_${sourceId}`; if (!SafeFileUtils.accessSync(sourceTempPath)) { return; } const currentSize = await this.calculateDirectorySize(...
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 checkAndCleanTempCache AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left ...
private async checkAndCleanTempCache(sourceId: number, maxSize: number): Promise<void> { try { const sourceTempPath = `${this.tempCachePath}/source_${sourceId}`; if (!SafeFileUtils.accessSync(sourceTempPath)) { return; } const currentSize = await this.calculateDirectorySize(...
https://github.com/DaLongZhuaZi/manxia
64cdd2e3a3a575feeec727813e600e87ac9e601d
github
Delsin-Yu/JustPDF
entry/src/main/ets/entryability/EntryAbility.ets
arkts
attemptPendingContinuationLaunch
跨设备接续:Router 就绪时通过 guarded replaceUrl 打开;否则保留 pendingContinuationWant。
private attemptPendingContinuationLaunch(): boolean { if (this.pendingContinuationWant === undefined) { return false; } const args = this.buildContinuationRouterArgs(this.pendingContinuationWant); if (args === undefined) { logContinuationError('attemptPendingContinuationLaunch 接续载荷无效'); ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left attemptPendingContinuationLaunch 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#bo...
private attemptPendingContinuationLaunch(): boolean { if (this.pendingContinuationWant === undefined) { return false; } const args = this.buildContinuationRouterArgs(this.pendingContinuationWant); if (args === undefined) { logContinuationError('attemptPendingContinuationLaunch 接续载荷无效'); ...
https://github.com/Delsin-Yu/JustPDF/blob/07d9dd917e7592f584d67821fb06a7369bd3f15b/entry/src/main/ets/entryability/EntryAbility.ets#L290-L310
b84e01432e06c2b76effc217d4acbd4cfd7992a0
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/utils/CryptoUtil.ets
arkts
getPemCertBytes
获取 PEM 编码的证书字节(用于配对)
static getPemCertBytes(der: Uint8Array): Uint8Array { const pem = CryptoUtil.derToPem(der); const textEncoder = new util.TextEncoder(); return textEncoder.encodeInto(pem); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getPemCertBytes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left der AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left U...
static getPemCertBytes(der: Uint8Array): Uint8Array { const pem = CryptoUtil.derToPem(der); const textEncoder = new util.TextEncoder(); return textEncoder.encodeInto(pem); }
https://github.com/AlkaidLab/moonlight-harmony
ce30d53634be5e772633cb2110f4e3a7edae3ae9
github
Amaz1ny/HarmonyDO-public
entry/src/main/ets/models/User.ets
arkts
backgroundUrl
获取背景图 URL(优先 profile,其次 card)
get backgroundUrl(): string { if (this.profileBackgroundUploadUrl !== null && this.profileBackgroundUploadUrl.length > 0) { return this.profileBackgroundUploadUrl; } if (this.cardBackgroundUploadUrl !== null && this.cardBackgroundUploadUrl.length > 0) { return this.cardBackgroundUploadUrl; ...
AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left backgroundUrl 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#Rig...
get backgroundUrl(): string { if (this.profileBackgroundUploadUrl !== null && this.profileBackgroundUploadUrl.length > 0) { return this.profileBackgroundUploadUrl; } if (this.cardBackgroundUploadUrl !== null && this.cardBackgroundUploadUrl.length > 0) { return this.cardBackgroundUploadUrl; ...
https://github.com/Amaz1ny/HarmonyDO-public
422493cbfa62dd1f022a494cc4ed0523f613e64c
github
xufei5789651/HmWan
commons/utils/src/main/ets/manager/PreferenceManager.ets
arkts
initPreference
获取Preferences实例 @param storeName @returns
private async initPreference(context: Context, storeName: string): Promise<void> { return preferences.getPreferences(context, storeName) .then((preferences: preferences.Preferences) => { this.preferences = preferences; }); }
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 initPreference AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Lef...
private async initPreference(context: Context, storeName: string): Promise<void> { return preferences.getPreferences(context, storeName) .then((preferences: preferences.Preferences) => { this.preferences = preferences; }); }
https://github.com/xufei5789651/HmWan
31084b2d1fccc096c474940b12b213abfdfa26c4
github
Joker-x-dev/CoolMallArkTS
core/network/src/main/ets/datasource/page/PageNetworkDataSourceImpl.ets
arkts
getConfirmOrder
获取确认订单页数据 @returns {Promise<NetworkResponse<ConfirmOrder>>} 确认订单信息
async getConfirmOrder(): Promise<NetworkResponse<ConfirmOrder>> { const resp: AxiosResponse<NetworkResponse<ConfirmOrder>> = await NetworkClient.http.get("page/confirmOrder"); return resp.data; }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getConfirmOrder AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#gene...
async getConfirmOrder(): Promise<NetworkResponse<ConfirmOrder>> { const resp: AxiosResponse<NetworkResponse<ConfirmOrder>> = await NetworkClient.http.get("page/confirmOrder"); return resp.data; }
https://github.com/Joker-x-dev/CoolMallArkTS
2568a025931710ff2c8a1ecdb6f5661bfa3d533b
github