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
JackJiang2011/harmonychat
entry/src/main/ets/pages/components/ChatInputView.ets
arkts
doSendMessage
发送消息实现方法
doSendMessage() { if(this.messageInput.length > 0 && this.receiverInput.length > 0) { if(this.receiverInput === ClientCoreSDK.getInstance().currentLoginInfo?.loginUserId) { ToolKits.showToast('不能给自已发送消息哦!'); return; } // 先生成指纹码 let fingerPring: string = Protocal.genFingerP...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left doSendMessage 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...
doSendMessage() { if(this.messageInput.length > 0 && this.receiverInput.length > 0) { if(this.receiverInput === ClientCoreSDK.getInstance().currentLoginInfo?.loginUserId) { ToolKits.showToast('不能给自已发送消息哦!'); return; } // 先生成指纹码 let fingerPring: string = Protocal.genFingerP...
https://github.com/JackJiang2011/harmonychat
d372936b96d8b731645bfca5f2bba9245ce4b79a
github
openharmony/arkui_ace_engine
advanced_ui_component_static/assembled_advanced_ui_component/@ohos.arkui.advanced.GridObjectSortComponent.ets
arkts
getSymbolFontSizeFrom
translate option imageSize to symbol fontSize
getSymbolFontSizeFrom(imageSize?: int | Resource | undefined): string | Resource { if (imageSize === undefined) { return SYMBOL_DEFAULT; } if (typeof imageSize === 'int') { return `${imageSize as int}vp`; } return imageSize as Resource; }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getSymbolFontSizeFrom AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#binary_expression#Left AST#identifier#Left imageSize AST#identifier#Right AST#ERROR...
getSymbolFontSizeFrom(imageSize?: int | Resource | undefined): string | Resource { if (imageSize === undefined) { return SYMBOL_DEFAULT; } if (typeof imageSize === 'int') { return `${imageSize as int}vp`; } return imageSize as Resource; }
https://gitcode.com/openharmony/arkui_ace_engine
d503167b5006b50c8a7b5e99cddf009c2fad91f9
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/TypeCreator.ets
arkts
create
resides in ctx, no need to free Forces creation of `this` creator and creators it depends on @returns created Type instance
public create(): Type throws { if (this.typ == null) { const ctx = new TypeCreatorCtx() try { ctx.create(this) } finally { ctx.deinit() } } return this.typ! }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left create 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 Type AST#identi...
public create(): Type throws { if (this.typ == null) { const ctx = new TypeCreatorCtx() try { ctx.create(this) } finally { ctx.deinit() } } return this.typ! }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
2acbfe91d3ec15cbca99af4eb6dbfa83e08d37b8
gitee
wgli-collab/arkts-lodash
entry/src/main/ets/test/TestFunction.ets
arkts
makeInc
Module-level helpers to avoid ArkTS closure nesting issues
function makeInc(): (...args: Object[]) => Object { const fn: (...args: Object[]) => Object = (...innerArgs: Object[]): Object => { return ((innerArgs[0] as number) + 1) as Object } return fn }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left makeInc 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#function_type#Left ...
function makeInc(): (...args: Object[]) => Object { const fn: (...args: Object[]) => Object = (...innerArgs: Object[]): Object => { return ((innerArgs[0] as number) + 1) as Object } return fn }
https://github.com/wgli-collab/arkts-lodash
267c9a184ea9e22c857190abac6c525e17191f87
github
wuba/omni-ui
omni_component/src/main/ets/components/popup/BasePopup.ets
arkts
dismissTop
关闭最上层弹窗
static dismissTop() { if (BasePopup.popupList != null && BasePopup.popupList.length > 0) { let size: number = BasePopup.popupList.length let lastPopup: BasePopup<ESObject> = BasePopup.popupList.get(size - 1) lastPopup.dismiss() } }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left dismissTop AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AS...
static dismissTop() { if (BasePopup.popupList != null && BasePopup.popupList.length > 0) { let size: number = BasePopup.popupList.length let lastPopup: BasePopup<ESObject> = BasePopup.popupList.get(size - 1) lastPopup.dismiss() } }
https://github.com/wuba/omni-ui
cbbd4f4c2f625002c75f3a92c348bef100cf0223
github
kumaleap/ArkLuban
library/src/main/ets/luban/LubanUtils.ets
arkts
preprocessImageFile
预处理图片文件路径 对于 URI,直接复制到临时目录;对于普通路径,直接返回 @param filePath 原文件路径或 URI @returns 处理后的可访问文件路径
static async preprocessImageFile(filePath: string): Promise<string> { const result = await LubanUtils.preprocessImageFileWithCleanup(filePath); return result.path; }
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 preprocessImageFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath AST#identifier#Right AST#ERROR#Left AST#:#...
static async preprocessImageFile(filePath: string): Promise<string> { const result = await LubanUtils.preprocessImageFileWithCleanup(filePath); return result.path; }
https://github.com/kumaleap/ArkLuban
e580e7943ccb604ae26af1104c0001f491819b2e
github
Nekofox-POT/LinMusic
entry/src/main/ets/package/audio_player/by_ffmpeg_player.ets
arkts
pause
暂停 //
pause() {nativeModule.pause()}
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left pause AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c...
pause() {nativeModule.pause()}
https://github.com/Nekofox-POT/LinMusic
9f9ff9419b036474ebfae247a2285d3e3df533a1
github
openharmony-sig/ohos_easyui
easyui/src/main/ets/common/components/AddressEdit.ets
arkts
closeAreaSelect
关闭地区选择面板
closeAreaSelect(){ setTimeout(()=>{ this.showAreaSelect = false },350) this.maskOpacity = 0 this.areaSelectHeight = "0%" }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left closeAreaSelect AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Le...
closeAreaSelect(){ setTimeout(()=>{ this.showAreaSelect = false },350) this.maskOpacity = 0 this.areaSelectHeight = "0%" }
https://gitee.com/openharmony-sig/ohos_easyui.git
4319bc1d12edbc32c28627a2fd0a3c67d9c6969b
gitee
wuba/omni-ui
omni_component/src/main/ets/components/popup/OmniPopup.ets
arkts
setBorderRadius
全局设置-圆角 @param borderRadius
static setBorderRadius(borderRadius: Length | BorderRadiuses | LocalizedBorderRadiuses) { Config.popupConfig.borderRadius = borderRadius }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setBorderRadius AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#binary_expression#Left AST#identifier#Left borderRadius AST#identifier#Right AST#ERROR#Left...
static setBorderRadius(borderRadius: Length | BorderRadiuses | LocalizedBorderRadiuses) { Config.popupConfig.borderRadius = borderRadius }
https://github.com/wuba/omni-ui
af1657136091ba50137bcd55cf9bf6ac1c62fbc2
github
openharmony/codelabs
ETSUI/LifeTrack/entry/src/main/ets/services/RepeatService.ets
arkts
setRemindersForInstances
为实例设置提醒
private async setRemindersForInstances(originalEvent: CalendarEvent, instances: EventInstance[]): Promise<void> { try { const reminderService = ReminderService.getInstance(); for (const instance of instances) { // 计算实例的结束时间(保持相同的时长) const duration = originalEvent.endTime - originalEve...
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 setRemindersForInstances AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left originalEvent AST#identifier...
private async setRemindersForInstances(originalEvent: CalendarEvent, instances: EventInstance[]): Promise<void> { try { const reminderService = ReminderService.getInstance(); for (const instance of instances) { // 计算实例的结束时间(保持相同的时长) const duration = originalEvent.endTime - originalEve...
https://gitcode.com/openharmony/codelabs
b4f86867b731bdf9c06ce18e2f24be55049a2b99
gitcode
revalue-o/HarmonyOS-Next-Hook-demo
source_codes/ArkTS-inject/entry/src/main/ets/utils/LocationUtil.ets
arkts
isLocationEnabled
检查位置服务是否启用
static async isLocationEnabled(): Promise<boolean> { try { const isEnabled = await geoLocationManager.isLocationEnabled(); hilog.info(DOMAIN, 'LocationUtil', 'Location service enabled: %{public}s', isEnabled.toString()); return isEnabled; } catch (err) { const error = err as BusinessEr...
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 isLocationEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS...
static async isLocationEnabled(): Promise<boolean> { try { const isEnabled = await geoLocationManager.isLocationEnabled(); hilog.info(DOMAIN, 'LocationUtil', 'Location service enabled: %{public}s', isEnabled.toString()); return isEnabled; } catch (err) { const error = err as BusinessEr...
https://github.com/revalue-o/HarmonyOS-Next-Hook-demo
d26702d0dc736f99753bd488d1feee27677ac238
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
reduceRight
Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. @param { function } callbackfn - A function that accepts four arguments. The reduceR...
public reduceRight(callbackfn: (previousValue: BigInt, currentValue: BigInt, currentIndex: int, array: BigInt64Array) => BigInt): BigInt { if (this.lengthInt == 0) { throw new TypeError("Reduce of empty array with no initial value") } let accumulatedValue: BigInt = new BigInt(th...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left reduceRight AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left callbackfn AST#identifier#Right AST#ERROR#Left AST#:#L...
public reduceRight(callbackfn: (previousValue: BigInt, currentValue: BigInt, currentIndex: int, array: BigInt64Array) => BigInt): BigInt { if (this.lengthInt == 0) { throw new TypeError("Reduce of empty array with no initial value") } let accumulatedValue: BigInt = new BigInt(th...
https://gitcode.com/iop123123/arkts-static-skills
9848c959fd87161a3a2d78988361593fd9fbf8e2
gitcode
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test41_original_index.ets
arkts
countGrades
--- Switch with counters ---
function countGrades(scores: number[]): string { let a: number = 0; let b: number = 0; let c: number = 0; let f: number = 0; for (let i: number = 0; i < scores.length; i++) { let s: number = scores[i]; if (s >= 90) { a = a + 1; } else if (s >= 80) { b = b + 1; } else if (s >= 70) {...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left countGrades AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left scores AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Ri...
function countGrades(scores: number[]): string { let a: number = 0; let b: number = 0; let c: number = 0; let f: number = 0; for (let i: number = 0; i < scores.length; i++) { let s: number = scores[i]; if (s >= 90) { a = a + 1; } else if (s >= 80) { b = b + 1; } else if (s >= 70) {...
https://github.com/miaochiahao/ark-ghidra
4fba86d2f13cc04132897dd41e303ba64a641073
github
offlinecat-dev/OCNetORM
src/main/ets/query/QueryCache.ets
arkts
getNamespace
获取当前缓存命名空间(主要用于测试) @returns 命名空间标识
getNamespace(): string { return this.namespace }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getNamespace AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement...
getNamespace(): string { return this.namespace }
https://github.com/offlinecat-dev/OCNetORM
f380045787d8b34e0698698ce86a146fa9e40178
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/ohosTest/ets/test/dao/AccountDAO.test.ets
arkts
getTestContext
在测试环境中获取 Context 的辅助函数
function getTestContext(): common.Context { // 在 stageMode 中,getContext 是全局函数 return getContext() as common.Context; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getTestContext 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#nested_type_...
function getTestContext(): common.Context { // 在 stageMode 中,getContext 是全局函数 return getContext() as common.Context; }
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
ae1196b26a8852e3fecb7b4c2fd24f05b7a89e53
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/WelcomeGuideManager.ets
arkts
markGuideCompleted
标记引导完成
public async markGuideCompleted(): Promise<void> { try { if (!this.isInitialized) { await this.initialize(); } this.guideCompleted = true; this.isFirstLaunch = false; this.currentStep = GuideStep.COMPLETED; this.activeGuideFlow = GuideFlowMode.FULL; await this.sav...
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 markGuideCompleted AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A...
public async markGuideCompleted(): Promise<void> { try { if (!this.isInitialized) { await this.initialize(); } this.guideCompleted = true; this.isFirstLaunch = false; this.currentStep = GuideStep.COMPLETED; this.activeGuideFlow = GuideFlowMode.FULL; await this.sav...
https://github.com/DaLongZhuaZi/manxia
a94b49efb39c9f4f8e3089409b56cff86732992f
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test50_original_index.ets
arkts
testMultiLevel
--- Multi-level data structure ---
function testMultiLevel(): string { let departments: Map<string, Map<string, number>> = new Map(); let eng: Map<string, number> = new Map(); eng.set('senior', 5); eng.set('junior', 10); let sales: Map<string, number> = new Map(); sales.set('senior', 3); sales.set('junior', 8); departments.set('engineeri...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testMultiLevel 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 testMultiLevel(): string { let departments: Map<string, Map<string, number>> = new Map(); let eng: Map<string, number> = new Map(); eng.set('senior', 5); eng.set('junior', 10); let sales: Map<string, number> = new Map(); sales.set('senior', 3); sales.set('junior', 8); departments.set('engineeri...
https://github.com/miaochiahao/ark-ghidra
95e1e9446382c89c2e701c679aaa0688dfd5bb8b
github
luojiang001/Pulse
Pulse/entry/src/main/ets/pages/component/Medicine/MedicineCart.ets
arkts
getCartTotal
计算购物车总金额
getCartTotal(): number { return this.cart.reduce((total, item) => total + (item.price * item.quantity), 0) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCartTotal AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statement...
getCartTotal(): number { return this.cart.reduce((total, item) => total + (item.price * item.quantity), 0) }
https://github.com/luojiang001/Pulse
19d86d66ab271456478f3525831a4e09dbfbd6ce
github
openharmony-sig/flutter_packages
packages/local_auth/local_auth_ohos/ohos/src/main/ets/io/flutter/plugins/localauth/LocalAuthPlugin.ets
arkts
deviceCanSupportBiometrics
Returns true if this device can support biometric authentication, whether any biometrics are enrolled or not.
deviceCanSupportBiometrics(): Boolean { return this.supportHardware(userAuth.UserAuthType.FINGERPRINT, userAuth.AuthTrustLevel.ATL1) || this.supportHardware(userAuth.UserAuthType.FACE, userAuth.AuthTrustLevel.ATL1); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left deviceCanSupportBiometrics AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left Boolean AST#identifier#Right AST#ER...
deviceCanSupportBiometrics(): Boolean { return this.supportHardware(userAuth.UserAuthType.FINGERPRINT, userAuth.AuthTrustLevel.ATL1) || this.supportHardware(userAuth.UserAuthType.FACE, userAuth.AuthTrustLevel.ATL1); }
https://gitee.com/openharmony-sig/flutter_packages.git
faaeb26bab1f0875c7c3ca212c6ab3d6f2ec1f6d
gitee
LongLiveY96/chatcube
entry/src/main/ets/services/WebSearchService.ets
arkts
fetchUrlContent
========== URL 抓取功能 ========== 抓取网页内容
async fetchUrlContent(url: string, options?: WebSearchExecutionOptions): Promise<WebSearchResult> { const runtime = options?.runtimeConfig !== undefined ? options.runtimeConfig : await this.getRuntimeConfigSnapshot() const requestId = options?.requestId !== undefined ? options.requestId : '' const control...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left fetchUrlContent AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left url AST#identifier#Right AST#type_annotation#Left AST#:#Left : ...
async fetchUrlContent(url: string, options?: WebSearchExecutionOptions): Promise<WebSearchResult> { const runtime = options?.runtimeConfig !== undefined ? options.runtimeConfig : await this.getRuntimeConfigSnapshot() const requestId = options?.requestId !== undefined ? options.requestId : '' const control...
https://github.com/LongLiveY96/chatcube
ce185df1c2fb45c9eb9389a20682868b0c642d7f
github
Cool_foolisher1/ArkTSRepository
GuardianAssistant/entry/src/main/ets/manager/AudioCapturerManager.ets
arkts
getAudioCapturer
创建/获取音频采集器
async getAudioCapturer() { if (this.audioCapturer) { return this.audioCapturer } this.audioCapturer = await audio.createAudioCapturer({ streamInfo: this.audioStreamInfo, capturerInfo: this.audioCapturerInfo }) return this.audioCapturer }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getAudioCapturer AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST...
async getAudioCapturer() { if (this.audioCapturer) { return this.audioCapturer } this.audioCapturer = await audio.createAudioCapturer({ streamInfo: this.audioStreamInfo, capturerInfo: this.audioCapturerInfo }) return this.audioCapturer }
https://gitcode.com/Cool_foolisher1/ArkTSRepository
bd5f3282feb1862019587c231028fb31cbdebdc6
gitcode
honjow/Next2V
shared/src/main/ets/settings/IgnoredNodesSettings.ets
arkts
toggle
Flip the ignored state of `name`; returns the new state.
static toggle(name: string): boolean { return IgnoredNodesSettings.setIgnored(name, !IgnoredNodesSettings.isIgnored(name)) }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left toggle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AS...
static toggle(name: string): boolean { return IgnoredNodesSettings.setIgnored(name, !IgnoredNodesSettings.isIgnored(name)) }
https://github.com/honjow/Next2V
8a4f458f7f3041fa64307676ff7c3868ed4744ed
github
openharmony/codelabs
ETSUI/LifeTrack/entry/src/main/ets/utils/StepUtils.ets
arkts
generateHistoricalSteps
生成过去几天的历史步数数据(仅用于初始化时填充历史数据)
async generateHistoricalSteps(days: number = 7): Promise<void> { try { const today = new Date(); for (let i = days - 1; i >= 0; i--) { const date = new Date(today); date.setDate(today.getDate() - i); const dateStr = this.formatDate(date); // 检查是否已经有该日期的记录 con...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left generateHistoricalSteps AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left days AST#identifier#Right AST#type_annotation#Left AST#...
async generateHistoricalSteps(days: number = 7): Promise<void> { try { const today = new Date(); for (let i = days - 1; i >= 0; i--) { const date = new Date(today); date.setDate(today.getDate() - i); const dateStr = this.formatDate(date); // 检查是否已经有该日期的记录 con...
https://gitcode.com/openharmony/codelabs
6d9e94fd8f7d0ae6996120e282070f53a9588746
gitcode
JackJiang2011/harmonychat
entry/src/main/ets/pages/model/MessagesProvider.ets
arkts
addSystemMessage
添加一条系统消息(显示在聊天列表中)。 @param content 消息内容
addSystemMessage(content: string): void { let m: Message = Message.createChatMsgEntity_INCOME_SYSTEAMINFO('0', content, 0); this.putMessage(m); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addSystemMessage 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#Right AST#ERROR#Right AST#)#Left ) AST...
addSystemMessage(content: string): void { let m: Message = Message.createChatMsgEntity_INCOME_SYSTEAMINFO('0', content, 0); this.putMessage(m); }
https://github.com/JackJiang2011/harmonychat
6928b7aad925e40a7f045bb77ff3a980e9cb5ee9
github
ASweetBite/HarmonyPulse
entry/src/main/ets/type/GlobalMusic.ets
arkts
notifySongChange
触发所有监听
notifySongChange() { this.onSongChangeListeners.forEach(cb => cb()); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left notifySongChange 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...
notifySongChange() { this.onSongChangeListeners.forEach(cb => cb()); }
https://github.com/ASweetBite/HarmonyPulse/blob/a7fcf153a20bafa29ac1fb8c25743dd5350dc54c/entry/src/main/ets/type/GlobalMusic.ets#L35-L37
6fb3cc2eb3aa666640beef75c2537ca87a74596f
github
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/JsonEncodingVisitor.ets
arkts
visitRepeatedInt32
========== Repeated 字段 ========== 访问 repeated int32 字段 JSON: array of number
visitRepeatedInt32(value: number[], fieldNumber: number): void { const fieldName = this.getFieldName(fieldNumber) this.json[fieldName] = [...value] as Object }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitRepeatedInt32 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left number...
visitRepeatedInt32(value: number[], fieldNumber: number): void { const fieldName = this.getFieldName(fieldNumber) this.json[fieldName] = [...value] as Object }
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
bf9ce8751fe56ea5e7839d3153b53e0841985735
gitcode
YANGZX22/Voot
entry/src/main/ets/entryformability/EntryFormAbility.ets
arkts
addFormId
Helper to add formId to persistent storage
private async addFormId(formId: string): Promise<void> { try { const pref = await preferences.getPreferences(this.context, PREF_FILE); const idsStr = await pref.get(FORM_IDS_KEY, '[]') as string; const ids: string[] = JSON.parse(idsStr); if (!ids.includes(formId)) { ids.push(formId...
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 addFormId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left formId AST#identifier#Right AST#:#Left : AS...
private async addFormId(formId: string): Promise<void> { try { const pref = await preferences.getPreferences(this.context, PREF_FILE); const idsStr = await pref.get(FORM_IDS_KEY, '[]') as string; const ids: string[] = JSON.parse(idsStr); if (!ids.includes(formId)) { ids.push(formId...
https://github.com/YANGZX22/Voot
2358eaf8699d15549bd2890a7a5894d14a96b6da
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Promise.ets
arkts
race
Create a promise that will be completed after at least one promise is completed @param promises iterable object of promise-like objects @returns { Promise } promise that will completed with the same value as one of the promises in the argument
static race<U>(promises: Iterable<PromiseLike<U>|U>): Promise<Awaited<U>> { try { return Promise.race<U>(Promise.toArray(promises)); } catch (e) { // NOTE(csaba.osztrogonac): remove as cast once e has Error type return Promise.reject<U>(e as Error); } ...
AST#program#Left AST#ERROR#Left AST#binary_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left race AST#identifier#Right AST#ERROR#Right AST#<#Left < AST#<#Right AST#identifier#Left U AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#formal_para...
static race<U>(promises: Iterable<PromiseLike<U>|U>): Promise<Awaited<U>> { try { return Promise.race<U>(Promise.toArray(promises)); } catch (e) { // NOTE(csaba.osztrogonac): remove as cast once e has Error type return Promise.reject<U>(e as Error); } ...
https://gitcode.com/iop123123/arkts-static-skills
e7d958075e481861c91db329f8625b82fac1f2b5
gitcode
openharmony/codelabs
ETSUI/HarmonyPhotoAlbum/entry/src/main/ets/model/PhotoModel.ets
arkts
matchesKeyword
检查名称或标签是否包含关键词 @param keyword 搜索关键词 @returns 是否匹配
matchesKeyword(keyword: string): boolean { const lowerKeyword = keyword.toLowerCase(); const nameMatch = this.name.toLowerCase().includes(lowerKeyword); const tagMatch = this.hasTag(keyword); return nameMatch || tagMatch; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left matchesKeyword AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left keyword AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST#)...
matchesKeyword(keyword: string): boolean { const lowerKeyword = keyword.toLowerCase(); const nameMatch = this.name.toLowerCase().includes(lowerKeyword); const tagMatch = this.hasTag(keyword); return nameMatch || tagMatch; }
https://gitcode.com/openharmony/codelabs
d3d89157a9d875b6b787747cb046c88f9cb21646
gitcode
LJ666-ui/harmony-health-care
entry/src/main/ets/common/utils/TokenManager.ets
arkts
getCurrentToken
获取当前角色的Token 优先级:家属 > 护士 > 医生 > 普通用户
static getCurrentToken(): string | null { if (AuthManager.isFamily()) { return SettingsUtil.get('familyToken'); } else if (AuthManager.isNurse()) { return SettingsUtil.get('nurseToken'); } else if (AuthManager.isDoctor()) { return SettingsUtil.get('doctorToken'); } else { retur...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getCurrentToken AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left...
static getCurrentToken(): string | null { if (AuthManager.isFamily()) { return SettingsUtil.get('familyToken'); } else if (AuthManager.isNurse()) { return SettingsUtil.get('nurseToken'); } else if (AuthManager.isDoctor()) { return SettingsUtil.get('doctorToken'); } else { retur...
https://github.com/LJ666-ui/harmony-health-care
333c5176a24d4958346b82bbfd8b5330554916c4
github
codelably/HCompass
entry/src/main/ets/entryability/AppInterceptors.ets
arkts
logRequest
打印请求日志
private logRequest(config: InternalAxiosRequestConfig): void { const method: string = this.normalizeMethod(config.method); const url: string = this.buildRequestUrl(config); const params: string = this.safeStringify(config.params as Unknown, true); const data: string = this.safeStringify(config.data as...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left logRequest 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 ...
private logRequest(config: InternalAxiosRequestConfig): void { const method: string = this.normalizeMethod(config.method); const url: string = this.buildRequestUrl(config); const params: string = this.safeStringify(config.params as Unknown, true); const data: string = this.safeStringify(config.data as...
https://github.com/codelably/HCompass
3a005df8efe461866f04c400fc9f32f3f518694c
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelLoginManager.ets
arkts
getSourceDataSnapshot
获取书源持久化数据快照(对应Legado的source.get)
getSourceDataSnapshot(sourceId: string): Record<string, string> { const result: Record<string, string> = {}; const prefix = `${sourceId}_`; this.sourceDataStore.forEach((value: string, key: string): void => { if (key.startsWith(prefix)) { const dataKey = key.substring(prefix.length); ...
AST#program#Left AST#expression_statement#Left AST#sequence_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getSourceDataSnapshot AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#R...
getSourceDataSnapshot(sourceId: string): Record<string, string> { const result: Record<string, string> = {}; const prefix = `${sourceId}_`; this.sourceDataStore.forEach((value: string, key: string): void => { if (key.startsWith(prefix)) { const dataKey = key.substring(prefix.length); ...
https://github.com/DaLongZhuaZi/manxia
081c17176e7a062d0b025897c204b0f0b138a0cc
github
harmonyos/codelabs
CanvasComponent/entry/src/main/ets/viewmodel/DrawModel.ets
arkts
getResourceString
Obtains the character string corresponding to the specified resource ID. @param resource resource.
getResourceString(resource: Resource): string { if (CheckEmptyUtils.isEmptyObj(resource)) { Logger.error('[DrawModel][getResourceString] resource is empty.') return ''; } let resourceString: string = ''; try { resourceString = getContext(this).resourceManager.getStringSync(resource.i...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getResourceString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resource AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Resource AST#identifier#Right AST#...
getResourceString(resource: Resource): string { if (CheckEmptyUtils.isEmptyObj(resource)) { Logger.error('[DrawModel][getResourceString] resource is empty.') return ''; } let resourceString: string = ''; try { resourceString = getContext(this).resourceManager.getStringSync(resource.i...
https://gitee.com/harmonyos/codelabs.git
53986e96a3286eeef430914dc484021a5763cbd0
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Loaders/MangaDetailLoader.ets
arkts
convertLocalChaptersToMangaChapters
转换本地章节为MangaChapter格式
private async convertLocalChaptersToMangaChapters(chapters: ChapterInfo[]): Promise<MangaChapter[]> { const mangaChapters: MangaChapter[] = []; for (let i = 0; i < chapters.length; i++) { const ch = chapters[i]; const chapter: MangaChapter = { id: ch.id, title: ch.title, ...
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 convertLocalChaptersToMangaChapters AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left chapters AST#iden...
private async convertLocalChaptersToMangaChapters(chapters: ChapterInfo[]): Promise<MangaChapter[]> { const mangaChapters: MangaChapter[] = []; for (let i = 0; i < chapters.length; i++) { const ch = chapters[i]; const chapter: MangaChapter = { id: ch.id, title: ch.title, ...
https://github.com/DaLongZhuaZi/manxia
3f97818cb408176403fa20110825b232a0e2fb67
github
David8Idira/AI-OA
packages/harmonyos/commons/src/main/ets/services/KnowledgeService.ets
arkts
addComment
添加评论 @param documentId 文档ID @param content 评论内容 @param parentCommentId 父评论ID(回复)
async addComment(documentId: string, content: string, parentCommentId?: string): Promise<ApiResponse<any>> { return this.client.post<any>(`/api/v1/knowledge/documents/${documentId}/comments`, { content, parentCommentId }) }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left addComment 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#:#Left ...
async addComment(documentId: string, content: string, parentCommentId?: string): Promise<ApiResponse<any>> { return this.client.post<any>(`/api/v1/knowledge/documents/${documentId}/comments`, { content, parentCommentId }) }
https://github.com/David8Idira/AI-OA
dfbaf7178e164930e1398cf0344fea5b87742972
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/StringBuilder.ets
arkts
newCapacity
adjust capacity so that it is either doubled plus 2 of the current capacity or set to the `size` if the former is not enough
private static newCapacity(capacity : int, size : int) : int { if (capacity < size) { capacity += (capacity + 2); capacity = capacity >= size ? capacity : size; } return capacity; }
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 newCapacity AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left capacity AST#identifier#Right AST#ERROR#Left AST#:#Left...
private static newCapacity(capacity : int, size : int) : int { if (capacity < size) { capacity += (capacity + 2); capacity = capacity >= size ? capacity : size; } return capacity; }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
1ca8e7a507f95f7b4ad1cafc72a659d15be3659a
gitee
openharmony/arkui_ace_engine
advanced_ui_component/subheader/source/subheader.ets
arkts
isResourceType
是否Resource类型 @param resource 资源 @returns true:Resource类型;false:非Resource类型
public static isResourceType(resource: ResourceStr | Resource | undefined): boolean { if (!resource) { return false; } if (typeof resource === 'string' || typeof resource === 'undefined') { return false; } return true; }
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 isResourceType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resource AST#identifier#Right AST#:#Left...
public static isResourceType(resource: ResourceStr | Resource | undefined): boolean { if (!resource) { return false; } if (typeof resource === 'string' || typeof resource === 'undefined') { return false; } return true; }
https://gitee.com/openharmony/arkui_ace_engine.git
a18cc9e5dc047b4832456793a880b5ecff59c14a
gitee
huaweicloud/huaweicloud-iot-device-sdk-arkts
huaweicloud_iot_device_library/src/main/ets/service/AbstractDevice.ets
arkts
getService
查询服务 @param serviceId 服务id @return AbstractService 服务实例
public getService(serviceId: string): AbstractService | undefined { return this.services.get(serviceId); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getService AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left serviceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Ri...
public getService(serviceId: string): AbstractService | undefined { return this.services.get(serviceId); }
https://github.com/huaweicloud/huaweicloud-iot-device-sdk-arkts
bb4e3f06117cfaf09c845d26e1fbf2d1ce28f15c
github
universesons/arcts
entry/src/main/ets/view/BadgePanelComponent.ets
arkts
aboutToAppear
找到打卡次数这个 需要补充一个量,存储每天微笑的次数,初始化为0,除以每天的任务目标就可以判断
aboutToAppear() { Logger.debug('BadgePanel', 'aboutToAppear'); getAchievementLevel(); getSmileLevel(); // this.homeStore.initData(); // 初始化HomeStore数据 // this.getSmileTimes(); // 获取微笑次数 }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left...
aboutToAppear() { Logger.debug('BadgePanel', 'aboutToAppear'); getAchievementLevel(); getSmileLevel(); // this.homeStore.initData(); // 初始化HomeStore数据 // this.getSmileTimes(); // 获取微笑次数 }
https://github.com/universesons/arcts
a1d3346e0c328bdab234dbfd74425330a130b8a6
github
LJ666-ui/harmony-health-care
entry/src/main/ets/components/charts/base/BaseChart.ets
arkts
getData
获取当前数据
public getData(): ChartData<T> { return { ...this.data, data: [...this.data.data] }; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getData 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_sta...
public getData(): ChartData<T> { return { ...this.data, data: [...this.data.data] }; }
https://github.com/LJ666-ui/harmony-health-care
52b52779fb6af650718a720dcfa4aa034e6a6045
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Services/DataService.ets
arkts
setCurrentUserId
设置当前用户ID
public setCurrentUserId(userId: string): void { this.currentUserId = userId; logger.debug(TAG, `设置当前用户: ${userId}`); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setCurrentUserId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le...
public setCurrentUserId(userId: string): void { this.currentUserId = userId; logger.debug(TAG, `设置当前用户: ${userId}`); }
https://github.com/DaLongZhuaZi/manxia
4c4edd06470c5770ae7cac04869b28b9e135dd55
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
of
Returns a new array from a set of elements. @param { FixedArray<number> } items - a set of elements to include in the new array object. @returns { BigUint64Array } - a new BigUint64Array @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static of(...items: FixedArray<number>): BigUint64Array { let res = new BigUint64Array(items.length.toInt()) for (let i: int = 0; i < items.length; i++) { res.setUnsafeClamp(i, (new BigInt(items[i])).getULong()) } return res }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#of#Left of AST#of#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#ERROR...
public static of(...items: FixedArray<number>): BigUint64Array { let res = new BigUint64Array(items.length.toInt()) for (let i: int = 0; i < items.length; i++) { res.setUnsafeClamp(i, (new BigInt(items[i])).getULong()) } return res }
https://gitcode.com/iop123123/arkts-static-skills
ac7d644f1ad67215681e08558154c3fe13edd32e
gitcode
the-wwyang/kids-learning-app
src/main/ets/services/ParentalControlService.ets
arkts
recordLearningStats
记录学习统计
public async recordLearningStats( moduleName: string, minutes: number, questionsAnswered: number, correctCount: number, starsEarned: number ): Promise<void> { if (!this.dataPreferences) return; try { const today = this.getTodayString(); const stats = await this.getLearningSt...
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 recordLearningStats AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left moduleName AST#identifier#Right AST#ERROR#Left AST#...
public async recordLearningStats( moduleName: string, minutes: number, questionsAnswered: number, correctCount: number, starsEarned: number ): Promise<void> { if (!this.dataPreferences) return; try { const today = this.getTodayString(); const stats = await this.getLearningSt...
https://github.com/the-wwyang/kids-learning-app
157e694be964ab704a5ce243f987e4fe95dfa5b4
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/TouchInputHandler.ets
arkts
setDoubleTapTimeThreshold
配置双击时间阈值(从设置读取后调用)
setDoubleTapTimeThreshold(threshold: number): void { this.trackpad.updateConfig(undefined, threshold, undefined); this.mouseDoubleTapTime = threshold; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setDoubleTapTimeThreshold AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left threshold AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)...
setDoubleTapTimeThreshold(threshold: number): void { this.trackpad.updateConfig(undefined, threshold, undefined); this.mouseDoubleTapTime = threshold; }
https://github.com/AlkaidLab/moonlight-harmony
d31ac2a2731bb37691e3cae358ef1781d491967f
github
LJ666-ui/harmony-health-care
entry/src/main/ets/core/SmartWardInitializer.ets
arkts
generateMockData
生成模拟数据
public async generateMockData(): Promise<void> { console.log('SmartWardInitializer: Generating real data from database...'); const mockGenerator = RealDataGenerator.getInstance(); // 使用真实数据生成器 const deviceManager = DeviceManager.getInstance(); // 生成6个病房 const rooms = mockGenerator.generateWardR...
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 generateMockData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST...
public async generateMockData(): Promise<void> { console.log('SmartWardInitializer: Generating real data from database...'); const mockGenerator = RealDataGenerator.getInstance(); // 使用真实数据生成器 const deviceManager = DeviceManager.getInstance(); // 生成6个病房 const rooms = mockGenerator.generateWardR...
https://github.com/LJ666-ui/harmony-health-care
c2092144ba137476a069101f7df6a67acc60bfa3
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/ResponsiveLayout.ets
arkts
getSidebarWidth
获取侧边栏宽度
public static getSidebarWidth(): number { return ResponsiveLayoutHelper.getLayoutParams().sidebarWidth; }
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 getSidebarWidth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST...
public static getSidebarWidth(): number { return ResponsiveLayoutHelper.getLayoutParams().sidebarWidth; }
https://github.com/DaLongZhuaZi/manxia
022f787ce9c71e2d8d509d0e2b66966d1989ad25
github
HarmonyOS_Samples/BestPracticeSnippets
ArkUI/StateManagement/entry/src/main/ets/segment/segment7.ets
arkts
getUserData
[EndExclude Case4] Getting server-side user information in a business class
getUserData(): void { this.userAccountRepository.getUserData().then((data: UserData) => { // 2.Storing user information data into AppStorage AppStorage.setOrCreate('userData', data); }) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getUserData 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#...
getUserData(): void { this.userAccountRepository.getUserData().then((data: UserData) => { // 2.Storing user information data into AppStorage AppStorage.setOrCreate('userData', data); }) }
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
54193638006d2a50641821319b22dbb04c152bc0
gitcode
tdcare/tdwebrtc
src/main/ets/WebRTCManager.ets
arkts
getSignalingConnected
获取信令连接状态
public getSignalingConnected(): boolean { return this.signaling?.getIsConnected() ?? false; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getSignalingConnected 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 boo...
public getSignalingConnected(): boolean { return this.signaling?.getIsConnected() ?? false; }
https://github.com/tdcare/tdwebrtc
edf13c3418581b3f8c24f36f6b69dbb70995b42b
github
aimilin6688/KeePassHO
entry/src/main/ets/common/utils/CommonUtils.ets
arkts
showConfirmDialog
确认弹框 @param context 上下文 @param title 标题 @param message 消息 @param callback 回调
public static showConfirmDialog(context: UIContext, title: ResourceStr, message: ResourceStr, callback?: ConfirmCallback): void { context.showAlertDialog({ title: title, message: message, primaryButton: { value: $r('app.string.cancel_button_text'), action: () => { callb...
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 showConfirmDialog AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Le...
public static showConfirmDialog(context: UIContext, title: ResourceStr, message: ResourceStr, callback?: ConfirmCallback): void { context.showAlertDialog({ title: title, message: message, primaryButton: { value: $r('app.string.cancel_button_text'), action: () => { callb...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/CommonUtils.ets#L231-L248
546b1cceee85c181ba2ec3afc9a3361309569aef
github
chendi126/harmonyOS-TCP
entry/src/main/ets/pages/DeviceMonitor.ets
arkts
formatUptime
格式化运行时间
formatUptime(seconds: number): string { const hours = Math.floor(seconds / 3600); const minutes = Math.floor((seconds % 3600) / 60); const secs = seconds % 60; return `${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left formatUptime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left seconds AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) AST#)#R...
formatUptime(seconds: number): string { const hours = Math.floor(seconds / 3600); const minutes = Math.floor((seconds % 3600) / 60); const secs = seconds % 60; return `${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}:${secs.toString().padStart(2, '0')}`; }
https://github.com/chendi126/harmonyOS-TCP
0cdf0cccb92ce9af1739b04dd1e956aa487e73e4
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/checked/launch_test.ets
arkts
add
konstanting (#I67QXC): currently we have to return an object from any coroutine. This will change once I add autoboxing for the primitive return values
function add(a: int): String { counter += a; return "Some dummy string" }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left add AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left a AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#type_...
function add(a: int): String { counter += a; return "Some dummy string" }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
48606c52afbbdd845fb1d079cc7a8c88e388db45
gitee
Tencent-RTC/TUIKit_Harmony
atomic_x/src/main/ets/basecomponent/utils/ContextProvider.ets
arkts
onConfigurationUpdate
Handle configuration updates @param newConfig New configuration
static onConfigurationUpdate(newConfig: AbilityConfiguration): void { try { // Update the system color mode to AppStorage AppStorage.setOrCreate('currentColorMode', newConfig.colorMode); hilog.info(0x0000, 'ContextProvider', 'Configuration updated - colorMode: %{public}d', newConfig.colorMode); ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left onConfigurationUpdate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left newConfig AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ident...
static onConfigurationUpdate(newConfig: AbilityConfiguration): void { try { // Update the system color mode to AppStorage AppStorage.setOrCreate('currentColorMode', newConfig.colorMode); hilog.info(0x0000, 'ContextProvider', 'Configuration updated - colorMode: %{public}d', newConfig.colorMode); ...
https://github.com/Tencent-RTC/TUIKit_Harmony
d29e577cbb784ba11dd0dc67aa06958172ff423a
github
richshaw2015/nds
ohos/entry/src/main/ets/components/game/FirmwarePauseMenu.ets
arkts
getFirmwareMenuItems
固件模式菜单项 — 对齐 Android FirmwarePauseMenuOption: SETTINGS, RESET, EXIT
function getFirmwareMenuItems(): FirmwareMenuItem[] { return [ { option: PauseMenuOption.RESUME, label: I18n.t('resume_short'), icon: CupertinoIcons.play }, { option: PauseMenuOption.SETTINGS, label: I18n.t('settings'), icon: CupertinoIcons.settings }, { option: PauseMenuOption.RESET, label: I18n.t('reset...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getFirmwareMenuItems AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#array_...
function getFirmwareMenuItems(): FirmwareMenuItem[] { return [ { option: PauseMenuOption.RESUME, label: I18n.t('resume_short'), icon: CupertinoIcons.play }, { option: PauseMenuOption.SETTINGS, label: I18n.t('settings'), icon: CupertinoIcons.settings }, { option: PauseMenuOption.RESET, label: I18n.t('reset...
https://github.com/richshaw2015/nds
d2536579b1af80101993a8830ae5d0a6de9eaa57
github
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/utils/ClipboardManager.ets
arkts
stopLocalClipboardMonitoring
Stop monitoring local clipboard changes
private stopLocalClipboardMonitoring(): void { try { if (this.pasteboardObserver) { const systemPasteboard = pasteboard.getSystemPasteboard(); systemPasteboard.off('update', this.pasteboardObserver.callback); this.pasteboardObserver = null; console.info(`${TAG}: Local clipboa...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left stopLocalClipboardMonitoring 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#L...
private stopLocalClipboardMonitoring(): void { try { if (this.pasteboardObserver) { const systemPasteboard = pasteboard.getSystemPasteboard(); systemPasteboard.off('update', this.pasteboardObserver.callback); this.pasteboardObserver = null; console.info(`${TAG}: Local clipboa...
https://github.com/tangwengang-del/freerdp-harmonyos
61daf304c6ba6dc2c8114c1c5f92c304560192d6
github
DaLongZhuaZi/manxia
tmp/ohpm_research/wolfx_minizip/package/src/main/ets/Zip.ets
arkts
collectAllFiles
收集所有需要压缩的文件(扁平化处理)
private collectAllFiles(dirPath: string, basePath: string): Promise<Array<CompressFileInfo>> { return new Promise((resolve: (value: Array<CompressFileInfo>) => void, reject: (reason: Error) => void) => { try { const result: Array<CompressFileInfo> = []; const collect = (currentDirPath: strin...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left collectAllFiles AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left dirPath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#str...
private collectAllFiles(dirPath: string, basePath: string): Promise<Array<CompressFileInfo>> { return new Promise((resolve: (value: Array<CompressFileInfo>) => void, reject: (reason: Error) => void) => { try { const result: Array<CompressFileInfo> = []; const collect = (currentDirPath: strin...
https://github.com/DaLongZhuaZi/manxia
d132c7d89ff4da66547b9d4c8bb7cc8e2743432c
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/ReminderDAO.ets
arkts
getByUserId
查询用户的所有提醒
static async getByUserId(userId: number): Promise<Reminder[]> { const store = DatabaseManager.getDatabase(); const sql = `SELECT * FROM ${Reminder.tableName} WHERE user_id = ? AND is_deleted = 0 ORDER BY next_reminder_date ASC`; let rs: relationalStore.ResultSet | null = null; const list: Reminder[] =...
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 getByUserId 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 getByUserId(userId: number): Promise<Reminder[]> { const store = DatabaseManager.getDatabase(); const sql = `SELECT * FROM ${Reminder.tableName} WHERE user_id = ? AND is_deleted = 0 ORDER BY next_reminder_date ASC`; let rs: relationalStore.ResultSet | null = null; const list: Reminder[] =...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
57b00eda7b9e609a59178214115a89b79289d3a8
github
offlinecat-dev/OCNetORM
src/main/ets/core/EntityMetadata.ets
arkts
getNonPrimaryKeyColumns
获取所有非主键列 @returns 非主键列数组
getNonPrimaryKeyColumns(): Array<ColumnMetadata> { const result: Array<ColumnMetadata> = [] for (let i = 0; i < this.columns.length; i++) { const col = this.columns[i] if (!col.isPrimaryKey) { result.push(col) } } return result }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getNonPrimaryKeyColumns AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left...
getNonPrimaryKeyColumns(): Array<ColumnMetadata> { const result: Array<ColumnMetadata> = [] for (let i = 0; i < this.columns.length; i++) { const col = this.columns[i] if (!col.isPrimaryKey) { result.push(col) } } return result }
https://github.com/offlinecat-dev/OCNetORM
2ccd83814de17220e3a24f39ed61f6b89956e13d
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
map
Creates a new Uint32Array using fn(arr[i]) over all elements of current Uint32Array @param fn a function to apply for each element of current Uint32Array @returns a new Uint32Array where for each element from current Uint32Array fn was applied
public map(fn: (val: number) => number): Uint32Array { let newF: (val: number, index: int) => number = (val: number, index: int): number => { return fn(val as number) as number } return this.map(newF) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left map AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right...
public map(fn: (val: number) => number): Uint32Array { let newF: (val: number, index: int) => number = (val: number, index: int): number => { return fn(val as number) as number } return this.map(newF) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
339665e407581d5ffd1516dd399e2781b9e44316
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Source/SourceVerifier.ets
arkts
verifySingle
快速校验单个书源 @param sourceUrl 书源 URL @param timeout 超时(ms),默认 10 秒
static async verifySingle(sourceUrl: string, timeout: number = 10000): Promise<boolean> { const task = new taskpool.Task(verifySingleSource, sourceUrl, timeout); try { return (await taskpool.execute(task)) as boolean; } catch { return false; } }
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 verifySingle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceUrl AST#identifier#Right AST#ERROR#Left AST#:#Left :...
static async verifySingle(sourceUrl: string, timeout: number = 10000): Promise<boolean> { const task = new taskpool.Task(verifySingleSource, sourceUrl, timeout); try { return (await taskpool.execute(task)) as boolean; } catch { return false; } }
https://github.com/DaLongZhuaZi/manxia
b8a1609b53a148508277e92f4156f5a0eec437bc
github
richshaw2015/nds
ohos/entry/src/test/SyncToNativeProperty.test.ets
arkts
mockSetSettingsConfig
Mock NAPI setSettingsConfig - records calls and returns configurable result
function mockSetSettingsConfig(key: string, value: SettingsConfigValue): boolean { napiCallLog.push({ key, value }); return mockNapiShouldSucceed; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left mockSetSettingsConfig AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left key AST#identifier#Right AST#type_annotation#Left AST#:#Left : A...
function mockSetSettingsConfig(key: string, value: SettingsConfigValue): boolean { napiCallLog.push({ key, value }); return mockNapiShouldSucceed; }
https://github.com/richshaw2015/nds
68120a1a9260847bdc276b3768575e5b04d06648
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/AppSettingsService.ets
arkts
ensureInitialized
确保已初始化
private static async ensureInitialized(): Promise<void> { if (!AppSettingsService.preferencesInstance) { if (AppSettingsService.initPromise) { await AppSettingsService.initPromise; } else { throw new Error('AppSettingsService not initialized. Call init() first.'); } } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left ensureInitialized AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arg...
private static async ensureInitialized(): Promise<void> { if (!AppSettingsService.preferencesInstance) { if (AppSettingsService.initPromise) { await AppSettingsService.initPromise; } else { throw new Error('AppSettingsService not initialized. Call init() first.'); } } }
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
a3de656dd9b6b0f17834ca2941d9fc7c3897f35e
github
harmonyos/codelabs
HarmonyOS_NEXT/Recorder/entry/src/main/ets/common/utils/Utils.ets
arkts
updateTime
Update time. @param millisecond @returns time
static updateTime(millisecond: number): string { /* if (millisecond < 0) { return '00:00:00' }*/ let hour = Math.floor((millisecond / Const.TIME_60000 / Const.TIME_60)); let minute = Math.floor((millisecond / Const.TIME_60000 - hour * Const.TIME_60)); let second = Math.floor((millisecond...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left updateTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left millisecond AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#...
static updateTime(millisecond: number): string { /* if (millisecond < 0) { return '00:00:00' }*/ let hour = Math.floor((millisecond / Const.TIME_60000 / Const.TIME_60)); let minute = Math.floor((millisecond / Const.TIME_60000 - hour * Const.TIME_60)); let second = Math.floor((millisecond...
https://gitee.com/harmonyos/codelabs.git
aa3ad7b20a950a447547e94b3fd8550c5462ddce
gitee
LJ666-ui/harmony-health-care
entry/src/main/ets/aiagent/MedicalAgent.ets
arkts
process
处理用户问题 @param question 用户问题 @param context 对话上下文 @returns 智能体回答
async process(question: string, context?: ConversationContext): Promise<AgentAnswer> { const startTime = Date.now(); // 1. RAG知识检索 const knowledge = await this.retrieveKnowledge(question); // 2. 构建提示词 const prompt = this.buildPrompt(question, knowledge, context); // 3. 调用LLM生成回答 const r...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left process AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left question AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST...
async process(question: string, context?: ConversationContext): Promise<AgentAnswer> { const startTime = Date.now(); // 1. RAG知识检索 const knowledge = await this.retrieveKnowledge(question); // 2. 构建提示词 const prompt = this.buildPrompt(question, knowledge, context); // 3. 调用LLM生成回答 const r...
https://github.com/LJ666-ui/harmony-health-care
3a923002152218a2bc9a6425eaa9f0515641df45
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/LinkedBlockingQueue.ets
arkts
getEnd
Returns the end element in a LinkedBlockingQueue. @returns { T | undefined } the end element or undefined when the queue is empty.
public getEnd(): T | undefined { ConcurrencyHelpers.mutexLock(this.pushMutex); try { ConcurrencyHelpers.mutexLock(this.popMutex); let element = this.tail.element; ConcurrencyHelpers.mutexUnlock(this.popMutex); return element...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getEnd AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_stat...
public getEnd(): T | undefined { ConcurrencyHelpers.mutexLock(this.pushMutex); try { ConcurrencyHelpers.mutexLock(this.popMutex); let element = this.tail.element; ConcurrencyHelpers.mutexUnlock(this.popMutex); return element...
https://gitcode.com/iop123123/arkts-static-skills
6d823336e4949525df10b04ff86247d3eb463e72
gitcode
wuba/omni-ui
omni_component/src/main/ets/components/popup/Builder.ets
arkts
setDismissOnTouchOutside
允许用户单击遮罩层退出 @param dismiss @returns
setDismissOnTouchOutside(dismiss: boolean): Builder { this.dialogOptions.autoCancel = dismiss return this }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setDismissOnTouchOutside AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dismiss AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right...
setDismissOnTouchOutside(dismiss: boolean): Builder { this.dialogOptions.autoCancel = dismiss return this }
https://github.com/wuba/omni-ui
2fcf0ef37cd984a7754b9df9114dcb2e3bb02c33
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/components/dialogs/GameMenuDialog.ets
arkts
isCurrentDark
当前是否深色主题,直接在布局中使用以确保 ArkTS 响应式更新 COLOR_MODE_LIGHT = 1; 深色时黑透卡片,浅色时白透卡片
isCurrentDark(): boolean { return this.currentColorMode !== 1; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isCurrentDark AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#state...
isCurrentDark(): boolean { return this.currentColorMode !== 1; }
https://github.com/AlkaidLab/moonlight-harmony
360536a040d5f3f68313992426ef07e5058b8f2e
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/model/SmartBudgetPlan.ets
arkts
setCategoryBudgets
设置分类预算分配
setCategoryBudgets(budgets: CategoryBudgetAllocation[]): void { this.categoryBudgetsJson = JSON.stringify(budgets); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setCategoryBudgets AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left budgets AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left Cate...
setCategoryBudgets(budgets: CategoryBudgetAllocation[]): void { this.categoryBudgetsJson = JSON.stringify(budgets); }
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
b617f375770aaa8feedc8ce4a632abf36d461997
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Preload/ChapterPreloadManager.ets
arkts
savePageListToDatabase
保存页面列表到数据库
private async savePageListToDatabase(chapterId: string, pages: PageInfo[]): Promise<void> { try { const dataManager = DataManager.getInstance(); // 检查是否已经保存过 const existingPages = await dataManager.getPageInfoList(chapterId); if (existingPages.length > 0) { logger.debug(TAG,...
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 savePageListToDatabase AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left chapterId AST#identifier#Right AST#ERROR#Left...
private async savePageListToDatabase(chapterId: string, pages: PageInfo[]): Promise<void> { try { const dataManager = DataManager.getInstance(); // 检查是否已经保存过 const existingPages = await dataManager.getPageInfoList(chapterId); if (existingPages.length > 0) { logger.debug(TAG,...
https://github.com/DaLongZhuaZi/manxia
abe9173fc99c0305e0d0466bb84a2dfa28781fc1
github
HarmonyOS_Samples/MusicHome
features/player/src/main/ets/util/PlayerDataUtil.ets
arkts
playNext
Delegates to MediaService.playNextAuto from user control.
public static playNext(): void { MediaService.getInstance().playNextAuto(true); }
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 playNext AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left...
public static playNext(): void { MediaService.getInstance().playNextAuto(true); }
https://gitcode.com/HarmonyOS_Samples/MusicHome
25f1759d017a97eb6db7cdc20618d89ee656feb9
gitcode
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/model/EventSourcing.ets
arkts
createBillCreatedEvent
创建账单创建事件
static createBillCreatedEvent( userId: number, billId: number, billDataJson: string ): DomainEvent { const event = new DomainEvent( '', EVENT_TYPE_BILL_CREATED, AGGREGATE_TYPE_BILL, billId, userId, 1, billDataJson, '', '', '' ); con...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createBillCreatedEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif...
static createBillCreatedEvent( userId: number, billId: number, billDataJson: string ): DomainEvent { const event = new DomainEvent( '', EVENT_TYPE_BILL_CREATED, AGGREGATE_TYPE_BILL, billId, userId, 1, billDataJson, '', '', '' ); con...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
60e661bf3da888b048cf29ec4478b824b244727d
github
dingzhilin1990/zhilinclaw
src/core/ZhiLinClawCore.ets
arkts
initialize
初始化核心系统
public async initialize(config: Partial<CoreConfig>): Promise<void> { if (this.initialized) { this.log('核心系统已初始化'); return; } // 合并配置 this.config = { ...this.config, ...config }; this.log(`初始化 ${this.config.name} v${this.config.version}`); // 初始化各个模块 this.memoryManager =...
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 initialize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#...
public async initialize(config: Partial<CoreConfig>): Promise<void> { if (this.initialized) { this.log('核心系统已初始化'); return; } // 合并配置 this.config = { ...this.config, ...config }; this.log(`初始化 ${this.config.name} v${this.config.version}`); // 初始化各个模块 this.memoryManager =...
https://github.com/dingzhilin1990/zhilinclaw
1953c994fb1a417cb62536e1463a290ae19474fd
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/usbdriver/DualSenseController.ets
arkts
getInitData
获取初始化数据
protected getInitData(): Uint8Array { // DualSense 不需要特殊初始化 return new Uint8Array(0); }
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left getInitData 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 U...
protected getInitData(): Uint8Array { // DualSense 不需要特殊初始化 return new Uint8Array(0); }
https://github.com/AlkaidLab/moonlight-harmony
c39b6627e508884dc3d29c314e9e9dcf71548844
github
Cool_foolisher1/ArkTSRepository
GraphicalCode/features/algorithm/src/main/ets/manager/ComponentDetailManager.ets
arkts
getInstance
获取ComponentDetailManager实例 @returns ComponentDetailManager
public static getInstance(): ComponentDetailManager { if (!ComponentDetailManager.instance) { ComponentDetailManager.instance = new ComponentDetailManager() } return ComponentDetailManager.instance }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L...
public static getInstance(): ComponentDetailManager { if (!ComponentDetailManager.instance) { ComponentDetailManager.instance = new ComponentDetailManager() } return ComponentDetailManager.instance }
https://gitcode.com/Cool_foolisher1/ArkTSRepository
61ae95a7d7bec1fddd1fea90952def585a6e384b
gitcode
Harrisonls2004/WaterFlow
entry/src/main/ets/common/bean/Message.ets
arkts
generateConversationId
Generate conversation ID from two usernames.
static generateConversationId(username1: string, username2: string): string { const sorted = [username1, username2].sort(); return `${sorted[0]}_${sorted[1]}`; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left generateConversationId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left username1 AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string A...
static generateConversationId(username1: string, username2: string): string { const sorted = [username1, username2].sort(); return `${sorted[0]}_${sorted[1]}`; }
https://github.com/Harrisonls2004/WaterFlow
5c1d143468ad21ab8e23aaae34638983494e080b
github
Countly/countly-sdk-hos
library/src/main/ets/internal/modules/ModuleContent.ets
arkts
onConsentChanged
-- Lifecycle hooks --
public override async onConsentChanged(_added: string[], removed: string[], _source: ConsentChangeSource): Promise<void> { if (removed.indexOf(CountlyFeature.CONTENT) !== -1) { this.exitContentZoneInternal(); } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left onConsentChanged AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left...
public override async onConsentChanged(_added: string[], removed: string[], _source: ConsentChangeSource): Promise<void> { if (removed.indexOf(CountlyFeature.CONTENT) !== -1) { this.exitContentZoneInternal(); } }
https://github.com/Countly/countly-sdk-hos
886a82ef1873af5050af9c1eece8905059f91828
github
TDCQCX/ShiHuaMusic-Harmony
entry/src/main/ets/utils/StyleUtil.ets
arkts
getFabStyle
获取悬浮按钮样式
static getFabStyle() { const theme = ThemeUtil.getCurrentThemeConfig(); const spacing = theme.spacing; return { backgroundColor: theme.colors.primary, color: theme.colors.onPrimary, width: '56px', height: '56px', borderRadius: '28px', position: 'absolute' as const,...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getFabStyle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { A...
static getFabStyle() { const theme = ThemeUtil.getCurrentThemeConfig(); const spacing = theme.spacing; return { backgroundColor: theme.colors.primary, color: theme.colors.onPrimary, width: '56px', height: '56px', borderRadius: '28px', position: 'absolute' as const,...
https://github.com/TDCQCX/ShiHuaMusic-Harmony
549288fcdea5b3c9f401eb3e1359f529379cb632
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Source/SuwayomiCacheManager.ets
arkts
getChapterCacheStatus
获取章节缓存状态
public getChapterCacheStatus(mangaTitle: string, chapterTitle: string, totalPages: number): CacheStatus { let cachedPages = 0; for (let i = 0; i < totalPages; i++) { if (this.isPageCached(mangaTitle, chapterTitle, i)) { cachedPages++; } } const status: CacheStatus = { mangaId...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getChapterCacheStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left mangaTitle AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string A...
public getChapterCacheStatus(mangaTitle: string, chapterTitle: string, totalPages: number): CacheStatus { let cachedPages = 0; for (let i = 0; i < totalPages; i++) { if (this.isPageCached(mangaTitle, chapterTitle, i)) { cachedPages++; } } const status: CacheStatus = { mangaId...
https://github.com/DaLongZhuaZi/manxia
029d13616899f664433e5ce32f0c938ac4191381
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/unary_plus/unary_plus_char.ets
arkts
main
--- desc: check unary plus operation for char operand ---
function main(): void { const v: char = {{v.value}} assert +(v) == {{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 v: char = {{v.value}} assert +(v) == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
cbecda78ed9d0a53d8799abb0f6878ded82fe743
gitee
heeh02/superconnect
harmony/entry/src/main/ets/services/ConnectionManager.ets
arkts
setCaptureEnabled
Paused (captureEnabled=false) → reveal the tablet's own cursor so the user can operate HarmonyOS; capturing → hide it again.
setCaptureEnabled(enabled: boolean): void { try { pointer.setPointerVisibleSync(!enabled); } catch (e) { /* best-effort */ } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setCaptureEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right AST#)#...
setCaptureEnabled(enabled: boolean): void { try { pointer.setPointerVisibleSync(!enabled); } catch (e) { /* best-effort */ } }
https://github.com/heeh02/superconnect
6f23f67cd3ac3a315b15f0909b7e2f7c6e006142
github
openharmony-sig/ohos_axios
entry/src/main/ets/pages/Index.ets
arkts
creat
Creat请求
creat() { this.clear() this.showUrl = this.getUrl const instance = axios.create(); this.startTime = new Date().getTime(); instance.get<string, AxiosResponse<string>, null>(this.getUrl, { connectTimeout: this.connectTimeout, readTimeout: this.readTimeout, maxBodyLength: this.maxB...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left creat AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c...
creat() { this.clear() this.showUrl = this.getUrl const instance = axios.create(); this.startTime = new Date().getTime(); instance.get<string, AxiosResponse<string>, null>(this.getUrl, { connectTimeout: this.connectTimeout, readTimeout: this.readTimeout, maxBodyLength: this.maxB...
https://gitee.com/openharmony-sig/ohos_axios.git
6291c2cc554be9782bf57ea9555f1d67ce30f6e4
gitee
LYM15/FireflyCompanion
entry/src/main/ets/components/PopupTimePicker.ets
arkts
DatePickerStyle
============ 公共样式 ============
@Extend(DatePicker) function DatePickerStyle() { .textStyle({ color: $r('app.color.font_primary'), font: { size: $r('app.float.title_text_s'), weight: FontWeight.Normal } }) .selectedTextStyle({ color: $r('app.color.primary_6'), font: { size: $r('app.float.title_text_s'), weight: FontWeight.Bold }...
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#call_expression#Left AST#identifier#Left Extend AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left DatePicker AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expres...
@Extend(DatePicker) function DatePickerStyle() { .textStyle({ color: $r('app.color.font_primary'), font: { size: $r('app.float.title_text_s'), weight: FontWeight.Normal } }) .selectedTextStyle({ color: $r('app.color.primary_6'), font: { size: $r('app.float.title_text_s'), weight: FontWeight.Bold }...
https://github.com/LYM15/FireflyCompanion
b72b948460840fc83629ec3cd641f42f9bb747cf
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/TypeShelfManager.ets
arkts
getItemShelfId
获取内容所属的书架ID
getItemShelfId(itemId: string, contentType: ContentType): string { return this.categoryManager.getItemCategory(itemId, contentType); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getItemShelfId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left itemId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left ...
getItemShelfId(itemId: string, contentType: ContentType): string { return this.categoryManager.getItemCategory(itemId, contentType); }
https://github.com/DaLongZhuaZi/manxia
f25c89d98c85f4ab0df0aabfe6f86b505f8b4881
github
wuba/omni-ui
omni_component/src/main/ets/components/calendar/OmniCalendar.ets
arkts
_updateDateOnPrevClick
更新日期用于上一页点击
_updateDateOnPrevClick(): Date { if (this.displayMode == DisplayMode.month) { return new Date(this.currentDate.getFullYear(), this.currentDate.getMonth() - 1, 1); } else { return new Date(this.currentDate.getTime() - 7 * 24 * 60 * 60 * 1000); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left _updateDateOnPrevClick 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 Date AST#identifier#Right AST#ERROR#Rig...
_updateDateOnPrevClick(): Date { if (this.displayMode == DisplayMode.month) { return new Date(this.currentDate.getFullYear(), this.currentDate.getMonth() - 1, 1); } else { return new Date(this.currentDate.getTime() - 7 * 24 * 60 * 60 * 1000); } }
https://github.com/wuba/omni-ui
ede7fc1441be842d6f9ec45594ab08e37829e121
github
CsCesium/KantaiHomo
entry/src/main/ets/infra/fairy/service/FairyService.ets
arkts
hide
Hide the SubWindow without destroying it.
async hide(): Promise<void> { if (!this.subWin || !this.alive) { return; } try { await this.subWin.minimize(); AppStorage.set<boolean>('fairy.visible', false); } catch (e) { hilog.error(0x1357, TAG, 'hide failed: %{public}s', String(e)); } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left hide 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...
async hide(): Promise<void> { if (!this.subWin || !this.alive) { return; } try { await this.subWin.minimize(); AppStorage.set<boolean>('fairy.visible', false); } catch (e) { hilog.error(0x1357, TAG, 'hide failed: %{public}s', String(e)); } }
https://github.com/CsCesium/KantaiHomo
2c458fd5878550a19ea431d43523285336d322bd
github
TDCQCX/ShiHuaMusic-Harmony
entry/src/main/ets/utils/AudioManager.ets
arkts
removeFromPlaylist
从播放列表移除 @param index 索引
removeFromPlaylist(index: number): void { if (index >= 0 && index < this.playlist.length) { this.playlist.splice(index, 1); // 如果移除的是当前播放歌曲,调整当前索引 if (index <= this.currentIndex) { this.currentIndex = Math.max(0, this.currentIndex - 1); } } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left removeFromPlaylist AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Le...
removeFromPlaylist(index: number): void { if (index >= 0 && index < this.playlist.length) { this.playlist.splice(index, 1); // 如果移除的是当前播放歌曲,调整当前索引 if (index <= this.currentIndex) { this.currentIndex = Math.max(0, this.currentIndex - 1); } } }
https://github.com/TDCQCX/ShiHuaMusic-Harmony
9f6e4a665a87ab234e911b6aea129c0f65c2484b
github
the-wwyang/kids-learning-app
src/main/ets/services/LearningService.ets
arkts
getTotalStats
获取总学习统计
public async getTotalStats(): Promise<TotalStats> { const allProgress = await this.getAllProgress(); let totalStars = 0; let totalCompletedLessons = 0; for (const progress of allProgress) { totalStars += progress.stars; totalCompletedLessons += progress.completedLessons; } retur...
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 getTotalStats AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#...
public async getTotalStats(): Promise<TotalStats> { const allProgress = await this.getAllProgress(); let totalStars = 0; let totalCompletedLessons = 0; for (const progress of allProgress) { totalStars += progress.stars; totalCompletedLessons += progress.completedLessons; } retur...
https://github.com/the-wwyang/kids-learning-app
cf46d1b55ce46b8a605740c2bacf21d2fedec136
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test16_original_index.ets
arkts
fibonacciMemo
--- Memoization with Map cache ---
function fibonacciMemo(n: number, cache: Map<number, number>): number { let cached: number | undefined = cache.get(n); if (cached !== undefined) { return cached; } let result: number; if (n <= 1) { result = n; } else { let a: number = fibonacciMemo(n - 1, cache); let b: number = fibonacciMem...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left fibonacciMemo AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left n AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right...
function fibonacciMemo(n: number, cache: Map<number, number>): number { let cached: number | undefined = cache.get(n); if (cached !== undefined) { return cached; } let result: number; if (n <= 1) { result = n; } else { let a: number = fibonacciMemo(n - 1, cache); let b: number = fibonacciMem...
https://github.com/miaochiahao/ark-ghidra
43b36c532983216de961d349a6a3504987b4af64
github
openharmony-sig/commons-cli
library/src/main/ets/components/cli/HelpFormatter.ets
arkts
setDescPadding
Sets the 'descPadding'. @param padding the new value of 'descPadding'
public setDescPadding(padding: number):void { this.defaultDescPad = padding; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setDescPadding AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left padding AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#...
public setDescPadding(padding: number):void { this.defaultDescPad = padding; }
https://gitee.com/openharmony-sig/commons-cli.git
58213aa9e9832c718d1ffcdada6fcf5099c743dc
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
findIndex
Finds an index of the first element in the Uint8Array that satisfies the condition @param fn condition @returns the index of the first element that satisfies fn
public findIndex(fn: (val: number, index: int, array: Uint8Array) => boolean): int { for (let i = 0; i < this.length; ++i) { let val = this.at(i) if (fn(val, i, this)) { return i } } return -1 }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left findIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#...
public findIndex(fn: (val: number, index: int, array: Uint8Array) => boolean): int { for (let i = 0; i < this.length; ++i) { let val = this.at(i) if (fn(val, i, this)) { return i } } return -1 }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
184280e61372a56e1d77d3c39b36c696e4e5649f
gitee
DaLongZhuaZi/NGF
ngf_framework/src/main/ets/security/facades/KeyStoreManagerFacade.ets
arkts
addSecret
存储极度敏感数据 (如支付密码、长期 Token) 到芯片级安全环境
async addSecret(alias: string, secretString: string): Promise<boolean> { try { const secretBuffer = new Uint8Array(secretString.split('').map(c => c.charCodeAt(0))); const attr: asset.AssetMap = new Map(); attr.set(asset.Tag.ALIAS, new Uint8Array(alias.split('').map(c => c.charCodeAt(0)))); ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left addSecret AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left alias AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#...
async addSecret(alias: string, secretString: string): Promise<boolean> { try { const secretBuffer = new Uint8Array(secretString.split('').map(c => c.charCodeAt(0))); const attr: asset.AssetMap = new Map(); attr.set(asset.Tag.ALIAS, new Uint8Array(alias.split('').map(c => c.charCodeAt(0)))); ...
https://github.com/DaLongZhuaZi/NGF
2a5d603901e7310f3ba617503895d283226e749e
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebDAV/WebDAVClient.ets
arkts
getFullUrl
获取完整URL
private getFullUrl(relativePath: string): string { const baseUrl = this.config.serverUrl.replace(/\/$/, ''); const basePath = this.config.basePath.replace(/^\//, '').replace(/\/$/, ''); const relPath = relativePath.replace(/^\//, ''); if (basePath && relPath) { return `${baseUrl}/${basePath...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getFullUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left relativePath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#str...
private getFullUrl(relativePath: string): string { const baseUrl = this.config.serverUrl.replace(/\/$/, ''); const basePath = this.config.basePath.replace(/^\//, '').replace(/\/$/, ''); const relPath = relativePath.replace(/^\//, ''); if (basePath && relPath) { return `${baseUrl}/${basePath...
https://github.com/DaLongZhuaZi/manxia
e5eeea69856d92c1c4f4f9a8514423ececfc566d
github
encorexin/WordPressCMS
harmonyos/entry/src/main/ets/components/article/ArticleListItemCard.ets
arkts
aboutToReuse
@Reusable 组件复用时重置内部状态 当前组件无 @State 内部状态,保留生命周期以便后续扩展
aboutToReuse(): void { // No internal state to reset. }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToReuse AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Le...
aboutToReuse(): void { // No internal state to reset. }
https://github.com/encorexin/WordPressCMS
94964bbc2c9160a8e75cfe2b4be2d11312c28af3
github
webabcd/HarmonyDemo
entry/src/main/ets/pages/component/list/ListDemo2.ets
arkts
myHeader
分组列表的每个组的 header
@Builder function myHeader(text: string) { Text(text) .fontSize(24) .backgroundColor(Color.Orange) .fontColor(Color.White) .width("100%") .padding(10) }
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Builder AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left myHeader AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required...
@Builder function myHeader(text: string) { Text(text) .fontSize(24) .backgroundColor(Color.Orange) .fontColor(Color.White) .width("100%") .padding(10) }
https://github.com/webabcd/HarmonyDemo
cac647d1ce7df9e58debe0960242483d9262f78a
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Tracking/trackers/AniListTracker.ets
arkts
handleAuthCallback
处理OAuth回调
public async handleAuthCallback(code: string): Promise<boolean> { try { this.log(`处理OAuth回调: code=${code.substring(0, 10)}...`); // 使用授权码换取访问令牌 const tokenResponse = await this.exchangeCodeForToken(code); if (!tokenResponse) { this.logError('获取访问令牌失败'); return false;...
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 handleAuthCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left code AST#identifier#Right AST#:#Left ...
public async handleAuthCallback(code: string): Promise<boolean> { try { this.log(`处理OAuth回调: code=${code.substring(0, 10)}...`); // 使用授权码换取访问令牌 const tokenResponse = await this.exchangeCodeForToken(code); if (!tokenResponse) { this.logError('获取访问令牌失败'); return false;...
https://github.com/DaLongZhuaZi/manxia
0314fe26876c3766a5e8f5c8a1babc80d3ac4d47
github
cpdd5201314/harmonyOS-music-app
products/phone/src/main/ets/pages/PlaylistManager.ets
arkts
setPlaylist
设置播放列表
setPlaylist(list: MusicInfo[], index: number = 0): void { this.playlist = list; this.currentIndex = index; AppStorage.setOrCreate('musicList',list) AppStorage.setOrCreate('currentIndex',index) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setPlaylist AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left list AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left MusicInfo AST#...
setPlaylist(list: MusicInfo[], index: number = 0): void { this.playlist = list; this.currentIndex = index; AppStorage.setOrCreate('musicList',list) AppStorage.setOrCreate('currentIndex',index) }
https://github.com/cpdd5201314/harmonyOS-music-app
21f99d73a5ed4862c9a2635c346caf541ae5a7a8
github
LJ666-ui/harmony-health-care
entry/src/main/ets/ancientimage/ImageRestorationEngine.ets
arkts
executeOCR
执行OCR识别
private async executeOCR( imageData: AncientImageData, params?: ProcessingParams ): Promise<OCRProcessResult> { const startTime = Date.now(); const ocrResult = await this.ocrService.recognize(imageData, params?.ocr); const duration = Date.now() - startTime; const result: OCRProcessResult ...
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 executeOCR AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left imageData AST#identifier#Right AST#:#Left ...
private async executeOCR( imageData: AncientImageData, params?: ProcessingParams ): Promise<OCRProcessResult> { const startTime = Date.now(); const ocrResult = await this.ocrService.recognize(imageData, params?.ocr); const duration = Date.now() - startTime; const result: OCRProcessResult ...
https://github.com/LJ666-ui/harmony-health-care
9dbe76c56c1c32f0eac4c883d0e0543c439f4aa4
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test3_original_index.ets
arkts
testRestSum
=== Rest Parameters ===
function testRestSum(...values: number[]): number { let total: number = 0; for (const v of values) { total += v; } return total; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testRestSum AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#rest_pattern#Left AST#...#Left ... AST#...#Right AST#identifier#Left values AST#identifier...
function testRestSum(...values: number[]): number { let total: number = 0; for (const v of values) { total += v; } return total; }
https://github.com/miaochiahao/ark-ghidra
f55c88a535e5966178551b7b84ffc49c646a3393
github
OMGCA/sakipay
sakipay_hmos/main/src/main/ets/services/HolidayCalendarService.ets
arkts
currentCalendar
Returns the holiday calendar for the current calendar year, or null.
public currentCalendar(): HolidayCalendarData | null { const year: number = new Date().getFullYear() return this.calendarForYear(year) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left currentCalendar AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left...
public currentCalendar(): HolidayCalendarData | null { const year: number = new Date().getFullYear() return this.calendarForYear(year) }
https://github.com/OMGCA/sakipay
1702d235e3d8c4f4683f91182b609824a6bbd3fd
github
ibestservices/ibest-ui
library/src/main/ets/components/price/index.ets
arkts
formatDecimal
格式化小数部分
formatDecimal() { let value = this.value if(isNaN(Number(value)) || Number(value) == 0) { value = 0 } if(this.isHasPoint()) { value = Number(value).toFixed(this.decimal) value = value.split('.')[1] }else { value = 0 } ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left formatDecimal 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...
formatDecimal() { let value = this.value if(isNaN(Number(value)) || Number(value) == 0) { value = 0 } if(this.isHasPoint()) { value = Number(value).toFixed(this.decimal) value = value.split('.')[1] }else { value = 0 } ...
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/price/index.ets#L83-L96
63ecb0ec5451b4eb5118b5e03686782b0c40adc1
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelSourceManager.ets
arkts
setSourceEnabled
启用/禁用书源(同时更新数据库)
async setSourceEnabled(sourceId: string, enabled: boolean): Promise<boolean> { const source = this.sources.get(sourceId); if (source) { source.enabled = enabled; // 更新数据库 try { const dataManager = getNovelDataManager(); await dataManager.saveSource(source); } cat...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left setSourceEnabled 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 setSourceEnabled(sourceId: string, enabled: boolean): Promise<boolean> { const source = this.sources.get(sourceId); if (source) { source.enabled = enabled; // 更新数据库 try { const dataManager = getNovelDataManager(); await dataManager.saveSource(source); } cat...
https://github.com/DaLongZhuaZi/manxia
8279f612fd536dc2ff000993284486c7e8183010
github