nwo
stringclasses
449 values
path
stringlengths
9
173
language
stringclasses
1 value
identifier
stringlengths
1
53
docstring
stringlengths
5
4.13k
function
stringlengths
10
87.2k
ast_function
stringlengths
351
354k
obf_function
stringlengths
10
87.2k
url
stringlengths
30
175
function_sha
stringlengths
40
40
source
stringclasses
3 values
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets
arkts
getLiteral
Returns literal representation of this method type @returns {string} Literal representation @syscap SystemCapability.Utils.Lang @FaAndStageModel
public override getLiteral(): string { let sb = new StringBuilder("(") const paramsNum = this.getParametersNum() if (this.hasReceiver()) { sb.append("this: ") sb.append(this.getReceiverType().toString()) if (paramsNum > 0) { sb.append(", ")...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left getLiteral AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#...
public override getLiteral(): string { let sb = new StringBuilder("(") const paramsNum = this.getParametersNum() if (this.hasReceiver()) { sb.append("this: ") sb.append(this.getReceiverType().toString()) if (paramsNum > 0) { sb.append(", ")...
https://gitcode.com/iop123123/arkts-static-skills
72751a01790a17363655fbcc58dbf4450c7b0c75
gitcode
Cool_foolisher1/ArkTSRepository
GuardianAssistant/entry/src/main/ets/pages/Test/PermissionsTestPage.ets
arkts
openSettingPage
打开应用设置页的函数封装,写法固定
function openSettingPage() { // 1. 获取应用上下文,并通过 as 断言收窄类型为 UIAbilityContext,否则 context 默认类型无法调用 startAbility 方法 const context = new UIContext().getHostContext() as Context const uiAbilityContext = context as common.UIAbilityContext // 2. 获取 bundle 包信息 const bundleInfo = bundleManager.getBundleInfoForSelfSync(b...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left openSettingPage 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#Lef...
function openSettingPage() { // 1. 获取应用上下文,并通过 as 断言收窄类型为 UIAbilityContext,否则 context 默认类型无法调用 startAbility 方法 const context = new UIContext().getHostContext() as Context const uiAbilityContext = context as common.UIAbilityContext // 2. 获取 bundle 包信息 const bundleInfo = bundleManager.getBundleInfoForSelfSync(b...
https://gitcode.com/Cool_foolisher1/ArkTSRepository
b613c8e4800599cc9936b3490e04a286917f0cfb
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/EntryAbility.ets
arkts
restoreContinuationState
恢复跨端流转状态
private restoreContinuationState(want: Want): void { logger.info('EntryAbility', 'restoreContinuationState: 开始恢复跨端流转状态'); if (want.parameters && want.parameters['distributedSessionId']) { const sessionId = want.parameters['distributedSessionId'] as string; const bookId = want.parameters['book...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left restoreContinuationState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#iden...
private restoreContinuationState(want: Want): void { logger.info('EntryAbility', 'restoreContinuationState: 开始恢复跨端流转状态'); if (want.parameters && want.parameters['distributedSessionId']) { const sessionId = want.parameters['distributedSessionId'] as string; const bookId = want.parameters['book...
https://github.com/DaLongZhuaZi/manxia
63d3a92cf8389da5304267b84a69f5457a201f3a
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/LinkedBlockingQueue.ets
arkts
push
Inserts element at the end. If the queue is full, blocking. @param { T } element the element pushed to the BlockingQueue
override push(element: T): void { let newNode = new ListNode<T>(element); ConcurrencyHelpers.mutexLock(this.pushMutex); this.waitFullQueue(); this.pushListNode(newNode); let c = this.fetchAndAddSize(); if (c + 1 < this.actualCapacity) { ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left override AST#identifier#Right AST#ERROR#Left AST#identifier#Left push AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left element AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST...
override push(element: T): void { let newNode = new ListNode<T>(element); ConcurrencyHelpers.mutexLock(this.pushMutex); this.waitFullQueue(); this.pushListNode(newNode); let c = this.fetchAndAddSize(); if (c + 1 < this.actualCapacity) { ...
https://gitcode.com/iop123123/arkts-static-skills
4937795b7683e11e6e7114a30a4bc6e73fa93a6f
gitcode
HarmonyOS_Samples/live-view-kit_-sample-code_-clientdemo_-arkts
entry/src/main/ets/utils/CommonUtil.ets
arkts
setFlightBackground
为实况窗设置航班背景(仅适用于航旅出行场景) @param backgroundType 指定的航班背景 @returns 对应的航班背景
public static setFlightBackground(backgroundType?: liveViewManager.BackgroundType): liveViewManager.BackgroundType { if (backgroundType) { return backgroundType; } // 此处开发者可以根据自身业务需要编写设置逻辑,这里默认不显示 return liveViewManager.BackgroundType.SYS_BACKGROUND_UNDEFINED; }
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 setFlightBackground AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left backgroundType AST#identifier#Right...
public static setFlightBackground(backgroundType?: liveViewManager.BackgroundType): liveViewManager.BackgroundType { if (backgroundType) { return backgroundType; } // 此处开发者可以根据自身业务需要编写设置逻辑,这里默认不显示 return liveViewManager.BackgroundType.SYS_BACKGROUND_UNDEFINED; }
https://gitcode.com/HarmonyOS_Samples/live-view-kit_-sample-code_-clientdemo_-arkts
696d0787f4d3bc8d01da7ae6ebf8c004141865e1
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Char.ets
arkts
isBinDigit
isBinDigit() checks whether the underlying char represents a binary digit. @returns { boolean } @syscap SystemCapability.Utils.Lang @FaAndStageModel
public isBinDigit(): boolean { return Char.isBinDigit(this.value); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isBinDigit AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#bo...
public isBinDigit(): boolean { return Char.isBinDigit(this.value); }
https://gitcode.com/iop123123/arkts-static-skills
28374f8fdba105e0b29522423db010d5f1b32505
gitcode
JackJiang2011/harmonychat
entry/src/main/ets/IMClientManager.ets
arkts
registerSocketEvent
注册MobileIMSDK框架开放各种事件监听。
private registerSocketEvent() { let emiter: common.EventHub = this.getEmitter(); /* * 本地用户的登陆结果回调事件通知(此事件发生时表示客户端已登陆/连接或重连完成)。 * * @param loginInfoRes 即PLoginInfoResponse对象,API文档地址:http://docs.52im.net/extend/docs/api/mobileimsdk/server_tcp/net/x52im/mobileimsdk/server/protocal/s/PLoginInfoRe...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left registerSocketEvent 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...
private registerSocketEvent() { let emiter: common.EventHub = this.getEmitter(); /* * 本地用户的登陆结果回调事件通知(此事件发生时表示客户端已登陆/连接或重连完成)。 * * @param loginInfoRes 即PLoginInfoResponse对象,API文档地址:http://docs.52im.net/extend/docs/api/mobileimsdk/server_tcp/net/x52im/mobileimsdk/server/protocal/s/PLoginInfoRe...
https://github.com/JackJiang2011/harmonychat
c48ef3894671a3c602c6ded4aef2d57e581c2611
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/EBookDataManager.ets
arkts
deleteEBookFiles
删除电子书相关文件 [修复] 删除整个电子书文件夹
private async deleteEBookFiles(ebook: EBook): Promise<void> { try { const candidateDirectories: Set<string> = this.collectManagedEBookDirectories(ebook); const candidateFiles: Set<string> = this.collectManagedEBookFiles(ebook); const deletedDirectories: string[] = []; for (const dirPath o...
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 deleteEBookFiles AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ebook AST#identifier#Right AST#:#Lef...
private async deleteEBookFiles(ebook: EBook): Promise<void> { try { const candidateDirectories: Set<string> = this.collectManagedEBookDirectories(ebook); const candidateFiles: Set<string> = this.collectManagedEBookFiles(ebook); const deletedDirectories: string[] = []; for (const dirPath o...
https://github.com/DaLongZhuaZi/manxia
cf220a6781501bd8fd31167856d7d1f08c2a3f69
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets
arkts
getElementsByXPathPathWithContent
根据XPath路径获取元素(使用指定内容)
private getElementsByXPathPathWithContent(xpath: string, content: string): string[] { let elements: string[] = [content]; // 分解XPath路径 const steps = this.parseXPathSteps(xpath); for (const step of steps) { const newElements: string[] = []; for (const element of elements) { ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getElementsByXPathPathWithContent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left xpath AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Righ...
private getElementsByXPathPathWithContent(xpath: string, content: string): string[] { let elements: string[] = [content]; // 分解XPath路径 const steps = this.parseXPathSteps(xpath); for (const step of steps) { const newElements: string[] = []; for (const element of elements) { ...
https://github.com/DaLongZhuaZi/manxia
fb78b49cac5ab3f9e7fca3a22f9d92dccbcb3d9c
github
LongLiveY96/chatcube
entry/src/main/ets/pages/UsageStatsPage.ets
arkts
formatCompactNumber
大数字紧凑格式化:>=1e6→x.xM,>=1e4→x.xK,否则原样。避免几十万 token 在卡片里溢出。 ArkTS 无千分位 API,这里用 toFixed 并去掉多余的 .0
function formatCompactNumber(value: number): string { if (value >= 1000000) { return stripTrailingZero((value / 1000000).toFixed(1)) + 'M' } if (value >= 10000) { return stripTrailingZero((value / 1000).toFixed(1)) + 'K' } return value.toString() }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left formatCompactNumber AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left value AST#identifier#Right AST#type_annotation#Left AST#:#Left : A...
function formatCompactNumber(value: number): string { if (value >= 1000000) { return stripTrailingZero((value / 1000000).toFixed(1)) + 'M' } if (value >= 10000) { return stripTrailingZero((value / 1000).toFixed(1)) + 'K' } return value.toString() }
https://github.com/LongLiveY96/chatcube
33c4507e8a9b300c6affef32424866cd16836fab
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/equal/equal_uint.ets
arkts
main
--- desc: check equality of two unsigned integers ---
function main(): void { const a: uint = {{v.left}} const b: uint = {{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: uint = {{v.right}} assert (a == b) == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
23ad188312d0a6c7d4edf19fe9c3744371743fe8
gitee
azhu0001/localsend-harmony
entry/src/main/ets/utils/FileProvider.ets
arkts
clearFilesReceiveQueue
清除当前文件传输队列
static clearFilesReceiveQueue() { AppStorage.delete(FileProvider.FILE_RECEIVE_QUEUE) }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left clearFilesReceiveQueue 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...
static clearFilesReceiveQueue() { AppStorage.delete(FileProvider.FILE_RECEIVE_QUEUE) }
https://gitcode.com/azhu0001/localsend-harmony
ea7f57854d2e5d169548c2dc62871548a2b62ce1
gitcode
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/CategoryDAO.ets
arkts
softDelete
软删除分类(自动清除缓存) 缓存失效策略: - 删除后清除该用户的所有分类缓存 - 确保数据一致性
static async softDelete(userId: number, categoryId: number): Promise<void> { const store = DatabaseManager.getDatabase(); const now = new Date().toISOString(); const sql = `UPDATE categories SET is_deleted = 1, updated_at = ? WHERE category_id = ? AND user_id = ?`; try { await store.executeSql(s...
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 softDelete AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : AST#...
static async softDelete(userId: number, categoryId: number): Promise<void> { const store = DatabaseManager.getDatabase(); const now = new Date().toISOString(); const sql = `UPDATE categories SET is_deleted = 1, updated_at = ? WHERE category_id = ? AND user_id = ?`; try { await store.executeSql(s...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
8713007f83ec4a2881dc6e9cb20a3bddf5fc4cc0
github
751496032/ZRouter
RouterApi/src/main/ets/animation/NavAnimationMgr.ets
arkts
unregisterAnim
取消注册路由转场动画 @param modifier
public unregisterAnim(component: object): void { NavAnimationStore.getInstance().unregisterAnim(component) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left unregisterAnim AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left component AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#object#Left object AST#objec...
public unregisterAnim(component: object): void { NavAnimationStore.getInstance().unregisterAnim(component) }
https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/animation/NavAnimationMgr.ets#L102-L104
efe1d7cb0f48a1e9d3f53eeca55c9c0590c82494
github
arkui-x/samples
CodeLab/Cases/feature/addressrecognize/src/main/ets/view/AddressRecognize.ets
arkts
imagePicker
选择图库照片
imagePicker(): void { // 选择选项 const photoSelectOptions = new photoAccessHelper.PhotoSelectOptions(); // 过滤选择媒体文件类型为IMAGE photoSelectOptions.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE; // 选择媒体文件的最大数目 photoSelectOptions.maxSelectNumber = 1; const photoViewPicker = new photoAc...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left imagePicker 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#...
imagePicker(): void { // 选择选项 const photoSelectOptions = new photoAccessHelper.PhotoSelectOptions(); // 过滤选择媒体文件类型为IMAGE photoSelectOptions.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE; // 选择媒体文件的最大数目 photoSelectOptions.maxSelectNumber = 1; const photoViewPicker = new photoAc...
https://gitcode.com/arkui-x/samples
9eddd94972d77bf8019553c22ca219a140038390
gitcode
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test37_original_index.ets
arkts
testSimpleLoop
--- Simple for-loop accumulator (no conditions inside) ---
function testSimpleLoop(): string { let total: number = 0; let arr: number[] = [1, 2, 3, 4, 5]; for (let i: number = 0; i < arr.length; i++) { total = total + arr[i]; } return String(total); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testSimpleLoop AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_t...
function testSimpleLoop(): string { let total: number = 0; let arr: number[] = [1, 2, 3, 4, 5]; for (let i: number = 0; i < arr.length; i++) { total = total + arr[i]; } return String(total); }
https://github.com/miaochiahao/ark-ghidra
7204917021a497ca6c7b511eff52c62c48052341
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets
arkts
type
The content-type of the Blob.
get type(): string { return this.blobType }
AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left type AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ER...
get type(): string { return this.blobType }
https://gitcode.com/iop123123/arkts-static-skills
8ca3feca3aabf1febb167b6562ac4fd780804516
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Authentication/LoginManager.ets
arkts
checkLoginStatus
检查登录状态
async checkLoginStatus(sourceId: number, checkUrl: string): Promise<boolean> { try { const httpRequest = http.createHttp(); // 获取已保存的Cookie const cookieStr = await this.cookieManager.getCookieString(sourceId); const options: http.HttpRequestOptions = { method: http.RequestM...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left checkLoginStatus AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceId AST#identifier#Right AST#type_annotation#Left AST#:#L...
async checkLoginStatus(sourceId: number, checkUrl: string): Promise<boolean> { try { const httpRequest = http.createHttp(); // 获取已保存的Cookie const cookieStr = await this.cookieManager.getCookieString(sourceId); const options: http.HttpRequestOptions = { method: http.RequestM...
https://github.com/DaLongZhuaZi/manxia
b8bbdaf5ff41e2e11286502846b9ed8dbd338a34
github
Joker-x-dev/CoolMallArkTS
core/result/src/main/ets/RequestHelper.ets
arkts
constructor
构造函数 @param {Promise<NetworkResponse<T>>} promise - 原始请求 Promise
private constructor(promise: Promise<NetworkResponse<T>>) { this.source = promise; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left promise AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_...
private constructor(promise: Promise<NetworkResponse<T>>) { this.source = promise; }
https://github.com/Joker-x-dev/CoolMallArkTS
560e337fa7def031c222684d54246c3209a5d1dc
github
aimilin6688/KeePassHO
entry/src/main/ets/storage/local/LocalFileStorage.ets
arkts
init
初始化 @param config
public init(config: StorageConfig): void { }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#Right AST#ER...
public init(config: StorageConfig): void { }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/local/LocalFileStorage.ets#L31-L32
b411a8ca22753c52ece6b18c3d3a3f19bd9b5c71
github
Joker-x-dev/CoolMallArkTS
core/designsystem/src/main/ets/component/Column.ets
arkts
build
渲染布局 @returns {void} 无返回值 @example ColumnSpaceEvenly() { Text("A"); Text("B"); Text("C"); }
build(): void { ColumnBase({ options: this.options, justifyContent: FlexAlign.SpaceEvenly, alignItems: HorizontalAlign.Center, widthValue: this.widthValue, heightValue: this.heightValue, sizeValue: this.sizeValue, paddingValue: this.paddingValue, marginValue: this.m...
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 { ColumnBase({ options: this.options, justifyContent: FlexAlign.SpaceEvenly, alignItems: HorizontalAlign.Center, widthValue: this.widthValue, heightValue: this.heightValue, sizeValue: this.sizeValue, paddingValue: this.paddingValue, marginValue: this.m...
https://github.com/Joker-x-dev/CoolMallArkTS
661c13c9506b5ea7f6e5e9bcb7b3d49e84c93bc2
github
arkui-x/samples
CodeLab/Cases/feature/h5cache/src/main/ets/diskLruCache/DiskLruCache.ets
arkts
trimToSize
根据LRU算法删除多余缓存数据
trimToSize() { while (this.size > this.maxSize) { // 获取cacheMap中最先设置的key let firstKey: string = this.cacheMap.keys().next().value; // 获取文件大小 let fileSize = (this.cacheMap.get(firstKey) as DiskCacheEntry).getSize(); // 更新当前磁盘缓存大小 if (fileSize > 0) { this.size = this.si...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left trimToSize 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 AS...
trimToSize() { while (this.size > this.maxSize) { // 获取cacheMap中最先设置的key let firstKey: string = this.cacheMap.keys().next().value; // 获取文件大小 let fileSize = (this.cacheMap.get(firstKey) as DiskCacheEntry).getSize(); // 更新当前磁盘缓存大小 if (fileSize > 0) { this.size = this.si...
https://gitcode.com/arkui-x/samples
aa85baa5a4fc3764606b9b9eed79d079d94e0e76
gitcode
Tencent-RTC/TUIKit_Harmony
atomic_x/src/main/ets/basecomponent/utils/ContextProvider.ets
arkts
isRTL
Check if current language is RTL (Right-to-Left) Supports Arabic (ar), Hebrew (he), Persian (fa), and Urdu (ur) @returns true if current language is RTL, false otherwise
static isRTL(): boolean { return LanguageState.getInstance().isRTL(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left isRTL AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Rig...
static isRTL(): boolean { return LanguageState.getInstance().isRTL(); }
https://github.com/Tencent-RTC/TUIKit_Harmony
aca49969fe8c5e99503f6093544d0d1b9999ef33
github
HarmonyOS_Samples/MusicHome
features/player/src/main/ets/util/SongItemBuilder.ets
arkts
release
Closes the raw FD for the current songItem and clears internal state.
public async release(): Promise<void> { if (this.abilityContext && this.songItem !== null) { try { await this.abilityContext.resourceManager.closeRawFd(this.songItem.src); } catch (error) { Logger.error('Failed to closeRawFd'); } } this.songItem = null; }
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 release 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 release(): Promise<void> { if (this.abilityContext && this.songItem !== null) { try { await this.abilityContext.resourceManager.closeRawFd(this.songItem.src); } catch (error) { Logger.error('Failed to closeRawFd'); } } this.songItem = null; }
https://gitcode.com/HarmonyOS_Samples/MusicHome
94be1ebd4ce373e37728967b8bde53648271635f
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/String.ets
arkts
$_invoke
Creates a new instance of a String from long @param { long } value The value to be converted to a string. @returns { string } A new String instance @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
static $_invoke(value: long): string { return new String(value); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left $_invoke AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left long AST#identifier#Ri...
static $_invoke(value: long): string { return new String(value); }
https://gitcode.com/iop123123/arkts-static-skills
bf0669395178b4a9228c1fd8943488f08106099f
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/MangaSourceEngine.ets
arkts
extractChapterSortWeight
提取章节的排序权重 @param chapter 章节信息 @param originalIndex 原始索引 @returns 排序权重(数字越小越靠前) [优化] 排序优先级调整: 1. number字段(API明确提供的章节号,最可靠) 2. 标题提取(大多数图源的章节标题都包含章节号) 3. externalId数字(降低优先级,因为混合显示时externalId可能无效) 4. 原始顺序(最后手段)
private extractChapterSortWeight(chapter: ChapterInfo, originalIndex: number): number { // 1. 优先使用 number 字段(API明确提供的章节号) if (chapter.number !== undefined && chapter.number !== null && !isNaN(chapter.number)) { return chapter.number; } // 2. [优化] 优先从标题中提取章节号(比externalId更可靠) const titleNum =...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left extractChapterSortWeight AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left chapter AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#i...
private extractChapterSortWeight(chapter: ChapterInfo, originalIndex: number): number { // 1. 优先使用 number 字段(API明确提供的章节号) if (chapter.number !== undefined && chapter.number !== null && !isNaN(chapter.number)) { return chapter.number; } // 2. [优化] 优先从标题中提取章节号(比externalId更可靠) const titleNum =...
https://github.com/DaLongZhuaZi/manxia
056f423958c09c6ba81e09474c2e3c94d5436e47
github
AGenUI/AGenUI
platforms/harmony/agenui/src/main/ets/agenui/hybrid/HybridWebView.ets
arkts
loadWebSource
Loads Web content. @param source URL (http/https) or HTML string
public loadWebSource(source: string): void { if (!source || source === this.webSource) { return; } try { this.webSource = source; this.isUrl = source.startsWith('http://') || source.startsWith('https://'); this.htmlLoaded = false; hilog.info(0, TAG, 'loadWebSource: nodeId=%...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left loadWebSource AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left source AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ...
public loadWebSource(source: string): void { if (!source || source === this.webSource) { return; } try { this.webSource = source; this.isUrl = source.startsWith('http://') || source.startsWith('https://'); this.htmlLoaded = false; hilog.info(0, TAG, 'loadWebSource: nodeId=%...
https://github.com/AGenUI/AGenUI
8ea7a2824a4c99b7cf9710eedf07d082a52106c2
github
Joker-x-dev/CoolMallArkTS
feature/user/src/main/ets/viewmodel/ProfileViewModel.ets
arkts
getUserState
获取用户信息 @returns {UserState} 用户状态
getUserState(): UserState { return this.userState; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getUserState 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 UserState AST#identifier#Right AST#ERROR#Right AS...
getUserState(): UserState { return this.userState; }
https://github.com/Joker-x-dev/CoolMallArkTS
084c69fc6e277fd69c32c31cacb11ec8977969c6
github
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/utils/ClipboardManager.ets
arkts
uninitialize
Uninitialize clipboard manager
uninitialize(): void { this.stopLocalClipboardMonitoring(); this.instance = 0; console.info(`${TAG}: Uninitialized`); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left uninitialize 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...
uninitialize(): void { this.stopLocalClipboardMonitoring(); this.instance = 0; console.info(`${TAG}: Uninitialized`); }
https://github.com/tangwengang-del/freerdp-harmonyos
7932060e706f7651c1ebb1427150cb26d8097bb5
github
Dabing-0x19d/berverage_HarmonyOS6.0
entry/src/main/ets/model/LoginStateManager.ets
arkts
setLoggedIn
设置已登录状态(服务端验证成功后调用)
async setLoggedIn(unionId: string, openId: string, nickName: string = '', avatarUrl: string = '', phoneNumber: string = '', registrationNumber: string = ''): Promise<void> { this.loginState = { isLoggedIn: true, unionId, openId, nickName: nickName || '华为账号用户', avatarUrl, phoneN...
AST#program#Left AST#expression_statement#Left AST#assignment_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left setLoggedIn AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left ...
async setLoggedIn(unionId: string, openId: string, nickName: string = '', avatarUrl: string = '', phoneNumber: string = '', registrationNumber: string = ''): Promise<void> { this.loginState = { isLoggedIn: true, unionId, openId, nickName: nickName || '华为账号用户', avatarUrl, phoneN...
https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0
a04f9abf07f283ddea35cebeb28c8b119b5e4f12
github
who7708/harmonyos-codelabs
HmosWorld/commons/common/src/main/ets/service/datasource/network/agc/FuncNetwork.ets
arkts
login
************************************* LOGIN ***************************************** @param username @param password @returns UserAccount
public login(username: string, password: string): Promise<UserAccount> { let params: LoginParams = { username, password }; return new Promise((resolve: (value: UserAccount | PromiseLike<UserAccount>) => void, reject: (reason?: Object) => void) => { Logger.info(TAG, 'login--------...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left login AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left username AST#identifier#Right A...
public login(username: string, password: string): Promise<UserAccount> { let params: LoginParams = { username, password }; return new Promise((resolve: (value: UserAccount | PromiseLike<UserAccount>) => void, reject: (reason?: Object) => void) => { Logger.info(TAG, 'login--------...
https://github.com/who7708/harmonyos-codelabs
3b467fb7b3758ea986f7b645a2eff63a8c2967ae
github
aimilin6688/KeePassHO
entry/src/main/ets/common/utils/ShareUtils.ets
arkts
shareText
分享文本内容 @param context UIAbility上下文 @param text 文本内容 @param title 分享标题(可选) @returns 是否成功发起分享
public static async shareText( context: common.UIAbilityContext, text: string, title?: string ): Promise<boolean> { try { // 构造分享数据记录 const record: systemShare.SharedRecord = { utd: utd.UniformDataType.TEXT, content: text, title: title }; // 创建分享数据对象 ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left shareText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context ...
public static async shareText( context: common.UIAbilityContext, text: string, title?: string ): Promise<boolean> { try { // 构造分享数据记录 const record: systemShare.SharedRecord = { utd: utd.UniformDataType.TEXT, content: text, title: title }; // 创建分享数据对象 ...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/ShareUtils.ets#L193-L228
fec86c3351094748ec7fff299c2ba841128335ea
github
OHPG/FinVideo
entry/src/main/ets/player/VersionSelectStrategy.ets
arkts
isCellular
─── 设备 & 网络辅助方法 ─────────────────────────────────────────────────────
private static isCellular(): boolean { try { const handle = connection.getDefaultNetSync() if (!handle) { return false } const caps = connection.getNetCapabilitiesSync(handle) const bearerTypes = caps?.bearerTypes if (bearerTypes) { return bearerTypes.indexOf(co...
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 isCellular AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:...
private static isCellular(): boolean { try { const handle = connection.getDefaultNetSync() if (!handle) { return false } const caps = connection.getNetCapabilitiesSync(handle) const bearerTypes = caps?.bearerTypes if (bearerTypes) { return bearerTypes.indexOf(co...
https://github.com/OHPG/FinVideo
9ee200553fa01e1747a41d5b5c84af6c1f35b9c7
github
openharmony/applications_settings
product/phone/src/main/ets/pages/passwordSetting.ets
arkts
showClosePasswordDialog
------------------------------ Dialog --------------------------- Close password dialog @param item password setting item
showClosePasswordDialog(delItem: PasswordSettingItem) { AlertDialog.show({ title: $r("app.string.password_disable_password"), message: $r("app.string.password_disable_prompt"), primaryButton: { value: $r('app.string.cancel'), action: () => { LogUtil.info(this.TAG_PAGE ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left showClosePasswordDialog AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left delItem AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left PasswordSettin...
showClosePasswordDialog(delItem: PasswordSettingItem) { AlertDialog.show({ title: $r("app.string.password_disable_password"), message: $r("app.string.password_disable_prompt"), primaryButton: { value: $r('app.string.cancel'), action: () => { LogUtil.info(this.TAG_PAGE ...
https://gitee.com/openharmony/applications_settings.git
55094d641befb61586e5b9f6f6f8d217950bba6d
gitee
iHongRen/harmony-study-demo
entry/src/main/ets/pages/oss/OssUploader.ets
arkts
closeClient
关闭客户端连接(避免资源泄漏)
private closeClient(): void { if (this.client) { try { this.client.requestHandler.getSession().close(); } catch (err) { console.warn('关闭 OSS 客户端连接失败:', err); } finally { this.client = null; } } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left closeClient AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#express...
private closeClient(): void { if (this.client) { try { this.client.requestHandler.getSession().close(); } catch (err) { console.warn('关闭 OSS 客户端连接失败:', err); } finally { this.client = null; } } }
https://github.com/iHongRen/harmony-study-demo
1d39d160750377722feb16889438d122693f037e
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/WebUploadServer.ets
arkts
getUploadPageHtml
获取上传页面 HTML 移植自 PPSSPP 的上传页面实现
private getUploadPageHtml(): string { // 获取简化的目录显示路径 let displayPath = this.uploadPath; const downloadMatch = this.uploadPath.match(/\/storage\/Users\/[^/]+\/(.+)/); if (downloadMatch) { displayPath = '~/' + downloadMatch[1]; } else { const downloadIndex = this.uploadPath.indexOf('/Dow...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getUploadPageHtml 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 strin...
private getUploadPageHtml(): string { // 获取简化的目录显示路径 let displayPath = this.uploadPath; const downloadMatch = this.uploadPath.match(/\/storage\/Users\/[^/]+\/(.+)/); if (downloadMatch) { displayPath = '~/' + downloadMatch[1]; } else { const downloadIndex = this.uploadPath.indexOf('/Dow...
https://github.com/richshaw2015/nds
03d56462bca5ec6d1b06bf3049f305d2ba8f6cba
github
openharmony-tpc/ImageKnife
library/src/main/ets/utils/FileUtils.ets
arkts
createFolderSync
创建文件夹 @param path 文件夹绝对路径,只有是权限范围内的路径,可以生成 @param recursive
createFolderSync(path: string, recursive?: boolean) { try { if (recursive) { if (!this.existFolder(path)) { let lastInterval = path.lastIndexOf(FileUtils.SEPARATOR) if (lastInterval == 0) { return } let newPath = path.substring(0, lastInterval) ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left createFolderSync 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#identifier#Left string AST#identifier#Ri...
createFolderSync(path: string, recursive?: boolean) { try { if (recursive) { if (!this.existFolder(path)) { let lastInterval = path.lastIndexOf(FileUtils.SEPARATOR) if (lastInterval == 0) { return } let newPath = path.substring(0, lastInterval) ...
https://gitee.com/openharmony-tpc/ImageKnife.git
dee8315d5c55f8dabc2c13fe2c791c51ee9cea19
gitee
tdcare/tdwebrtc
src/main/ets/SignalingClient.ets
arkts
sendRawMessage
---- 消息发送 ----
private sendRawMessage(text: string): boolean { LogUtil.info(`${TAG} sendRawMessage: isConnected=${this.isConnected}, ws=${this.ws !== null ? 'ok' : 'null'}, msg=${text}`); if (this.ws !== null && this.isConnected) { this.ws.send(text); LogUtil.info(`${TAG} 消息已发送`); return true; } Lo...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left sendRawMessage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
private sendRawMessage(text: string): boolean { LogUtil.info(`${TAG} sendRawMessage: isConnected=${this.isConnected}, ws=${this.ws !== null ? 'ok' : 'null'}, msg=${text}`); if (this.ws !== null && this.isConnected) { this.ws.send(text); LogUtil.info(`${TAG} 消息已发送`); return true; } Lo...
https://github.com/tdcare/tdwebrtc
39f9969d5fb00f1972b95195580d40a93556e700
github
DaLongZhuaZi/manxia
entry/src/main/ets/pages/MainMenuPage.ets
arkts
openEBookReaderFromHome
打开电子书阅读器(带翻开动画)- 从首页调用
private openEBookReaderFromHome(ebook: EBook): void { this.openEBookReaderWithComponentId(ebook, `cover_ebook_home_${ebook.id}`); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left openEBookReaderFromHome AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ebook AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#iden...
private openEBookReaderFromHome(ebook: EBook): void { this.openEBookReaderWithComponentId(ebook, `cover_ebook_home_${ebook.id}`); }
https://github.com/DaLongZhuaZi/manxia
91fe7af3e92719c88d1170857e1f0c34207c5c50
github
ibestservices/ibest-ui
library/src/main/ets/components/numberKeyboard/index.ets
arkts
genCustomKeys
获取自定义keys
genCustomKeys(): IBestNumberKeyboardType[] { const keys = this.genBasicKeys() const extraKeys: ResourceStr[] = Array.isArray(this.extraKey) ? this.extraKey : [this.extraKey] if (extraKeys.length === 1) { keys.push( { text: "0", fullWidth: true }, { text: extraKeys[0], type: 'extra' } ) } else if ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left genCustomKeys 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 IBestNumberKeyboardType AST#identifier#Right AST...
genCustomKeys(): IBestNumberKeyboardType[] { const keys = this.genBasicKeys() const extraKeys: ResourceStr[] = Array.isArray(this.extraKey) ? this.extraKey : [this.extraKey] if (extraKeys.length === 1) { keys.push( { text: "0", fullWidth: true }, { text: extraKeys[0], type: 'extra' } ) } else if ...
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/numberKeyboard/index.ets#L145-L161
fed78e6f1ebcb6ba80948f810680ea648912d9cf
github
openharmony-sig/ohos_commons-fileupload
entry/src/main/ets/pages/UploadFile.ets
arkts
loadFileByResource
通过资源加载文件 @param fileName
loadFileByResource(fileName: string): void { EntryAbility.resourceManager.getRawFile(fileName, (error:ESObject, value:ESObject) => { if (error != null) { logError(error); this.loadedFileResult = this.getResourceString($r('app.string.failed')) return; } const file:ESObject...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left loadFileByResource AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left fileName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) ...
loadFileByResource(fileName: string): void { EntryAbility.resourceManager.getRawFile(fileName, (error:ESObject, value:ESObject) => { if (error != null) { logError(error); this.loadedFileResult = this.getResourceString($r('app.string.failed')) return; } const file:ESObject...
https://gitee.com/openharmony-sig/ohos_commons-fileupload.git
52f1b4ac347460998eaf1258c2106851b378408f
gitee
LJ666-ui/harmony-health-care
entry/src/main/ets/ancientimage/SuperResolutionProcessor.ets
arkts
process
处理图像超分辨率 @param imageData 输入图像数据 @param params 超分辨率参数 @returns 超分辨率后的图像数据
async process(imageData: ImageData, params: SuperResolutionParams): Promise<ImageData> { console.info(`[SuperResolutionProcessor] 开始超分辨率处理,放大倍数: ${params.scale}x`); const startTime = Date.now(); // 模拟超分辨率处理 const newWidth = imageData.width * params.scale; const newHeight = imageData.height * par...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left process AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left imageData AST#identifier#Right AST#type_annotation#Left AST#:#...
async process(imageData: ImageData, params: SuperResolutionParams): Promise<ImageData> { console.info(`[SuperResolutionProcessor] 开始超分辨率处理,放大倍数: ${params.scale}x`); const startTime = Date.now(); // 模拟超分辨率处理 const newWidth = imageData.width * params.scale; const newHeight = imageData.height * par...
https://github.com/LJ666-ui/harmony-health-care
a064b038fffcfd24fd6e54a057808604e99dc237
github
openharmony-sig/ohos_base64
library/src/main/ets/components/MainPage/Base64.ets
arkts
encodeBytesToBytes
Similar to encodeBytes(bytes: Uint8Array)} but returns a byte array instead of instantiating a String. This is more efficient if you're working with I/O streams and have large data sets to encode. @param source The data to convert @return The Base64-encoded data as a Uint8Array
public static encodeBytesToBytes(source: Uint8Array): Uint8Array{ return Base64.stringToBytes(Base64.encodeBytes(source)) }
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 encodeBytesToBytes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left source AST#identifier#Right AST#:#Le...
public static encodeBytesToBytes(source: Uint8Array): Uint8Array{ return Base64.stringToBytes(Base64.encodeBytes(source)) }
https://gitee.com/openharmony-sig/ohos_base64.git
32a8c8d80d1b4f82706cc41875360379020f1273
gitee
the-wwyang/kids-learning-app
src/main/ets/storage/DataStorageManager.ets
arkts
getObject
读取对象数据(从JSON反序列化) @param storeName 存储文件名 @param key 键名 @param defaultValue 默认值 @returns 读取的对象或默认值
async getObject<T>(storeName: string, key: string, defaultValue: T): Promise<T> { try { const jsonString = await this.getString(storeName, key, ''); if (jsonString === '') { return defaultValue; } return JSON.parse(jsonString) as T; } catch (error) { console.error(`[DataS...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getObject AST#identifier#Right AST#ERROR#Right AST#type_parameters#Left AST#<#Left < AST#<#Right AST#type_parameter#Left AST#type_identifier#Left T AST#type_identifier#Right AST#type_parameter#Right AST#>#Left > AST#...
async getObject<T>(storeName: string, key: string, defaultValue: T): Promise<T> { try { const jsonString = await this.getString(storeName, key, ''); if (jsonString === '') { return defaultValue; } return JSON.parse(jsonString) as T; } catch (error) { console.error(`[DataS...
https://github.com/the-wwyang/kids-learning-app
4c42e2e23fc21b7b0e74bd6409ab59a86653672e
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Jsonx.ets
arkts
createNull
Creates a new JSON element containing a null value. @returns {JsonElement} A new JsonElement containing null
static createNull(): JsonElement { const element = new JsonElement() element.maybeNullValue = null return element }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createNull 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 JsonElement...
static createNull(): JsonElement { const element = new JsonElement() element.maybeNullValue = null return element }
https://gitcode.com/iop123123/arkts-static-skills
8dc067a9fce155ae40981bb593261777ad6b126d
gitcode
yangyongzhen/hmmovie
entry/src/main/ets/utils/HelperUtil.ets
arkts
isLengthCorrect
长度合法 @param value @param min @param max @returns
static isLengthCorrect(value: string, min: number = 6, max: number = 20) { if (value.length < min || value.length > max) { return false; } else { return true; } }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isLengthCorrect AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left...
static isLengthCorrect(value: string, min: number = 6, max: number = 20) { if (value.length < min || value.length > max) { return false; } else { return true; } }
https://github.com/yangyongzhen/hmmovie
3224c25f13482ec29b15c66cf82c160f09aae673
github
silence17/harmonydemo
entry/src/main/ets/util/BasicDataSource.ets
arkts
registerDataChangeListener
注销数据改变的监听器 @param listener interface DataChangeListener { onDataReloaded(): void; // 重新加载数据时调用 onDataAdded(index: number): void; // 添加数据时调用 onDataMoved(from: number, to: number): void; // 数据移动起始位置与数据移动目标位置交换时调用 onDataDeleted(index: number): void; // 删除数据时调用 onDataChanged(index: number): void; // 改变数据时调用 onDataAdd(index...
registerDataChangeListener(listener: DataChangeListener): void { if (this.listeners.indexOf(listener) < 0) { Log.info('add listener') this.listeners.push(listener) } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left registerDataChangeListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left listener AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left DataChangeListener AST#id...
registerDataChangeListener(listener: DataChangeListener): void { if (this.listeners.indexOf(listener) < 0) { Log.info('add listener') this.listeners.push(listener) } }
https://github.com/silence17/harmonydemo
2dcda7e6e0dfd7ec1cc983fcefea394aad453b78
github
Tencent-RTC/TUIKit_Harmony
atomic_x/src/main/ets/basecomponent/utils/ContextProvider.ets
arkts
init
Initialize Context @param context Application Context
static init(context: common.Context): void { const provider = ContextProvider.getInstance(); if (!context) { hilog.error(0x0000, 'ContextProvider', 'init context is null'); return; } provider._appContext = context; // Update the Context configuration (if supported by the Context) ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#E...
static init(context: common.Context): void { const provider = ContextProvider.getInstance(); if (!context) { hilog.error(0x0000, 'ContextProvider', 'init context is null'); return; } provider._appContext = context; // Update the Context configuration (if supported by the Context) ...
https://github.com/Tencent-RTC/TUIKit_Harmony
748cb4bdc76f193351e63435f796bf1fbdf65b1e
github
wuba/omni-ui
omni_component/src/main/ets/components/popup/Builder.ets
arkts
setArrowDownRightRadius
箭头底部右边弧度,单位:vp,气泡弹窗有效 @param arrowDownRightRadius @returns
setArrowDownRightRadius(arrowDownRightRadius: number): Builder { this.popupConfig.arrowDownRightRadius = arrowDownRightRadius return this }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setArrowDownRightRadius AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left arrowDownRightRadius AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Ri...
setArrowDownRightRadius(arrowDownRightRadius: number): Builder { this.popupConfig.arrowDownRightRadius = arrowDownRightRadius return this }
https://github.com/wuba/omni-ui
50859141538c7fa709ad2764069f58d10e1250d6
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/LayoutConfigManager.ets
arkts
buildVariant
构建当前屏幕的 UILayoutVariant
static buildVariant(width: number, height: number): UILayoutVariant { return { width: width, height: height, orientation: width > height ? Orientation.LANDSCAPE : Orientation.PORTRAIT, }; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left buildVariant AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left width AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left nu...
static buildVariant(width: number, height: number): UILayoutVariant { return { width: width, height: height, orientation: width > height ? Orientation.LANDSCAPE : Orientation.PORTRAIT, }; }
https://github.com/richshaw2015/nds
d5f9ec4e1eb1937c2619cff4acb90388d1bab7cc
github
picklerick422/zju-learning-assistant-OH
entry/src/main/ets/services/ExportService.ets
arkts
activate
应用启动时激活已持久化的目录授权;返回是否可用。
static async activate(uri: string): Promise<boolean> { if (!uri || uri.length === 0 || !ExportService.persistSupported()) { return false; } try { const policies: Array<fileShare.PolicyInfo> = [{ uri: uri, operationMode: RW }]; await fileShare.activatePermission(policies); return tr...
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 activate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uri AST#identifier#Right AST#:#Left : AST#:#Rig...
static async activate(uri: string): Promise<boolean> { if (!uri || uri.length === 0 || !ExportService.persistSupported()) { return false; } try { const policies: Array<fileShare.PolicyInfo> = [{ uri: uri, operationMode: RW }]; await fileShare.activatePermission(policies); return tr...
https://github.com/picklerick422/zju-learning-assistant-OH
1bb381108e6c0821a77f1fbfa693d7f0b97f0c4e
github
LambdaYH/ScrcpyForHarmonyOS
app/src/main/ets/client/tools/ControlPacket.ets
arkts
createInjectKeycode
============ TYPE_INJECT_KEYCODE (0) ============ 格式: type(1) + action(1) + keycode(4) + repeat(4) + metaState(4) = 14 bytes
static createInjectKeycode(action: number, keycode: number, repeat: number = 0, metaState: number = 0): ArrayBuffer { const buf = new ArrayBuffer(14); const view = new DataView(buf); view.setUint8(0, ControlMessageType.TYPE_INJECT_KEYCODE); view.setUint8(1, action); // ACTION_DOWN=0, ACTION_UP=1 ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createInjectKeycode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left action AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier...
static createInjectKeycode(action: number, keycode: number, repeat: number = 0, metaState: number = 0): ArrayBuffer { const buf = new ArrayBuffer(14); const view = new DataView(buf); view.setUint8(0, ControlMessageType.TYPE_INJECT_KEYCODE); view.setUint8(1, action); // ACTION_DOWN=0, ACTION_UP=1 ...
https://github.com/LambdaYH/ScrcpyForHarmonyOS
666a9540b60adc9b9ad0e1494f61df243f12396e
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Parsers/TxtMetadataExtractor.ets
arkts
cleanDescription
清理描述文本
private static cleanDescription(text: string): string { return text // 移除广告链接 .replace(/B\s*站.*?www\.[^\s]+/gi, '') .replace(/https?:\/\/[^\s]+/gi, '') // 移除多余空白 .replace(/[ \s]+/g, ' ') .replace(/\n{3,}/g, '\n\n') // 移除首尾空白 .trim(); }
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 cleanDescription AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Lef...
private static cleanDescription(text: string): string { return text // 移除广告链接 .replace(/B\s*站.*?www\.[^\s]+/gi, '') .replace(/https?:\/\/[^\s]+/gi, '') // 移除多余空白 .replace(/[ \s]+/g, ' ') .replace(/\n{3,}/g, '\n\n') // 移除首尾空白 .trim(); }
https://github.com/DaLongZhuaZi/manxia
cde57c13afebf510e00b4a51f1e4f5ab9c299f4b
github
LongLiveY96/chatcube
entry/src/main/ets/viewmodels/ChatViewModel.ets
arkts
harvestStreamUsage
流式完成时把 AIApiService 本轮累积的 token 用量收割到消息上。 用 += 累加:工具调用一条助手消息可能历经多轮 stream,每轮各有 usage 需累计; 单轮路径首次累加等价于赋值。consume 取走即清空,故重复收割不会重复计数。
private harvestStreamUsage(aiMessage: ChatMessage): void { const usage = this.aiApiService.consumeLastStreamUsage() if (usage === null) { return } aiMessage.promptTokens += usage.prompt_tokens aiMessage.completionTokens += usage.completion_tokens aiMessage.totalTokens += usage.total_toke...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left harvestStreamUsage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left aiMessage AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ident...
private harvestStreamUsage(aiMessage: ChatMessage): void { const usage = this.aiApiService.consumeLastStreamUsage() if (usage === null) { return } aiMessage.promptTokens += usage.prompt_tokens aiMessage.completionTokens += usage.completion_tokens aiMessage.totalTokens += usage.total_toke...
https://github.com/LongLiveY96/chatcube
4b7ddef742986cd010f8ea7e5fcbff52fb18c8d5
github
CLMC2025/Vignette
entry/src/main/ets/sync/DataSyncManager.ets
arkts
getSyncConfig
获取同步配置
getSyncConfig(): SyncConfig { return this.syncConfig; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getSyncConfig 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 SyncConfig AST#identifier#Right AST#ERROR#Right ...
getSyncConfig(): SyncConfig { return this.syncConfig; }
https://github.com/CLMC2025/Vignette
16b47ec6b54775d540a702b470f17980d69d3f36
github
PollenWang6/HiXD
entry/src/main/ets/utils/PreferenceUtil.ets
arkts
saveSharedFile
共享文件读写(主应用/卡片进程都可通过 filesDir 访问同一文件) 用于绕过 Preferences 的跨进程隔离
static saveSharedFile(filename: string, content: string): void { console.error(TAG, '[DIAG-SAVE] sFilesDir="' + sFilesDir + '" len=' + sFilesDir.length); if (sFilesDir.length === 0) { console.warn(TAG, 'saveSharedFile: filesDir not initialized'); return; } try { const path: string = ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left saveSharedFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filename AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string...
static saveSharedFile(filename: string, content: string): void { console.error(TAG, '[DIAG-SAVE] sFilesDir="' + sFilesDir + '" len=' + sFilesDir.length); if (sFilesDir.length === 0) { console.warn(TAG, 'saveSharedFile: filesDir not initialized'); return; } try { const path: string = ...
https://github.com/PollenWang6/HiXD
f8f3dd6227de6edcfd40ae0a51ff32206c7746ad
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test11_original_index.ets
arkts
testStringSearch
--- String.search() ---
function testStringSearch(): number { let s: string = 'hello world'; let idx: number = s.search(/world/); return idx; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testStringSearch 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 testStringSearch(): number { let s: string = 'hello world'; let idx: number = s.search(/world/); return idx; }
https://github.com/miaochiahao/ark-ghidra
c3306f234f8c9548caaf463d15c7695025436d14
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/TrackpadGestureHandler.ets
arkts
startDragTimer
---- 定时器管理 ----
private startDragTimer(): void { this.cancelDragTimer(); this.dragTimer = setTimeout(() => { if (this.confirmedMove || this.maxCountInGesture !== 1) return; this.confirmedDrag = true; this.sink.sendMouseButton(BUTTON_ACTION_PRESS, BUTTON_LEFT); }, this.dragTimeThreshold); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left startDragTimer 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#expr...
private startDragTimer(): void { this.cancelDragTimer(); this.dragTimer = setTimeout(() => { if (this.confirmedMove || this.maxCountInGesture !== 1) return; this.confirmedDrag = true; this.sink.sendMouseButton(BUTTON_ACTION_PRESS, BUTTON_LEFT); }, this.dragTimeThreshold); }
https://github.com/AlkaidLab/moonlight-harmony
e40a2cb3904ab94eabe271792a6339ff3e663772
github
electronicminer/Harmony-Markdown-Editor
entry/src/main/ets/utils/AIService.ets
arkts
normalizePlan
把模型返回的原始 plan 规整成统一的多步结构。 - 新版:直接采用 steps,过滤掉缺必填字段的非法步骤。 - 旧版:把单 action 映射为单元素 steps(向后兼容)。
private static normalizePlan(raw: RawPlanJSON): AgentPlan | undefined { const description: string = raw.description ?? ''; let steps: AgentStep[] = []; if (Array.isArray(raw.steps) && raw.steps.length > 0) { steps = raw.steps; } else if (raw.action) { // 旧版单 action 兼容映射 const legacy...
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 normalizePlan AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left raw AST#identifier#Right AST#:#Left : ...
private static normalizePlan(raw: RawPlanJSON): AgentPlan | undefined { const description: string = raw.description ?? ''; let steps: AgentStep[] = []; if (Array.isArray(raw.steps) && raw.steps.length > 0) { steps = raw.steps; } else if (raw.action) { // 旧版单 action 兼容映射 const legacy...
https://github.com/electronicminer/Harmony-Markdown-Editor
d7894439bb02acdd7b0e844cee1193d60b4730ed
github
XJTUWYD/ArkDiff
entry/src/main/ets/viewmodel/DiffSessionViewModel.ets
arkts
loadFileAndDiff
从文件 URI 加载文件并执行 Diff
loadFileAndDiff(uriA: string, uriB: string): void { this.isComputing = true; this.isFileMode = true; this.lastError = null; try { const resultA = FileContentService.readFileContent(uriA); const resultB = FileContentService.readFileContent(uriB); this.fileNameA = resultA.fileName; ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left loadFileAndDiff AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uriA AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left ,...
loadFileAndDiff(uriA: string, uriB: string): void { this.isComputing = true; this.isFileMode = true; this.lastError = null; try { const resultA = FileContentService.readFileContent(uriA); const resultB = FileContentService.readFileContent(uriB); this.fileNameA = resultA.fileName; ...
https://github.com/XJTUWYD/ArkDiff
c421428d626649b913d4fefdcc7598daeaf0b504
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Theme/AppColors.ets
arkts
surface
==================== 表面色系 ====================
static get surface(): string { return getColorForCurrentTheme(ColorRole.SURFACE); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left get AST#identifier#Right AST#call_expression#Left AST#identifier#Left surface AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : A...
static get surface(): string { return getColorForCurrentTheme(ColorRole.SURFACE); }
https://github.com/DaLongZhuaZi/manxia
86206e44beb3ddca45bc826ec3246bef29f6cdf4
github
UnbalancedCat/ohos-ssh-core
ssh_lib/src/main/ets/core/EventEmitter.ets
arkts
removeAllListeners
Remove all listeners (useful for cleanup).
protected removeAllListeners(): void { this.listeners.clear(); }
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left removeAllListeners AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Righ...
protected removeAllListeners(): void { this.listeners.clear(); }
https://github.com/UnbalancedCat/ohos-ssh-core
d4c25dae0498f7d66024b92dae8c1153329f2d3e
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/DeviceAdaptationManager.ets
arkts
isTabletOrLarger
判断是否是平板、二合一或更大的设备
public isTabletOrLarger(): boolean { const info = this.getDeviceInfo(); return info.isTablet || (info.isFoldable && info.foldStatus !== FoldStatus.FOLDED); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isTabletOrLarger 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 ...
public isTabletOrLarger(): boolean { const info = this.getDeviceInfo(); return info.isTablet || (info.isFoldable && info.foldStatus !== FoldStatus.FOLDED); }
https://github.com/DaLongZhuaZi/manxia
11643dae892b6d99dde048dc9f69ccf5069e718c
github
HarmonyOS_Samples/hmosworld
HMOSWorld/Application/features/topic/src/main/ets/pages/ThemeSettingPage.ets
arkts
savingEffect
Dynamic effect when saving data.
savingEffect(): void { let count = 1; const loadingList = [' ', '. ', '..']; if (this.saving) { this.saveTitle = $r('app.string.saving',loadingList[0]); this.intervalId = setInterval(() => { count++; count %= 3; this.saveTitle = $r('app.string.saving', loadingList[coun...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left savingEffect 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...
savingEffect(): void { let count = 1; const loadingList = [' ', '. ', '..']; if (this.saving) { this.saveTitle = $r('app.string.saving',loadingList[0]); this.intervalId = setInterval(() => { count++; count %= 3; this.saveTitle = $r('app.string.saving', loadingList[coun...
https://gitcode.com/HarmonyOS_Samples/hmosworld
2ee95343d9c2cfadf5136ee9677ed5c1af8dd33e
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
set
Copies all elements of arr to the current Float32Array starting from insertPos. @param arr array to copy data from @param insertPos start index where data from arr will be inserted {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set}
public set(arr: number[], insertPos1: number): void { const insertPos = insertPos1 as int if (insertPos < 0 || insertPos + arr.length > this.length) { throw new RangeError("set(insertPos: int, arr: float[]): size of arr is greater than Float32Array.length") } for (let i =...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#...
public set(arr: number[], insertPos1: number): void { const insertPos = insertPos1 as int if (insertPos < 0 || insertPos + arr.length > this.length) { throw new RangeError("set(insertPos: int, arr: float[]): size of arr is greater than Float32Array.length") } for (let i =...
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
e6d6064dd0c9150528cfeadcab71ecb2eb8cd5a7
gitee
openharmony/codelabs
ETSUI/MemoTime/entry/src/main/ets/service/DataService.ets
arkts
insertSchedule
==================== 日程操作 ==================== 插入日程
async insertSchedule(schedule: Schedule): Promise<void> { if (!this.rdbStore) { return } try { const valuesBucket = schedule.toDbObject() await this.rdbStore.insert(AppConstants.TABLE_SCHEDULE, valuesBucket) Logger.info(TAG, `Schedule inserted: ${schedule.id}`) } catch (error)...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left insertSchedule AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left schedule AST#identifier#Right ...
async insertSchedule(schedule: Schedule): Promise<void> { if (!this.rdbStore) { return } try { const valuesBucket = schedule.toDbObject() await this.rdbStore.insert(AppConstants.TABLE_SCHEDULE, valuesBucket) Logger.info(TAG, `Schedule inserted: ${schedule.id}`) } catch (error)...
https://gitcode.com/openharmony/codelabs
8f616e5c1f1f8d95c83618b4f30080afe7697e5c
gitcode
Nekofox-POT/LinMusic
entry/src/main/ets/建筑垃圾堆/web_ui_old.ets
arkts
listen_broadcast
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 扩展函数 // ////////// 广播监听 //
listen_broadcast() { // 元数据监听 // emitter.on({ eventId: 712 }, async (eventData: emitter.EventData) => { // 载入 this.lin_music_ui.runJavaScript(`set_meta(${JSON.stringify([eventData.data?.name, eventData.data?.title, eventData.data?.artist])})`) // 时间载入 this.lin_music_ui.runJavaScript(`c...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left listen_broadcast 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...
listen_broadcast() { // 元数据监听 // emitter.on({ eventId: 712 }, async (eventData: emitter.EventData) => { // 载入 this.lin_music_ui.runJavaScript(`set_meta(${JSON.stringify([eventData.data?.name, eventData.data?.title, eventData.data?.artist])})`) // 时间载入 this.lin_music_ui.runJavaScript(`c...
https://github.com/Nekofox-POT/LinMusic
a0e10c3460a709e274628bb7cda723e6d6bc4f9c
github
midori52000/ArkPilot
Agent/entry/src/main/ets/backend/ProviderConfigStore.ets
arkts
tomlMapToDefinition
── TOML mapping helpers ──
function tomlMapToDefinition(m: Map<string, string>): ProviderDefinition { return new ProviderDefinition( parseTomlString(m.get('id') ?? '""'), parseTomlString(m.get('name') ?? '""'), parseTomlString(m.get('base_url') ?? '""'), parseTomlString(m.get('model') ?? '""'), parseTomlString(m.get('wire_a...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left tomlMapToDefinition AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left m AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:...
function tomlMapToDefinition(m: Map<string, string>): ProviderDefinition { return new ProviderDefinition( parseTomlString(m.get('id') ?? '""'), parseTomlString(m.get('name') ?? '""'), parseTomlString(m.get('base_url') ?? '""'), parseTomlString(m.get('model') ?? '""'), parseTomlString(m.get('wire_a...
https://github.com/midori52000/ArkPilot
ff873b93cb5e71419ce120a2ec3a51e31272bf1f
github
RoooyHe/toona-ohos
toona/src/main/ets/database/LocalDatabase.ets
arkts
saveMessage
── Message CRUD ──
async saveMessage(message: Message): Promise<void> { if (!this.messageDao) { throw new Error('Database not initialized'); } try { const entity = this.messageToEntity(message); await this.messageDao.insert(entity); } catch (error) { LocalDatabase.logger.error('Failed to save me...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left saveMessage AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left message AST#identifier#Right AST#...
async saveMessage(message: Message): Promise<void> { if (!this.messageDao) { throw new Error('Database not initialized'); } try { const entity = this.messageToEntity(message); await this.messageDao.insert(entity); } catch (error) { LocalDatabase.logger.error('Failed to save me...
https://github.com/RoooyHe/toona-ohos
d88fff2f7caeb0493231b13ded31e4845b8aaa90
github
LJ666-ui/harmony-health-care
entry/src/main/ets/ar/PathPlanner.ets
arkts
getNavigationHistory
获取导航历史记录 @limit 数量限制
public getNavigationHistory(limit: number = 20): NavigationHistory[] { return this.navigationHistory.slice(0, limit); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getNavigationHistory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left limit AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment...
public getNavigationHistory(limit: number = 20): NavigationHistory[] { return this.navigationHistory.slice(0, limit); }
https://github.com/LJ666-ui/harmony-health-care
ec194a5fec186c6a1c50ba85dd9159b40116407d
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/MangaSourceConfigParser.ets
arkts
buildLoadMorePagesActions
构建加载更多页面操作序列
buildLoadMorePagesActions(config: MangaSourceConfig, chapterId: string): Action[] { const workflow = this.getWorkflow(config, 'loadMorePages'); if (!workflow) { throw new MangaSourceError( MangaSourceErrorCode.INVALID_CONFIG, '缺少加载更多页面工作流配置' ); } return this.processActions...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left buildLoadMorePagesActions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left MangaSourceCo...
buildLoadMorePagesActions(config: MangaSourceConfig, chapterId: string): Action[] { const workflow = this.getWorkflow(config, 'loadMorePages'); if (!workflow) { throw new MangaSourceError( MangaSourceErrorCode.INVALID_CONFIG, '缺少加载更多页面工作流配置' ); } return this.processActions...
https://github.com/DaLongZhuaZi/manxia
a29dc49cc3288a706a5f28cf5d374f833fe04792
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/PieChartModel.ets
arkts
calcAngleSum
calculates the needed angle for a given value @param value @return
private calcAngleSum(value: number): number { if (!this.mData) { return -1; } return this.calcAngle(value, this.mData.getYValueSum()); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left calcAngleSum AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left...
private calcAngleSum(value: number): number { if (!this.mData) { return -1; } return this.calcAngle(value, this.mData.getYValueSum()); }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
aa3c22df1097079764d889a9bbfc669314a12de5
gitee
HarmonyOS_Samples/guide-snippets
Ability/StartAbility/entry/src/main/ets/entryability/MailtoAbility.ets
arkts
onWindowStageCreate
[End mailto_ability]
onWindowStageCreate(windowStage: window.WindowStage): void { windowStage.loadContent('pages/MailtoIndex', (err) => { if (err.code) { hilog.error(DOMAIN, TAG, 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); return; } hilog.info(DOMAIN, TAG, 'Succeeded ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onWindowStageCreate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left windowStage AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left window AST#identif...
onWindowStageCreate(windowStage: window.WindowStage): void { windowStage.loadContent('pages/MailtoIndex', (err) => { if (err.code) { hilog.error(DOMAIN, TAG, 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); return; } hilog.info(DOMAIN, TAG, 'Succeeded ...
https://gitcode.com/HarmonyOS_Samples/guide-snippets
bd7647683b324fe63d0c97047d49ff8f83a68c1d
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/ComputerManager.ets
arkts
findComputerByAddress
按地址查找已存在的电脑(匹配所有地址字段)
private findComputerByAddress(address: string): ComputerInfo | undefined { return Array.from(this.computers.values()) .find(c => c.address === address || c.localAddress === address || c.remoteAddress === address || c.manualAddress === address || c.ipv6Address === addr...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left findComputerByAddress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left address AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string A...
private findComputerByAddress(address: string): ComputerInfo | undefined { return Array.from(this.computers.values()) .find(c => c.address === address || c.localAddress === address || c.remoteAddress === address || c.manualAddress === address || c.ipv6Address === addr...
https://github.com/AlkaidLab/moonlight-harmony
00ceba6e3548209a0daf031e91ebebeae0640a04
github
Explore-In-HMOS-Wearable/how-to-use-weather-kit
entry/src/main/ets/utils/WeatherIconHelper.ets
arkts
createIconConfig
Create a weather icon component configuration
createIconConfig( condition?: WeatherCondition, size: number = 24, useCustomColor: boolean = true ): IconConfig { return { resource: this.getWeatherIcon(condition), size: size, color: useCustomColor ? this.getWeatherColor(condition) : undefined }; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left createIconConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left condition AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left WeatherCo...
createIconConfig( condition?: WeatherCondition, size: number = 24, useCustomColor: boolean = true ): IconConfig { return { resource: this.getWeatherIcon(condition), size: size, color: useCustomColor ? this.getWeatherColor(condition) : undefined }; }
https://github.com/Explore-In-HMOS-Wearable/how-to-use-weather-kit
78525544f749bfe208e9119b7b286b9c63c24096
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/clipboard/ClipboardSyncConfig.ets
arkts
parse
Parse a wire frame received from the host. @param frame Wire frame bytes @returns { kind, token, payload } or null if invalid
static parse(frame: Uint8Array): ClipboardWireParseResult | null { if (frame.length < ClipboardWireFrame.HEADER_SIZE) { return null } const view = new DataView(frame.buffer, frame.byteOffset, frame.length) // Check version const version = view.getUint8(0) if (version !== ClipboardWireF...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left parse AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left frame AST#identi...
static parse(frame: Uint8Array): ClipboardWireParseResult | null { if (frame.length < ClipboardWireFrame.HEADER_SIZE) { return null } const view = new DataView(frame.buffer, frame.byteOffset, frame.length) // Check version const version = view.getUint8(0) if (version !== ClipboardWireF...
https://github.com/AlkaidLab/moonlight-harmony
245859176cd0945dacea12f0be8b0f1e00d9578b
github
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/model/SessionState.ets
arkts
registerSession
Register a new session
static registerSession(instance: number, session: SessionState): void { GlobalSessionManager.sessions.set(instance, session); console.info(`GlobalSessionManager: Registered session ${instance}`); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left registerSession AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left instance AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#numbe...
static registerSession(instance: number, session: SessionState): void { GlobalSessionManager.sessions.set(instance, session); console.info(`GlobalSessionManager: Registered session ${instance}`); }
https://github.com/tangwengang-del/freerdp-harmonyos
12d4558ce547a8ed728b9e4626f0a415bce65b7b
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
with
Creates a copy with replaced value on index @param { int } index - index to change @param { number } value - value to set @returns { Uint16Array } - an Uint16Array with replaced value on index @throws { RangeError } - If the index exceeds the array range, throw an exception @syscap SystemCapability.Utils.Lang @FaAndSta...
public with(index: int, value: number): Uint16Array { let res = new Uint16Array(this) res.setUnsafeClamp(index, value.toInt()) return res }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#ERROR#Right AST#with_statement#Left AST#with#Left with AST#with#Right AST#parenthesized_expression#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST...
public with(index: int, value: number): Uint16Array { let res = new Uint16Array(this) res.setUnsafeClamp(index, value.toInt()) return res }
https://gitcode.com/iop123123/arkts-static-skills
2b5bb0a73915eb5c5653247c0e8df6e53f5e0f5b
gitcode
David8Idira/AI-OA
packages/harmonyos/commons/src/main/ets/services/KnowledgeService.ets
arkts
moveDocument
移动文档 @param documentId 文档ID @param targetParentId 目标父文件夹ID
async moveDocument(documentId: string, targetParentId?: string): Promise<ApiResponse<any>> { return this.client.put<any>(`/api/v1/knowledge/documents/${documentId}/move`, { parentId: targetParentId }) }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left moveDocument AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left documentId AST#identifier#Right AST#type_annotation#Left AST#:#Lef...
async moveDocument(documentId: string, targetParentId?: string): Promise<ApiResponse<any>> { return this.client.put<any>(`/api/v1/knowledge/documents/${documentId}/move`, { parentId: targetParentId }) }
https://github.com/David8Idira/AI-OA
8cbf1f1453ac04c8a8792157a749d357df77f96b
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/ImageCacheManager.ets
arkts
findLFUKey
查找LFU键
private findLFUKey(): string { let lfuKey = ''; let lfuCount = Number.MAX_SAFE_INTEGER; for (const mapEntry of this.memoryCache) { const key = mapEntry[0]; const entry = mapEntry[1]; if (entry.accessCount < lfuCount) { lfuCount = entry.accessCount; lfuKey = key; ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left findLFUKey AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#s...
private findLFUKey(): string { let lfuKey = ''; let lfuCount = Number.MAX_SAFE_INTEGER; for (const mapEntry of this.memoryCache) { const key = mapEntry[0]; const entry = mapEntry[1]; if (entry.accessCount < lfuCount) { lfuCount = entry.accessCount; lfuKey = key; ...
https://github.com/DaLongZhuaZi/manxia
3638f26dfc18d1654012df0fe7ad51b729bb1b90
github
openharmony-sig/flutter_sqflite
sqflite/ohos/src/main/ets/io/flutter/plugins/sqflite/DatabaseHelper.ets
arkts
options
/ Options操作,设置LogLevel,仅限开发,已被废弃
public static async options(call: MethodCall, result: MethodResult): Promise<void> { let logLevel: number | undefined = call.argument(Constant.PARAM_LOG_LEVEL); result.success(null); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left options AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left call AST#i...
public static async options(call: MethodCall, result: MethodResult): Promise<void> { let logLevel: number | undefined = call.argument(Constant.PARAM_LOG_LEVEL); result.success(null); }
https://gitee.com/openharmony-sig/flutter_sqflite.git
715e8fa8ea09a279c4104c4731fd380ed100a762
gitee
wuba/omni-ui
omni_component/src/main/ets/components/popup/BasePopup.ets
arkts
setParams
参数,可以不返回 @returns
setParams(params: T | undefined) { this.args = params }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setParams AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#identifier#Left params AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#R...
setParams(params: T | undefined) { this.args = params }
https://github.com/wuba/omni-ui
9f67cb1c74eb05fad9b8232d183e7de3e8cd3a15
github
apap6628114/nga_oh
entry/src/main/ets/common/datasource/BaseLazyDataSource.ets
arkts
replaceAll
用新列表整体替换当前元素,替换后通知整体刷新。 @param list - 新元素列表
replaceAll(list: T[]): void { this.dataList = [] for (let i = 0; i < list.length; i++) { this.dataList.push(list[i]) } this.notifyReload() }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left replaceAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left list AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#Right AST#[#Left [ AST#[#Right AST#]#Left ] ...
replaceAll(list: T[]): void { this.dataList = [] for (let i = 0; i < list.length; i++) { this.dataList.push(list[i]) } this.notifyReload() }
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/common/datasource/BaseLazyDataSource.ets#L58-L64
6ec80dd6f4f3162a7133ad1b37341d4fd1feaf6e
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/DataManager.ets
arkts
getRecommendationCandidateComics
[性能优化] 获取推荐候选漫画(使用 SQL LIKE 预过滤) 只查询推荐所需的最少字段,通过作者/标签模糊匹配缩小候选集 @param authorFilter 作者过滤关键词 @param tagFilters 标签过滤关键词数组 @returns Promise<ComicInfo[]> 匹配的候选漫画列表
public async getRecommendationCandidateComics(authorFilter: string, tagFilters: string[]): Promise<ComicInfo[]> { try { // 构建 WHERE 条件: 非隐私 AND (作者 LIKE 或 标签 LIKE) const conditions: string[] = ['(isPrivate = 0 OR isPrivate IS NULL)']; const args: (string | number)[] = []; const filt...
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 getRecommendationCandidateComics AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left authorFilter AST#identifier#Right AST#...
public async getRecommendationCandidateComics(authorFilter: string, tagFilters: string[]): Promise<ComicInfo[]> { try { // 构建 WHERE 条件: 非隐私 AND (作者 LIKE 或 标签 LIKE) const conditions: string[] = ['(isPrivate = 0 OR isPrivate IS NULL)']; const args: (string | number)[] = []; const filt...
https://github.com/DaLongZhuaZi/manxia
4d145bcf737d60d6341e40174e0b26c45d3994d5
github
XHXYT/Pixark
entry/src/main/ets/viewmodel/RankViewModel.ets
arkts
openEditMode
编辑面板逻辑
openEditMode() { const allAvailableKeys = Object.keys(FunctionConstants.ILLUST_RANK_MODES) .filter(key => appSettings.show_H || !key.includes('r18')); const currentSelectedKeys = appSettings.rank_modes.filter(key => allAvailableKeys.includes(key)); this.editingSelected = new Set(currentSelectedKeys)...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left openEditMode 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 ...
openEditMode() { const allAvailableKeys = Object.keys(FunctionConstants.ILLUST_RANK_MODES) .filter(key => appSettings.show_H || !key.includes('r18')); const currentSelectedKeys = appSettings.rank_modes.filter(key => allAvailableKeys.includes(key)); this.editingSelected = new Set(currentSelectedKeys)...
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/viewmodel/RankViewModel.ets#L132-L139
036569d5ab72ff1620c87ef652a41cc870f72f42
github
CLMC2025/Vignette
entry/src/main/ets/database/DBManager.ets
arkts
beginTransaction
==================== TRANSACTION OPERATIONS ====================
beginTransaction(): void { this.ensureInitialized(); this.store!.beginTransaction(); console.info('[DBManager] Transaction BEGIN'); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left beginTransaction AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_b...
beginTransaction(): void { this.ensureInitialized(); this.store!.beginTransaction(); console.info('[DBManager] Transaction BEGIN'); }
https://github.com/CLMC2025/Vignette
cb26dbe8ce360e06c26804187dcf021a0dd57a30
github
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnInputViewModel.ets
arkts
setPasswordValue
设置密码输入框的内容 @param value 新的密码输入值
setPasswordValue(value: string): void { this.passwordValue = value; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setPasswordValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left...
setPasswordValue(value: string): void { this.passwordValue = value; }
https://github.com/codelably/tuniao-ui
6e1c38b26b10f161f1be0292a03768871e713c00
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/MangaSourceConfigParser.ets
arkts
processActions
处理操作序列,替换变量
private processActions(actions: Action[], context: Partial<WorkflowContext>): Action[] { const variables: VariableMap = {}; // 调试日志 logger.debug(TAG, `processActions context: mangaId=${context.mangaId}, chapterId=${context.chapterId}`); // 设置上下文变量 if (context.searchKeyword) { variables.sea...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left processActions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left actions AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_e...
private processActions(actions: Action[], context: Partial<WorkflowContext>): Action[] { const variables: VariableMap = {}; // 调试日志 logger.debug(TAG, `processActions context: mangaId=${context.mangaId}, chapterId=${context.chapterId}`); // 设置上下文变量 if (context.searchKeyword) { variables.sea...
https://github.com/DaLongZhuaZi/manxia
616ab32f495f5eed8a0493fa988ed45425f3fbeb
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Storage/StorageAnalyzer.ets
arkts
getDirectoryInfo
获取目录信息(大小和文件数)
private async getDirectoryInfo(dirPath: string): Promise<DirectoryInfo> { try { // 检查目录是否存在 const exists = await this.sandboxManager.exists(dirPath); if (!exists) { logger.debug(TAG, `目录不存在: ${dirPath}`); return { size: 0, count: 0 }; } const size = await this....
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 getDirectoryInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left dirPath AST#identifier#Right AST#ERROR#Left AST#:#L...
private async getDirectoryInfo(dirPath: string): Promise<DirectoryInfo> { try { // 检查目录是否存在 const exists = await this.sandboxManager.exists(dirPath); if (!exists) { logger.debug(TAG, `目录不存在: ${dirPath}`); return { size: 0, count: 0 }; } const size = await this....
https://github.com/DaLongZhuaZi/manxia
121d967ed5484d1efee1f619ef3575535ee563ce
github
LJ666-ui/harmony-health-care
entry/src/main/ets/common/utils/HttpUtil.ets
arkts
clearNurseToken
清除护士Token
static async clearNurseToken(): Promise<void> { try { AppStorage.setOrCreate<string>('nurseToken', ''); const settings: SettingsUtil = SettingsUtil.getInstance(); await settings.clearNurseAuth(); } catch (error) { console.error('[HttpUtil] 清除护士Token失败:', error); } }
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 clearNurseToken AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#...
static async clearNurseToken(): Promise<void> { try { AppStorage.setOrCreate<string>('nurseToken', ''); const settings: SettingsUtil = SettingsUtil.getInstance(); await settings.clearNurseAuth(); } catch (error) { console.error('[HttpUtil] 清除护士Token失败:', error); } }
https://github.com/LJ666-ui/harmony-health-care
9e41deb14000392cc0348e23db1c37087d9f559d
github
openharmony/applications_mms
entry/src/main/ets/pages/settings/advancedSettings/advancedSettingsController.ets
arkts
autoHandleAutoDeleteInfoValueChange
This method is used when the value of autoDeleteInfoSwitch changes.
autoHandleAutoDeleteInfoValueChange(newValue) { HiLog.i(TAG, 'autoHandleAutoDeleteInfoValueChange, newValue = ' + newValue); let messageCode = common.route.MESSAGE_CODE_UPDATE_AUTO_DELETE_INFO_MESSAGES_VALUE; let actionData: LooseObject = {}; actionData.booleanValue = newValue; ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left autoHandleAutoDeleteInfoValueChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left newValue AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#...
autoHandleAutoDeleteInfoValueChange(newValue) { HiLog.i(TAG, 'autoHandleAutoDeleteInfoValueChange, newValue = ' + newValue); let messageCode = common.route.MESSAGE_CODE_UPDATE_AUTO_DELETE_INFO_MESSAGES_VALUE; let actionData: LooseObject = {}; actionData.booleanValue = newValue; ...
https://gitee.com/openharmony/applications_mms.git
7146dd195461a9515191ec5711419f1dc795b4b1
gitee
Amaz1ny/HarmonyDO-public
entry/src/main/ets/services/storage/PreferencesUtil.ets
arkts
putNumber
保存数字值
static async putNumber(key: string, value: number): Promise<void> { if (PreferencesUtil.preferencesInstance === null) { return; } try { await PreferencesUtil.preferencesInstance.put(key, value); await PreferencesUtil.preferencesInstance.flush(); } catch (err) { hilog.error(0x00...
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 putNumber AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Ri...
static async putNumber(key: string, value: number): Promise<void> { if (PreferencesUtil.preferencesInstance === null) { return; } try { await PreferencesUtil.preferencesInstance.put(key, value); await PreferencesUtil.preferencesInstance.flush(); } catch (err) { hilog.error(0x00...
https://github.com/Amaz1ny/HarmonyDO-public
7b3f0bf20d0abad3d750f83c93980d8eab6fde05
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/equal/equal_long.ets
arkts
main
--- desc: check equality of two long integers ---
function main(): void { const a: long = {{v.left}} const b: long = {{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: long = {{v.left}} const b: long = {{v.right}} assert (a == b) == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
aa44967431b0f4c5b73eb64664a30229ccfb92e7
gitee
apap6628114/nga_oh
entry/src/main/ets/store/settings/domain/ThemeSettings.ets
arkts
load
从持久化对象加载主题字段
load(saved: SettingsState): void { if (saved.theme) this.ctx.state.theme = saved.theme }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left load AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left saved AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left SettingsState AST#identifier#Right AST#)#Left ) AS...
load(saved: SettingsState): void { if (saved.theme) this.ctx.state.theme = saved.theme }
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/store/settings/domain/ThemeSettings.ets#L64-L66
d5c7b141e6f7f7a1fcf84ad4e58dfe078f8d31f0
github
apap6628114/nga_oh
entry/src/main/ets/common/managers/PaginationManager.ets
arkts
getPrefetchedRaw
读取某页的预取缓存条目(object[]),不存在时返回 undefined。 子类 commitPrefetchedPage 取出后按需做类型转换与 append 去重。 @param page - 页码 @returns 缓存 holder 或 undefined
protected getPrefetchedRaw(page: number): PrefetchedPageHolder | undefined { return this.prefetchedPages.get(page) }
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left getPrefetchedRaw AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left page AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi...
protected getPrefetchedRaw(page: number): PrefetchedPageHolder | undefined { return this.prefetchedPages.get(page) }
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/common/managers/PaginationManager.ets#L95-L97
f509668c6cc0d81c16bba693917a0665675d6ad6
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test2_original_index.ets
arkts
testTryCatchFinally
=== Exception Handling ===
function testTryCatchFinally(): string { let result: string = ''; try { let arr: number[] = [1, 2, 3]; let val: number = arr[10]; result = 'no error'; } catch (err) { result = 'caught: ' + String(err); } finally { result = result + ' done'; } return result; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testTryCatchFinally 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#predefi...
function testTryCatchFinally(): string { let result: string = ''; try { let arr: number[] = [1, 2, 3]; let val: number = arr[10]; result = 'no error'; } catch (err) { result = 'caught: ' + String(err); } finally { result = result + ' done'; } return result; }
https://github.com/miaochiahao/ark-ghidra
9c119319e6399863885086b7f3503185656ab002
github
arkui-x/samples
CodeLab/Cases/feature/bluetooth/src/main/ets/uicomponents/HeartRateGraph.ets
arkts
drawHeartRateLine
画心率变动曲线
drawHeartRateLine() { this.context.lineWidth = LINE_WIDTH; this.context.strokeStyle = COLOR_LINE; // draw broken line let path: Path2D = new Path2D(); for (let i = 0; i < SIZE; i++) { let x = START_X + this.mOffset * i + PADDING_HORIZONTAL; let y = this.viewHeight - PADDING_VE...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left drawHeartRateLine 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#...
drawHeartRateLine() { this.context.lineWidth = LINE_WIDTH; this.context.strokeStyle = COLOR_LINE; // draw broken line let path: Path2D = new Path2D(); for (let i = 0; i < SIZE; i++) { let x = START_X + this.mOffset * i + PADDING_HORIZONTAL; let y = this.viewHeight - PADDING_VE...
https://gitcode.com/arkui-x/samples
231ba957a3edf66466e8c078f8c312075719a418
gitcode
codelably/HCompass
core/network/src/main/ets/RequestHelper.ets
arkts
fromResult
创建请求助手(从 NetworkResult) @param promise NetworkResult Promise @returns RequestHelper 实例
static fromResult<T>(promise: Promise<NetworkResult<T>>): RequestHelper<T> { return new RequestHelper<T>(promise as Promise<Unknown>, undefined, true); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#binary_expression#Left AST#identifier#Left fromResult AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Ri...
static fromResult<T>(promise: Promise<NetworkResult<T>>): RequestHelper<T> { return new RequestHelper<T>(promise as Promise<Unknown>, undefined, true); }
https://github.com/codelably/HCompass
82c4c27505ca98a85f2d5dd0c4258a14895f534e
github
XJTUWYD/ArkDiff
entry/src/main/ets/engine/FilterRuleEngine.ets
arkts
isBinaryContent
检查文件是否是二进制(通过内容启发式判断)
static isBinaryContent(content: string): boolean { // 检查前 8000 个字符中是否有 null 字节或过多控制字符 const sample = content.substring(0, Math.min(8000, content.length)); let controlCount = 0; for (let i = 0; i < sample.length; i++) { const code = sample.charCodeAt(i); if (code === 0) return true; // null...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isBinaryContent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left content AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string...
static isBinaryContent(content: string): boolean { // 检查前 8000 个字符中是否有 null 字节或过多控制字符 const sample = content.substring(0, Math.min(8000, content.length)); let controlCount = 0; for (let i = 0; i < sample.length; i++) { const code = sample.charCodeAt(i); if (code === 0) return true; // null...
https://github.com/XJTUWYD/ArkDiff
a14a8a31424b2e52e79dc2bfb8c798e9ca31b613
github
AGenUI/AGenUI
platforms/harmony/agenui/src/main/ets/agenui/hybrid/HybridBaseView.ets
arkts
updateArkUI
Updates the ArkUI node when view data changes.
updateArkUI(): void { if (this.arkUINode) { this.arkUINode.update(this); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateArkUI 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#Lef...
updateArkUI(): void { if (this.arkUINode) { this.arkUINode.update(this); } }
https://github.com/AGenUI/AGenUI
20ea725f89eb411b37d3681a76b589b6805c706f
github