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
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/BookshelfCategoryManager.ets
arkts
moveCategoryToPosition
移动分类到指定位置
async moveCategoryToPosition(categoryId: string, newPosition: number): Promise<void> { const category = this.categories.find(c => c.id === categoryId); if (!category) return; const oldPosition = category.order; if (oldPosition === newPosition) return; // 更新其他分类的顺序 this.categories.forEach(c =...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left moveCategoryToPosition AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left categoryId AST#identifier#Right AST#type_annotation#Left...
async moveCategoryToPosition(categoryId: string, newPosition: number): Promise<void> { const category = this.categories.find(c => c.id === categoryId); if (!category) return; const oldPosition = category.order; if (oldPosition === newPosition) return; // 更新其他分类的顺序 this.categories.forEach(c =...
https://github.com/DaLongZhuaZi/manxia
f1b6e3ea7879a84669ec4a8c38d2e7a412b1b4fc
github
HuolalaTech/sophon_harmony
sophon/src/main/ets/components/page/SandboxFilePage.ets
arkts
renderFileNode
递归渲染 FileNode
renderFileNode(node: FileNode, level: number) { ListItem() { Column() { Row() { Flex() { }.width(level == 0 ? 0 : 20) // 根据层级设置缩进 .height(22) .margin({ left: level * 10, right: 4 }) .drawModifier(new DrawLineModifier()) ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left renderFileNode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left node AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left FileNode AST#identifier#Ri...
renderFileNode(node: FileNode, level: number) { ListItem() { Column() { Row() { Flex() { }.width(level == 0 ? 0 : 20) // 根据层级设置缩进 .height(22) .margin({ left: level * 10, right: 4 }) .drawModifier(new DrawLineModifier()) ...
https://github.com/HuolalaTech/sophon_harmony
a924f41e6294a76e547727315ae651cc2a65fb0a
github
Nekofox-POT/LinMusic
entry/src/main/ets/pages/ui/web_ui.ets
arkts
save_data
保存数据 //
save_data() {}
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left save_data 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...
save_data() {}
https://github.com/Nekofox-POT/LinMusic
d450e26cdade90986b6c5c3e3f00e4f1f792558d
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets
arkts
parseXPathPredicate
解析XPath谓词
private parseXPathPredicate(predicate: string): XPathPredicate { const pred: XPathPredicate = { type: 'unknown', value: predicate }; // 数字索引 [1], [2] if (/^\d+$/.test(predicate)) { pred.type = 'position'; pred.position = parseInt(predicate); return pred; } // last() ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseXPathPredicate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left predicate AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string A...
private parseXPathPredicate(predicate: string): XPathPredicate { const pred: XPathPredicate = { type: 'unknown', value: predicate }; // 数字索引 [1], [2] if (/^\d+$/.test(predicate)) { pred.type = 'position'; pred.position = parseInt(predicate); return pred; } // last() ...
https://github.com/DaLongZhuaZi/manxia
4d1b1b910caca97ab645dde3288e1612524d727f
github
Nekofox-POT/LinMusic
entry/src/main/ets/建筑垃圾堆/class_audio_ffmpeg_player.ets
arkts
avs_start_up
元音频 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// av_session专用 // ///////////////// 初始化 //
async avs_start_up() { // 创建AVSession log('创建avs') this.session = await avSession.createAVSession(getContext(this), 'ArkMusic', 'audio') // 注册行为 log('注册行为') this.session.on("play", () => {this.playing()}) // 播放 this.session.on("pause", () => {this.pause()}) // 暂停 this.session.on("set...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left avs_start_up AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#{#Left { AST#{#Right AST#ERROR#Right AST#comment...
async avs_start_up() { // 创建AVSession log('创建avs') this.session = await avSession.createAVSession(getContext(this), 'ArkMusic', 'audio') // 注册行为 log('注册行为') this.session.on("play", () => {this.playing()}) // 播放 this.session.on("pause", () => {this.pause()}) // 暂停 this.session.on("set...
https://github.com/Nekofox-POT/LinMusic
009768d157ea71baafacaf9af87c7a857672a216
github
openharmony-sig/smartperf
device/device_ui/entry/src/main/ets/common/ui/detail/chart/components/Legend.ets
arkts
getFormLineWidth
returns the line width in dp for drawing forms that consist of lines @return
public getFormLineWidth() : number { return this.mFormLineWidth; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getFormLineWidth 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 AS...
public getFormLineWidth() : number { return this.mFormLineWidth; }
https://gitee.com/openharmony-sig/smartperf.git
15719991d20629bd3a59ef1f9e54f338de5ae61e
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/json.ets
arkts
stringifyJsonElement
Converts a JsonElement to a JSON string. @param elem - The JsonElement to stringify @returns The JSON string representation
public static stringifyJsonElement(elem: jsonx.JsonElement): string { return stringifyElementRecursively(elem, undefined, undefined, 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 stringifyJsonElement AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left elem AST#identifier#Right AST#:#Le...
public static stringifyJsonElement(elem: jsonx.JsonElement): string { return stringifyElementRecursively(elem, undefined, undefined, 0) }
https://gitcode.com/iop123123/arkts-static-skills
43b82bcdc535572cdcecc42dd40aa7a363b64b99
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/GamepadManager.ets
arkts
notifyGamepadDisconnectedByKey
发送断开通知并释放连接通知 Key,允许同一设备后续真正重连时再次提示。
private notifyGamepadDisconnectedByKey(notificationKey: string, slot: number): void { this.notifiedConnectionKeys.delete(notificationKey); this.listener?.onGamepadDisconnected(slot); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left notifyGamepadDisconnectedByKey AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left notificationKey AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#str...
private notifyGamepadDisconnectedByKey(notificationKey: string, slot: number): void { this.notifiedConnectionKeys.delete(notificationKey); this.listener?.onGamepadDisconnected(slot); }
https://github.com/AlkaidLab/moonlight-harmony
4dd32132a63cef7f728a3c0b96eb52b7434afe23
github
tdcare/tdwebrtc
src/main/ets/WebRTCManager.ets
arkts
initSignaling
============================================================ 信令集成 — 对齐 Android WebRtcManager ============================================================ 初始化信令连接(对齐 Android WebRtcManager.init) 如果 WebRTC 客户端尚未初始化,会自动调用 init() 创建 Rust WebRtcClient 和 UDP Socket。 @param socketUrl 信令服务器 WebSocket URL(不含 MAC 后缀) @param snNum...
public initSignaling(socketUrl: string, snNum: string, jsonStr: string): void { LogUtil.info(`[WebRTC] initSignaling: socketUrl=${socketUrl}, snNum=${snNum}, jsonStr=${jsonStr}`); this.localMac = snNum; // 如果已有客户端,先关闭再重新初始化(确保每次呼叫都从干净状态开始) if (this.client !== null) { LogUtil.info('[WebRTC] 检测到已...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left initSignaling AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left socketUrl AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string...
public initSignaling(socketUrl: string, snNum: string, jsonStr: string): void { LogUtil.info(`[WebRTC] initSignaling: socketUrl=${socketUrl}, snNum=${snNum}, jsonStr=${jsonStr}`); this.localMac = snNum; // 如果已有客户端,先关闭再重新初始化(确保每次呼叫都从干净状态开始) if (this.client !== null) { LogUtil.info('[WebRTC] 检测到已...
https://github.com/tdcare/tdwebrtc
96d2858a8249e168554cad27998e7c47d722c9eb
github
aimilin6688/KeePassHO
entry/src/main/ets/common/utils/KdbxUtils.ets
arkts
entryMatchesSearch
检查条目是否匹配搜索文本 @param entry 要检查的条目 @param searchText 搜索文本(小写) @returns 是否匹配
private static entryMatchesSearch(entry: KdbxEntry, searchText: string): boolean { // 搜索标准字段 const standardFields = [ KdbxUtils.FIELD_TITLE, KdbxUtils.FIELD_USERNAME, KdbxUtils.FIELD_URL, KdbxUtils.FIELD_NOTES, KdbxUtils.FIELD_TAGS ]; for (const field of standardFields) ...
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 entryMatchesSearch AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left entry AST#identifier#Right AST#:#...
private static entryMatchesSearch(entry: KdbxEntry, searchText: string): boolean { // 搜索标准字段 const standardFields = [ KdbxUtils.FIELD_TITLE, KdbxUtils.FIELD_USERNAME, KdbxUtils.FIELD_URL, KdbxUtils.FIELD_NOTES, KdbxUtils.FIELD_TAGS ]; for (const field of standardFields) ...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/KdbxUtils.ets#L213-L252
32633009c8fc4ca494a11e1e99baeaa1d74196c7
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets
arkts
getStringListByXPath
通过XPath获取字符串列表 支持: //tag, //tag[@attr='value'], //tag/text(), //tag/@attr 支持: //tag[position()], //tag[contains(@attr,'value')] 支持: 规则分割符 &&, ||, %%
private getStringListByXPath(xpath: string): string[] { // 处理规则分割符 const splitResult = this.splitRuleStr(xpath); if (splitResult.rules.length > 1) { return this.getXPathListWithSplitRules(splitResult.rules, splitResult.splitType); } return this.getStringListByXPathSingle(xpath); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getStringListByXPath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left xpath AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif...
private getStringListByXPath(xpath: string): string[] { // 处理规则分割符 const splitResult = this.splitRuleStr(xpath); if (splitResult.rules.length > 1) { return this.getXPathListWithSplitRules(splitResult.rules, splitResult.splitType); } return this.getStringListByXPathSingle(xpath); }
https://github.com/DaLongZhuaZi/manxia
d48a62a0a2cfeb62b8d86631b54a2caa7ccd1c48
github
Joker-x-dev/CoolMallArkTS
feature/goods/src/main/ets/viewmodel/GoodsDetailViewModel.ets
arkts
updateTopBarAlpha
更新顶部导航栏透明度 @param {number} scrollOffset - 当前滚动增量 @param {number | undefined} absoluteOffset - 当前滚动绝对距离 @returns {void} 无返回值
updateTopBarAlpha(scrollOffset: number, absoluteOffset?: number): void { if (absoluteOffset !== undefined) { this.topBarAlpha = this.clampAlpha(Math.floor(absoluteOffset)); this.totalScrollOffset = this.topBarAlpha; return; } this.totalScrollOffset += scrollOffset; this.topBarAlpha ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateTopBarAlpha AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left scrollOffset AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left...
updateTopBarAlpha(scrollOffset: number, absoluteOffset?: number): void { if (absoluteOffset !== undefined) { this.topBarAlpha = this.clampAlpha(Math.floor(absoluteOffset)); this.totalScrollOffset = this.topBarAlpha; return; } this.totalScrollOffset += scrollOffset; this.topBarAlpha ...
https://github.com/Joker-x-dev/CoolMallArkTS
c4b8a46891de1b1c1139cb0d7933b57463e48095
github
aimilin6688/KeePassHO
entry/src/main/ets/services/kdbx/KdbxLoadService.ets
arkts
stopWorker
终止 Worker
public static stopWorker() { // 终止 Worker if (KdbxLoadService.databaseWorker) { try { KdbxLoadService.databaseWorker.terminate(); KdbxLoadService.databaseWorker = null; hilog.info(DOMAIN, TAG, 'Database load worker terminated'); } catch (e) { hilog.info(DOMAIN, TAG,...
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 stopWorker AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERRO...
public static stopWorker() { // 终止 Worker if (KdbxLoadService.databaseWorker) { try { KdbxLoadService.databaseWorker.terminate(); KdbxLoadService.databaseWorker = null; hilog.info(DOMAIN, TAG, 'Database load worker terminated'); } catch (e) { hilog.info(DOMAIN, TAG,...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/kdbx/KdbxLoadService.ets#L133-L144
4867d88a37b72bec7fc9950c9c13731ef3370c7f
github
HarmonyOS_Samples/HarmonyOSComponentUXExamples
commons/componentuxexamplesbase/src/main/ets/model/BreakpointModel.ets
arkts
isSmallScreen
Checks if the current device is considered a small screen. A screen is considered small if the width breakpoint is WIDTH_XS or WIDTH_SM. @returns {boolean} True if the current screen is small, false otherwise.
public isSmallScreen(): boolean { return this.currentWidthBreakpoint === WidthBreakpoint.WIDTH_XS || this.currentWidthBreakpoint === WidthBreakpoint.WIDTH_SM; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isSmallScreen 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...
public isSmallScreen(): boolean { return this.currentWidthBreakpoint === WidthBreakpoint.WIDTH_XS || this.currentWidthBreakpoint === WidthBreakpoint.WIDTH_SM; }
https://gitcode.com/HarmonyOS_Samples/HarmonyOSComponentUXExamples
6cdcfd92beeae779523887a1e1f891670f7666d6
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Diagnostics/StartupDiagnostics.ets
arkts
generateDiagnosticsReport
生成诊断报告
private generateDiagnosticsReport(): StartupDiagnosticsReport { const phases = Array.from(this.phases.values()); const totalStartupTime = Date.now() - this.startupStartTime; const systemHealth = this.getSystemHealthStatus(); const issues: string[] = []; const recommendations: string[] = []; /...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left generateDiagnosticsReport 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#identifie...
private generateDiagnosticsReport(): StartupDiagnosticsReport { const phases = Array.from(this.phases.values()); const totalStartupTime = Date.now() - this.startupStartTime; const systemHealth = this.getSystemHealthStatus(); const issues: string[] = []; const recommendations: string[] = []; /...
https://github.com/DaLongZhuaZi/manxia
ada2b9f07bed748a2f7a49f30152961fabd3723d
github
Dabing-0x19d/berverage_HarmonyOS6.0
entry/src/main/ets/common/utils/PreferencesUtil.ets
arkts
getWeekFormIds
获取周数据卡片的所有 formId
getWeekFormIds(preferences: preferences.Preferences): Array<string> { if (preferences === null) { hilog.error(0x0000, TAG, `preferences is null`); return []; } try { const result = preferences.getSync('weekFormIdList', []); return (result as Array<string>) || []; } catch (error...
AST#program#Left AST#ERROR#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getWeekFormIds AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left preferences AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left ...
getWeekFormIds(preferences: preferences.Preferences): Array<string> { if (preferences === null) { hilog.error(0x0000, TAG, `preferences is null`); return []; } try { const result = preferences.getSync('weekFormIdList', []); return (result as Array<string>) || []; } catch (error...
https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0
2e70fd85680c694cac12da9e720bf6887a8afce7
github
Joker-x-dev/CoolMallArkTS
feature/order/src/main/ets/viewmodel/OrderDetailViewModel.ets
arkts
showCommentModal
显示商品评论弹窗 @returns {void} 无返回值
showCommentModal(): void { this.commentModalVisible = true; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left showCommentModal 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_b...
showCommentModal(): void { this.commentModalVisible = true; }
https://github.com/Joker-x-dev/CoolMallArkTS
85ffb3436d5c5ccdfdb6abb7370441321078026d
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/json.ets
arkts
stringify
Converts array of bytes to JSON format @param d: byte[] - array of byte to be converted to a JSON as an Array of Numbers @returns String - JSON representation of array of bytes
public static stringify(d: float[]): String { let s = new StringBuilder("[") let last_elem = d.length - 1 for (let i = 0; i < last_elem; ++i) { s.append(d[i]) s.append(',') } if (d.length > 0) { s.append(d[last_elem]) } s.ap...
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 stringify AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left d AST#identifier#Right AST#:#Left : AST#:#Rig...
public static stringify(d: float[]): String { let s = new StringBuilder("[") let last_elem = d.length - 1 for (let i = 0; i < last_elem; ++i) { s.append(d[i]) s.append(',') } if (d.length > 0) { s.append(d[last_elem]) } s.ap...
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
f13efda562689bb8059735911b3dfe272dc2792d
gitee
honjow/Next2V
shared/src/main/ets/settings/CloudSyncSettings.ets
arkts
recordLastSync
Record the outcome of a sync attempt: update the in-memory holder AND persist it, so Settings can show the "上次同步:…" line immediately on next open (and after a restart). Best-effort persistence — the holder is updated first so the live UI reacts even if the write fails.
static async recordLastSync( context: common.UIAbilityContext, ok: boolean, cloudDisabled: boolean, ): Promise<void> { const at: number = Date.now() const state: CloudSyncState = connectCloudSync() state.lastSyncAt = at state.lastSyncOk = ok state.lastSyncCloudDisabled = cloudDisable...
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 recordLastSync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left :...
static async recordLastSync( context: common.UIAbilityContext, ok: boolean, cloudDisabled: boolean, ): Promise<void> { const at: number = Date.now() const state: CloudSyncState = connectCloudSync() state.lastSyncAt = at state.lastSyncOk = ok state.lastSyncCloudDisabled = cloudDisable...
https://github.com/honjow/Next2V
890522af575e7c99b33c4f6ff43b3e074a7fe5a2
github
openharmony/graphic_graphic_2d
frameworks/text/interface/export/ani/@ohos.graphics.text.ets
arkts
loadFont
Load font. @param { string } name - The font name. @param { string | Resource } path - The path of the font file. @returns { Promise<void> } The promise returned by the function. @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; <br>2. Incorrect parameter ty...
async loadFont(name: string, path: string | Resource): Promise<void> { await new Promise<void>((resolve, reject) => { try { taskpool.execute((): void => { this.loadFontSync(name, path); }).then(() => { resolve(undefined); }) } catch (err) {...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left loadFont 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 : AST#:#...
async loadFont(name: string, path: string | Resource): Promise<void> { await new Promise<void>((resolve, reject) => { try { taskpool.execute((): void => { this.loadFontSync(name, path); }).then(() => { resolve(undefined); }) } catch (err) {...
https://gitee.com/openharmony/graphic_graphic_2d.git
cc479269e27d8b197ae3d11e0b59d61b4eaf0fef
gitee
aimilin6688/KeePassHO
entry/src/main/ets/services/beans/LocationParam.ets
arkts
getInstance
获取实例, 未初始化则返回select模式 @return LocationParam
public static getInstance(): LocationParam { return LocationParam.instance || LocationParam.ofSelect(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L...
public static getInstance(): LocationParam { return LocationParam.instance || LocationParam.ofSelect(); }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/beans/LocationParam.ets#L133-L135
c97b267f321ea466e6cf7a1878358bfb4bea2ed9
github
Kira-Yagami-Light/Kira-Projects
TodoTask/entry/src/main/ets/data/database/PreferenceDao.ets
arkts
has
检查偏好设置是否存在 @param key 键 @returns Promise<boolean> 是否存在
async has(key: string): Promise<boolean> { await this.ensureInitialized(); try { return await this.preference!.has(key); } catch (err) { Logger.error(this.LOG_TAG, `Failed to check preference: ${JSON.stringify(err)}`); return false; } }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left has AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left key AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right ...
async has(key: string): Promise<boolean> { await this.ensureInitialized(); try { return await this.preference!.has(key); } catch (err) { Logger.error(this.LOG_TAG, `Failed to check preference: ${JSON.stringify(err)}`); return false; } }
https://github.com/Kira-Yagami-Light/Kira-Projects
a658d15dd232391d878328765e6bfe0d2f3f6679
github
aimilin6688/KeePassHO
entry/src/main/ets/services/template/TemplateBuilder.ets
arkts
withUrl
设置URL
withUrl(url: string): TemplateBuilder { this.entry.fields.set('URL', url); return this; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left withUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)#Ri...
withUrl(url: string): TemplateBuilder { this.entry.fields.set('URL', url); return this; }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/template/TemplateBuilder.ets#L72-L75
67a65ecf6cc057b68676f162cd1cf705715f088f
github
SMAT-Lab/PhantomRendering
Harmoney_Next-Tiktok/entry/src/main/ets/utils/WatchHistoryManager.ets
arkts
getTotalWatchDuration
获取总观看时长(分钟)
getTotalWatchDuration(): number { const historyList = this.getAllWatchHistory() const totalSeconds = historyList.reduce((sum, item) => sum + item.watchDuration, 0) return Math.floor(totalSeconds / 60) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getTotalWatchDuration AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#...
getTotalWatchDuration(): number { const historyList = this.getAllWatchHistory() const totalSeconds = historyList.reduce((sum, item) => sum + item.watchDuration, 0) return Math.floor(totalSeconds / 60) }
https://github.com/SMAT-Lab/PhantomRendering
09eda68495bd371b9df7bebb1adbacd0970c1cba
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/EnhancedBackupManager.ets
arkts
copyCustomFonts
复制自定义字体文件到备份目录 从FontManager的preferences中读取字体文件路径,直接复制文件
private async copyCustomFonts(tempDir: string): Promise<void> { try { // 从FontManager的preferences读取自定义字体列表 const context = getGlobalContext(); const fontPrefs: preferences.Preferences = await preferences.getPreferences(context, 'font_settings'); const customFontsStr = await fontPrefs.get('...
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 copyCustomFonts AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left tempDir AST#identifier#Right AST#ERROR#Left AST#:#Le...
private async copyCustomFonts(tempDir: string): Promise<void> { try { // 从FontManager的preferences读取自定义字体列表 const context = getGlobalContext(); const fontPrefs: preferences.Preferences = await preferences.getPreferences(context, 'font_settings'); const customFontsStr = await fontPrefs.get('...
https://github.com/DaLongZhuaZi/manxia
93b919ae78977a6546a7cba0d00760ce78907593
github
trueWangSyutung/Sensitive-Word-Blocking-Module-For-OHOS
sensitiveinput/src/main/ets/module/SensitiveWordChecker.ets
arkts
getSensitiveWords
获取文本中的敏感词 @param text 待检查的文本 @returns 包含的敏感词列表
public getSensitiveWords(text: string): Array<GeneratedTypeLiteralInterface_3> { const sensitiveWords: Array<GeneratedTypeLiteralInterface_3> = []; const foundWords: Set<string> = new Set(); // 避免重复 // 从文本的每个位置开始查找 for (let i = 0; i < text.length; i++) { const result = this.extractFromPosition(...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getSensitiveWords AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
public getSensitiveWords(text: string): Array<GeneratedTypeLiteralInterface_3> { const sensitiveWords: Array<GeneratedTypeLiteralInterface_3> = []; const foundWords: Set<string> = new Set(); // 避免重复 // 从文本的每个位置开始查找 for (let i = 0; i < text.length; i++) { const result = this.extractFromPosition(...
https://github.com/trueWangSyutung/Sensitive-Word-Blocking-Module-For-OHOS
add69681301c7918e35d8f64f93673b4d46324d7
github
DaLongZhuaZi/manxia
entry/src/main/ets/libs/htmlparser/Parser.ets
arkts
parseText
解析文本节点
private parseText(parent: HTMLElement): void { const start = this.pos; let text = ''; while (this.pos < this.html.length && this.html[this.pos] !== '<') { text += this.html[this.pos]; this.pos++; } if (text) { const textRange: [number, number] = [start, this.pos]; ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left parent AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left H...
private parseText(parent: HTMLElement): void { const start = this.pos; let text = ''; while (this.pos < this.html.length && this.html[this.pos] !== '<') { text += this.html[this.pos]; this.pos++; } if (text) { const textRange: [number, number] = [start, this.pos]; ...
https://github.com/DaLongZhuaZi/manxia
2992af08383575962c2879e78f5ebdc14b033f22
github
zmuxuny/ai-guardian-star
entry/src/main/ets/common/UserManager.ets
arkts
setCurrentUsername
设置当前登录用户名 @param username 用户名
public setCurrentUsername(username: string): void { AppStorage.setOrCreate<string>(UserManager.STORAGE_KEY, username); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setCurrentUsername AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left username AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#st...
public setCurrentUsername(username: string): void { AppStorage.setOrCreate<string>(UserManager.STORAGE_KEY, username); }
https://github.com/zmuxuny/ai-guardian-star/blob/87ab023d8b9aab4303a9fc1e97508e1f8ee01e07/entry/src/main/ets/common/UserManager.ets#L37-L39
9fb1e409e3a7de399128ac751a9e3f18f8433e76
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/ReminderService.ets
arkts
createBatchReminders
批量创建提醒
static async createBatchReminders(options: ReminderCreateOptions[]): Promise<number[]> { try { const reminderIds: number[] = []; for (const option of options) { const id: number = await ReminderService.createReminder(option); reminderIds.push(id); } console.log(`[ReminderSe...
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 createBatchReminders AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left options AST#identifier#Right AST#:#...
static async createBatchReminders(options: ReminderCreateOptions[]): Promise<number[]> { try { const reminderIds: number[] = []; for (const option of options) { const id: number = await ReminderService.createReminder(option); reminderIds.push(id); } console.log(`[ReminderSe...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
9101efd0c0d83751d84bf6f3b7383cb2fd4fdff8
github
tdcare/tdwebrtc
src/main/ets/MediaStream.ets
arkts
encodeLatestCameraFrame
v17: 编码最新的相机帧 Phase 3: 单次 encodeAndSendVideo NAPI 调用,Rust 内部完成编码 + RTP 打包 + 发送 旧路径:ETS encodeFrame + pollOutput + sendEncodedVideoFrame(3+ 次 NAPI)
private async encodeLatestCameraFrame(): Promise<void> { this.videoEncodeScheduled = false; if (this.latestCameraFrame === null || !this.videoEncoderCreated) { return; } // 取出最新帧并清空槽位 const frameData: ArrayBuffer = this.latestCameraFrame; const timestampUs: number = this.latestCameraTi...
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 encodeLatestCameraFrame AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression...
private async encodeLatestCameraFrame(): Promise<void> { this.videoEncodeScheduled = false; if (this.latestCameraFrame === null || !this.videoEncoderCreated) { return; } // 取出最新帧并清空槽位 const frameData: ArrayBuffer = this.latestCameraFrame; const timestampUs: number = this.latestCameraTi...
https://github.com/tdcare/tdwebrtc
94839b1913c15c5abec037833d8070e6974b72ea
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
sort
Sorts in-place according to the numeric ordering @returns sorted Float32Array
public sort(): Float32Array { let newF: (a: number, b: number) => number = (a: number, b: number): number => { const a1 = a as double as int as float const b1 = b as double as int as float return a1 < b1 ? -1 : a1 == b1 ? 0 : 1 } return this.sort(newF) ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left sort 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#:#Righ...
public sort(): Float32Array { let newF: (a: number, b: number) => number = (a: number, b: number): number => { const a1 = a as double as int as float const b1 = b as double as int as float return a1 < b1 ? -1 : a1 == b1 ? 0 : 1 } return this.sort(newF) ...
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
232c31aaab5b8530c6172231e521ddb888efd4f5
gitee
SMAT-Lab/PhantomRendering
example/entry/src/main/ets/common/DeviceUtils.ets
arkts
px2dp
px转dp
static px2dp(px: number): number { return Math.round(px / DeviceUtils.getDensity()) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left px2dp AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left px AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR...
static px2dp(px: number): number { return Math.round(px / DeviceUtils.getDensity()) }
https://github.com/SMAT-Lab/PhantomRendering
a359515a31ef6e3dc828caed976eff303b897738
github
HarmonyOS_Samples/BestPracticeSnippets
VideoPlayerSample/MediaService/src/main/ets/controller/AvSessionControllerPCode.ets
arkts
setLaunchAbility
[StartExclude session_controller1]
setLaunchAbility() {}
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setLaunchAbility AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#L...
setLaunchAbility() {}
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
e78a35aa9a657eafac032b4e0dbb76ff2c51fcdd
gitcode
Mydstiny/RemoteDeskHarmonyOS
entry/src/main/ets/services/DataCrypto.ets
arkts
disableEncryption
关闭加密 (需验证密码) 验证密码并保留 DEK 在内存中, 供调用方执行批量解密。 @returns true=验证成功 DEK已就绪, false=密码错误
async disableEncryption(password: string): Promise<boolean> { return await this.unlock(password); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left disableEncryption AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left password AST#identifier#Right AST#type_annotation#Left AST#:#...
async disableEncryption(password: string): Promise<boolean> { return await this.unlock(password); }
https://github.com/Mydstiny/RemoteDeskHarmonyOS
c6a9aa30abd29154e8814d20880e9b32c0af6a03
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Database/DatabaseTypes.ets
arkts
createComicInfoRecord
创建漫画信息数据库记录
static createComicInfoRecord(): ComicInfoDatabaseRecord { return { id: '', title: '', author: '', description: '', coverUrl: '', sourceId: '', externalId: '', // 外部图源ID status: '', tags: '[]', rating: 0, chapterCount: 0, lastUpdateTime: 0, ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createComicInfoRecord 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 ...
static createComicInfoRecord(): ComicInfoDatabaseRecord { return { id: '', title: '', author: '', description: '', coverUrl: '', sourceId: '', externalId: '', // 外部图源ID status: '', tags: '[]', rating: 0, chapterCount: 0, lastUpdateTime: 0, ...
https://github.com/DaLongZhuaZi/manxia
347b89a0b0ca9c41a5e345b7d7b696ee35a84f9a
github
openharmony/codelabs
ETSUI/LifeTrack/entry/src/main/ets/services/StepCounterService.ets
arkts
addStepChangeListener
添加步数变化监听器
public addStepChangeListener(listener: (steps: number) => void): void { this.listeners.push(listener); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left addStepChangeListener AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left listener AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Left...
public addStepChangeListener(listener: (steps: number) => void): void { this.listeners.push(listener); }
https://gitcode.com/openharmony/codelabs
d5bfcc71361212a7ea3133fb235bfb4ce2e88f40
gitcode
wuba/omni-ui
omni_component/src/main/ets/components/guide/model/GuidePage.ets
arkts
setEverywhereCancelable
设置当前引导页是否支持点击任意位置切换下一页或移除 @param everywhereCancelable 是否支持点击任意位置切换下一页或移除 @returns 当前引导页
public setEverywhereCancelable(everywhereCancelable: boolean): GuidePage { this.everywhereCancelable = everywhereCancelable; return this; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setEverywhereCancelable AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left everywhereCancelable AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#...
public setEverywhereCancelable(everywhereCancelable: boolean): GuidePage { this.everywhereCancelable = everywhereCancelable; return this; }
https://github.com/wuba/omni-ui
06e4eac4acde8e5dea3a6e47911ab4ac1f526890
github
openharmony/arkui_ace_engine
examples/Info/entry/src/main/ets/pages/qrcode/qrcodegen.ets
arkts
constructor
The QR Code can tolerate about 30% erroneous codewords -- Constructor and fields --
private constructor( // In the range 0 to 3 (unsigned 2-bit integer). public readonly ordinal: int, // (Package-private) In the range 0 to 3 (unsigned 2-bit integer). public readonly formatBits: int) { }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#comment#Left // In the range 0 to 3 (unsigned 2-bit integer). AST#comment...
private constructor( // In the range 0 to 3 (unsigned 2-bit integer). public readonly ordinal: int, // (Package-private) In the range 0 to 3 (unsigned 2-bit integer). public readonly formatBits: int) { }
https://gitee.com/openharmony/arkui_ace_engine.git
43881b87a829416190957fe5eae7b001994d974b
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/prefix_decrement/prefix_decrement_char.ets
arkts
main
--- desc: check prefix decrement for char operand ---
function main(): void { let value: char = {{v.value}} let result: char = --value assert value == {{v.result}}
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#predefined_type#Left A...
function main(): void { let value: char = {{v.value}} let result: char = --value assert value == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
1be08e3be0c47418f535937f6c6593d5418d52a7
gitee
openharmony/applications_app_samples
code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/pages/CreateRoom.ets
arkts
pushIndex
跳转至Index页面
pushIndex(): void { router.pushUrl({ url: 'pages/NewIndex', params: { 'userId': this.userId, 'socketType': this.socketType } }); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left pushIndex 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#Le...
pushIndex(): void { router.pushUrl({ url: 'pages/NewIndex', params: { 'userId': this.userId, 'socketType': this.socketType } }); }
https://github.com/openharmony/applications_app_samples
5e6b1dd020078e1ea9cfa0dab233e50f9b9ceedb
github
openharmony/security_privacy_center
entry/src/main/ets/main/auto_menu/AutoMenuModel.ets
arkts
_convertMenuConfigToMenuInfo
MenuConfig[] to MenuInfo[]
private async _convertMenuConfigToMenuInfo(context: Context, menuConfigList: MenuConfig[], userId: number): Promise<MenuInfo[]> { let menuInfoList: MenuInfo[] = []; for (let i = 0; i < menuConfigList.length; i++) { const menuConfig: MenuConfig = menuConfigList[i]; let menuInfo: MenuInfo = { ...
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 _convertMenuConfigToMenuInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#R...
private async _convertMenuConfigToMenuInfo(context: Context, menuConfigList: MenuConfig[], userId: number): Promise<MenuInfo[]> { let menuInfoList: MenuInfo[] = []; for (let i = 0; i < menuConfigList.length; i++) { const menuConfig: MenuConfig = menuConfigList[i]; let menuInfo: MenuInfo = { ...
https://gitee.com/openharmony/security_privacy_center.git
203941a045032b5be06af597013f156cae8e2de7
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/AsyncLock.ets
arkts
lockAsync
Perform an operation with the acquired lock. The method acquires the lock first, then calls the callback, and then releases the lock. The callback is called asynchronously in the same thread where lockAsync was called. An optional timeout value can be provided in {@link AsyncLockOptions}. In this case, lockAsync will r...
public lockAsync<T, U>(callback: AsyncLockCallback<T>, mode: AsyncLockMode, options: AsyncLockOptions<U>): Promise<T> { let callerCID = CoroutineExtras.getCoroutineId(); let asyncLockInfo = new AsyncLockInfo(this.name, mode, callerCID); let wrapped = (l: AsyncLock) => { return l.syncwrapper<...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#ERROR#Right AST#expression_statement#Left AST#sequence_expression#Left AST#binary_expression#Left AST#identifier#Left lockAsync AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right...
public lockAsync<T, U>(callback: AsyncLockCallback<T>, mode: AsyncLockMode, options: AsyncLockOptions<U>): Promise<T> { let callerCID = CoroutineExtras.getCoroutineId(); let asyncLockInfo = new AsyncLockInfo(this.name, mode, callerCID); let wrapped = (l: AsyncLock) => { return l.syncwrapper<...
https://gitcode.com/iop123123/arkts-static-skills
025bb4857549af84e32b5a9e92a0afa411983ccc
gitcode
Countly/countly-sdk-hos
library/src/main/ets/internal/ModuleBase.ets
arkts
isHalted
Whether the owning instance has been halted. User-facing module mutators use this to short-circuit post-halt calls. Internal methods called from `onHalt` (drain paths) intentionally bypass this check.
public isHalted(): boolean { return this.config.halted; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isHalted 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#bool...
public isHalted(): boolean { return this.config.halted; }
https://github.com/Countly/countly-sdk-hos
3746120cec82bcca7e59d5a67082035584be4fa5
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Download/DownloadManager.ets
arkts
createDownloadTask
创建下载任务(本地漫画,保存到应用私有目录)
public async createDownloadTask( mangaId: string, mangaTitle: string, chapterId: string, chapterTitle: string, imageUrls: string[], downloadCacheFlowId: string = '' ): Promise<string> { const startedAt: number = Date.now(); try { if (!this.context) { throw new Error('应用...
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 createDownloadTask AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left mangaId AST#identifier#Right AST#ERROR#Left AST#:#Le...
public async createDownloadTask( mangaId: string, mangaTitle: string, chapterId: string, chapterTitle: string, imageUrls: string[], downloadCacheFlowId: string = '' ): Promise<string> { const startedAt: number = Date.now(); try { if (!this.context) { throw new Error('应用...
https://github.com/DaLongZhuaZi/manxia
99f07230a3dd255c411e483fa782850e227febfd
github
erosTeam/NextE
shared/src/main/ets/network/EhApiService.ets
arkts
submitGalleryArchiverLocal
Submit a protected local archive request. Returns the generated archive URL; caller decides how to open it.
async submitGalleryArchiverLocal( gid: string, token: string, archiverLink: string, dltype: string, dlcheck: string, isEx: boolean, ): Promise<EhGalleryArchiverSubmitResult> { const url: string = this.archiverUrl(gid, token, archiverLink, isEx) const body: string = [ this.formP...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left submitGalleryArchiverLocal AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left gid AST#identifier#Right AST#type_annotation#Left AS...
async submitGalleryArchiverLocal( gid: string, token: string, archiverLink: string, dltype: string, dlcheck: string, isEx: boolean, ): Promise<EhGalleryArchiverSubmitResult> { const url: string = this.archiverUrl(gid, token, archiverLink, isEx) const body: string = [ this.formP...
https://github.com/erosTeam/NextE
35b2c30d641bb40899b26cbe64ebaa78a63460e6
github
tdcare/tdwebrtc
example/MediaStreamAdvancedExample.ets
arkts
toggleSpeaker
切换音频路由(听筒/免提)
public async toggleSpeaker(): Promise<void> { if (!this.mediaStream) { return; } this.isSpeakerOn = !this.isSpeakerOn; await this.mediaStream.setAudioRoute(this.isSpeakerOn); console.log(`[MediaStreamExample] ${this.isSpeakerOn ? '免提' : '听筒'}模式`); }
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 toggleSpeaker AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#...
public async toggleSpeaker(): Promise<void> { if (!this.mediaStream) { return; } this.isSpeakerOn = !this.isSpeakerOn; await this.mediaStream.setAudioRoute(this.isSpeakerOn); console.log(`[MediaStreamExample] ${this.isSpeakerOn ? '免提' : '听筒'}模式`); }
https://github.com/tdcare/tdwebrtc
43458e0e1751e6c7a33ff82f1b4bd721a7038e94
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/ComputerManager.ets
arkts
addComputer
手动添加电脑 @param addressInput 用户输入的地址,支持以下格式: - "192.168.1.100" - IPv4 地址,使用默认端口 - "192.168.1.100:47989" - IPv4 地址 + 自定义端口 - "::1" 或 "[::1]" - IPv6 地址,使用默认端口 - "[::1]:47989" - IPv6 地址 + 自定义端口 - "mydomain.com" - 域名,会被保存为 manualAddress 对 AAAA-only 域名的兜底:用户反馈"手输 IPv6 字面量可连接、用域名超时" 推测鸿蒙 RCK / native getaddrinfo 对纯 AAAA 域名解析不稳...
async addComputer(addressInput: string): Promise<ComputerInfo> { const parsed = parseAddressAndPort(addressInput); const isLiteralIp = isIPv4Address(parsed.host) || isIPv6Address(parsed.host); const manualAddOptions: AddComputerInternalOptions = { httpPort: parsed.port, robustServerInfo: true ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left addComputer AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left addressInput AST#identifier#Right AST#type_annotation#Left AST#:#Le...
async addComputer(addressInput: string): Promise<ComputerInfo> { const parsed = parseAddressAndPort(addressInput); const isLiteralIp = isIPv4Address(parsed.host) || isIPv6Address(parsed.host); const manualAddOptions: AddComputerInternalOptions = { httpPort: parsed.port, robustServerInfo: true ...
https://github.com/AlkaidLab/moonlight-harmony
f642b30d6366e04a52d672835917a0506e9af605
github
XHXYT/Pixark
entry/src/main/ets/common/entity/CusItemInfo.ets
arkts
constructor
构造函数:支持传入部分属性初始化
constructor(init?: CustomItemInfoParam) { if (init) { // 逐个属性赋值 if (init.id !== undefined) this.id = init.id; if (init.icon !== undefined) this.icon = init.icon; if (init.symbol !== undefined) this.symbol = init.symbol; if (init.iconColor !== undefined) this.iconColor = init.iconColo...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Cust...
constructor(init?: CustomItemInfoParam) { if (init) { // 逐个属性赋值 if (init.id !== undefined) this.id = init.id; if (init.icon !== undefined) this.icon = init.icon; if (init.symbol !== undefined) this.symbol = init.symbol; if (init.iconColor !== undefined) this.iconColor = init.iconColo...
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/common/entity/CusItemInfo.ets#L64-L87
447b7e7fb46aacabda5f31e7bed4aa258a524b39
github
dingzhilin1990/zhilinclaw
src/security/SecurityContext.ets
arkts
log
记录审计日志 @param entry 日志条目信息
public async log(entry: Omit<AuditLogEntry, 'id' | 'timestamp'>): Promise<void> { if (!this.policy.enableAuditLog) { return; } const logEntry: AuditLogEntry = { ...entry, id: `audit_${++this.logCounter}`, timestamp: Date.now() }; this.auditLog.push(logEntry); // 在控制台...
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 log AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left entry AST#identifier#Right AST#:#Left : AST#:#Right ...
public async log(entry: Omit<AuditLogEntry, 'id' | 'timestamp'>): Promise<void> { if (!this.policy.enableAuditLog) { return; } const logEntry: AuditLogEntry = { ...entry, id: `audit_${++this.logCounter}`, timestamp: Date.now() }; this.auditLog.push(logEntry); // 在控制台...
https://github.com/dingzhilin1990/zhilinclaw
abc1aea9b79b6303833c906d1114959044e52c2e
github
yongoe1024/RdbPlus
rdbplus/src/main/ets/BaseMapper.ets
arkts
insertBatch
添加一组数据 @param obj 实体类 @returns sql执行结果:最后一个rowId
async insertBatch(list: T[], db?: Connection): Promise<relationalStore.ValueType> { let isClose: boolean = true if (db === undefined) { db = await this.getConnection() } else { isClose = false } const sqlData = this.sqlUtils.insertBatch(list) let res = await db.execDML(sqlData.sql,...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left insertBatch AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left list AST#identifier#Right AST#type_annotation#Left AST#:#L...
async insertBatch(list: T[], db?: Connection): Promise<relationalStore.ValueType> { let isClose: boolean = true if (db === undefined) { db = await this.getConnection() } else { isClose = false } const sqlData = this.sqlUtils.insertBatch(list) let res = await db.execDML(sqlData.sql,...
https://github.com/yongoe1024/RdbPlus/blob/83f7347b7ac692941729d3464923155948e876bb/rdbplus/src/main/ets/BaseMapper.ets#L296-L309
6b27e25fca652382ca5cf5eb476ffb0ad25536c6
github
openharmony/applications_permission_manager
permissionmanager/src/main/ets/ServiceExtAbility/GrantDialogModel.ets
arkts
clickHandle
点击事件处理 @param groupConfig @param callerAppInfo 调用方信息 @param locationFlag 位置权限组flag @param buttonStatus 点击状态 return
public async clickHandle( groupConfig: PermissionGroupConfig, callerAppInfo: CallerAppInfo, locationFlag: number, buttonStatus: ButtonStatus ): Promise<void> { let flag: number = THIS_TIME_FLAG.includes(buttonStatus) ? Constants.PERMISSION_ALLOW_THIS_TIME : Constants.PERMISSION_FLAG; Log.info(`cli...
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 clickHandle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left groupConfig AST#identifier#Right AST#:#Left ...
public async clickHandle( groupConfig: PermissionGroupConfig, callerAppInfo: CallerAppInfo, locationFlag: number, buttonStatus: ButtonStatus ): Promise<void> { let flag: number = THIS_TIME_FLAG.includes(buttonStatus) ? Constants.PERMISSION_ALLOW_THIS_TIME : Constants.PERMISSION_FLAG; Log.info(`cli...
https://gitee.com/openharmony/applications_permission_manager.git
9d2ff0b07f0038a1c6999c9f3a33a32645f2c79c
gitee
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/utils/JArrayList.ets
arkts
contains
判断给定的值是否在列表中
contains(element: T) { return this.dataSource.indexOf(element) > -1; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left contains AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left element AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#Right AST#ERROR#Right AST#)#...
contains(element: T) { return this.dataSource.indexOf(element) > -1; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
05d5377a61b4e93d9829bdb0ac09dd1dfa0f5e02
gitee
2763981847/Accounting-app
entry/src/main/ets/common/database/tables/AccountTable.ets
arkts
batchDelete
批量删除账目数据
batchDelete(accounts: Account[], callback: Function) { // 创建 RdbPredicates 对象,用于指定删除条件 let predicates = new relationalStore.RdbPredicates(CommonConstants.ACCOUNT_TABLE.tableName); // 设置删除条件为账目ID在给定账目数组中 predicates.in('id', accounts.map((account) => account.id)); // 调用 Rdb 对象的删除数据方法,并传入回调函数 thi...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left batchDelete AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left accounts AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#...
batchDelete(accounts: Account[], callback: Function) { // 创建 RdbPredicates 对象,用于指定删除条件 let predicates = new relationalStore.RdbPredicates(CommonConstants.ACCOUNT_TABLE.tableName); // 设置删除条件为账目ID在给定账目数组中 predicates.in('id', accounts.map((account) => account.id)); // 调用 Rdb 对象的删除数据方法,并传入回调函数 thi...
https://github.com/2763981847/Accounting-app
ac2e5827c21586440c1390066c44acdfbb036cbe
github
CPF-ApplicationTPC/openharmony_tpc_samples
SwipeMenuListView/library/src/main/ets/components/SwipeMenuListItem.ets
arkts
onItemChanged
监听item变化 - 重新创建菜单以确保菜单项正确更新
onItemChanged() { logger.debug(`SwipeMenuListItem-${this.index} item changed, recreating menu`); this.createMenu(); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onItemChanged 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...
onItemChanged() { logger.debug(`SwipeMenuListItem-${this.index} item changed, recreating menu`); this.createMenu(); }
https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples
689bcb551b0270049d618738d9a3af6c3f59ecb0
gitcode
wuba/omni-ui
omni_component/src/main/ets/components/popup/Builder.ets
arkts
setDialogOptions
设置配置 @param config 设置配置 @returns
setDialogOptions(config: promptAction.BaseDialogOptions): Builder { this.dialogOptions = config return this }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setDialogOptions 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#member_expression#Left AST#identifier#Left promptActi...
setDialogOptions(config: promptAction.BaseDialogOptions): Builder { this.dialogOptions = config return this }
https://github.com/wuba/omni-ui
ea87b791cc9d63af566b6c70cf9f3175a2079c6d
github
openharmony-sig/flutter_packages
packages/webview_flutter-v4.4.4/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/DownloadListenerFlutterApiImpl.ets
arkts
onDownloadStart
Passes arguments from {@link DownloadListener#onDownloadStart} to Dart.
onDownloadStart( downloadListener: WebviewController | ESObject, url: string, userAgent: string, contentDisposition: string, mimetype: string, contentLength: number, callback: Reply<void> ) { super.onDownloadStartT( this.getIdentifierForListener(downloadListener), url, user...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onDownloadStart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left downloadListener AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#id...
onDownloadStart( downloadListener: WebviewController | ESObject, url: string, userAgent: string, contentDisposition: string, mimetype: string, contentLength: number, callback: Reply<void> ) { super.onDownloadStartT( this.getIdentifierForListener(downloadListener), url, user...
https://gitee.com/openharmony-sig/flutter_packages.git
2197aed35722e505b1e6c232ead691b051c103bf
gitee
LJ666-ui/harmony-health-care
entry/src/main/ets/mock/smartwardMock_realdata.ets
arkts
generateCarePlans
获取2份真实护理计划
public generateCarePlans(): CarePlanData[] { return [ { planId: '1', patientId: '201', patientName: '张三*', planName: '膝关节置换术后康复护理计划', planType: 'POST_OPERATIVE', wardNumber: '301', bedNumber: '床1', acuityLevel: 'HIGH', status: 'ACTIVE',...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left generateCarePlans 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 Care...
public generateCarePlans(): CarePlanData[] { return [ { planId: '1', patientId: '201', patientName: '张三*', planName: '膝关节置换术后康复护理计划', planType: 'POST_OPERATIVE', wardNumber: '301', bedNumber: '床1', acuityLevel: 'HIGH', status: 'ACTIVE',...
https://github.com/LJ666-ui/harmony-health-care
10f8aa0d930bd5d84943a0902dd7884539a8fbc3
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/AutoPageTurnController.ets
arkts
resume
恢复自动翻页
public resume(): void { if (this.state !== AutoPageTurnState.PAUSED) { return; } this.state = AutoPageTurnState.RUNNING; logger.info(TAG, '恢复自动翻页'); this.scheduleNextTurn(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left resume AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_stat...
public resume(): void { if (this.state !== AutoPageTurnState.PAUSED) { return; } this.state = AutoPageTurnState.RUNNING; logger.info(TAG, '恢复自动翻页'); this.scheduleNextTurn(); }
https://github.com/DaLongZhuaZi/manxia
06fcfa018ff0488860782237b2270d73b0a3ebc7
github
openharmony/codelabs
ETSUI/LifeTrack/entry/src/main/ets/dao/ContactDao.ets
arkts
batchInsertContacts
批量插入联系人
public async batchInsertContacts(contacts: BatchContactData[]): Promise<OperationResult> { try { const rdbStore = await this.ensureDBInitialized(); let successCount = 0; let failCount = 0; const failMessages: string[] = []; // 开始事务 await this.dbConfig.beginTransaction(); ...
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 batchInsertContacts AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left contacts AST#identifier#Right AST#:#...
public async batchInsertContacts(contacts: BatchContactData[]): Promise<OperationResult> { try { const rdbStore = await this.ensureDBInitialized(); let successCount = 0; let failCount = 0; const failMessages: string[] = []; // 开始事务 await this.dbConfig.beginTransaction(); ...
https://gitcode.com/openharmony/codelabs
c3f2b8a9610409a2ea9d132f6c960afe36ef05f0
gitcode
LiHuaJZOAQ/GuardSysAPP
entry/src/main/ets/pages/WifiManager.ets
arkts
getCurrentWifi
获取当前连接的WiFi信息
static async getCurrentWifi(): Promise<string> { try { const linkedInfo: wifiManager.WifiLinkedInfo = await wifiManager.getLinkedInfo(); return linkedInfo.ssid; } catch (e) { return ''; } }
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 getCurrentWifi AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:...
static async getCurrentWifi(): Promise<string> { try { const linkedInfo: wifiManager.WifiLinkedInfo = await wifiManager.getLinkedInfo(); return linkedInfo.ssid; } catch (e) { return ''; } }
https://github.com/LiHuaJZOAQ/GuardSysAPP
39c2ce2fd444b0e987c5a5379b305b6b046993f1
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
set
Assigns val as element on insertPos. @param { int } insertPos - index to change @param { byte } val - value to set @throws { RangeError } - If the index exceeds the array range, throw an exception @syscap SystemCapability.Utils.Lang @FaAndStageModel
public set(insertPos: int, val: byte): void { this.$_set(insertPos, val) }
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#identifier#Left insertPos AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#...
public set(insertPos: int, val: byte): void { this.$_set(insertPos, val) }
https://gitcode.com/iop123123/arkts-static-skills
680562787ed3b6837d4bf4405f5aa7be10dabc16
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Source/SuwayomiSource.ets
arkts
getCategoryMangas
获取指定分类的所有漫画 通过 category(id) 查询获取特定分类的漫画列表
public async getCategoryMangas(categoryId: number): Promise<ComicInfo[]> { const query = ` query GetCategoryMangas($id: Int!) { category(id: $id) { id name mangas { nodes { id title thumbnailUrl author ...
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 getCategoryMangas AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left categoryId AST#identifier#Right AST#ERROR#Left AST#:#...
public async getCategoryMangas(categoryId: number): Promise<ComicInfo[]> { const query = ` query GetCategoryMangas($id: Int!) { category(id: $id) { id name mangas { nodes { id title thumbnailUrl author ...
https://github.com/DaLongZhuaZi/manxia
e95c91976544c5827b44656b3e000698e5212f85
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/MoonBridge.ets
arkts
init
初始化桥接层
init(callbacks: MoonBridgeCallbacks): boolean { this.callbacks = callbacks; return nativeLib.init(callbacks); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left init AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callbacks AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left MoonBridgeCallbacks AST#identifier#Right AST#)...
init(callbacks: MoonBridgeCallbacks): boolean { this.callbacks = callbacks; return nativeLib.init(callbacks); }
https://github.com/AlkaidLab/moonlight-harmony
5c47baa46f62a1b466e9aa4edb0887817555ccd1
github
Yebingiscn/SweetVideo
entry/src/main/ets/utils/FileProcessorUtil.ets
arkts
getFileQueue
获取文件操作队列
static getFileQueue(uri: string): AsyncQueue { if (!ConcurrencyManagerUtil.fileQueues.has(uri)) { ConcurrencyManagerUtil.fileQueues.set(uri, new AsyncQueue()) } return ConcurrencyManagerUtil.fileQueues.get(uri)! }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getFileQueue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uri AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left stri...
static getFileQueue(uri: string): AsyncQueue { if (!ConcurrencyManagerUtil.fileQueues.has(uri)) { ConcurrencyManagerUtil.fileQueues.set(uri, new AsyncQueue()) } return ConcurrencyManagerUtil.fileQueues.get(uri)! }
https://github.com/Yebingiscn/SweetVideo
8f23d1f28db9173be4a5d7f85bc96afdde74fc64
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/utils/ViewPortHandler.ets
arkts
setZoom
Sets the scale factor to the specified values. @param scaleX @param scaleY @return
public setZoom(scaleX: number, scaleY: number, x?: number, y?: number): Matrix { let save: Matrix = new Matrix(); save.reset(); save.set(this.mMatrixTouch); if (x != undefined && y != undefined) { save.setScale(scaleX, scaleY, x, y); } else { save.setScale(scaleX, scaleY); } r...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setZoom AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left scaleX AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number...
public setZoom(scaleX: number, scaleY: number, x?: number, y?: number): Matrix { let save: Matrix = new Matrix(); save.reset(); save.set(this.mMatrixTouch); if (x != undefined && y != undefined) { save.setScale(scaleX, scaleY, x, y); } else { save.setScale(scaleX, scaleY); } r...
https://gitee.com/openharmony-tpc/ohos_mpchart.git
fb0ee8de762c8c592e8464bca2b934ca3c6e19ae
gitee
LZZLHY/hlib
entry/src/main/ets/pages/PrivacyPage.ets
arkts
aboutToDisappear
页面卸载时写时间戳给 SplashPage 等待方使用: 它们通过 @StorageProp + @Watch(PRIVACY_PAGE_CLOSED_AT) 检测此变化以恢复 UI(如重新拉起同意弹窗)。
aboutToDisappear(): void { AppStorage.setOrCreate<number>(AppStorageKeys.PRIVACY_PAGE_CLOSED_AT, Date.now()); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToDisappear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_b...
aboutToDisappear(): void { AppStorage.setOrCreate<number>(AppStorageKeys.PRIVACY_PAGE_CLOSED_AT, Date.now()); }
https://github.com/LZZLHY/hlib
c5ed9824750c8c4e0746659e9164f4255c819d10
github
openharmony/applications_contacts
entry/src/main/ets/model/ContactAbilityModel.ets
arkts
updateContact
Edit Contact Information @param {string} DAHelper @param {Object} addParams Contact Information @param {Object} callBack Contact ID
async updateContact(daHelper: dataShare.DataShareHelper | null, addParams: ContactInfo, callBack: Function, context?: common.UIAbilityContext | Context) { HiLog.i(TAG, 'Start to update contacts.'); try { if (daHelper == undefined || daHelper == null) { daHelper = await dataShare.createDataSh...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left updateContact AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left daHelper AST#identifier#Right AST#type_annotation#Left A...
async updateContact(daHelper: dataShare.DataShareHelper | null, addParams: ContactInfo, callBack: Function, context?: common.UIAbilityContext | Context) { HiLog.i(TAG, 'Start to update contacts.'); try { if (daHelper == undefined || daHelper == null) { daHelper = await dataShare.createDataSh...
https://gitee.com/openharmony/applications_contacts.git
6fb2f792e3e834bb6095aeabceb8d0dbcf863b36
gitee
Cool_foolisher1/ArkTSRepository
GraphicalCode/commons/src/main/ets/util/BreakpointSystemUtil.ets
arkts
onWindowSizeChange
监听窗口大小变化 @param window window.Window
public onWindowSizeChange(window: window.Window): void { this.updateWidthBp(window) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left onWindowSizeChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left window AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expr...
public onWindowSizeChange(window: window.Window): void { this.updateWidthBp(window) }
https://gitcode.com/Cool_foolisher1/ArkTSRepository
f8954c872320874afa9081cd1a475d36cb553b51
gitcode
ZHCOOL520/HarmonyOS-AUTOcall
entry/src/main/ets/utils/FileImportManager.ets
arkts
getAudioFiles
获取音频文件列表
static getAudioFiles(context: common.UIAbilityContext): string[] { try { const audioDir = `${context.filesDir}/audio` if (!fs.accessSync(audioDir)) { return [] } const dir = fs.opendirSync(audioDir) const files: string[] = [] let entry = dir.readSync() whi...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getAudioFiles AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expressi...
static getAudioFiles(context: common.UIAbilityContext): string[] { try { const audioDir = `${context.filesDir}/audio` if (!fs.accessSync(audioDir)) { return [] } const dir = fs.opendirSync(audioDir) const files: string[] = [] let entry = dir.readSync() whi...
https://github.com/ZHCOOL520/HarmonyOS-AUTOcall
fb84bca73b14d2bf5537d0c5142effcd92be7757
github
CLMC2025/Vignette
entry/src/main/ets/manager/SessionPlanner.ets
arkts
planSession
为单词列表编排完整会话
planSession(words: WordItem[]): TaskItem[] { const allTasks: TaskItem[] = []; for (const word of words) { const wordTasks = this.generateBaseTasks(word); allTasks.push(...wordTasks); } // 按优先级排序(强化任务优先) allTasks.sort((a: TaskItem, b: TaskItem): number => { if (a.isReinforcement...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left planSession AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left words AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Lef...
planSession(words: WordItem[]): TaskItem[] { const allTasks: TaskItem[] = []; for (const word of words) { const wordTasks = this.generateBaseTasks(word); allTasks.push(...wordTasks); } // 按优先级排序(强化任务优先) allTasks.sort((a: TaskItem, b: TaskItem): number => { if (a.isReinforcement...
https://github.com/CLMC2025/Vignette
9ff3349f5cecc1cf085d816cbeed1f54bdda1095
github
jjjjjjava/ffmpeg_tools
src/main/ets/ffmpeg/FFmpegFactory.ets
arkts
imagesToVideo
图片序列合成视频 @param inputPattern 输入图片路径模式,如 "/path/frame_%04d.jpg" @param output 输出视频路径 @param fps 视频帧率,默认 25
public static imagesToVideo(inputPattern: string, output: string, fps: number = 25): string[] { return [ 'ffmpeg', '-framerate', fps.toString(), '-i', inputPattern, '-c:v', FFmpegFactory.HW_CODEC, '-pix_fmt', 'yuv420p', '-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 imagesToVideo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left inputPattern AST#identifier#Right AST#ERROR#Left AST#:#L...
public static imagesToVideo(inputPattern: string, output: string, fps: number = 25): string[] { return [ 'ffmpeg', '-framerate', fps.toString(), '-i', inputPattern, '-c:v', FFmpegFactory.HW_CODEC, '-pix_fmt', 'yuv420p', '-y', output ]; }
https://github.com/jjjjjjava/ffmpeg_tools
26d073fca23a6b8d1311cd47f84d4892c0884363
github
openharmony-sig/flutter_audioplayers
packages/audioplayers_ohos/ohos/src/main/ets/components/plugin/player/WrappedPlayer.ets
arkts
createPlayer
Create new player
private async createPlayer(): Promise<Player> { if (this.playerMode == PlayerMode.LOW_LATENCY) { let player = new SoundPoolPlayer(this, this.soundPoolManager); await player.init(); return player; } else { let player = new MediaPlayerPlayer(this, this.context); await player.initMe...
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 createPlayer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#...
private async createPlayer(): Promise<Player> { if (this.playerMode == PlayerMode.LOW_LATENCY) { let player = new SoundPoolPlayer(this, this.soundPoolManager); await player.init(); return player; } else { let player = new MediaPlayerPlayer(this, this.context); await player.initMe...
https://gitee.com/openharmony-sig/flutter_audioplayers.git
1acbd3aeab3d6569194fcf5064d7caf8b2245a3a
gitee
tdcare/tdwebrtc
src/main/ets/WebRTCManager.ets
arkts
getMediaTracks
获取所有媒体轨道
public getMediaTracks(): MediaTrackConfig[] { return this.localTracks; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getMediaTracks AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#express...
public getMediaTracks(): MediaTrackConfig[] { return this.localTracks; }
https://github.com/tdcare/tdwebrtc
2dbdd82af68042b0b2075dadba02e29b57b2767a
github
LJ666-ui/harmony-health-care
entry/src/main/ets/utils/AccessibilityUtils.ets
arkts
getSaturation
计算颜色饱和度 @param color 颜色 @returns 饱和度(0-100)
public static getSaturation(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); if (max === 0) { return 0; } const satura...
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 getSaturation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left color AST#identifier#Right AST#:#Left : A...
public static getSaturation(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); if (max === 0) { return 0; } const satura...
https://github.com/LJ666-ui/harmony-health-care
eeb5efdb53112b16fe023dd7c2f652028cd62cf2
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets
arkts
preprocessHtmlForXPath
==================== XPath解析 ==================== 预处理HTML内容,处理特殊情况 参考Kotlin原版strToJXDocument
private preprocessHtmlForXPath(html: string): string { let processed = html; // 处理表格片段,自动包装 if (processed.trimEnd().endsWith('</td>')) { processed = `<tr>${processed}</tr>`; } if (processed.trimEnd().endsWith('</tr>') || processed.trimEnd().endsWith('</tbody>')) { processed = `<ta...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left preprocessHtmlForXPath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left html AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi...
private preprocessHtmlForXPath(html: string): string { let processed = html; // 处理表格片段,自动包装 if (processed.trimEnd().endsWith('</td>')) { processed = `<tr>${processed}</tr>`; } if (processed.trimEnd().endsWith('</tr>') || processed.trimEnd().endsWith('</tbody>')) { processed = `<ta...
https://github.com/DaLongZhuaZi/manxia
fa1e271cbe458f5deb9d46194c2f39c43e8a409c
github
LJ666-ui/harmony-health-care
entry/src/main/ets/aiagent/EnhancedRAGRetriever.ets
arkts
addDocuments
批量添加文档
async addDocuments(documents: KnowledgeDocument[]): Promise<void> { for (const doc of documents) { await this.addDocument(doc); } }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left addDocuments AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left documents AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right A...
async addDocuments(documents: KnowledgeDocument[]): Promise<void> { for (const doc of documents) { await this.addDocument(doc); } }
https://github.com/LJ666-ui/harmony-health-care
9c7a21f349ce5c54c8fd194156f003897c1d80aa
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/LayoutConfigManager.ets
arkts
getOptimalLayoutForVariant
============================================================================ 变体布局匹配 (对齐 Android UILayoutProvider.getOptimalLayoutForVariant) ============================================================================ 获取最优布局 (对齐 Android UILayoutProvider.getOptimalLayoutForVariant) 匹配链: 精确匹配 → 同方向回退 → 生成默认布局
getOptimalLayoutForVariant(config: LayoutConfiguration, variant: UILayoutVariant): PositionedLayoutComponent[] { const key = variantToKey(variant); // 1. 精确匹配 if (config.layoutVariants[key]) { return config.layoutVariants[key].components; } // 2. 同方向回退 (对齐 Android findSimilarLayoutVariant:...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getOptimalLayoutForVariant 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#Left LayoutConfig...
getOptimalLayoutForVariant(config: LayoutConfiguration, variant: UILayoutVariant): PositionedLayoutComponent[] { const key = variantToKey(variant); // 1. 精确匹配 if (config.layoutVariants[key]) { return config.layoutVariants[key].components; } // 2. 同方向回退 (对齐 Android findSimilarLayoutVariant:...
https://github.com/richshaw2015/nds
aac57fbe2a5f268e4420ff4d87d132bcf086e15c
github
openharmony/arkcompiler_taihe_ffi_gen
test/ani_tuple/user/main.ets
arkts
testMakeArrayTuple
====== Test 8: ArrayTuple - tuple containing an Array ======
function testMakeArrayTuple() { let t = TupleTest.makeArrayTuple("data", 3); console.log("makeArrayTuple: [" + t[0] + ", " + t[1] + "]"); arktest.assertEQ(t[0], "data"); arktest.assertEQ(t[1].length, 3); // values: [10, 20, 30] arktest.assertEQ(t[1][0], 10); arktest.assertEQ(t[1][1], 20); ...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testMakeArrayTuple AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#lexical_...
function testMakeArrayTuple() { let t = TupleTest.makeArrayTuple("data", 3); console.log("makeArrayTuple: [" + t[0] + ", " + t[1] + "]"); arktest.assertEQ(t[0], "data"); arktest.assertEQ(t[1].length, 3); // values: [10, 20, 30] arktest.assertEQ(t[1][0], 10); arktest.assertEQ(t[1][1], 20); ...
https://gitcode.com/openharmony/arkcompiler_taihe_ffi_gen
fe717fbe1f7fcf80cd4f52e118a96c581d723177
gitcode
openharmony/codelabs
ETSUI/PositioningDemo/entry/src/main/ets/service/PlanService.ets
arkts
getActivePlansCount
获取进行中的计划数量
async getActivePlansCount(): Promise<number> { const plans = await this.getAllPlans(); return plans.filter(p => p.status === PlanStatus.ACTIVE).length; }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getActivePlansCount 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#...
async getActivePlansCount(): Promise<number> { const plans = await this.getAllPlans(); return plans.filter(p => p.status === PlanStatus.ACTIVE).length; }
https://gitcode.com/openharmony/codelabs
dff321cea5e27d92b5e4ee191875e0e7dc7f3ec9
gitcode
tdcare/tdwebrtc
src/main/ets/WebRTCManager.ets
arkts
removeMediaTrack
移除媒体轨道
public removeMediaTrack(trackId: string): boolean { if (!this.client) return false; const result: boolean = this.client.removeMediaTrack(trackId); if (result) { this.localTracks = this.localTracks.filter((t: MediaTrackConfig) => t.trackId !== trackId); LogUtil.info(`[WebRTC] 轨道已移除: ${trackId}...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left removeMediaTrack AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left trackId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#strin...
public removeMediaTrack(trackId: string): boolean { if (!this.client) return false; const result: boolean = this.client.removeMediaTrack(trackId); if (result) { this.localTracks = this.localTracks.filter((t: MediaTrackConfig) => t.trackId !== trackId); LogUtil.info(`[WebRTC] 轨道已移除: ${trackId}...
https://github.com/tdcare/tdwebrtc
f126cb5605d6540cc9368ce86743153141ce1ba9
github
openharmony-sig/applications_inputmethod
entry/src/main/ets/model/InputHandler.ets
arkts
insertText
输入框和拼音插入新字符
public insertText(text: string,isChinese?: boolean,isSelText?: boolean) { this.addLog('insertText:' + text+'-->isChinese:'+isChinese+'-->isSelText:'+isSelText) //判断中文输入 if (isChinese){ //判断是否是备选中文选择 if(isSelText){ if (this.curFenci.length > 1){ this.wordsSelChar = '' ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left insertText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left strin...
public insertText(text: string,isChinese?: boolean,isSelText?: boolean) { this.addLog('insertText:' + text+'-->isChinese:'+isChinese+'-->isSelText:'+isSelText) //判断中文输入 if (isChinese){ //判断是否是备选中文选择 if(isSelText){ if (this.curFenci.length > 1){ this.wordsSelChar = '' ...
https://gitee.com/openharmony-sig/applications_inputmethod.git
bf9cc9d044d05bdf12bfcb882f35f41a5ecee73d
gitee
Cool_foolisher1/ArkTSRepository
GuardianAssistant/entry/src/main/ets/pages/Guard/Fake/FakeTelPage.ets
arkts
playCallRing
播放来电音频
playCallRing() { // 播放本地音频 avPlayerManager.playByRawSrc('lab_call_ring.mp3') // 循环播放 avPlayerManager.setLoop(true) // 开启后台播放(熄屏播放) backgroundRunningManager.startBackgroundRunning() }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left playCallRing 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 ...
playCallRing() { // 播放本地音频 avPlayerManager.playByRawSrc('lab_call_ring.mp3') // 循环播放 avPlayerManager.setLoop(true) // 开启后台播放(熄屏播放) backgroundRunningManager.startBackgroundRunning() }
https://gitcode.com/Cool_foolisher1/ArkTSRepository
02387ea83c417cfd4a76407cc3f179176fc5d89a
gitcode
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.HashSet.ets
arkts
remove
Removes a value from the HashSet @param value the value to remove from the HashSet @returns true if the value was removed, false otherwise
remove(value: T): boolean { if (this.isEmpty() || !this.buckets.hasKey(value)) { return false; } const res = this.buckets.remove(value); return res === undefined ? false : true; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left remove AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#Right AST#ERROR#Right AST#)#Left ) AST#)#Right ...
remove(value: T): boolean { if (this.isEmpty() || !this.buckets.hasKey(value)) { return false; } const res = this.buckets.remove(value); return res === undefined ? false : true; }
https://gitcode.com/iop123123/arkts-static-skills
0251a86bc4badb7510b3ba349bc2df2a0f71a105
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/json.ets
arkts
createShortFromJSONValue
Creates a Short instance based on JSONValue @param { Short } this JSONValue - a JSON representation @param { JSONValue } json @returns { Short } - true if JSON encodes true literal, false if JSON encodes false literal @throws { JSONTypeError } if json does not encode a valid boolean literal
function createShortFromJSONValue(json: JSONValue): Short { if (json instanceof JSONNumber) { let num = (json as JSONNumber).value if (Double.isInteger(num) && Short.MIN_VALUE <= num && num <= Short.MAX_VALUE) { return num.toShort() } } throw new JSONTypeError('Cannot cre...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left createShortFromJSONValue AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left json AST#identifier#Right AST#type_annotation#Left AST#:#Left...
function createShortFromJSONValue(json: JSONValue): Short { if (json instanceof JSONNumber) { let num = (json as JSONNumber).value if (Double.isInteger(num) && Short.MIN_VALUE <= num && num <= Short.MAX_VALUE) { return num.toShort() } } throw new JSONTypeError('Cannot cre...
https://gitcode.com/iop123123/arkts-static-skills
eca639d966776ed65d115113929aa0cd4ae986db
gitcode
daugf2527/harmonyos-libretro-emulator
entry/src/main/ets/common/SaveStateRepository.ets
arkts
reconcileManifestItems
D002: 对账 manifest 条目与 saves/ 目录实际文件,消除两类孤儿: (a) manifest 有条目但 .state 文件不存在 → 裁剪(如 deleteSaveStateItem unlink 后崩溃) (b) .state 文件存在但 manifest 无条目 → 补充(romFile='' 待后续编辑补全; 如 saveStateData 写完 .state 但写 manifest 前崩溃,避免用户存档丢失) 写操作本身是 tmp+rename 原子写,半写文件以 .tmp 结尾不被本对账拾取。
async function reconcileManifestItems( context: common.UIAbilityContext, manifestItems: SaveStateManifestItem[] ): Promise<SaveStateManifestItem[]> { const validItems: SaveStateManifestItem[] = [] const knownFileNames = new Set<string>() // (a) 逐条 stat:文件不存在则裁剪 for (let index = 0; index < manifestItems.leng...
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left reconcileManifestItems AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#Rig...
async function reconcileManifestItems( context: common.UIAbilityContext, manifestItems: SaveStateManifestItem[] ): Promise<SaveStateManifestItem[]> { const validItems: SaveStateManifestItem[] = [] const knownFileNames = new Set<string>() // (a) 逐条 stat:文件不存在则裁剪 for (let index = 0; index < manifestItems.leng...
https://github.com/daugf2527/harmonyos-libretro-emulator
7dfd8305bb6876853ab48c1dc27971c4211d11d8
github
Joker-x-dev/CoolMallArkTS
core/util/src/main/ets/permission/PermissionUtils.ets
arkts
checkPermissionGrant
检查单个权限是否已授权 @param {Permissions} permission 目标权限 @returns {Promise<boolean>} 是否已授权
private async checkPermissionGrant(permission: Permissions): Promise<boolean> { try { const bundleInfo: bundleManager.BundleInfo = await bundleManager.getBundleInfoForSelf(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION); // 获取包含应用信息的 BundleInfo,比如应用名称、应用包名、应用组件 const appInfo: bundleManager....
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 checkPermissionGrant AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left permission AST#identifier#Right ...
private async checkPermissionGrant(permission: Permissions): Promise<boolean> { try { const bundleInfo: bundleManager.BundleInfo = await bundleManager.getBundleInfoForSelf(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION); // 获取包含应用信息的 BundleInfo,比如应用名称、应用包名、应用组件 const appInfo: bundleManager....
https://github.com/Joker-x-dev/CoolMallArkTS
5f05dbbd8c5a06f7afb522b245b6d3719a31ad61
github
LJ666-ui/harmony-health-care
entry/src/main/ets/medicalimaging/MedicalImageUtils.ets
arkts
extractFeatures
提取图像特征 @param pixelMap 图像 @returns 图像特征对象
static async extractFeatures(pixelMap: image.PixelMap): Promise<ImageFeatures> { try { // 获取图像信息 const imageInfo = await pixelMap.getImageInfo(); const width = imageInfo.size.width; const height = imageInfo.size.height; // 并行计算各项特征 const [colorHistogram, textureFeatures, avera...
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 extractFeatures AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left pixelMap AST#identifier#Righ...
static async extractFeatures(pixelMap: image.PixelMap): Promise<ImageFeatures> { try { // 获取图像信息 const imageInfo = await pixelMap.getImageInfo(); const width = imageInfo.size.width; const height = imageInfo.size.height; // 并行计算各项特征 const [colorHistogram, textureFeatures, avera...
https://github.com/LJ666-ui/harmony-health-care
96564ceaf818f2cee0d5e6caa008e1f8c9a350c4
github
daugf2527/harmonyos-libretro-emulator
entry/src/main/ets/common/PerformanceTracker.ets
arkts
endTimer
结束计时并返回耗时 @param label 计时器标签 @returns 耗时(毫秒),如果计时器不存在返回 -1
static endTimer(label: string): number { const startTime = this.timers.get(label); if (startTime === undefined) { return -1; } const elapsed = Date.now() - startTime; this.timers.delete(label); return elapsed; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left endTimer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left label AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string...
static endTimer(label: string): number { const startTime = this.timers.get(label); if (startTime === undefined) { return -1; } const elapsed = Date.now() - startTime; this.timers.delete(label); return elapsed; }
https://github.com/daugf2527/harmonyos-libretro-emulator
42bb223d4830f5ac97e2cc81ee14826e3d193b5e
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Char.ets
arkts
isLowSurrogate
isLowSurrogate(char) checks if the char is a low surrogate. @param { char } value the char to be checked. @returns { boolean } @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static isLowSurrogate(value: char): boolean { return (Char.LOW_SURROGATE_MIN.compareTo(value) <= 0) && (Char.LOW_SURROGATE_MAX.compareTo(value) >= 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 isLowSurrogate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : ...
public static isLowSurrogate(value: char): boolean { return (Char.LOW_SURROGATE_MIN.compareTo(value) <= 0) && (Char.LOW_SURROGATE_MAX.compareTo(value) >= 0); }
https://gitcode.com/iop123123/arkts-static-skills
5c43a4919129126f8603a9f2b6e077896c95ba25
gitcode
LJ666-ui/harmony-health-care
entry/src/main/ets/ar/ARNavigationService.ets
arkts
isArrived
检查是否到达
private isArrived(currentPosition: Position3D): boolean { return this.navigationState.remainingDistance <= this.arrivalThreshold; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left isArrived AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left currentPosition AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Position...
private isArrived(currentPosition: Position3D): boolean { return this.navigationState.remainingDistance <= this.arrivalThreshold; }
https://github.com/LJ666-ui/harmony-health-care
4379c84b1dbd4b916fac1f3990eca25c7a8702ba
github
azhu0001/localsend-harmony
entry/src/main/ets/service/upload/UploadServer.ets
arkts
getChunkedStream
添加chunked协议数据并返回 @param input 需要传输的流 @returns
private getChunkedStream(input: ArrayBuffer): ArrayBuffer { const start = `${input.byteLength.toString(16)}${CRLF}` const buff = buffer.allocUninitializedFromPool(start.length + input.byteLength + CRLF.length) buff.write(start) buffer.from(input).copy(buff, start.length, 0, input.byteLength) buff....
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getChunkedStream AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left input AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#...
private getChunkedStream(input: ArrayBuffer): ArrayBuffer { const start = `${input.byteLength.toString(16)}${CRLF}` const buff = buffer.allocUninitializedFromPool(start.length + input.byteLength + CRLF.length) buff.write(start) buffer.from(input).copy(buff, start.length, 0, input.byteLength) buff....
https://gitcode.com/azhu0001/localsend-harmony
62940d721df97c01f46f0a333e2153fd9ab7bc01
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Theme/AppColors.ets
arkts
isDark
获取当前是否为深色主题
static get isDark(): boolean { const themeManager = ThemeManager.getInstance(); return themeManager.isDarkThemeSync(); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left get AST#identifier#Right AST#call_expression#Left AST#identifier#Left isDark AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AS...
static get isDark(): boolean { const themeManager = ThemeManager.getInstance(); return themeManager.isDarkThemeSync(); }
https://github.com/DaLongZhuaZi/manxia
5985ab6496f31f99d248e9f2be0be52945daf0a4
github
XJTUWYD/ArkDiff
entry/src/main/ets/viewmodel/DiffSessionViewModel.ets
arkts
_buildSearchMatchLineSet
重建搜索匹配行索引缓存
private _buildSearchMatchLineSet(): void { this._searchMatchLineSet = new Set<number>(); for (let i = 0; i < this.searchMatches.length; i++) { this._searchMatchLineSet.add(this.searchMatches[i].lineIndex); } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left _buildSearchMatchLineSet 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#Righ...
private _buildSearchMatchLineSet(): void { this._searchMatchLineSet = new Set<number>(); for (let i = 0; i < this.searchMatches.length; i++) { this._searchMatchLineSet.add(this.searchMatches[i].lineIndex); } }
https://github.com/XJTUWYD/ArkDiff
7f4c97dc0cd15557d45c2673bafda878750e0944
github
David8Idira/AI-OA
packages/harmonyos/commons/src/main/ets/services/IMService.ets
arkts
getGroupMembers
============ 群成员管理 ============ 获取群成员列表 @param conversationId 会话ID
async getGroupMembers(conversationId: string): Promise<ApiResponse<{ members: GroupMember[] }>> { return this.client.get<{ members: GroupMember[] }>(`/api/v1/im/conversations/${conversationId}/members`) }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getGroupMembers AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left conversationId AST#identifier#Right AST#type_annotation#Left AS...
async getGroupMembers(conversationId: string): Promise<ApiResponse<{ members: GroupMember[] }>> { return this.client.get<{ members: GroupMember[] }>(`/api/v1/im/conversations/${conversationId}/members`) }
https://github.com/David8Idira/AI-OA
7490403dda81ca1fc02ab0a98769a3c3ca5f8d27
github
queueit/harmony-sdk
queueit_sdk/src/main/ets/main/QueueItEngine.ets
arkts
runWithConnection
--- Internal Logic ---
private async runWithConnection(enqueueToken?: string, enqueueKey?: string): Promise<void> { try { const queueITWaitingRoomProviderResult = await this.provider.tryEnqueue(enqueueToken, enqueueKey); Logger.debug(QueueItEngine.TAG, `checkResult: ${JSON.stringify(queueITWaitingRoomProvi...
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 runWithConnection AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left enqueueToken AST#identifier#Right AST#ERROR#Left A...
private async runWithConnection(enqueueToken?: string, enqueueKey?: string): Promise<void> { try { const queueITWaitingRoomProviderResult = await this.provider.tryEnqueue(enqueueToken, enqueueKey); Logger.debug(QueueItEngine.TAG, `checkResult: ${JSON.stringify(queueITWaitingRoomProvi...
https://github.com/queueit/harmony-sdk
9de36d88752569b77bfcc55d2b853c1da0533e31
github
DaLongZhuaZi/manxia
entry/src/main/ets/libs/htmlparser/TextNode.ets
arkts
text
获取文本内容(解码 HTML 实体)
get text(): string { return this.decodeHtmlEntities(this._rawText); }
AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left text AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ER...
get text(): string { return this.decodeHtmlEntities(this._rawText); }
https://github.com/DaLongZhuaZi/manxia
1fa40860571af9c81db252c5bcc7a17d78d721f2
github
tdcare/tdwebrtc
src/main/ets/utils/StrUtil.ets
arkts
bufferToStr
ArrayBuffer转字符串 @param str @returns
static bufferToStr(src: ArrayBuffer, encoding: buffer.BufferEncoding = 'utf-8'): string { const buf = buffer.from(src); const result = buf.toString(encoding); return result; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left bufferToStr AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left src AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Array...
static bufferToStr(src: ArrayBuffer, encoding: buffer.BufferEncoding = 'utf-8'): string { const buf = buffer.from(src); const result = buf.toString(encoding); return result; }
https://github.com/tdcare/tdwebrtc
db3f6d314d5fa397b0861ea9deca674ebd96dd5a
github
openharmony/codelabs
ETSUI/MemoTime/entry/src/main/ets/service/AudioService.ets
arkts
ensureRecordingDir
确保录音目录存在
private async ensureRecordingDir(): Promise<void> { const dir = this.getRecordingDir() try { await fileIo.access(dir) } catch { await fileIo.mkdir(dir) Logger.info(TAG, `Created recording directory: ${dir}`) } }
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 ensureRecordingDir AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ...
private async ensureRecordingDir(): Promise<void> { const dir = this.getRecordingDir() try { await fileIo.access(dir) } catch { await fileIo.mkdir(dir) Logger.info(TAG, `Created recording directory: ${dir}`) } }
https://gitcode.com/openharmony/codelabs
972d01a4b99f2f37ca73c2ff30a6615b5ed0e95f
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/utils/CryptoUtil.ets
arkts
derToPem
将 DER 编码的证书转换为 PEM 格式
static derToPem(der: Uint8Array): string { const base64 = CryptoUtil.base64Encode(der); const lines: string[] = []; lines.push('-----BEGIN CERTIFICATE-----'); for (let i = 0; i < base64.length; i += 64) { lines.push(base64.substring(i, Math.min(i + 64, base64.length))); } lines.push('---...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left derToPem 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 Uint8Arr...
static derToPem(der: Uint8Array): string { const base64 = CryptoUtil.base64Encode(der); const lines: string[] = []; lines.push('-----BEGIN CERTIFICATE-----'); for (let i = 0; i < base64.length; i += 64) { lines.push(base64.substring(i, Math.min(i + 64, base64.length))); } lines.push('---...
https://github.com/AlkaidLab/moonlight-harmony
c09a21e838a58d854f580e112711d61cf0d57481
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.Deque.ets
arkts
isEmpty
Checks if the deque is empty. @returns {boolean} True if the deque is empty, false otherwise.
private isEmpty(): boolean { return this.front == this.rear; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left isEmpty AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#bo...
private isEmpty(): boolean { return this.front == this.rear; }
https://gitcode.com/iop123123/arkts-static-skills
c94b20544abf38deea8cda9186e8a947e2035fbb
gitcode