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/Novel/LegadoRuleAnalyzer.ets
arkts
getStringByJsonPath
==================== JSONPath解析 ==================== 通过JSONPath获取字符串
private getStringByJsonPath(path: string): string { try { const data: Object = SafeUtils.parseObj(this.content); const embeddedResult: string | null = this.replaceJsonPathEmbeddedRules(path, data as ESObject); if (embeddedResult !== null) { return embeddedResult; } const resu...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getStringByJsonPath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie...
private getStringByJsonPath(path: string): string { try { const data: Object = SafeUtils.parseObj(this.content); const embeddedResult: string | null = this.replaceJsonPathEmbeddedRules(path, data as ESObject); if (embeddedResult !== null) { return embeddedResult; } const resu...
https://github.com/DaLongZhuaZi/manxia
4413090f196feb16c4e8adb66ac67e9b8654de4b
github
openharmony-sig/knowledge_demo_entainment
FA/notebook/entry/src/main/ets/pages/Index.ets
arkts
refreshData
查询笔记数据
refreshData() { // todo 查询笔记数据 // 为了展示页面效果添加的临时数据 this.noteInfoList = [ { id: 1, title: "标题1", content: "我是内容1", date: "03/20", imageArr: "" }, { id: 2, title: "标题2", content: "我是内容2", date: "02/21", imageArr...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left refreshData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A...
refreshData() { // todo 查询笔记数据 // 为了展示页面效果添加的临时数据 this.noteInfoList = [ { id: 1, title: "标题1", content: "我是内容1", date: "03/20", imageArr: "" }, { id: 2, title: "标题2", content: "我是内容2", date: "02/21", imageArr...
https://gitee.com/openharmony-sig/knowledge_demo_entainment.git
23ad676b2927877fa38f402b18c1a1e432af242d
gitee
LJ666-ui/harmony-health-care
entry/src/main/ets/mindsphere/MindSporeLiteEngine.ets
arkts
predictFallRisk
跌倒风险预测
async predictFallRisk(sensorData: { accelerometer: { x: number; y: number; z: number }; gyroscope: { x: number; y: number; z: number }; age: number; hasFallHistory: boolean; }): Promise<{ riskLevel: 'low' | 'medium' | 'high'; confidence: number }> { try { const accMagnitude = Math.sqrt( ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left predictFallRisk AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sensorData AST#identifier#Right AST#type_annotation#Left AST#:#...
async predictFallRisk(sensorData: { accelerometer: { x: number; y: number; z: number }; gyroscope: { x: number; y: number; z: number }; age: number; hasFallHistory: boolean; }): Promise<{ riskLevel: 'low' | 'medium' | 'high'; confidence: number }> { try { const accMagnitude = Math.sqrt( ...
https://github.com/LJ666-ui/harmony-health-care
6742fc23d718b588cc9ffb08affe8a07983f7942
github
HarmonyOS_Codelabs/arkts-basic-syntax-demo
entry/src/main/ets/pages/BasicPage.ets
arkts
assignmentOperators
操作符 赋值运算符
function assignmentOperators() { // 基本赋值运算符 let a = 10; // 复合赋值运算符 a += 5; // 等价于 a = a + 5; console.log(`a: ${a}`); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left assignmentOperators 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#comment...
function assignmentOperators() { // 基本赋值运算符 let a = 10; // 复合赋值运算符 a += 5; // 等价于 a = a + 5; console.log(`a: ${a}`); }
https://gitcode.com/HarmonyOS_Codelabs/arkts-basic-syntax-demo
4b3de9878985692af793218dd8fa81a83346a4a0
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/pages/MainMenuPage.ets
arkts
activateSwipeFor
==================== 左滑删除:辅助方法与确认弹窗 ====================
private activateSwipeFor(mangaId: string): void { if (this.mangaMultiSelect.isActive) { return; } this.mangaSwipe.activeId = mangaId; this.mangaSwipe.isActive = true; this.mangaSwipe.offset = 0; this.mangaSwipe = this.mangaSwipe; logger.info(TAG, `开始漫画列表左滑删除手势: ${mangaId}`); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left activateSwipeFor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left mangaId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#st...
private activateSwipeFor(mangaId: string): void { if (this.mangaMultiSelect.isActive) { return; } this.mangaSwipe.activeId = mangaId; this.mangaSwipe.isActive = true; this.mangaSwipe.offset = 0; this.mangaSwipe = this.mangaSwipe; logger.info(TAG, `开始漫画列表左滑删除手势: ${mangaId}`); }
https://github.com/DaLongZhuaZi/manxia
c8ae2dbdf2e33bb9ca9a4eb8e8ac44f894f6e29f
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/BookshelfCategoryManager.ets
arkts
getDefaultCategory
获取默认分类
getDefaultCategory(): BookshelfCategory | undefined { return this.categories.find(c => c.isDefault); }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getDefaultCategory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#id...
getDefaultCategory(): BookshelfCategory | undefined { return this.categories.find(c => c.isDefault); }
https://github.com/DaLongZhuaZi/manxia
e10c1225ffb211108301079289b4091e954003cd
github
AGenUI/AGenUI
platforms/harmony/agenui/src/main/ets/agenui/bridge/AGenUIEngineSurfaceManagerBridge.ets
arkts
triggerAction
Dispatches an interaction event.
triggerAction(surfaceId: string, componentId: string, contextJson: string | null): void { submitUIAction(this.instanceId, surfaceId, componentId, contextJson ?? ''); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left triggerAction AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left surfaceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , AST#...
triggerAction(surfaceId: string, componentId: string, contextJson: string | null): void { submitUIAction(this.instanceId, surfaceId, componentId, contextJson ?? ''); }
https://github.com/AGenUI/AGenUI
bb527cee3b10797bd96fd5e72d93b6ffa2d34eab
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Loading/LoadingStateManager.ets
arkts
addStateChangeListener
添加状态变更监听器
public addStateChangeListener(listener: (event: LoadingStateChangeEvent) => void): void { if (this.stateChangeListeners.includes(listener)) { return; } this.stateChangeListeners.push(listener); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left addStateChangeListener AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left listener AST#identifier#Right AST#E...
public addStateChangeListener(listener: (event: LoadingStateChangeEvent) => void): void { if (this.stateChangeListeners.includes(listener)) { return; } this.stateChangeListeners.push(listener); }
https://github.com/DaLongZhuaZi/manxia
6d216d701e4493e87aab435d2bfd877049d2f1ca
github
harmonyos/codelabs
CanvasComponent/entry/src/main/ets/viewmodel/DrawModel.ets
arkts
drawInnerCircle
Draw the inner disc.
drawInnerCircle() { this.fillArc(new FillArcData(0, 0, this.screenWidth * CommonConstants.INNER_CIRCLE_RATIOS, 0, Math.PI * CommonConstants.TWO), ColorConstants.INNER_CIRCLE_COLOR); this.fillArc(new FillArcData(0, 0, this.screenWidth * CommonConstants.INNER_WHITE_CIRCLE_RATIOS, 0, Math.PI * Common...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left drawInnerCircle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Le...
drawInnerCircle() { this.fillArc(new FillArcData(0, 0, this.screenWidth * CommonConstants.INNER_CIRCLE_RATIOS, 0, Math.PI * CommonConstants.TWO), ColorConstants.INNER_CIRCLE_COLOR); this.fillArc(new FillArcData(0, 0, this.screenWidth * CommonConstants.INNER_WHITE_CIRCLE_RATIOS, 0, Math.PI * Common...
https://gitee.com/harmonyos/codelabs.git
afcaa76b6d1e9d0dbdf61b28e08ee26c5f2de159
gitee
codelably/HCompass
core/network/src/main/ets/RequestHelper.ets
arkts
response
执行请求,返回完整响应 @returns NetworkResult Promise
async response(): Promise<NetworkResult<T>> { return this.executeInternal(); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left response AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_typ...
async response(): Promise<NetworkResult<T>> { return this.executeInternal(); }
https://github.com/codelably/HCompass
4363b46cfb1427c44ad41f9d846965e0db99bf1a
github
xblLab/HarmonyProjectTemplate
features/mine/src/main/ets/utils/NumberUtil.ets
arkts
getCountFormat
获取数量格式化 @param count @returns
public static getCountFormat(num: number | undefined): string { let count: string = '0' if (num) { count = num.toString() if (num >= 10000) { count = (num / 10000).toFixed(1) + 'w' } else if (num >= 1000) { count = (num / 1000).toFixed(1) + 'k' } } return count;...
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 getCountFormat AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left num AST#identifier#Right AST#:#Left : AS...
public static getCountFormat(num: number | undefined): string { let count: string = '0' if (num) { count = num.toString() if (num >= 10000) { count = (num / 10000).toFixed(1) + 'w' } else if (num >= 1000) { count = (num / 1000).toFixed(1) + 'k' } } return count;...
https://github.com/xblLab/HarmonyProjectTemplate
07fd7dd64d7090c7fe73c6f8d008e0bee09ed0df
github
Mydstiny/RemoteDeskHarmonyOS
entry/src/main/ets/services/ExtensionLoader.ets
arkts
sendKey
====== 音频 ======
sendKey(sessionId: number, scancode: number, pressed: boolean): void { try { rdpnapi.sendKey(sessionId, scancode, pressed); } catch (err) { hilog.error(DOMAIN, TAG, '[ExtensionLoader] sendKey: ' + JSON.stringify(err)); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left sendKey AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sessionId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , AST#,#Righ...
sendKey(sessionId: number, scancode: number, pressed: boolean): void { try { rdpnapi.sendKey(sessionId, scancode, pressed); } catch (err) { hilog.error(DOMAIN, TAG, '[ExtensionLoader] sendKey: ' + JSON.stringify(err)); } }
https://github.com/Mydstiny/RemoteDeskHarmonyOS
c423c8b2f9d2d5f8dcc536af7e51c06c988f3e26
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/ternary/ternary_ubyte.ets
arkts
main
--- desc: check ternary if-else operation with condition of unsigned byte operand ---
function main(): void { const a: ubyte = {{v.condition}} const b: ubyte = {{v.ifTrue}} const c: ubyte = {{v.ifFalse}} assert (a ? b : c) == {{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 { const a: ubyte = {{v.condition}} const b: ubyte = {{v.ifTrue}} const c: ubyte = {{v.ifFalse}} assert (a ? b : c) == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
4c4f61316ad43f10cae48df8e4a119ebc2def020
gitee
Octo-o-o-o/harmonyos-ai-workspace
samples/templates/web-bridge-h5-shell/BridgeJavaScriptProxy.ets
arkts
buildAck
─── envelope 构造工具 ────────────────────────────────────
private buildAck(req: BridgeEnvelope): BridgeEnvelope { return this.buildResponse(req, '{"ack":true}') }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildAck AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left req AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Bridg...
private buildAck(req: BridgeEnvelope): BridgeEnvelope { return this.buildResponse(req, '{"ack":true}') }
https://github.com/Octo-o-o-o/harmonyos-ai-workspace
bec61ac83f118ab9342a28002983b1ef47951d6f
github
openharmony-tpc/XmlGraphicsBatik
library/src/main/ets/batik/SVGManager.ets
arkts
getSVGTotalObj
获取整个SVG的整体对象
public getSVGTotalObj() { return this._svgObj; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getSVGTotalObj AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left ...
public getSVGTotalObj() { return this._svgObj; }
https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git
5b8a7883bbd477b6a3d560c8eb9b13fb054e07c8
gitee
HarmonyOS_Codelabs/arkts-basic-syntax-demo
entry/src/main/ets/pages/BasicPage.ets
arkts
arithmeticOperators
算数运算符
function arithmeticOperators() { // 一元运算符 let count = 5; let result = count++; // 等价于: let result = count; count = count + 1; console.log(`count: ${count}, result: ${result}`); // 二元运算符 let a = 10; let b = 4; console.log(`${a} + ${b} = ${a + b}`); console.log(`${a} - ${b} = ${a - b}`); console.log(...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left arithmeticOperators 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#comment...
function arithmeticOperators() { // 一元运算符 let count = 5; let result = count++; // 等价于: let result = count; count = count + 1; console.log(`count: ${count}, result: ${result}`); // 二元运算符 let a = 10; let b = 4; console.log(`${a} + ${b} = ${a + b}`); console.log(`${a} - ${b} = ${a - b}`); console.log(...
https://gitcode.com/HarmonyOS_Codelabs/arkts-basic-syntax-demo
90cd4104efd693efc8e1df4da96a78ae757f7aac
gitcode
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/common/utils/DAOHelper.ets
arkts
getNumberValue
安全获取数字值(兼容null)
static getNumberValue(resultSet: relationalStore.ResultSet, columnName: string): number { try { const index = resultSet.getColumnIndex(columnName); if (resultSet.isColumnNull(index)) { return 0; } return resultSet.getDouble(index); } catch (error) { console.warn(`[DAOHelp...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getNumberValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resultSet AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expre...
static getNumberValue(resultSet: relationalStore.ResultSet, columnName: string): number { try { const index = resultSet.getColumnIndex(columnName); if (resultSet.isColumnNull(index)) { return 0; } return resultSet.getDouble(index); } catch (error) { console.warn(`[DAOHelp...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
63f7f6387c401960042f77dfeeb8b0c4db41c996
github
openharmony/applications_contacts
entry/src/main/ets/presenter/contact/detail/DetailPresenter.ets
arkts
subStringWithEllipsis
Truncates the first five characters of the string plus..
subStringWithEllipsis(str: string, len: number) { let newLength = 0; let newStr = ''; let chineseRegex = /[^\x00-\xff]/g; let singleChar = ''; let strLength = str.replace(chineseRegex, '**').length; for (let i = 0; i < strLength; i++) { singleChar = str.charAt(i).toString(); if (singleChar.match(chi...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left subStringWithEllipsis AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifie...
subStringWithEllipsis(str: string, len: number) { let newLength = 0; let newStr = ''; let chineseRegex = /[^\x00-\xff]/g; let singleChar = ''; let strLength = str.replace(chineseRegex, '**').length; for (let i = 0; i < strLength; i++) { singleChar = str.charAt(i).toString(); if (singleChar.match(chi...
https://gitee.com/openharmony/applications_contacts.git
1487c1a260971ba927c2a728d7adcc9e00e2cc16
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Download/DownloadManager.ets
arkts
createPartialOnlineMangaArchive
创建部分归档(含占位图) 当下载完成度达到阈值但仍有失败页面时使用
private async createPartialOnlineMangaArchive( task: DownloadTaskInfo, pageFiles: OnlineArchivePageFile[], failedPageIndexes: number[] ): Promise<OnlineArchiveCreateResult> { if (pageFiles.length === 0) { throw new Error('部分归档没有可归档页面'); } const metadata = await this.buildOnlineArchive...
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 createPartialOnlineMangaArchive AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left task AST#identifier#R...
private async createPartialOnlineMangaArchive( task: DownloadTaskInfo, pageFiles: OnlineArchivePageFile[], failedPageIndexes: number[] ): Promise<OnlineArchiveCreateResult> { if (pageFiles.length === 0) { throw new Error('部分归档没有可归档页面'); } const metadata = await this.buildOnlineArchive...
https://github.com/DaLongZhuaZi/manxia
746a05be75a043485d65513d7281fef006358ff3
github
openharmony/arkui_ace_engine
advanced_ui_component_static/assembled_advanced_ui_component/@ohos.arkui.advanced.TreeView.ets
arkts
on
Event registration and processing. The event will not be destroyed after being processed. @param { type } event Registered Events. @param callback. @syscap SystemCapability.ArkUI.ArkUI.Full @since 10 Event registration and processing. The event will not be destroyed after being processed. @param { type } event Register...
public on(type: TreeListenType, callback: (callbackParam: CallbackParam) => void): void { this._events.set(type, callback) }
AST#program#Left AST#ERROR#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left on AST#identifier#Right AST#ERROR#Right AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left TreeListenType AST...
public on(type: TreeListenType, callback: (callbackParam: CallbackParam) => void): void { this._events.set(type, callback) }
https://gitcode.com/openharmony/arkui_ace_engine
9a82972eb7a49eca166e3718c93ba33a0aef554a
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/DataManager.ets
arkts
getAllOnlineComics
[新增] 获取所有在线漫画列表
public async getAllOnlineComics(): Promise<OnlineComicInfo[]> { try { const records = await this.databaseManager.query( 'online_comic_info', undefined, undefined, undefined, 'lastUpdateTime DESC' ); return records.map(record => this.convertRecordToOnlineC...
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 getAllOnlineComics AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A...
public async getAllOnlineComics(): Promise<OnlineComicInfo[]> { try { const records = await this.databaseManager.query( 'online_comic_info', undefined, undefined, undefined, 'lastUpdateTime DESC' ); return records.map(record => this.convertRecordToOnlineC...
https://github.com/DaLongZhuaZi/manxia
03c256985c5ea38b36492277ef329589059d9164
github
DaLongZhuaZi/manxia
entry/src/main/ets/libs/htmlparser/Node.ets
arkts
decodeHtmlEntities
解码 HTML 实体
protected decodeHtmlEntities(text: string): string { return HtmlEntities.decode(text); }
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left decodeHtmlEntities 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#iden...
protected decodeHtmlEntities(text: string): string { return HtmlEntities.decode(text); }
https://github.com/DaLongZhuaZi/manxia
6134299317d4daeaeafe7a9f52ea666a6d57df9c
github
zhpywhatever/OHOS-Top3-Health-APP
entry/src/main/ets/pages/MomentsPage.ets
arkts
generateRandomImages
生成随机数组b的函数
function generateRandomImages(): ResourceStr[] { // 生成0到9的随机长度 const length = Math.floor(Math.random() * 10); // 生成随机数组b const randomArray: Resource[] = []; for (let i = 0; i < length; i++) { randomArray.push(getRandomElement2(images)); } return randomArray; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left generateRandomImages 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#array_...
function generateRandomImages(): ResourceStr[] { // 生成0到9的随机长度 const length = Math.floor(Math.random() * 10); // 生成随机数组b const randomArray: Resource[] = []; for (let i = 0; i < length; i++) { randomArray.push(getRandomElement2(images)); } return randomArray; }
https://github.com/zhpywhatever/OHOS-Top3-Health-APP
0b991e22e492677a265c0d252890b86cfcc57da9
github
LZZLHY/hlib
entry/src/main/ets/viewmodel/BookDetailVM.ets
arkts
safeSimilar
similar 失败不影响 detail。
private static async safeSimilar(bookId: string, hashId: string): Promise<Book[]> { try { return await ZLibraryClient.instance.similar(bookId, hashId); } catch (e) { Logger.w(TAG, `similar failed: ${(e as Error).message}`); return []; } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left safeSimilar AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left boo...
private static async safeSimilar(bookId: string, hashId: string): Promise<Book[]> { try { return await ZLibraryClient.instance.similar(bookId, hashId); } catch (e) { Logger.w(TAG, `similar failed: ${(e as Error).message}`); return []; } }
https://github.com/LZZLHY/hlib
9deb928634c2a9792ad30b2ce321801ad4f3d54c
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/SettingsManager.ets
arkts
delete
============================================================================ 设置删除和重置 ============================================================================ 删除单个设置(恢复为默认值) @param key 设置键名 @returns 操作结果
public async delete(key: string): Promise<SettingsResult<void>> { const definition = getSettingDefinition(key); if (!definition) { return createErrorResult(SettingsErrorCode.ERR_UNKNOWN_SETTING_KEY, key); } // 恢复缓存为默认值 this.settingsCache.set(key, definition.defaultValue); if (!this.ini...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#delete#Left delete AST#delete#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 ...
public async delete(key: string): Promise<SettingsResult<void>> { const definition = getSettingDefinition(key); if (!definition) { return createErrorResult(SettingsErrorCode.ERR_UNKNOWN_SETTING_KEY, key); } // 恢复缓存为默认值 this.settingsCache.set(key, definition.defaultValue); if (!this.ini...
https://github.com/richshaw2015/nds
7b3e4851a3575b3137379c556fbe7fba1f54e4d4
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/InputProcessor.ets
arkts
processGamepadButton
处理手柄按键事件 根据 gamepadMappings 查找 buttonCode 对应的 InputTarget, 返回 ProcessResult 或 null(未找到映射时)。 @param buttonCode 手柄按键码 @param isDown 是否为按下事件 @returns ProcessResult 或 null
processGamepadButton(buttonCode: number, isDown: boolean): ProcessResult | null { const mapping = this.gamepadMappings.find((m: GamepadMappingEntry) => m.buttonCode === buttonCode) if (!mapping) { return null } return this.createResultFromTarget(mapping.target, isDown) }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left processGamepadButton AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left buttonCode AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number ...
processGamepadButton(buttonCode: number, isDown: boolean): ProcessResult | null { const mapping = this.gamepadMappings.find((m: GamepadMappingEntry) => m.buttonCode === buttonCode) if (!mapping) { return null } return this.createResultFromTarget(mapping.target, isDown) }
https://github.com/richshaw2015/nds
118465ffba807feca311e3f84ae34699d08343f1
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test19_original_index.ets
arkts
testTypeofGuards
--- Typeof guard with branching ---
function testTypeofGuards(): string { let vals: (string | number | boolean)[] = ['hello', 42, true]; let result: string = ''; for (let i: number = 0; i < vals.length; i++) { let v: string | number | boolean = vals[i]; if (typeof v === 'string') { result = result + 'S'; } else if (typeof v === 'n...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testTypeofGuards AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined...
function testTypeofGuards(): string { let vals: (string | number | boolean)[] = ['hello', 42, true]; let result: string = ''; for (let i: number = 0; i < vals.length; i++) { let v: string | number | boolean = vals[i]; if (typeof v === 'string') { result = result + 'S'; } else if (typeof v === 'n...
https://github.com/miaochiahao/ark-ghidra
665fe2be006ee93f3473ba61818d9703e90d3acb
github
XHXYT/Pixark
entry/src/main/ets/viewmodel/AppDataViewModel.ets
arkts
clearCache
清理缓存 @param dir 不传则清理全部,传 'ImageKnife' 或 'Pixiv/Pictures' 清理指定目录
async clearCache(dir?: string) { if (!dir) { await Promise.all([ this.clearCache('ImageKnife'), this.clearCache('Pixiv/Pictures') ]); return; } try { const cacheDir = `${this.context.filesDir}/${dir}`; if (!fs.accessSync(cacheDir)) { toastUtil.showToa...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left clearCache AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#optional_parameter#Left AST#identifier#Left dir AST#identifier#Right AST#?#Left ? AST#?#Right AST#type_annotatio...
async clearCache(dir?: string) { if (!dir) { await Promise.all([ this.clearCache('ImageKnife'), this.clearCache('Pixiv/Pictures') ]); return; } try { const cacheDir = `${this.context.filesDir}/${dir}`; if (!fs.accessSync(cacheDir)) { toastUtil.showToa...
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/viewmodel/AppDataViewModel.ets#L300-L341
81dbc46edee66a5f06af864111a6d6b6bf2d5ef8
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/UndefinableObjectArray.ets
arkts
constructor
Constructs new UndefinableObjectArray with respect to capacity and initial value @param { int } capacity - The initial capacity of the array @param { UndefinableObject } val - The value used to initialize all array elements @syscap SystemCapability.Utils.Lang
constructor(capacity: int, val: UndefinableObject) { this.init(capacity, val) }
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#identifier#Left capacity AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#Right AST#ERROR#Right ...
constructor(capacity: int, val: UndefinableObject) { this.init(capacity, val) }
https://gitcode.com/iop123123/arkts-static-skills
8d22075977a295bccf8e71fd91f0dc0fe799b7fc
gitcode
Countly/countly-sdk-hos
library/src/main/ets/internal/modules/ModuleDeviceId.ets
arkts
setBeforeNonMergedSwapHook
Pre-swap hook for the changeWithoutMerge path. Fires UNDER THE OLD ID, after events/UP have flushed but before commit(). Used by CountlyInstance to emit end_session (non-manual + active session) and consent-reset requests under the old identity before the device-id swap.
public setBeforeNonMergedSwapHook(cb: (oldId: string, newId: string) => Promise<void>): void { this.onBeforeNonMergedSwap = cb; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setBeforeNonMergedSwapHook AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left cb AST#identifier#Right AST#ERROR#Left ...
public setBeforeNonMergedSwapHook(cb: (oldId: string, newId: string) => Promise<void>): void { this.onBeforeNonMergedSwap = cb; }
https://github.com/Countly/countly-sdk-hos
b8caca83563ff1198105b243488cb947c279187b
github
aimilin6688/KeePassHO
entry/src/main/ets/services/kdbx/KdbxFileManager.ets
arkts
read
加载KDBX文件 @param path 文件路径 @return Promise<ArrayBuffer> 文件内容 @throws 如果加载失败则抛出异常
public async read(path: string): Promise<FileContentInfo> { try { // 检查文件是否存在 const fileInfo = await this.storage.getInfo(path); if (!fileInfo) { hilog.error(DOMAIN, TAG, 'KDBX file does not exist: %{public}s', path); throw new Error(ResourceManager.getString($r('app.string.file_...
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 read AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right ...
public async read(path: string): Promise<FileContentInfo> { try { // 检查文件是否存在 const fileInfo = await this.storage.getInfo(path); if (!fileInfo) { hilog.error(DOMAIN, TAG, 'KDBX file does not exist: %{public}s', path); throw new Error(ResourceManager.getString($r('app.string.file_...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/kdbx/KdbxFileManager.ets#L52-L68
23e1343358a8e39f267101619e157baafe206045
github
Dige945/EmoCollector
entry/src/main/ets/model/DBManager.ets
arkts
queryAll
查询所有记录(按时间倒序) @returns 返回 MoodData 数组
public async queryAll(): Promise<MoodData[]> { if (!this.rdbStore) { console.error('[DBManager] 数据库未初始化'); return []; } try { // 构造查询条件:按时间戳降序排列 const predicates = new relationalStore.RdbPredicates(this.TABLE_NAME); predicates.orderByDesc(this.COLUMN_TIMESTAMP); // 执行...
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 queryAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left ...
public async queryAll(): Promise<MoodData[]> { if (!this.rdbStore) { console.error('[DBManager] 数据库未初始化'); return []; } try { // 构造查询条件:按时间戳降序排列 const predicates = new relationalStore.RdbPredicates(this.TABLE_NAME); predicates.orderByDesc(this.COLUMN_TIMESTAMP); // 执行...
https://github.com/Dige945/EmoCollector
9b84afbc9564666c58631e5793052e5a444d7150
github
751496032/ZRouter
RouterApi/src/main/ets/model/NavDestBuilder.ets
arkts
getParam
获取当前页面的参数 @returns
public getParam(): ObjectOrNull { this.updateCurrentStackName() return this.routerMgr.getParam() }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getParam 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 ObjectOrNull ...
public getParam(): ObjectOrNull { this.updateCurrentStackName() return this.routerMgr.getParam() }
https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/model/NavDestBuilder.ets#L421-L424
2f56733516adc4315272a990e57745d611f7f7da
github
openharmony/applications_contacts
entry/src/main/ets/model/ContactAbilityModel.ets
arkts
getAllContact
Querying the Mobile Numbers of All Contacts @param {string} DAHelper @param {Object} callBack
async getAllContact(actionData: AllContactGetParam, callBack: Function, context?: common.UIAbilityContext | Context) { HiLog.i(TAG, 'Start to query all contacts without PhoneNumbers'); if (context) { ContactRepository.getInstance().init(context); } ContactRepository.getInstance().findAll(actionD...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getAllContact AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left actionData AST#identifier#Right AST#type_annotation#Left...
async getAllContact(actionData: AllContactGetParam, callBack: Function, context?: common.UIAbilityContext | Context) { HiLog.i(TAG, 'Start to query all contacts without PhoneNumbers'); if (context) { ContactRepository.getInstance().init(context); } ContactRepository.getInstance().findAll(actionD...
https://gitee.com/openharmony/applications_contacts.git
c170da4edcc54c6668f8f9d3b6488386c6167241
gitee
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/CategoryDAO.ets
arkts
aggregateByCategory
按分类聚合统计 @param userId 用户ID @param startDate 开始日期 @param endDate 结束日期 @returns 分类统计结果
static async aggregateByCategory( userId: number, startDate: string, endDate: string ): Promise<CategoryAggregation[]> { const store = DatabaseManager.getDatabase(); const sql = ` SELECT c.category_id, c.name AS category_name, c.type, c.icon, c...
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 aggregateByCategory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Le...
static async aggregateByCategory( userId: number, startDate: string, endDate: string ): Promise<CategoryAggregation[]> { const store = DatabaseManager.getDatabase(); const sql = ` SELECT c.category_id, c.name AS category_name, c.type, c.icon, c...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
6d0ea18a140fbc9b30b89e7468ec4d7a1b2362d9
github
Joker-x-dev/CoolMallArkTS
feature/user/src/main/ets/viewmodel/AddressDetailViewModel.ets
arkts
onRegionFieldClick
点击地区选择入口 @returns {void} 无返回值
onRegionFieldClick(): void { this.isRegionPickerVisible = true; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onRegionFieldClick 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...
onRegionFieldClick(): void { this.isRegionPickerVisible = true; }
https://github.com/Joker-x-dev/CoolMallArkTS
9d2fcec4eb0419807b5e5ead303ec66144c99b79
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
fill
Fills the Uint8Array with specified value @param { number } value - new valuy @param { int } [start] - start index to begin fill from @param { int } [end] - last index to end fill from, excluded @returns { Uint8Array } - modified Uint8Array @syscap SystemCapability.Utils.Lang @FaAndStageModel
public fill(value: number, start?: int, end?: int): Uint8Array { this.fill(Uint8Array.doubleToInt(value), start, end) return this }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left fill AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERR...
public fill(value: number, start?: int, end?: int): Uint8Array { this.fill(Uint8Array.doubleToInt(value), start, end) return this }
https://gitcode.com/iop123123/arkts-static-skills
64829b3197a37a5b6910122344919c1cbe169b77
gitcode
harmonyos/codelabs
HarmonyOS_NEXT/DistributedContacts/entry/src/main/ets/viewmodel/DeletePageViewModel.ets
arkts
cancelDialog
Button for canceling the deletion dialog box.
cancelDialog(): void { promptAction.showToast({ message: $r('app.string.delete_cancel_text'), duration: CommonConstants.PROMPT_DURATION }); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left cancelDialog 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...
cancelDialog(): void { promptAction.showToast({ message: $r('app.string.delete_cancel_text'), duration: CommonConstants.PROMPT_DURATION }); }
https://gitee.com/harmonyos/codelabs.git
908cc4de4112e440846d39b43045366d73c8b240
gitee
huaweicloud/huaweicloud-iot-device-sdk-arkts
huaweicloud_iot_device_library/src/main/ets/client/DeviceClient.ets
arkts
connectionListener
设置链路监听器,用户接收链路断开事件 @param connectLostListener
public set connectionListener(value: ConnectListener | null) { this._connectionListener = value; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left set AST#identifier#Right AST#call_expression#Left AST#identifier#Left connectionListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left :...
public set connectionListener(value: ConnectListener | null) { this._connectionListener = value; }
https://github.com/huaweicloud/huaweicloud-iot-device-sdk-arkts
a73097bd7f909a93a3409bcf81bae74bc531f810
github
AGenUI/AGenUI
platforms/harmony/agenui/src/main/ets/agenui/AGenEngineUI.ets
arkts
triggerAction
Dispatches a UI action to report user interaction with the component.
triggerAction(): void { const ctx: DefaultActionContext = { action: 'default' }; this._surface.triggerAction(this.componentId, ctx); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left triggerAction AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc...
triggerAction(): void { const ctx: DefaultActionContext = { action: 'default' }; this._surface.triggerAction(this.componentId, ctx); }
https://github.com/AGenUI/AGenUI
9603224627fcb1b56c7e3c586f2347524565d89b
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Distributed/DistributedDataSyncManager.ets
arkts
removeOnDataChangedCallback
移除数据变更监听
public removeOnDataChangedCallback(callback: (state: SyncReadingState) => void): void { this.dataChangedCallbacks.delete(callback); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left removeOnDataChangedCallback AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#...
public removeOnDataChangedCallback(callback: (state: SyncReadingState) => void): void { this.dataChangedCallbacks.delete(callback); }
https://github.com/DaLongZhuaZi/manxia
694d12eea0c3f57dce2b35953fff6ec1a5035a11
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/ArrayBuffer.ets
arkts
getByteLength
abstract
/* abstract */ getByteLength(): int { throw new Error("abstract"); }
AST#program#Left AST#comment#Left /* abstract */ AST#comment#Right AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getByteLength 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#Lef...
/* abstract */ getByteLength(): int { throw new Error("abstract"); }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
a07bb413b1656c1c51e20a13b33eeeab64e47b13
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/MessageHandler.ets
arkts
hasCallbacks
Check if a specific callback exists in the handler @param { Task } callback The callback function to check @returns { boolean } True if the callback exists, false otherwise
public hasCallbacks(callback: Task): boolean { if (this.workerIsMain()) { return false; } return this.hasMessage((value: MessageStatus, key: Message) => { return key.getCallback() == callback; }); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left hasCallbacks AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Task AST#identi...
public hasCallbacks(callback: Task): boolean { if (this.workerIsMain()) { return false; } return this.hasMessage((value: MessageStatus, key: Message) => { return key.getCallback() == callback; }); }
https://gitcode.com/iop123123/arkts-static-skills
7dbdd80b3ea75deeed326c022d494cdca48c44f5
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/ArrayAsListInt.ets
arkts
size
Returns number of elements in the List
public override size(): int { return this.curSize; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left override AST#identifier#Right AST#identifier#Left size AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right...
public override size(): int { return this.curSize; }
https://gitcode.com/iop123123/arkts-static-skills
5c00943dde0195af755dd44433240ddb19e69a4a
gitcode
LongLiveY96/chatcube
entry/src/main/ets/services/AssistantService.ets
arkts
getCurrentAssistantForNewChat
专门给“发起新会话”用:跟 getCurrentAssistant 的主体一致, 但额外会把兜底选择写回 Preferences,保证下次进入 new chat 时状态一致
async getCurrentAssistantForNewChat(): Promise<Assistant> { await this.store.ensureAssistantsInitialized() const assistantId = await this.getCurrentAssistantId() const assistant = this.store.getAssistantById(assistantId) if (assistant !== null) { return assistant } const fallback = this....
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getCurrentAssistantForNewChat AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Lef...
async getCurrentAssistantForNewChat(): Promise<Assistant> { await this.store.ensureAssistantsInitialized() const assistantId = await this.getCurrentAssistantId() const assistant = this.store.getAssistantById(assistantId) if (assistant !== null) { return assistant } const fallback = this....
https://github.com/LongLiveY96/chatcube
4672c526ff12dfc74420aa44a4ce099c8cb65d54
github
aimilin6688/KeePassHO
entry/src/main/ets/services/EventBus.ets
arkts
off
取消事件所有订阅者 @param event
static off(event: string, callback?: Callback<emitter.EventData>) { hilog.debug(DOMAIN, TAG, `Unsubscribe event: ${event}`); if (callback) { emitter.off(event, callback); } else { emitter.off(event); } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left off AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:#Left : AST#:...
static off(event: string, callback?: Callback<emitter.EventData>) { hilog.debug(DOMAIN, TAG, `Unsubscribe event: ${event}`); if (callback) { emitter.off(event, callback); } else { emitter.off(event); } }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/EventBus.ets#L37-L44
cbddff7230b7a34abc89ff0eebfb12f2d2979ef8
github
CLMC2025/Vignette
entry/src/main/ets/vocabulary/VocabularyTracker.ets
arkts
getWordsByTag
根据标签获取词汇
getWordsByTag(tag: string): VocabularyRecord[] { return this.getAllRecords().filter((record: VocabularyRecord): boolean => record.tags.includes(tag) ); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getWordsByTag AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tag AST#id...
getWordsByTag(tag: string): VocabularyRecord[] { return this.getAllRecords().filter((record: VocabularyRecord): boolean => record.tags.includes(tag) ); }
https://github.com/CLMC2025/Vignette
b4b2ef402dc5c8deeaa7849f7eec6e173b896daf
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/AbcRuntimeLinker.ets
arkts
addAbcFiles
Adds new ABC files in the linker's context. @param paths to new ABC files. @throws errors happened on loading ABC file.
public addAbcFiles(paths: string[]): void { const loadedFiles : FixedArray<AbcFile | undefined> = new FixedArray<AbcFile | undefined>(paths.length) let count = 0 for (let i = 0; i < paths.length; i++) { const file = AbcFile.loadAbcFile(this, paths[i]) if (...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addAbcFiles AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left paths AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expressio...
public addAbcFiles(paths: string[]): void { const loadedFiles : FixedArray<AbcFile | undefined> = new FixedArray<AbcFile | undefined>(paths.length) let count = 0 for (let i = 0; i < paths.length; i++) { const file = AbcFile.loadAbcFile(this, paths[i]) if (...
https://gitcode.com/iop123123/arkts-static-skills
73e8d5486a6c5d777b81d990d1b698f06186820f
gitcode
YDYm233/EasyRandom_HarmonyNextApp
common/SystemUtils/src/main/ets/utils/ApiVersionUtil.ets
arkts
getApiVersionInfo
获取API版本信息描述 @returns API版本信息字符串
static getApiVersionInfo(): string { return `当前设备API版本: ${deviceInfo.sdkApiVersion}`; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getApiVersionInfo 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 A...
static getApiVersionInfo(): string { return `当前设备API版本: ${deviceInfo.sdkApiVersion}`; }
https://github.com/YDYm233/EasyRandom_HarmonyNextApp
8dd19e3deb27470ff4c478b4658f2aadbf0cb367
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/utils/HttpClient.ets
arkts
postWithClientCert
执行带客户端证书的 POST 请求
static async postWithClientCert( url: string, body: string, certPath: string, keyPath: string, config?: HttpClientConfig ): Promise<HttpResponse> { return HttpClient.post(url, body, { skipServerValidation: true, clientCertPath: certPath, clientKeyPath: keyPath, header...
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 postWithClientCert AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left :...
static async postWithClientCert( url: string, body: string, certPath: string, keyPath: string, config?: HttpClientConfig ): Promise<HttpResponse> { return HttpClient.post(url, body, { skipServerValidation: true, clientCertPath: certPath, clientKeyPath: keyPath, header...
https://github.com/AlkaidLab/moonlight-harmony
dad2d2d3e91207f6e781b6fed159bbc9766c808a
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/SmartCategoryService.ets
arkts
splitKeywords
==================== 智能推荐 ====================
private static splitKeywords(raw: string): string[] { const trimmed: string = raw.trim(); if (trimmed.length === 0) { return []; } return trimmed .split(/[\s,,;;、]+/) .map((part: string) => part.trim()) .filter((part: string) => part.length > 0); }
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 splitKeywords AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left raw AST#identifier#Right AST#:#Left : ...
private static splitKeywords(raw: string): string[] { const trimmed: string = raw.trim(); if (trimmed.length === 0) { return []; } return trimmed .split(/[\s,,;;、]+/) .map((part: string) => part.trim()) .filter((part: string) => part.length > 0); }
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
6c6724b833bc5610c312775c8b971d71062f1428
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Debug/PerformanceAnalyzer.ets
arkts
setThresholds
设置性能阈值
public setThresholds(newThresholds: Partial<PerformanceThresholds>): void { if (newThresholds.minFPS !== undefined) { this.thresholds.minFPS = newThresholds.minFPS; } if (newThresholds.maxFrameTime !== undefined) { this.thresholds.maxFrameTime = newThresholds.maxFrameTime; } if (newThr...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setThresholds AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left newThresholds AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#R...
public setThresholds(newThresholds: Partial<PerformanceThresholds>): void { if (newThresholds.minFPS !== undefined) { this.thresholds.minFPS = newThresholds.minFPS; } if (newThresholds.maxFrameTime !== undefined) { this.thresholds.maxFrameTime = newThresholds.maxFrameTime; } if (newThr...
https://github.com/DaLongZhuaZi/manxia
0156fcdf1ad5ddc0451dc427c16d8234cd82ea0e
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test38_original_index.ets
arkts
testCharCodeRange
--- String encoding patterns (charCodeAt range) ---
function testCharCodeRange(): string { let result: string = ''; for (let i: number = 65; i <= 70; i++) { result = result + String.fromCharCode(i); } let code0: number = 'A'.charCodeAt(0); let code5: number = 'F'.charCodeAt(0); return result + ',' + String(code0) + ',' + String(code5); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testCharCodeRange 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#predefine...
function testCharCodeRange(): string { let result: string = ''; for (let i: number = 65; i <= 70; i++) { result = result + String.fromCharCode(i); } let code0: number = 'A'.charCodeAt(0); let code5: number = 'F'.charCodeAt(0); return result + ',' + String(code0) + ',' + String(code5); }
https://github.com/miaochiahao/ark-ghidra
8c0ebf1a042f63a5bccb25cdf17775ab1e02ce11
github
offlinecat-dev/OCNetORM
src/main/ets/core/ScopeRegistry.ets
arkts
clear
清空所有作用域
clear(): void { this.scopes.clear() }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left A...
clear(): void { this.scopes.clear() }
https://github.com/offlinecat-dev/OCNetORM
1869c964de9f5f599ead72096f428c4dd4e012e6
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
fill
Fills the BigInt64Array with specified value @param { long } value - new value @param { int } [start] - start index to begin fill from @param { int } [end] - last index to end fill from, excluded @returns { this } - modified BigInt64Array @syscap SystemCapability.Utils.Lang @FaAndStageModel
public fill(value: long, start?: int, end?: int): this { const k = normalizeIndex(start ?? 0, this.lengthInt) const finalPos = normalizeIndex(end ?? this.lengthInt, this.lengthInt) this.fillInternal(value, k, finalPos) return this }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left fill AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ide...
public fill(value: long, start?: int, end?: int): this { const k = normalizeIndex(start ?? 0, this.lengthInt) const finalPos = normalizeIndex(end ?? this.lengthInt, this.lengthInt) this.fillInternal(value, k, finalPos) return this }
https://gitcode.com/iop123123/arkts-static-skills
e98c2e7e4e60e350068d99ac6f03d27b87cacbfe
gitcode
OnceWeWere/Weather_HarmonyOS
entry/src/main/ets/pages/Index.ets
arkts
build
--- UI 构建 ---
build() { Navigation(this.pageStack) { Stack() { Column() .width('100%').height('100%') // .linearGradient({ angle: 180, colors: this.bgColors }) .backgroundColor(Color.Blue) .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST...
build() { Navigation(this.pageStack) { Stack() { Column() .width('100%').height('100%') // .linearGradient({ angle: 180, colors: this.bgColors }) .backgroundColor(Color.Blue) .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) ...
https://github.com/OnceWeWere/Weather_HarmonyOS
6d84cad7d189a2b24a6399f088dbda55d537afdc
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test13_original_index.ets
arkts
testMapGetDefault
--- Map.has / Map.get pattern ---
function testMapGetDefault(): string { let cache: Map<string, number> = new Map(); cache.set('a', 1); cache.set('b', 2); let key: string = 'c'; let val: number; if (cache.has(key)) { let existing: number | undefined = cache.get(key); if (existing !== undefined) { val = existing; } else { ...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testMapGetDefault 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#predefine...
function testMapGetDefault(): string { let cache: Map<string, number> = new Map(); cache.set('a', 1); cache.set('b', 2); let key: string = 'c'; let val: number; if (cache.has(key)) { let existing: number | undefined = cache.get(key); if (existing !== undefined) { val = existing; } else { ...
https://github.com/miaochiahao/ark-ghidra
e220133f03a81b02d5db1191ede032fc93cabc1f
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Source/SourceManager.ets
arkts
enableSource
==================== 管理功能 ==================== 启用图源
async enableSource(sourceId: number): Promise<void> { await this.dataManager.updateComicSource(sourceId, { isEnabled: true }); logger.info(TAG, `图源已启用: ${sourceId}`); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left enableSource AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceId AST#identifier#Right AST#type_annotation#Left AST#:#Left ...
async enableSource(sourceId: number): Promise<void> { await this.dataManager.updateComicSource(sourceId, { isEnabled: true }); logger.info(TAG, `图源已启用: ${sourceId}`); }
https://github.com/DaLongZhuaZi/manxia
7823c080c84e60238ccc4da2744060f965059b57
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/right_shift/right_shift_uint.ets
arkts
main
--- desc: check right shift operation for unsigned integer ---
function main(): void { const a: uint = {{v.left}} const b: int = {{v.right}} assert (a >> b) == {{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 { const a: uint = {{v.left}} const b: int = {{v.right}} assert (a >> b) == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
7c9bd50fbacba3e6cd77e1cfd4494cae97f15d7b
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Initialization/DataInitializer.ets
arkts
initializeDataService
初始化数据服务层
private async initializeDataService(context: common.UIAbilityContext, config: InitializationConfig): Promise<void> { try { const dataService = DataService.getInstance(); await dataService.initialize(context); logger.debug(TAG, '数据服务层初始化完成'); } catch (error) { throw new Error(`数据...
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 initializeDataService AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AS...
private async initializeDataService(context: common.UIAbilityContext, config: InitializationConfig): Promise<void> { try { const dataService = DataService.getInstance(); await dataService.initialize(context); logger.debug(TAG, '数据服务层初始化完成'); } catch (error) { throw new Error(`数据...
https://github.com/DaLongZhuaZi/manxia
67f7f08c83580594deee9857b6b885da68b6004f
github
offlinecat-dev/OCNetORM
src/main/ets/repository/Repository.ets
arkts
transactionWithOptions
在事务中执行操作(带选项) 支持事务超时、重试机制 @param callback 事务回调函数 @param options 事务选项 @returns Promise<TransactionResult>
async transactionWithOptions( callback: TransactionCallback, options: TransactionOptions ): Promise<TransactionResult> { this.ensureNoNestedTransaction('transactionWithOptions') return await this.transactionManager.transactionWithOptions(async (store) => { const scopedRepository = this.createT...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left transactionWithOptions AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#...
async transactionWithOptions( callback: TransactionCallback, options: TransactionOptions ): Promise<TransactionResult> { this.ensureNoNestedTransaction('transactionWithOptions') return await this.transactionManager.transactionWithOptions(async (store) => { const scopedRepository = this.createT...
https://github.com/offlinecat-dev/OCNetORM
cfdc91010932de2bf8835dd4f6552b870ead7b92
github
openharmony-sig/commons-cli
library/src/main/ets/components/cli/JMap.ets
arkts
removeByKey
删除指定KEY的元素,成功返回True,失败返回False
removeByKey(_key:T1):Boolean { let bln = false; try { for (let i = 0; i < this.elements.length; i++) { if (this.elements[i].key == _key) { this.elements.splice(i, 1); return true; } } } catch (e) { bln = false; } return bln; };
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left removeByKey AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left _key AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T1 AST#identifier#Right AST#ERROR#Right AST#)#Left ) AST#)#R...
removeByKey(_key:T1):Boolean { let bln = false; try { for (let i = 0; i < this.elements.length; i++) { if (this.elements[i].key == _key) { this.elements.splice(i, 1); return true; } } } catch (e) { bln = false; } return bln; };
https://gitee.com/openharmony-sig/commons-cli.git
8ca6903152057eb37e3df67eb8c9f6feb9827c73
gitee
AetheriumSimulator/qemu-hmos
entry/src/main/ets/managers/QemuVMManager.ets
arkts
createSnapshot
============================================================ 快照管理 ============================================================ 创建快照
async createSnapshot(vmName: string, snapshotName: string): Promise<SnapshotResult> { try { const response = await this.sendCommand({ command: 'create_snapshot', vmName: vmName, snapshotName: snapshotName }) const result: SnapshotResult = { success: response.success, mess...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left createSnapshot AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left vmName AST#identifier#Right AST#type_annotation#Left AST#:#Left ...
async createSnapshot(vmName: string, snapshotName: string): Promise<SnapshotResult> { try { const response = await this.sendCommand({ command: 'create_snapshot', vmName: vmName, snapshotName: snapshotName }) const result: SnapshotResult = { success: response.success, mess...
https://github.com/AetheriumSimulator/qemu-hmos
5ad7412e3ab694416ef02975bdd9a90bd1b70073
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/network/QrShareService.ets
arkts
fromCompactV1
v1 兼容:直接从含 KeyAction 对象的紧凑格式还原
function fromCompactV1(raw: Record<string, Object>): CustomKeyDef { return { id: generateKeyId(), label: raw['l'] as string ?? '', action: raw['a'] as KeyAction, shape: ((raw['s'] as string) === 'c' ? 'circle' : ((raw['s'] as string) === 'h' ? 'hexagon' : 'rect')) as KeyShape, behavior: ((raw['b']...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left fromCompactV1 AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left raw AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Rig...
function fromCompactV1(raw: Record<string, Object>): CustomKeyDef { return { id: generateKeyId(), label: raw['l'] as string ?? '', action: raw['a'] as KeyAction, shape: ((raw['s'] as string) === 'c' ? 'circle' : ((raw['s'] as string) === 'h' ? 'hexagon' : 'rect')) as KeyShape, behavior: ((raw['b']...
https://github.com/AlkaidLab/moonlight-harmony
1366e0b8068207961990f1911321939e5abf054b
github
tdcare/tdwebrtc
src/main/ets/utils/LogUtil.ets
arkts
getErrorStr
获取Error字符串
public static getErrorStr(error: Error, line: boolean = true): string { let errObj: Record<string, string | number> = {}; errObj['name'] = error.name; errObj['code'] = (error as BusinessError)?.code ?? ''; errObj['message'] = error.message; errObj['stack'] = error.stack ?? ''; let errorStr = L...
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 getErrorStr AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left error AST#identifier#Right AST#:#Left : AST...
public static getErrorStr(error: Error, line: boolean = true): string { let errObj: Record<string, string | number> = {}; errObj['name'] = error.name; errObj['code'] = (error as BusinessError)?.code ?? ''; errObj['message'] = error.message; errObj['stack'] = error.stack ?? ''; let errorStr = L...
https://github.com/tdcare/tdwebrtc
2c1d644c6efca5328e900ef51911fb00e2d21390
github
LJ666-ui/harmony-health-care
entry/src/main/ets/ar/PathPlanner.ets
arkts
clearHistory
清空导航历史
public clearHistory(): void { this.navigationHistory = []; console.log('[PathPlanner] 已清空导航历史'); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left clearHistory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expressio...
public clearHistory(): void { this.navigationHistory = []; console.log('[PathPlanner] 已清空导航历史'); }
https://github.com/LJ666-ui/harmony-health-care
6365abcc56887fadb663da125e5b0d4b581a682c
github
aimilin6688/KeePassHO
entry/src/main/ets/services/store/DistributedKVService.ets
arkts
onServiceDie
分布式数据服务终止回调
private static onServiceDie(): void { hilog.warn(DOMAIN, TAG, 'Distributed data service died, need to re-register callbacks'); // 服务终止后需要重新注册回调 if (DistributedKVService.kvStore) { try { DistributedKVService.kvStore.on('dataChange', distributedKVStore.SubscribeType.SUBSCRIBE_TYPE_REMOTE, Dist...
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 onServiceDie AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST...
private static onServiceDie(): void { hilog.warn(DOMAIN, TAG, 'Distributed data service died, need to re-register callbacks'); // 服务终止后需要重新注册回调 if (DistributedKVService.kvStore) { try { DistributedKVService.kvStore.on('dataChange', distributedKVStore.SubscribeType.SUBSCRIBE_TYPE_REMOTE, Dist...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/store/DistributedKVService.ets#L222-L234
9be94e0402340e3293afb7e2c7df29583c6d0e8c
github
RicardoWesleyli/HarmonyNEXT_Examples
Chapter14/entry/src/main/ets/network/NetworkManager.ets
arkts
validateResponseCode
验证HTTP响应状态码是否符合预期
private static validateResponseCode(response: http.HttpResponse, expectedCode: number): void { if (response.responseCode !== expectedCode) { throw new Error(`Server responded with status code: ${response.responseCode}`); } }
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 validateResponseCode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left response AST#identi...
private static validateResponseCode(response: http.HttpResponse, expectedCode: number): void { if (response.responseCode !== expectedCode) { throw new Error(`Server responded with status code: ${response.responseCode}`); } }
https://github.com/RicardoWesleyli/HarmonyNEXT_Examples
c3ce068be224f7e7bd0b2be8fe89550c1dd47553
github
Cool_foolisher1/ArkTSRepository
GuardianAssistant/entry/src/main/ets/pages/Guard/Indoor/IndoorCheckMovePage.ets
arkts
aboutToDisappear
页面卸载,取消传感器订阅,释放资源
aboutToDisappear() { this.stopSensor() }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToDisappear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#L...
aboutToDisappear() { this.stopSensor() }
https://gitcode.com/Cool_foolisher1/ArkTSRepository
0d21516484337a09998a10da1974a6846eddbbad
gitcode
751496032/ZRouter
RouterApi/src/main/ets/api/Router.ets
arkts
popWithResult
@deprecated @see {ZRouter.getInstance().popWithResult} @param result @param animated
public static popWithResult(result?: Object, animated: boolean = true) { ZRouter.getRouterMgr().popWithResult(result, animated) }
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 popWithResult AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left result AST#identifier#Right AST#?#Left ? ...
public static popWithResult(result?: Object, animated: boolean = true) { ZRouter.getRouterMgr().popWithResult(result, animated) }
https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/api/Router.ets#L457-L459
55e21ea84c9cb31180dae4cde55fa33089839e07
github
offlinecat-dev/OCNetORM
src/main/ets/query/QueryBuilder.ets
arkts
getResolvedColumnName
将属性名或列名解析为数据库列名 @param column 列名或属性名 @returns 数据库列名,未找到时返回 null
private getResolvedColumnName(column: string): string | null { const columnMetadata = this.entityMetadata.getColumnByName(column) if (columnMetadata !== null) { return columnMetadata.columnName } const columnByProperty = this.entityMetadata.getColumnByProperty(column) if (columnByProperty !=...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getResolvedColumnName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left column AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ident...
private getResolvedColumnName(column: string): string | null { const columnMetadata = this.entityMetadata.getColumnByName(column) if (columnMetadata !== null) { return columnMetadata.columnName } const columnByProperty = this.entityMetadata.getColumnByProperty(column) if (columnByProperty !=...
https://github.com/offlinecat-dev/OCNetORM
bf994dc1c61b9ceba475934a397c926833dc2fab
github
aimilin6688/KeePassHO
entry/src/main/ets/services/kdbx/KdbxImportService.ets
arkts
createFileSuffix
创建文件后缀 @param inputType
private static createFileSuffix(inputType?: ExportType) { if (inputType === ExportType.KDBX) { return ['.kdbx']; } if (inputType === ExportType.XML) { return ['.xml']; } if (inputType === ExportType.CSV) { return ['.csv']; } return KdbxImportService.EXPORT_TYPES; }
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 createFileSuffix AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left inputType AST#identifier#Right AST#...
private static createFileSuffix(inputType?: ExportType) { if (inputType === ExportType.KDBX) { return ['.kdbx']; } if (inputType === ExportType.XML) { return ['.xml']; } if (inputType === ExportType.CSV) { return ['.csv']; } return KdbxImportService.EXPORT_TYPES; }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/kdbx/KdbxImportService.ets#L136-L147
a533d615d982b6ddcbbde0199085a47dfdc44a95
github
OHPG/FinMusic
entry/src/main/ets/data/Repository.ets
arkts
getItem
获取媒体详情 @param id @returns
public getItem(id: string): Promise<BaseItemDto> { return this.requireApi().getItem(id) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getItem AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST...
public getItem(id: string): Promise<BaseItemDto> { return this.requireApi().getItem(id) }
https://github.com/OHPG/FinMusic
14aef87f299e2c6d5df2469e954e72ff6da6535f
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ets
arkts
getUpper
Obtains the upper bound of the current range. @returns { ScopeType } Returns the upper bound of the current range.
getUpper(): T { return this._upperLimit }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getUpper 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 T AST#identifier#Right AST#ERROR#Right AST#statement_...
getUpper(): T { return this._upperLimit }
https://gitcode.com/iop123123/arkts-static-skills
e0e09a5de40e0cae8787bf63b127fb8772601a5d
gitcode
harmonyos/codelabs
HarmonyOS_NEXT/TargetManagement/entry/src/main/ets/view/TargetList.ets
arkts
isSelectRows
Check whether there are selected rows.
isSelectRows(): boolean { return this.selectArray.filter((selected: boolean) => selected === true).length !== 0; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isSelectRows AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statem...
isSelectRows(): boolean { return this.selectArray.filter((selected: boolean) => selected === true).length !== 0; }
https://gitee.com/harmonyos/codelabs.git
91f23a8ddd8c24d2cd2a54b3aa8004220012fbf6
gitee
fbinba3955/Flymby
common/src/main/ets/utils/StringUtil.ets
arkts
truncate
截断字符串 @param str 原字符串 @param maxLength 最大长度 @param suffix 后缀,默认为'...' @returns 截断后的字符串
static truncate(str: string, maxLength: number, suffix: string = '...'): string { if (!str || str.length <= maxLength) { return str; } return str.substring(0, maxLength - suffix.length) + suffix; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left truncate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string A...
static truncate(str: string, maxLength: number, suffix: string = '...'): string { if (!str || str.length <= maxLength) { return str; } return str.substring(0, maxLength - suffix.length) + suffix; }
https://github.com/fbinba3955/Flymby
b90ebd537cddd5781e9905c5cec0734e4268f403
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/OCRRecognitionDAO.ets
arkts
getById
根据ID查询识别记录
static async getById(recordId: number): Promise<OCRRecognitionRecord | null> { try { const store = DatabaseManager.getDatabase(); const predicates = new relationalStore.RdbPredicates(OCRRecognitionRecord.tableName); predicates.equalTo('record_id', recordId).and().equalTo('is_deleted', 0); ...
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 getById AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left recordId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:...
static async getById(recordId: number): Promise<OCRRecognitionRecord | null> { try { const store = DatabaseManager.getDatabase(); const predicates = new relationalStore.RdbPredicates(OCRRecognitionRecord.tableName); predicates.equalTo('record_id', recordId).and().equalTo('is_deleted', 0); ...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
fe3f58ed7647d0786ea0c332e9740d4c71ed513f
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/JSONPathParser.ets
arkts
applySegment
应用单个路径段
private static applySegment(data: JSONPathResult, segment: string): JSONPathResult { if (data === null || data === undefined) { return null; } // 数组索引: [0], [1], etc. if (segment.startsWith('[') && segment.endsWith(']')) { const inner = segment.substring(1, segment.length - 1); ...
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 applySegment AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : ...
private static applySegment(data: JSONPathResult, segment: string): JSONPathResult { if (data === null || data === undefined) { return null; } // 数组索引: [0], [1], etc. if (segment.startsWith('[') && segment.endsWith(']')) { const inner = segment.substring(1, segment.length - 1); ...
https://github.com/DaLongZhuaZi/manxia
5b49387233f0643b42936d4620b9dc3b7243042a
github
751496032/ZRouter
RouterApi/src/main/ets/api/Router.ets
arkts
hideNavBar
标记Navigation是否是hideNavBar模式 @param hide true: Navigation根视图将会隐藏
public static hideNavBar(hide: boolean, atBottomBackCallback: OnAtBottomBackCallback | null = null) { ZRouter.getRouterMgr().hideNavbar = hide if (atBottomBackCallback) { ZRouter.getRouterMgr().onBackAtBottom = atBottomBackCallback } }
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 hideNavBar AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left hide AST#identifier#Right AST#:#Left : AST#:...
public static hideNavBar(hide: boolean, atBottomBackCallback: OnAtBottomBackCallback | null = null) { ZRouter.getRouterMgr().hideNavbar = hide if (atBottomBackCallback) { ZRouter.getRouterMgr().onBackAtBottom = atBottomBackCallback } }
https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/api/Router.ets#L366-L372
f31b742e12dd3f5280895315c79fd87826660366
github
LJ666-ui/harmony-health-care
5-skill离线包/星云智联–分布式AI全周期智慧健康管理平台_skills/skills/MedicalRiskAssessSkill.ets
arkts
assessChronicDiseaseRisks
评估慢性病风险
private static assessChronicDiseaseRisks( riskFactors: RiskFactor[], query: string ): ChronicDiseaseRisk[] { const risks: ChronicDiseaseRisk[] = []; // 高血压风险 const bpFactor = riskFactors.find(f => f.name === '血压'); if (bpFactor && bpFactor.riskScore > 30) { risks.push({ d...
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 assessChronicDiseaseRisks AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left riskFactors AST#identifier...
private static assessChronicDiseaseRisks( riskFactors: RiskFactor[], query: string ): ChronicDiseaseRisk[] { const risks: ChronicDiseaseRisk[] = []; // 高血压风险 const bpFactor = riskFactors.find(f => f.name === '血压'); if (bpFactor && bpFactor.riskScore > 30) { risks.push({ d...
https://github.com/LJ666-ui/harmony-health-care
c0615939a1f1275b08ca8d18afc7fa228f1008e5
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/StreamIMEManager.ets
arkts
setLocked
设置锁定模式。锁定后系统 IME 被点击外部关闭时会自动重新唤起, 避免 IME bar 随之消失。仅影响 HIDE 回调,不影响主动 hide() / backPress 逻辑。
setLocked(locked: boolean): void { this.locked = locked; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setLocked AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left locked AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right AST#)#Left ) AS...
setLocked(locked: boolean): void { this.locked = locked; }
https://github.com/AlkaidLab/moonlight-harmony
67b9e97eb5adca3845cb7c7ead5a6cd69b2459a7
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Array.ets
arkts
some
Tests whether at least one element in the array pass the test implemented by the provided function. It returns a Boolean value. @param fn function to execute for each element in the array. It should return a `true` to indicate the element passes the test, and a `false` value otherwise. @returns `true` if `fn` returns a...
public some(fn: (v: T, k: number) => boolean): boolean { for (let i = 0; i < this.data.length; i++) { if (fn(this.data[i], i)) { return true } } return false }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left some AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Righ...
public some(fn: (v: T, k: number) => boolean): boolean { for (let i = 0; i < this.data.length; i++) { if (fn(this.data[i], i)) { return true } } return false }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
2119a8478af1a7d30c9dfb54505de66ec52d5f9b
gitee
Mydstiny/RemoteDeskHarmonyOS
entry/src/main/ets/services/DataCrypto.ets
arkts
computeVerifier
HMAC-SHA256 计算验证器
private async computeVerifier(dek: Uint8Array): Promise<Uint8Array> { try { // 官方文档: createMac 参数是摘要算法名 ('SHA256'), 非复合名 ('HMAC|SHA256') const mac = cryptoFramework.createMac('SHA256'); // createSymKeyGenerator('HMAC|SHA256') 强制要求 key 长度 = 32 字节, 匹配 DEK const hmacKeyGenerator = cryptoFrame...
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 computeVerifier AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dek AST#identifier#Right AST#:#Left :...
private async computeVerifier(dek: Uint8Array): Promise<Uint8Array> { try { // 官方文档: createMac 参数是摘要算法名 ('SHA256'), 非复合名 ('HMAC|SHA256') const mac = cryptoFramework.createMac('SHA256'); // createSymKeyGenerator('HMAC|SHA256') 强制要求 key 长度 = 32 字节, 匹配 DEK const hmacKeyGenerator = cryptoFrame...
https://github.com/Mydstiny/RemoteDeskHarmonyOS
7f6cb2a1a8d61848b1544cf326f9e927f3055fdb
github
LJ666-ui/harmony-health-care
entry/src/main/ets/ar/ARNavigationService.ets
arkts
triggerVoiceGuidance
触发语音引导
private triggerVoiceGuidance(currentPosition: Position3D): void { const currentWaypoint = this.getNextWaypoint(); if (!currentWaypoint) return; const distance = this.pathPlanner.getDistance( currentPosition, currentWaypoint.position ); this.voiceGuide.checkAndAnnounce( currentP...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left triggerVoiceGuidance 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#Le...
private triggerVoiceGuidance(currentPosition: Position3D): void { const currentWaypoint = this.getNextWaypoint(); if (!currentWaypoint) return; const distance = this.pathPlanner.getDistance( currentPosition, currentWaypoint.position ); this.voiceGuide.checkAndAnnounce( currentP...
https://github.com/LJ666-ui/harmony-health-care
c752e68fc1ee581c708bee631755096df1ce7269
github
offlinecat-dev/OCNetORM
src/main/ets/schema/SchemaInspector.ets
arkts
escapeIdentifier
转义 SQL 标识符
private escapeIdentifier(identifier: string): string { const escaped = identifier.replace(/"/g, '""') return `"${escaped}"` }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left escapeIdentifier AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left identifier AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST...
private escapeIdentifier(identifier: string): string { const escaped = identifier.replace(/"/g, '""') return `"${escaped}"` }
https://github.com/offlinecat-dev/OCNetORM
85e21d73dc0f9fe6c6a2c6582482c0bdd5a0fc4e
github
Cierra-Runis/Honey
app/entry/src/main/ets/pages/ProfilePage.ets
arkts
rowFancy
row样式
@Extend(Row) function rowFancy() { .width("80%").height("20%").justifyContent(FlexAlign.Start).border({ width: { bottom: 1 }, color: Color.Gray, style: BorderStyle.Solid }) }
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#call_expression#Left AST#identifier#Left Extend AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left Row AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Ri...
@Extend(Row) function rowFancy() { .width("80%").height("20%").justifyContent(FlexAlign.Start).border({ width: { bottom: 1 }, color: Color.Gray, style: BorderStyle.Solid }) }
https://github.com/Cierra-Runis/Honey
cfe304defe036c46e0c656304faee1bda81738c5
github
Harrisonls2004/WaterFlow
entry/src/main/ets/pages/CouponListPage.ets
arkts
getLeftBgColor
获取左侧背景颜色
getLeftBgColor(group: GroupedCoupon): string { if (this.isExpired(group.coupon.expiryDate)) { return '#F5F5F5'; // 已过期 } else if (group.unusedCount === 0) { return '#F5F5F5'; // 已使用 } return '#FFF0F5'; // 可用 - 淡粉色 }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getLeftBgColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left group AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left GroupedCoupon AST#identifier#Right AST#)...
getLeftBgColor(group: GroupedCoupon): string { if (this.isExpired(group.coupon.expiryDate)) { return '#F5F5F5'; // 已过期 } else if (group.unusedCount === 0) { return '#F5F5F5'; // 已使用 } return '#FFF0F5'; // 可用 - 淡粉色 }
https://github.com/Harrisonls2004/WaterFlow
520ade2d28962c9140bfffcc5d5bb39333e6b356
github
openharmony/codelabs
ETSUI/PositioningDemo/entry/src/main/ets/model/ReminderModel.ets
arkts
reset
活跃的提醒ID
reset(): void { this.lastDurationReminder = 0; this.lastRegularReminder = 0; this.distanceGoalAchieved = false; this.durationGoalAchieved = false; this.caloriesGoalAchieved = false; this.activeReminders.clear(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left reset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left A...
reset(): void { this.lastDurationReminder = 0; this.lastRegularReminder = 0; this.distanceGoalAchieved = false; this.durationGoalAchieved = false; this.caloriesGoalAchieved = false; this.activeReminders.clear(); }
https://gitcode.com/openharmony/codelabs
577ab4d817c02ec0b22547fd8235393bcbd0a782
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Utils/Logger.ets
arkts
info
ℹ️ 信息级别的日志 @param tag - 日志分类标签 @param message - 要输出的日志信息 @param args - 其他可选参数
public info(tag: string, message: string, ...args: (string | number | boolean)[]): void { if (this.currentLevel <= LogLevel.INFO) { if (this.shouldSkipForBackgroundPause(LogLevel.INFO)) { return; } const formattedMessage = this.formatMessageWithArgs(LogLevel.INFO, tag, message, args); ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left info AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tag AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR...
public info(tag: string, message: string, ...args: (string | number | boolean)[]): void { if (this.currentLevel <= LogLevel.INFO) { if (this.shouldSkipForBackgroundPause(LogLevel.INFO)) { return; } const formattedMessage = this.formatMessageWithArgs(LogLevel.INFO, tag, message, args); ...
https://github.com/DaLongZhuaZi/manxia
03ee1be6ee8062f4b87e47aecb5e2ba0211b971c
github
openharmony/codelabs
Card/MovieCard/entry/src/main/ets/common/utils/CommonUtils.ets
arkts
isEmptyArr
Check array is empty. @param {Array}array @return {boolean} true(empty)
isEmptyArr(array: MovieDataBean[]): boolean { return (this.isEmpty(array) || array.length === 0); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isEmptyArr AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left array AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left MovieDataBean ...
isEmptyArr(array: MovieDataBean[]): boolean { return (this.isEmpty(array) || array.length === 0); }
https://gitee.com/openharmony/codelabs.git
0b22960a20bf16869327164079c787102b7b226e
gitee
Joker-x-dev/CoolMallArkTS
core/designsystem/src/main/ets/component/Scroll.ets
arkts
build
构建带大内边距的水平滚动布局 @returns {void} 无返回值
build(): void { HorizontalScroll({ scroller: this.scroller, fillMaxSize: this.fillMaxSize, fillMaxWidth: this.fillMaxWidth, widthValue: this.widthValue, heightValue: this.heightValue, scrollBarState: this.scrollBarState, paddingValue: $r("app.float.space_padding_large"), ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#...
build(): void { HorizontalScroll({ scroller: this.scroller, fillMaxSize: this.fillMaxSize, fillMaxWidth: this.fillMaxWidth, widthValue: this.widthValue, heightValue: this.heightValue, scrollBarState: this.scrollBarState, paddingValue: $r("app.float.space_padding_large"), ...
https://github.com/Joker-x-dev/CoolMallArkTS
121d07bc521d1f0e6a415e53f8753327889cdba3
github
Amaz1ny/HarmonyDO-public
entry/src/main/ets/services/network/HttpClient.ets
arkts
getText
GET 文本(用于获取 HTML,如 data-preloaded)
async getText( path: string, params: Record<string, Object> | null = null, accept: string = 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', readTimeoutMs: number = 60000, guardOptions: CfGuardOptions | null = null ): Promise<string> { await this.cookieStore.init(); let...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getText AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left path AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#R...
async getText( path: string, params: Record<string, Object> | null = null, accept: string = 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', readTimeoutMs: number = 60000, guardOptions: CfGuardOptions | null = null ): Promise<string> { await this.cookieStore.init(); let...
https://github.com/Amaz1ny/HarmonyDO-public
eb498d61393b8cc4de533392969f88de5f572938
github
CLMC2025/Vignette
entry/src/main/ets/database/DBManager.ets
arkts
getNotebookWords
==================== NOTEBOOK OPERATIONS ==================== Keeping this here for now as requested, but should be moved to WordBookRepo in future.
async getNotebookWords(): Promise<string[]> { this.ensureInitialized(); const columns: string[] = ['word']; const predicates = new relationalStore.RdbPredicates(TABLE_USER_NOTEBOOK_WORDS); const resultSet = await this.store!.query(predicates, columns); const out: string[] = []; while (resultSe...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getNotebookWords AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Ri...
async getNotebookWords(): Promise<string[]> { this.ensureInitialized(); const columns: string[] = ['word']; const predicates = new relationalStore.RdbPredicates(TABLE_USER_NOTEBOOK_WORDS); const resultSet = await this.store!.query(predicates, columns); const out: string[] = []; while (resultSe...
https://github.com/CLMC2025/Vignette
02b31aeeb86567424fc63ec370dad54cef353979
github
LJ666-ui/harmony-health-care
entry/src/main/ets/ar/PathPlanner.ets
arkts
isTurn
判断是否转弯 @param from 起点节点 @param to 终点节点
private isTurn(from: GraphNode, to: GraphNode): boolean { // 简化实现:如果方向变化>30度,视为转弯 const dir = this.getDirection(from.position, to.position); // 这里需要更复杂的逻辑,简化处理 return false; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left private AST#identifier#Right AST#ERROR#Left AST#identifier#Left isTurn AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left from AST#identifier#Right AST#:#Left : AST#:#Right AST#E...
private isTurn(from: GraphNode, to: GraphNode): boolean { // 简化实现:如果方向变化>30度,视为转弯 const dir = this.getDirection(from.position, to.position); // 这里需要更复杂的逻辑,简化处理 return false; }
https://github.com/LJ666-ui/harmony-health-care
780999892132f70300fa00c12f8d3de1bd1e59a4
github
IoTAccessControl/ArkTSAnalysis
TestApps/IntentsKit-codelab-Clientdemo-ArkTS/entry/src/main/ets/entryability/InsightIntentExecutorImpl.ets
arkts
viewRepayment
实现调用查看还款功能 @param param 意图参数 @param pageLoader 窗口
private viewRepayment(param: Record<string, Object>, pageLoader: window.WindowStage): Promise<insightIntent.ExecuteResult> { return new Promise((resolve, reject) => { let para: Record<string, string> = { 'result': JSON.stringify(param) }; let localStorage: LocalStorage = new LocalStorage...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left viewRepayment AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left param AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_...
private viewRepayment(param: Record<string, Object>, pageLoader: window.WindowStage): Promise<insightIntent.ExecuteResult> { return new Promise((resolve, reject) => { let para: Record<string, string> = { 'result': JSON.stringify(param) }; let localStorage: LocalStorage = new LocalStorage...
https://github.com/IoTAccessControl/ArkTSAnalysis
c169c3e4a28b54c762ba3f77ed48e70a3e6dd77a
github
openharmony-sig/fluttertpc_camerawesome
ohos/ohos/src/main/ets/components/plugin/CameraAwesomeX.ets
arkts
requestPermissions
申请权限 @param saveGpsLocation @param result
async requestPermissions(saveGpsLocation: boolean, result: Result<string[]>): Promise<void> { Logger.debug(TAG, `requestPermissions is called`); let permissions = await this.cameraPermissions.requestPermissions(this.uiAbility!!.context, saveGpsLocation) let resultPermissions: Array<string> =...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left requestPermissions AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left saveGpsLocation AST#identifier#Right AST#type_annot...
async requestPermissions(saveGpsLocation: boolean, result: Result<string[]>): Promise<void> { Logger.debug(TAG, `requestPermissions is called`); let permissions = await this.cameraPermissions.requestPermissions(this.uiAbility!!.context, saveGpsLocation) let resultPermissions: Array<string> =...
https://gitee.com/openharmony-sig/fluttertpc_camerawesome.git
4c0c625a3fbc4b0f34aaf8027015133c6079bfda
gitee
fuhhhhhhhh/openharmony
entry/src/main/ets/data/database/TransactionDao.ets
arkts
getTransactionById
根据ID查询单个交易记录(包含分类信息) @param transactionId 交易ID @returns 交易记录或null
public async getTransactionById(transactionId: number): Promise<TransactionWithCategory | null> { const sql: string = ` SELECT t.id, t.type, t.amount, t.category_id, t.date, t.note, c.name as category_name, c.icon_name as category_icon FROM ${DBManager.TABLE_TRANSACTIONS} t LEFT ...
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 getTransactionById AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left transactionId AST#identifier#Right AST#ERROR#Left AS...
public async getTransactionById(transactionId: number): Promise<TransactionWithCategory | null> { const sql: string = ` SELECT t.id, t.type, t.amount, t.category_id, t.date, t.note, c.name as category_name, c.icon_name as category_icon FROM ${DBManager.TABLE_TRANSACTIONS} t LEFT ...
https://github.com/fuhhhhhhhh/openharmony
f8d721b379338a25b07f5b05605093e5d98e6f42
github
openharmony-sig/applications_clock
feature/alarmclock/src/main/ets/manager/AudioManager.ets
arkts
stopAudio
Stop playing audio
async stopAudio(): Promise<void> { await this.releaseAudioResource(); this.audioEndTime = new Date().getTime(); const alarmDuration = this.audioEndTime - this.audioStartTime; // EventReportUtil.write(EventName.CLOCK_START_TO_END, hiAppEvent.EventType.BEHAVIOR, { // 'duration': alarmDuration }); ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left stopAudio AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_ty...
async stopAudio(): Promise<void> { await this.releaseAudioResource(); this.audioEndTime = new Date().getTime(); const alarmDuration = this.audioEndTime - this.audioStartTime; // EventReportUtil.write(EventName.CLOCK_START_TO_END, hiAppEvent.EventType.BEHAVIOR, { // 'duration': alarmDuration }); ...
https://gitee.com/openharmony-sig/applications_clock.git
f700df0d8e795985134e61f20972780e59601bbf
gitee
openharmony-sig/applications_clock
common/src/main/ets/manager/PageStateManager.ets
arkts
saveClockShowToSp
save showTextClock to preferences @param showTextClock showTextClock value
public async saveClockShowToSp(showTextClock: boolean): Promise<void> { const preferences = await this.getPreferences(); LogUtil.info(TAG, 'save showTextClock toSp:' + showTextClock); await preferences.put(showTextClockKey, showTextClock); await preferences.flush(); }
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 saveClockShowToSp AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left showTextClock AST#identifier#Right AST#ERROR#Left AST...
public async saveClockShowToSp(showTextClock: boolean): Promise<void> { const preferences = await this.getPreferences(); LogUtil.info(TAG, 'save showTextClock toSp:' + showTextClock); await preferences.put(showTextClockKey, showTextClock); await preferences.flush(); }
https://gitee.com/openharmony-sig/applications_clock.git
01ce947438fe614e31c4c87d552df8a848316e94
gitee
openharmony/applications_contacts
entry/src/main/ets/presenter/contact/detail/DetailPresenter.ets
arkts
sendMessage
Sending Messages
sendMessage(phoneNumber: string, formatnum: string, name: string) { PhoneNumber.fromString(phoneNumber).sendMessage(formatnum, name); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left sendMessage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left phoneNumber AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AS...
sendMessage(phoneNumber: string, formatnum: string, name: string) { PhoneNumber.fromString(phoneNumber).sendMessage(formatnum, name); }
https://gitee.com/openharmony/applications_contacts.git
12ab3cddb43418be8a2353e5cc08bd0e484f1a75
gitee