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
CPF-ApplicationTPC/openharmony_tpc_samples
OhosVideoCache/library/src/main/ets/ProxyCache.ets
arkts
waitForSourceData
最多等待1秒,但数据到达时立即唤醒
private async waitForSourceData(): Promise<void> { return new Promise<void>((resolve) => { this.waitForDataResolve = resolve; this.isWaitingForData = true; // 设置1秒超时(最大等待时间) this.timeoutId = setTimeout(() => { if (this.isWaitingForData) { this.isWaitingForData = false; ...
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 waitForSourceData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right...
private async waitForSourceData(): Promise<void> { return new Promise<void>((resolve) => { this.waitForDataResolve = resolve; this.isWaitingForData = true; // 设置1秒超时(最大等待时间) this.timeoutId = setTimeout(() => { if (this.isWaitingForData) { this.isWaitingForData = false; ...
https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples
b07c64b4ada6863ac91cdd0ea221243f1bf4604c
gitcode
apap6628114/nga_oh
entry/src/main/ets/store/SettingsStore.ets
arkts
setThreadNavMode
--- Reading ---
setThreadNavMode(v: string): void { this.readingSettings.setThreadNavMode(v) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setThreadNavMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left v AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) A...
setThreadNavMode(v: string): void { this.readingSettings.setThreadNavMode(v) }
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/store/SettingsStore.ets#L151-L151
841afa804e533b18dd0e649bfa5c1894b5d4ff52
github
Kira-Yagami-Light/Kira-Projects
TodoTask/entry/src/main/ets/data/repository/PreferenceRepository.ets
arkts
getLanguage
获取语言设置 @returns Promise<string> 语言代码(如 'zh_CN', 'en_US')
async getLanguage(): Promise<string> { try { const value = await this.dao.get(AppConstants.PREF_KEY_LANGUAGE, 'zh_CN'); return value.toString(); } catch (err) { Logger.error(this.LOG_TAG, `Failed to get language: ${JSON.stringify(err)}`); return 'zh_CN'; } }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getLanguage AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_...
async getLanguage(): Promise<string> { try { const value = await this.dao.get(AppConstants.PREF_KEY_LANGUAGE, 'zh_CN'); return value.toString(); } catch (err) { Logger.error(this.LOG_TAG, `Failed to get language: ${JSON.stringify(err)}`); return 'zh_CN'; } }
https://github.com/Kira-Yagami-Light/Kira-Projects
3027a324149670cec93fd7de42e891730df9d1e0
github
cpdd5201314/harmonyOS-music-app
products/phone/src/main/ets/pages/PlaylistManager.ets
arkts
getPlaylist
获取播放列表
getPlaylist(): MusicInfo[] { return this.playlist; }
AST#program#Left AST#expression_statement#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getPlaylist AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifie...
getPlaylist(): MusicInfo[] { return this.playlist; }
https://github.com/cpdd5201314/harmonyOS-music-app
fc07c8d3c66b2ea3f8a3bf266f8a15f85d5b2fe6
github
offlinecat-dev/OCNetORM
src/main/ets/logging/Logger.ets
arkts
logParallelRelation
记录并行关联加载日志 仅在 DEBUG 级别记录,包含关联数量和总耗时 @param relationNames 加载的关联名称数组 @param duration 总耗时(毫秒) @param successCount 成功加载的关联数量
logParallelRelation(relationNames: Array<string>, duration: number, successCount: number): void { // 并行关联日志仅在 DEBUG 级别记录 if (!this.shouldLog(LogLevel.DEBUG)) { return } const totalCount = relationNames.length const relationsStr = relationNames.join(', ') const content = `关联: [${relations...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left logParallelRelation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left relationNames AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Array AST...
logParallelRelation(relationNames: Array<string>, duration: number, successCount: number): void { // 并行关联日志仅在 DEBUG 级别记录 if (!this.shouldLog(LogLevel.DEBUG)) { return } const totalCount = relationNames.length const relationsStr = relationNames.join(', ') const content = `关联: [${relations...
https://github.com/offlinecat-dev/OCNetORM
4fa3c38c9a0cf55f06463dce726121016faf152a
github
Joker-x-dev/CoolMallArkTS
feature/order/src/main/ets/viewmodel/OrderConfirmViewModel.ets
arkts
onSubmitOrderClick
提交订单点击事件 @returns {void} 无返回值
onSubmitOrderClick(): void { const addressId: number | undefined = this.data?.defaultAddress?.id; if (!addressId) { ToastUtils.showError($r("app.string.select_address")); return; } const title: string = this.getPurchaseTitle(); const params: CreateOrderRequest = new CreateOrderRequest...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onSubmitOrderClick 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...
onSubmitOrderClick(): void { const addressId: number | undefined = this.data?.defaultAddress?.id; if (!addressId) { ToastUtils.showError($r("app.string.select_address")); return; } const title: string = this.getPurchaseTitle(); const params: CreateOrderRequest = new CreateOrderRequest...
https://github.com/Joker-x-dev/CoolMallArkTS
2b42b54a9238c365e884a5dbd399f3b763c007ba
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Download/UnifiedDownloadManager.ets
arkts
getDownloadStats
==================== 统计方法 ==================== 获取下载统计信息
public getDownloadStats(): DownloadStatsResult { const result: DownloadStatsResult = { total: this.unifiedTasks.size, pending: this.getIndexedTaskCount(this.taskIdsByStatus, UnifiedTaskStatus.PENDING), downloading: this.getIndexedTaskCount(this.taskIdsByStatus, UnifiedTaskStatus.DOWNLOADING), ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getDownloadStats 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 Downl...
public getDownloadStats(): DownloadStatsResult { const result: DownloadStatsResult = { total: this.unifiedTasks.size, pending: this.getIndexedTaskCount(this.taskIdsByStatus, UnifiedTaskStatus.PENDING), downloading: this.getIndexedTaskCount(this.taskIdsByStatus, UnifiedTaskStatus.DOWNLOADING), ...
https://github.com/DaLongZhuaZi/manxia
555c9130a77968b4c6dcec4d030daf0375db5529
github
AGenUI/AGenUI
platforms/harmony/agenui/src/main/ets/agenui/hybrid/HybridWebView.ets
arkts
onDestroy
Releases resources.
onDestroy(): void { this.webSource = ''; hilog.debug(0, TAG, 'onDestroy: nodeId=%{public}s', this.getNodeId()); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onDestroy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Le...
onDestroy(): void { this.webSource = ''; hilog.debug(0, TAG, 'onDestroy: nodeId=%{public}s', this.getNodeId()); }
https://github.com/AGenUI/AGenUI
e15e5699136c22271c27dbe2c756b687e6c91435
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
entries
Returns an array of key, value pairs for every entry in the Uint8Array @returns { IterableIterator<[int, Number]> } - key, value pairs for every entry in the array @syscap SystemCapability.Utils.Lang @FaAndStageModel
public entries(): IterableIterator<[int, Number]> { return new Uint8ArrayIteratorEntries(this) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left entries 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 entries(): IterableIterator<[int, Number]> { return new Uint8ArrayIteratorEntries(this) }
https://gitcode.com/iop123123/arkts-static-skills
5e74e32ee2bc7abfadaea84e55e860bb8b70080b
gitcode
zhangmeng1847/Preference
entry/src/main/ets/utils/MyPreferenceUtil.ets
arkts
loadPreference
加载Preferences实例对象
async loadPreference(context, name: string){ try { // 加载preferences let preference = await preferences.getPreferences(context, name) this.preferenceMap.set(name, preference) console.log('preferencesUtilTag', `加载Preferences[${name}]成功`) } catch (e) { console.log('preferencesUtilTa...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left loadPreference AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#Right AST#required_parameter#Right AST#,#...
async loadPreference(context, name: string){ try { // 加载preferences let preference = await preferences.getPreferences(context, name) this.preferenceMap.set(name, preference) console.log('preferencesUtilTag', `加载Preferences[${name}]成功`) } catch (e) { console.log('preferencesUtilTa...
https://github.com/zhangmeng1847/Preference
1467e54031f7d60eb3b881fc7feba0342cd9b07f
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
constructor
Creates an BigUint64Array from FixedArray<number> @param { FixedArray<number> } numbers - data initializer @syscap SystemCapability.Utils.Lang @FaAndStageModel
public constructor(numbers: FixedArray<number>) { this(numbers.length) for (let i: int = 0; i < this.lengthInt; ++i) { this.setUnsafe(i, new BigInt(numbers[i]).getULong()) } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left numbers AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_exp...
public constructor(numbers: FixedArray<number>) { this(numbers.length) for (let i: int = 0; i < this.lengthInt; ++i) { this.setUnsafe(i, new BigInt(numbers[i]).getULong()) } }
https://gitcode.com/iop123123/arkts-static-skills
4551f26a2019feeeb52e75e94834287d5a929e6f
gitcode
openharmony/applications_app_samples
code/BasicFeature/Media/Image/photomodify/src/main/ets/components/util/FileUtil.ets
arkts
packToFilePixelMap
PixelMap转为file @param context @param filePath 调用uri创建ImageSource方法, 需接收filePath参数
packToFilePixelMap(context: Context, filePath: string) { try { const packFilePath: string = context.filesDir + '/' + this.getTimeStr() + '_1.png'; const packFile = fs.openSync(packFilePath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); const result: number = ndkTest.packPixelMapToFile(filePath, ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left packToFilePixelMap AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Context AST#identif...
packToFilePixelMap(context: Context, filePath: string) { try { const packFilePath: string = context.filesDir + '/' + this.getTimeStr() + '_1.png'; const packFile = fs.openSync(packFilePath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); const result: number = ndkTest.packPixelMapToFile(filePath, ...
https://github.com/openharmony/applications_app_samples
8f8f41dfd6a1758378dbac8eef186081e5680145
github
openharmony-sig/ohos_highlightguide
library/src/main/ets/highlightguide/core/HighLightGuideBuilder.ets
arkts
alwaysShow
是否总是显示引导页,即是否无限次的显示 默认为false,如果设置为true,{@Link HighLightGuideBuilder#setShowCounts}将失效 @param isAlways 永久显示 @returns 引导页组件的配置项
public alwaysShow(isAlways: boolean): HighLightGuideBuilder { this.alwaysShowGuide = isAlways; return this; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left alwaysShow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isAlways AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#...
public alwaysShow(isAlways: boolean): HighLightGuideBuilder { this.alwaysShowGuide = isAlways; return this; }
https://gitee.com/openharmony-sig/ohos_highlightguide.git
ff35f0896e213fb8635898eb2ff197e96c71c2a0
gitee
openharmony/codelabs
ETSUI/LifeTrack/entry/src/main/ets/services/ReminderService.ets
arkts
getReminderIndexByMinutes
根据分钟数获取索引
getReminderIndexByMinutes(minutes: number): number { const options = this.getReminderOptions(); const index = options.findIndex(option => option.minutes === minutes); return index >= 0 ? index : 0; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getReminderIndexByMinutes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left minutes AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#L...
getReminderIndexByMinutes(minutes: number): number { const options = this.getReminderOptions(); const index = options.findIndex(option => option.minutes === minutes); return index >= 0 ? index : 0; }
https://gitcode.com/openharmony/codelabs
4d834695be426cdbfddc36504f0966a6c1570824
gitcode
LongLiveY96/chatcube
entry/src/main/ets/viewmodels/ChatViewModel.ets
arkts
hasActiveRequest
检查是否有活跃的请求
hasActiveRequest(): boolean { return this.activeRequests.size > 0 }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasActiveRequest 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#st...
hasActiveRequest(): boolean { return this.activeRequests.size > 0 }
https://github.com/LongLiveY96/chatcube
c1ba52937cee5acb5da08bfe3e4d12e31ff5ef8d
github
LJ666-ui/harmony-health-care
5-skill离线包/星云智联–分布式AI全周期智慧健康管理平台_skills/skills/MedicalRiskAssessSkill.ets
arkts
formatReport
格式化输出评估报告
static formatReport(result: RiskAssessmentResult): string { const dateStr = result.reportGeneratedAt.toLocaleString('zh-CN'); const nextDateStr = result.nextAssessmentDate.toLocaleDateString('zh-CN'); let output = `📋 **健康风险评估报告**\n`; output += `📅 评估时间: ${dateStr}\n`; output += `🔄 下次评估: ${n...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left formatReport AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left result AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left R...
static formatReport(result: RiskAssessmentResult): string { const dateStr = result.reportGeneratedAt.toLocaleString('zh-CN'); const nextDateStr = result.nextAssessmentDate.toLocaleDateString('zh-CN'); let output = `📋 **健康风险评估报告**\n`; output += `📅 评估时间: ${dateStr}\n`; output += `🔄 下次评估: ${n...
https://github.com/LJ666-ui/harmony-health-care
4234869cb2f7c26b952e8c35c5f7186bbb5c62e8
github
openharmony/applications_photos
feature/timeline/src/main/ets/view/TimelinePage.ets
arkts
onIndexPageShow
The callbacks after index page shows
onIndexPageShow() { Log.info(TAG, `[onIndexPageShow] isShow=${this.isShow}, isInCurrentTab=${this.isInCurrentTab}`); if (this.isShow && this.isInCurrentTab) { let params: Params = router.getParams() as Params; if (this.routerStart && params != null && params.pageType != null) { Log.info(TA...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onIndexPageShow 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...
onIndexPageShow() { Log.info(TAG, `[onIndexPageShow] isShow=${this.isShow}, isInCurrentTab=${this.isInCurrentTab}`); if (this.isShow && this.isInCurrentTab) { let params: Params = router.getParams() as Params; if (this.routerStart && params != null && params.pageType != null) { Log.info(TA...
https://gitee.com/openharmony/applications_photos.git
9a2e92f6412596fdb9e6af92e95f77120a7657ae
gitee
openharmony/applications_filepicker
audiopicker/src/main/ets/pages/viewmodel/AudioPickerViewModel.ets
arkts
getState
获取当前页面的可见性 @returns
public getState(): ViewState { return this.audioPickerViewData.getState() }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getState 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 ViewState AST...
public getState(): ViewState { return this.audioPickerViewData.getState() }
https://gitee.com/openharmony/applications_filepicker.git
0cf8e1aa63aaaa484c9b9ff873b771576e1e7042
gitee
openharmony/applications_mms
entry/src/main/ets/workers/WorkFactory.ets
arkts
getWorker
Get the Worker Wrapper obj @param type WorkerType @return WorkerWrapper for the WorkerType
static getWorker(type: WorkerType): WorkerWrapper { HiLog.i(TAG, `getWorker in ${WorkerType[type]}.`) let worker: WorkerWrapper = null; if (type == WorkerType.DataWorker) { HiLog.w(TAG, 'getWorker ' + type) worker = DataWorkerWrapper.getInstance(); } HiLog.w(TAG, 'getWorker end') r...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getWorker AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Worker...
static getWorker(type: WorkerType): WorkerWrapper { HiLog.i(TAG, `getWorker in ${WorkerType[type]}.`) let worker: WorkerWrapper = null; if (type == WorkerType.DataWorker) { HiLog.w(TAG, 'getWorker ' + type) worker = DataWorkerWrapper.getInstance(); } HiLog.w(TAG, 'getWorker end') r...
https://gitee.com/openharmony/applications_mms.git
a7da5c1b5f664575c95d33af7cf3ec7a551f5a96
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Diagnostics/StartupRecovery.ets
arkts
getGlobalContextRecoveryOptions
获取GlobalContext恢复选项
private getGlobalContextRecoveryOptions(attempts: number): RecoveryOption[] { const options: RecoveryOption[] = []; if (attempts < this.maxRetryAttempts) { const retryOption: RecoveryOption = { strategy: RecoveryStrategy.RETRY, description: '重试GlobalContext初始化', priority: 90...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getGlobalContextRecoveryOptions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left attempts AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Le...
private getGlobalContextRecoveryOptions(attempts: number): RecoveryOption[] { const options: RecoveryOption[] = []; if (attempts < this.maxRetryAttempts) { const retryOption: RecoveryOption = { strategy: RecoveryStrategy.RETRY, description: '重试GlobalContext初始化', priority: 90...
https://github.com/DaLongZhuaZi/manxia
912e4aa58f698a5ca78f15f192b172b0555dc9fb
github
openharmony/codelabs
ETSUI/LifeTrack/entry/src/main/ets/services/RepeatService.ets
arkts
getRepeatRuleByIndex
根据索引获取规则字符串
getRepeatRuleByIndex(index: number): string { if (index < 0 || index >= this.repeatOptions.length) { return ''; } const option = this.repeatOptions[index]; if (option.type === 'none') { return ''; } const rule: RepeatRule = { type: option.type, interval: 1, endT...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getRepeatRuleByIndex 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#)#...
getRepeatRuleByIndex(index: number): string { if (index < 0 || index >= this.repeatOptions.length) { return ''; } const option = this.repeatOptions[index]; if (option.type === 'none') { return ''; } const rule: RepeatRule = { type: option.type, interval: 1, endT...
https://gitcode.com/openharmony/codelabs
1cc71378a45a22909a0fc48ad2173501b1928be1
gitcode
aimilin6688/KeePassHO
entry/src/main/ets/services/template/TemplateService.ets
arkts
getPresetTemplatesByCategory
根据分类获取预置模板
getPresetTemplatesByCategory(category: TemplateCategory): IPresetTemplate[] { return TemplateConstants.getTemplatesByCategory(category); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getPresetTemplatesByCategory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left category AST#identifier#Right AST#:#Left : AST#...
getPresetTemplatesByCategory(category: TemplateCategory): IPresetTemplate[] { return TemplateConstants.getTemplatesByCategory(category); }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/template/TemplateService.ets#L93-L95
d194671c8cec4ffe8b043a9a49141479ad0bf598
github
openharmony/applications_contacts
entry/src/main/ets/presenter/favorite/EditFavoriteListPresenter.ets
arkts
cancelSingleFavoriteSelectInfo
Deselect Single Data @param isEditSelectList @param favoriteId
cancelSingleFavoriteSelectInfo(isEditSelectList: string[], favoriteBean: FavoriteBean): string[] { HiLog.i(TAG, 'cancelSingleFavoriteSelectInfo start.'); let index = isEditSelectList.indexOf(favoriteBean.contactId); if (index >= 0) { isEditSelectList.splice(index, 1); if (1 === favoriteBean.is...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left cancelSingleFavoriteSelectInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isEditSelectList AST#identifier#Right AST#ERROR#Left AST#:#L...
cancelSingleFavoriteSelectInfo(isEditSelectList: string[], favoriteBean: FavoriteBean): string[] { HiLog.i(TAG, 'cancelSingleFavoriteSelectInfo start.'); let index = isEditSelectList.indexOf(favoriteBean.contactId); if (index >= 0) { isEditSelectList.splice(index, 1); if (1 === favoriteBean.is...
https://gitee.com/openharmony/applications_contacts.git
bf7d241f510797f8933e340b9eb4f3471b20d987
gitee
HarmonyOS_Samples/MusicHome
features/player/src/main/ets/model/MediaService.ets
arkts
loadAsset
Load media asset for the given queue index (prepare or switch track). @param musicIndex Index in the play queue. @param loadOnly When true, only load without starting playback.
public async loadAsset(musicIndex: number, loadOnly?: boolean): Promise<void> { const len = this.getQueueLength(); if (len === 0) { Logger.error(TAG, 'play queue is empty when loadAsset'); return; } if (musicIndex < 0 || musicIndex >= len) { Logger.error(TAG, `current musicIndex ${mu...
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 loadAsset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left musicIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : A...
public async loadAsset(musicIndex: number, loadOnly?: boolean): Promise<void> { const len = this.getQueueLength(); if (len === 0) { Logger.error(TAG, 'play queue is empty when loadAsset'); return; } if (musicIndex < 0 || musicIndex >= len) { Logger.error(TAG, `current musicIndex ${mu...
https://gitcode.com/HarmonyOS_Samples/MusicHome
009d56754fc868c4a4838ae8a21a8cf655c234cf
gitcode
HarmonyOS_Samples/MusicHome
features/playlist/src/main/ets/viewmodel/MusicListPlaybackViewModel.ets
arkts
requestPlayFromPlaylistIndex
Applies a standard play intent for the given list index without the same-song shortcut. @param index Zero-based playlist index.
public requestPlayFromPlaylistIndex(index: number): void { PlaylistDataUtil.applyPlaybackIntentForPlaylistIndex(index, this.playlistSongUis, this.playbackIntent); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left requestPlayFromPlaylistIndex 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#id...
public requestPlayFromPlaylistIndex(index: number): void { PlaylistDataUtil.applyPlaybackIntentForPlaylistIndex(index, this.playlistSongUis, this.playbackIntent); }
https://gitcode.com/HarmonyOS_Samples/MusicHome
fe731ed0f763aeb94977d5107abc86939c4c6540
gitcode
qiuhaotc/HarmonyOSPlayground
entry/src/main/ets/utils/BillStatisticsUtil.ets
arkts
getDailyStatistics
获取每日统计数据(用于趋势图)
static getDailyStatistics(bills: BillModel[]): Map<string, DailyStats> { const dailyStats = new Map<string, DailyStats>(); bills.forEach((bill: BillModel) => { if (!dailyStats.has(bill.date)) { const newStats: DailyStats = { income: 0, expense: 0 }; daily...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getDailyStatistics AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bills AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_ex...
static getDailyStatistics(bills: BillModel[]): Map<string, DailyStats> { const dailyStats = new Map<string, DailyStats>(); bills.forEach((bill: BillModel) => { if (!dailyStats.has(bill.date)) { const newStats: DailyStats = { income: 0, expense: 0 }; daily...
https://github.com/qiuhaotc/HarmonyOSPlayground
5be7ce37338ff54ca5a1951369d559d9500b4627
github
openharmony/arkui_ace_engine
examples/ComponentSnapshot/entry/src/main/ets/view/GlobalScreenshot.ets
arkts
getAwardSnapshot
一个可以获取固定对象截图的静态方法
static async getAwardSnapshot(uiContext: UIContext, textParam: Params): Promise<image.PixelMap | undefined> { let resultPixmap: image.PixelMap | undefined = undefined let contentNode = new ComponentContent(uiContext, wrapBuilder(awardBuilder), textParam); await uiContext.getComponentSnapshot() .crea...
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 getAwardSnapshot AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uiContext AST#identifier#Right AST#:#Le...
static async getAwardSnapshot(uiContext: UIContext, textParam: Params): Promise<image.PixelMap | undefined> { let resultPixmap: image.PixelMap | undefined = undefined let contentNode = new ComponentContent(uiContext, wrapBuilder(awardBuilder), textParam); await uiContext.getComponentSnapshot() .crea...
https://gitcode.com/openharmony/arkui_ace_engine
e739f9fb1736d7eb3a40872bc01d5fd5e00d4187
gitcode
openharmony/codelabs
ETSUI/MemoTime/entry/src/main/ets/pages/ScheduleEditPage.ets
arkts
openStartDatePicker
打开开始日期选择器
openStartDatePicker(): void { const date = new Date(this.scheduleStartTime) this.tempYear = date.getFullYear() this.tempMonth = date.getMonth() + 1 this.tempDay = date.getDate() this.showStartDatePicker = true }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left openStartDatePicker 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#statemen...
openStartDatePicker(): void { const date = new Date(this.scheduleStartTime) this.tempYear = date.getFullYear() this.tempMonth = date.getMonth() + 1 this.tempDay = date.getDate() this.showStartDatePicker = true }
https://gitcode.com/openharmony/codelabs
f3c2c8c97c0b2e9d4b8373b769299bb00e565f38
gitcode
LZZLHY/hlib
entry/src/main/ets/utils/AppRouter.ets
arkts
replace
替换栈顶。
static replace(name: string, param?: object): void { const s: NavPathStack | null = AppRouter.stack; if (s === null) { Logger.w(TAG, `replace(${name}) ignored: not bound`); return; } try { s.replacePathByName(name, param !== undefined ? param : EMPTY_NAV_PARAM); } catch (e) { ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left replace 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 A...
static replace(name: string, param?: object): void { const s: NavPathStack | null = AppRouter.stack; if (s === null) { Logger.w(TAG, `replace(${name}) ignored: not bound`); return; } try { s.replacePathByName(name, param !== undefined ? param : EMPTY_NAV_PARAM); } catch (e) { ...
https://github.com/LZZLHY/hlib
f59496157eb12d8aca4194a953602e214610f650
github
Cool_foolisher1/ArkTSRepository
GuardianAssistant/entry/src/main/ets/pages/Hardware/HardwareIndexPage.ets
arkts
calculateSubnetMask
计算子网掩码 @param prefixLength 前缀长度 @returns 子网掩码字符串
function calculateSubnetMask(prefixLength: number): string { // 计算每个字节的子网掩码部分 let subnetMask = '' for (let i = 0; i < 4; i++) { // 每个字节中的有效位数 const bits = Math.min(prefixLength, 8) // 计算子网掩码字节的值并添加到结果字符串 subnetMask += (256 - Math.pow(2, 8 - bits)) + '.' // 更新剩余的位数 prefixLength -= bits } ...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left calculateSubnetMask AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left prefixLength AST#identifier#Right AST#type_annotation#Left AST#:#L...
function calculateSubnetMask(prefixLength: number): string { // 计算每个字节的子网掩码部分 let subnetMask = '' for (let i = 0; i < 4; i++) { // 每个字节中的有效位数 const bits = Math.min(prefixLength, 8) // 计算子网掩码字节的值并添加到结果字符串 subnetMask += (256 - Math.pow(2, 8 - bits)) + '.' // 更新剩余的位数 prefixLength -= bits } ...
https://gitcode.com/Cool_foolisher1/ArkTSRepository
32e8a0c454ef5c4929b911c3879d0357e790073e
gitcode
cduestc-course/ArkLearn
entry/src/main/ets/pages/06/6.2.6.ets
arkts
setToken
仓库中存储字段
static setToken(content:Context, token:string, storeName:string=PreferencesClass.defaultStore){ const store = preferences.getPreferencesSync(content, {name:storeName}) store.putSync(PreferencesClass.tokenKey, token) store.flush() }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setToken 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#identifier#Left Context AST#identifi...
static setToken(content:Context, token:string, storeName:string=PreferencesClass.defaultStore){ const store = preferences.getPreferencesSync(content, {name:storeName}) store.putSync(PreferencesClass.tokenKey, token) store.flush() }
https://github.com/cduestc-course/ArkLearn
98ba6568cb416afb59f36e67dd5acf304131c077
github
OHPG/FinSdk
jellyfin/src/main/ets/api/UserLibraryApi.ets
arkts
getLocalTrailers
Gets local trailers for an item. @summary Gets local trailers for an item. @param {UserLibraryApiGetLocalTrailersRequest} requestParameters Request parameters. @throws {RequiredError} @memberof UserLibraryApi
public async getLocalTrailers(requestParameters: UserLibraryApiGetLocalTrailersRequest): Promise<Array<BaseItemDto>> { this.assertParam(requestParameters.itemId) return this.apiClient.get({path: `/Items/${requestParameters.itemId}/LocalTrailers`, parameters: requestParameters, excludeParams: ['itemId']}) }
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 getLocalTrailers AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right ...
public async getLocalTrailers(requestParameters: UserLibraryApiGetLocalTrailersRequest): Promise<Array<BaseItemDto>> { this.assertParam(requestParameters.itemId) return this.apiClient.get({path: `/Items/${requestParameters.itemId}/LocalTrailers`, parameters: requestParameters, excludeParams: ['itemId']}) }
https://github.com/OHPG/FinSdk
98cf77fd13aab5df3ad325ba72aa05ac691677e5
github
harmonyos/codelabs
HarmonyOS_NEXT/OxHornCampus/entry/src/main/ets/controller/MapController.ets
arkts
mapMultiples
Obtains the map magnification. @returns Map magnification.
mapMultiples(): number { return Math.pow(Const.MAP_ZOOM_RATIO, this.pinchCount); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left mapMultiples 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...
mapMultiples(): number { return Math.pow(Const.MAP_ZOOM_RATIO, this.pinchCount); }
https://gitee.com/harmonyos/codelabs.git
1ab24e4142105cfaed338a01d5793a91d4bdc179
gitee
AlkaidLab/moonlight-harmony
entry/src/main/ets/components/ShortcutManager.ets
arkts
loadShortcuts
加载快捷键配置
private async loadShortcuts(): Promise<void> { if (!this.prefs) { this.shortcuts = this.getDefaultShortcuts(); return; } try { const deletedStr = await this.prefs.get(ShortcutManager.KEY_DELETED_BUILTINS, '') as string; this.deletedBuiltinIds = deletedStr ? JSON.parse(deletedS...
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 loadShortcuts AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST...
private async loadShortcuts(): Promise<void> { if (!this.prefs) { this.shortcuts = this.getDefaultShortcuts(); return; } try { const deletedStr = await this.prefs.get(ShortcutManager.KEY_DELETED_BUILTINS, '') as string; this.deletedBuiltinIds = deletedStr ? JSON.parse(deletedS...
https://github.com/AlkaidLab/moonlight-harmony
18b47c816aaecee91ba5c93449bbf374d36e260d
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/ReflectProxy.ets
arkts
invoke
Called by runtime in the compiled entrypoint.
private static invoke(proxy: Proxy, method: InstanceMethod, args: FixedArray<Any>): Any { return proxy.handler.invoke(proxy, method, args) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left private AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left invoke AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left proxy AS...
private static invoke(proxy: Proxy, method: InstanceMethod, args: FixedArray<Any>): Any { return proxy.handler.invoke(proxy, method, args) }
https://gitcode.com/iop123123/arkts-static-skills
a83dc264e157a1b4132bf33fb576d6d191a5b1e3
gitcode
DaLongZhuaZi/NGF
ngf_framework/src/main/ets/hardware/facades/SensorManagerFacade.ets
arkts
startAccelerometerListener
监听加速度传感器(例如用于摇一摇功能) @ohos.permission ohos.permission.ACCELEROMETER
startAccelerometerListener(onShake: (x: number, y: number, z: number) => void): boolean { try { sensor.on(sensor.SensorId.ACCELEROMETER, (data) => { // x, y, z 分别代表三轴加速度 onShake(data.x, data.y, data.z); }, { interval: 100000000 }); // 采样间隔 100ms logger.info(TAG, '已启动加速度传感器监听'); ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left startAccelerometerListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left onShake AST#identifier#Right AST#ERROR#...
startAccelerometerListener(onShake: (x: number, y: number, z: number) => void): boolean { try { sensor.on(sensor.SensorId.ACCELEROMETER, (data) => { // x, y, z 分别代表三轴加速度 onShake(data.x, data.y, data.z); }, { interval: 100000000 }); // 采样间隔 100ms logger.info(TAG, '已启动加速度传感器监听'); ...
https://github.com/DaLongZhuaZi/NGF
bdb570f438cb27051c039b3d5cf00c788435cb73
github
Joker-x-dev/HarmonyKit
core/database/src/main/ets/datasource/demo/DemoLocalDataSourceImpl.ets
arkts
getItemById
根据主键查询单条记录 @param {number} id - 记录主键 @returns {Promise<DemoEntity | undefined>} 匹配到的 Demo 或 undefined
async getItemById(id: number): Promise<DemoEntity | undefined> { const result: DemoEntity[] = this.orm.query(DemoEntity).where("id", id).find(); return result[0]; }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getItemById AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:...
async getItemById(id: number): Promise<DemoEntity | undefined> { const result: DemoEntity[] = this.orm.query(DemoEntity).where("id", id).find(); return result[0]; }
https://github.com/Joker-x-dev/HarmonyKit
a2244f19e31ae0bab8fc2d953848459af5875474
github
OHPG/FinSdk
jellyfin/src/main/ets/api/LibraryApi.ets
arkts
getItemCounts
@summary Get item counts. @param {LibraryApiGetItemCountsRequest} requestParameters Request parameters. @param {*} [options] Override http request option. @throws {RequiredError} @memberof LibraryApi
public getItemCounts(requestParameters: LibraryApiGetItemCountsRequest = {}): Promise<ItemCounts> { return this.apiClient.get({path: `/Items/Counts`, parameters: requestParameters}) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getItemCounts AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assig...
public getItemCounts(requestParameters: LibraryApiGetItemCountsRequest = {}): Promise<ItemCounts> { return this.apiClient.get({path: `/Items/Counts`, parameters: requestParameters}) }
https://github.com/OHPG/FinSdk
09bdc8319ce0eb4b8084e4aed04c1e0571182099
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/ChartModel.ets
arkts
setNoDataTextAlignment
alignment of the no data text @param align
public setNoDataTextAlignment(align: CanvasTextAlign) { if (this.mInfoPaint) { this.mInfoPaint.setTextAlign(align); } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setNoDataTextAlignment AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left align AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi...
public setNoDataTextAlignment(align: CanvasTextAlign) { if (this.mInfoPaint) { this.mInfoPaint.setTextAlign(align); } }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
94d1f62673e53c9fc326358f5b36b394668dc937
gitee
HarmonyOS_Samples/scankit-samplecode-clientdemo-arkts
common/sample_common/src/main/ets/model/UIContextSelf.ets
arkts
onEventHub
Subscription
public static onEventHub(event: string, callback: Function): void { try { UIContextSelf.commonContext.eventHub.on(event, callback); Logger.info(TAG, `onEventHub, event: ${event}`); } catch (error) { Logger.error(TAG, `Failed to onEventHub. Code: ${error.code}, message: ${error.message}.`); ...
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 onEventHub AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:#Left : AST#...
public static onEventHub(event: string, callback: Function): void { try { UIContextSelf.commonContext.eventHub.on(event, callback); Logger.info(TAG, `onEventHub, event: ${event}`); } catch (error) { Logger.error(TAG, `Failed to onEventHub. Code: ${error.code}, message: ${error.message}.`); ...
https://gitcode.com/HarmonyOS_Samples/scankit-samplecode-clientdemo-arkts
f93f54b9300559b096fb9e889c62d2564a37ec49
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Plugin/HSPPluginManager.ets
arkts
startEnabledPlugins
启动已启用的插件
private async startEnabledPlugins(): Promise<void> { try { // 使用显式属性访问替代解构 const registryEntries = Array.from(this.pluginRegistry.entries()); for (let i = 0; i < registryEntries.length; i++) { const pluginId = registryEntries[i][0]; const pluginInfo = registryEntries[i][1]; ...
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 startEnabledPlugins AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Rig...
private async startEnabledPlugins(): Promise<void> { try { // 使用显式属性访问替代解构 const registryEntries = Array.from(this.pluginRegistry.entries()); for (let i = 0; i < registryEntries.length; i++) { const pluginId = registryEntries[i][0]; const pluginInfo = registryEntries[i][1]; ...
https://github.com/DaLongZhuaZi/manxia
adf42cec33ec09e2293ef6b93a44e921a5dcbacd
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test51_original_index.ets
arkts
fibonacciIterative
--- Fibonacci iterative with array ---
function fibonacciIterative(n: number): number { if (n <= 1) { return n; } let fib: number[] = [0, 1]; for (let i: number = 2; i <= n; i++) { fib.push(fib[i - 1] + fib[i - 2]); } return fib[n]; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left fibonacciIterative 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#:#...
function fibonacciIterative(n: number): number { if (n <= 1) { return n; } let fib: number[] = [0, 1]; for (let i: number = 2; i <= n; i++) { fib.push(fib[i - 1] + fib[i - 2]); } return fib[n]; }
https://github.com/miaochiahao/ark-ghidra
61e395cb5ca51ae22d7448e5a290a6ddf1612c19
github
terryma2024/happyword
harmonyos/entry/src/main/ets/services/WordPackBootstrapper.ets
arkts
familyPacksFromService
Adapt the cached `FamilyPacksBlob` (server merged-JSON envelope, see FamilyPackMerge) into the V0.6.5 `Pack[]` shape. Each pack's raw words array is re-serialised through GlobalPackService.parsePacks so the field-level lift (snake_case ↔ camelCase, distractors, example, illustration/audio URLs) only lives in one place.
private static async familyPacksFromService(fps: FamilyPackService): Promise<Pack[]> { const blob: FamilyPacksBlob | null = await fps.warmFromCache(); if (blob === null) return []; if (blob.packs.length === 0) return []; // Build the same wire envelope the public global-packs endpoint // returns ...
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 familyPacksFromService AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifi...
private static async familyPacksFromService(fps: FamilyPackService): Promise<Pack[]> { const blob: FamilyPacksBlob | null = await fps.warmFromCache(); if (blob === null) return []; if (blob.packs.length === 0) return []; // Build the same wire envelope the public global-packs endpoint // returns ...
https://github.com/terryma2024/happyword
bf6eb4ed46ddda13fac22f738582451307dcc86f
github
Tencent-RTC/TUIKit_Harmony
atomic_x/src/main/ets/basecomponent/utils/ContextProvider.ets
arkts
isInitialized
Check if the context is initialized @returns true if context is initialized, false otherwise
static isInitialized(): boolean { const provider = ContextProvider.getInstance(); return provider._appContext !== null; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isInitialized 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...
static isInitialized(): boolean { const provider = ContextProvider.getInstance(); return provider._appContext !== null; }
https://github.com/Tencent-RTC/TUIKit_Harmony
986fc8cf1e30925613f00cfd8ab7c67b0504fa16
github
LongLiveY96/chatcube
entry/src/main/ets/services/FavoriteModelsService.ets
arkts
getFavoriteKeys
获取收藏模型的复合键列表(providerId::modelId 格式) @returns 复合键列表
getFavoriteKeys(): string[] { return this.favoriteModels.map(f => this.getFavoriteKey(f.providerId, f.modelId)) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getFavoriteKeys AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Rig...
getFavoriteKeys(): string[] { return this.favoriteModels.map(f => this.getFavoriteKey(f.providerId, f.modelId)) }
https://github.com/LongLiveY96/chatcube
bd5144734f7b9cbe20d6157c6f88aabd70c27290
github
751496032/ZRouter
RouterApi/src/main/ets/api/Router.ets
arkts
setModuleLoadedListener
添加模块加载完成的监听器 动态服务路由使用 @param listener
public static setModuleLoadedListener(listener: () => void) { if (ZRouter.isDynamicLoadedComplete()) { listener() } else { ZRouter.getRouterMgr().moduleLoadedListener = listener } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#identifier#Left setModuleLoadedListener AST#identifier#Right AST#(#Left ( AST#(#Right AST#assignment_expression#Left AST#member_expression#Left AST#call_expression#Left AST#member_expression#Left ...
public static setModuleLoadedListener(listener: () => void) { if (ZRouter.isDynamicLoadedComplete()) { listener() } else { ZRouter.getRouterMgr().moduleLoadedListener = listener } }
https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/api/Router.ets#L114-L120
dd05754cff8001d906156ae537e429cf18b57988
github
arkui-x/samples
CodeLab/Cases/feature/containernestedslide/src/main/ets/view/Scroller.ets
arkts
build
是否接触到Web底部
build() { Scroll(this.scroller) { Column() { this.webBuilder() this.titleBuilder() this.listBuilder() } .width(CommonConstants.FULL_PERCENT) } // TODO:知识点:通过调用Scroll.onScrollFrameBegin(),在每帧开始滚动时触发时将Scroll返回的实际滚动量的offset,通过scrollBy(0, offset)方法,将Scroll的竖直方向偏移量派发给W...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST...
build() { Scroll(this.scroller) { Column() { this.webBuilder() this.titleBuilder() this.listBuilder() } .width(CommonConstants.FULL_PERCENT) } // TODO:知识点:通过调用Scroll.onScrollFrameBegin(),在每帧开始滚动时触发时将Scroll返回的实际滚动量的offset,通过scrollBy(0, offset)方法,将Scroll的竖直方向偏移量派发给W...
https://gitcode.com/arkui-x/samples
0b1e709c9fc48e791ec148aaaf0b6b3c59ff91c2
gitcode
arkui-x/samples
CodeLab/Cases/feature/foldablescreencases/src/main/ets/viewmodel/MusicPlayViewModel.ets
arkts
genTimeStr
生成时间字符串 @param timeMs 毫秒数 @returns {string} 时:分:秒 规格的字符串
genTimeStr(timeMs: number): string { const totalTime = timeMs / 1000; const hours = Math.floor(totalTime / CommonConstants.SECONDS_IN_HOUR); const leftTime = totalTime % CommonConstants.SECONDS_IN_HOUR; const minutes = Math.floor(leftTime / CommonConstants.SECONDS_IN_MINUTE); const seconds = Math....
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left genTimeStr AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left timeMs AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) AS...
genTimeStr(timeMs: number): string { const totalTime = timeMs / 1000; const hours = Math.floor(totalTime / CommonConstants.SECONDS_IN_HOUR); const leftTime = totalTime % CommonConstants.SECONDS_IN_HOUR; const minutes = Math.floor(leftTime / CommonConstants.SECONDS_IN_MINUTE); const seconds = Math....
https://gitcode.com/arkui-x/samples
5ff665ed26188f05aefc9e5be7635ce76506a982
gitcode
SMAT-Lab/PhantomRendering
Harmoney_Next-Tiktok/entry/src/main/ets/utils/setting.ets
arkts
addOwnChatMessage
添加一条"我"和某个人的聊天记录
async addOwnChatMessage(userId: string, message: MessageInfoModel) { const store = this.getStore() const list = this.getChatMessage(userId) //拿到所有的所有的聊天记录 // 写入list list.push(message) store.putSync(`${UserRecord_KEY}_${userId}`, JSON.stringify(list)) await store.flush() }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left addOwnChatMessage AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left userId AST#identifier#Right AST#type_annotation#Left AST#:#Le...
async addOwnChatMessage(userId: string, message: MessageInfoModel) { const store = this.getStore() const list = this.getChatMessage(userId) //拿到所有的所有的聊天记录 // 写入list list.push(message) store.putSync(`${UserRecord_KEY}_${userId}`, JSON.stringify(list)) await store.flush() }
https://github.com/SMAT-Lab/PhantomRendering
a88fe9888f5ab25864ff6a6f835755a5a46f4cde
github
the-wwyang/kids-learning-app
src/main/ets/services/ScoreService.ets
arkts
getTotalExp
获取总经验值
public getTotalExp(): number { const userData = appStorage.getCurrentUser(); return userData?.totalExp || 0; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getTotalExp 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#num...
public getTotalExp(): number { const userData = appStorage.getCurrentUser(); return userData?.totalExp || 0; }
https://github.com/the-wwyang/kids-learning-app
2ab269132f7b286d4cb1cd6caf4380cdaf08e76d
github
openharmony-sig/ohos_danmaku_flame_master
library/src/main/ets/components/common/master/flame/danmaku/danmaku/parser/BaseDanmakuParser.ets
arkts
getViewportSizeFactor
decide the speed of scroll-danmakus @return
protected getViewportSizeFactor(): number { return 1 / (this.mDispDensity * 0.8); }
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left getViewportSizeFactor 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#...
protected getViewportSizeFactor(): number { return 1 / (this.mDispDensity * 0.8); }
https://gitee.com/openharmony-sig/ohos_danmaku_flame_master.git
d6843e457a3448ca882bc79bbea9a60598b2c43e
gitee
Joker-x-dev/CoolMallArkTS
core/data/src/main/ets/repository/CartRepository.ets
arkts
removeFromCart
从购物车删除商品 @param {number} goodsId 商品ID @returns {Promise<void>} Promise<void>
removeFromCart(goodsId: number): Promise<void> { return this.dataSource.removeFromCart(goodsId); }
AST#program#Left AST#expression_statement#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left removeFromCart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left goodsId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AS...
removeFromCart(goodsId: number): Promise<void> { return this.dataSource.removeFromCart(goodsId); }
https://github.com/Joker-x-dev/CoolMallArkTS
eea8d1fc5f8bc1286f20a666e099789a72cc5312
github
webabcd/HarmonyDemo
entry/src/main/ets/pages/component/navigation/pages/NavigationDemo2_Page1.ets
arkts
navigationDemo2_page1_builder
路由表中 routerMap 的 buildFunction 指定的 @Builder 函数,用于构造此路由指向的组件 name - 路由名称 param - 传递过来的数据
@Builder function navigationDemo2_page1_builder(name: string, param: Object) { NavigationDemo2_Page1({ message: `路由名称:${name}, 参数:${param}\n\n` }) }
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 navigationDemo2_page1_builder AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST...
@Builder function navigationDemo2_page1_builder(name: string, param: Object) { NavigationDemo2_Page1({ message: `路由名称:${name}, 参数:${param}\n\n` }) }
https://github.com/webabcd/HarmonyDemo
a6c8f28b3a71f8e63b98745a0a0817936acae48d
github
dingzhilin1990/zhilinclaw
src/security/SecurityFilter.ets
arkts
sanitizeOutput
清理输出内容 @param output AI 生成的输出
public sanitizeOutput(output: string): string { let sanitized = output; // 移除潜在的脚本标签 sanitized = sanitized.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, ''); // 移除潜在的危险 HTML sanitized = sanitized.replace(/<(iframe|object|embed|form|input)[^>]*>/gi, ''); // 移除 javascript: 协议...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left sanitizeOutput AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left output AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left...
public sanitizeOutput(output: string): string { let sanitized = output; // 移除潜在的脚本标签 sanitized = sanitized.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, ''); // 移除潜在的危险 HTML sanitized = sanitized.replace(/<(iframe|object|embed|form|input)[^>]*>/gi, ''); // 移除 javascript: 协议...
https://github.com/dingzhilin1990/zhilinclaw
c30007b7960d3006b08bd7fb98f3ee508e5e547e
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/components/AxisBase.ets
arkts
addLimitLine
Adds a new LimitLine to this axis. @param l
public addLimitLine(l: LimitLine): void { this.mLimitLines.add(l); if (this.mLimitLines.size() > 6) { LogUtil.log("MPChart", "Warning! You have more than 6 LimitLines on your axis, do you really want " + "that?"); } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addLimitLine AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left l AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left LimitL...
public addLimitLine(l: LimitLine): void { this.mLimitLines.add(l); if (this.mLimitLines.size() > 6) { LogUtil.log("MPChart", "Warning! You have more than 6 LimitLines on your axis, do you really want " + "that?"); } }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
fbac3331fdbc676ee99daa9dfa5d9789cc3a0481
gitee
richshaw2015/nds
ohos/entry/src/main/ets/utils/DownloadDirManager.ets
arkts
saveDownloadDir
保存下载目录
private async saveDownloadDir(): Promise<void> { if (!this.dataPreferences) return; try { await this.dataPreferences.put(KEY_DOWNLOAD_DIR_PATH, this.downloadDirPath); await this.dataPreferences.put(KEY_DOWNLOAD_DIR_URI, this.downloadDirUri); await this.dataPreferences.flush(); console...
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 saveDownloadDir AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A...
private async saveDownloadDir(): Promise<void> { if (!this.dataPreferences) return; try { await this.dataPreferences.put(KEY_DOWNLOAD_DIR_PATH, this.downloadDirPath); await this.dataPreferences.put(KEY_DOWNLOAD_DIR_URI, this.downloadDirUri); await this.dataPreferences.flush(); console...
https://github.com/richshaw2015/nds
fcbbe64b8b3c80fd4f24785566d16a76350d4d36
github
HarmonyOS_Samples/guide-snippets
ArkData/DataShare/ShareConfig/entry/src/main/ets/pages/Index.ets
arkts
publishSharedConfig
[Start publish_shared_config]
function publishSharedConfig() { dataShare.createDataProxyHandle().then((dataProxyHandle) => { const newConfigData: dataShare.ProxyData[] = [ { uri: 'datashareproxy://com.samples.shareconfig/config1', value: 'Value1', allowList: [ 'appIdentifier1', 'appIdentifier2...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left publishSharedConfig AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#express...
function publishSharedConfig() { dataShare.createDataProxyHandle().then((dataProxyHandle) => { const newConfigData: dataShare.ProxyData[] = [ { uri: 'datashareproxy://com.samples.shareconfig/config1', value: 'Value1', allowList: [ 'appIdentifier1', 'appIdentifier2...
https://gitcode.com/HarmonyOS_Samples/guide-snippets
05f87f37ca642203a06da27bc23b695f2e5fc720
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
arkts
onRestore
当系统请求恢复应用数据时调用 由于此扩展运行在独立进程,主应用的数据管理器均未初始化, 因此不执行实际恢复操作,仅安全返回。 @param bundleVersion 应用版本信息
async onRestore(bundleVersion: BundleVersion) { hilog.info(DOMAIN, TAG, `系统触发应用数据恢复(扩展进程),版本: code=${bundleVersion.code}, name=${bundleVersion.name}`); hilog.info(DOMAIN, TAG, '实际恢复由用户在应用内手动触发,此处安全返回'); // 不调用任何依赖主应用初始化的管理器,直接返回 }
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left onRestore AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left bundleVersion AST#identifier#Right AST#type_annotation#Left ...
async onRestore(bundleVersion: BundleVersion) { hilog.info(DOMAIN, TAG, `系统触发应用数据恢复(扩展进程),版本: code=${bundleVersion.code}, name=${bundleVersion.name}`); hilog.info(DOMAIN, TAG, '实际恢复由用户在应用内手动触发,此处安全返回'); // 不调用任何依赖主应用初始化的管理器,直接返回 }
https://github.com/DaLongZhuaZi/manxia
a1dcbbdeec60f75921cdd542e9db700f301f7dcc
github
youyeyejie/ZhiXing_ActHub
entry/src/main/ets/app/AppNav.ets
arkts
pushOverlayRoute
统一压入覆盖页并附带 onPop 同步逻辑。
private pushOverlayRoute(routeName: string, param: Object | undefined, animated: boolean): void { this.hasOverlayRoute = true; this.pushPath({ name: routeName, param: param, onPop: (_info: PopInfo): void => { this.syncOverlayState(); } }, animated); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left pushOverlayRoute AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left routeName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#...
private pushOverlayRoute(routeName: string, param: Object | undefined, animated: boolean): void { this.hasOverlayRoute = true; this.pushPath({ name: routeName, param: param, onPop: (_info: PopInfo): void => { this.syncOverlayState(); } }, animated); }
https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/app/AppNav.ets#L145-L154
18c8885e7941a0a1c6d48aa62df3a3da6239a74f
github
offlinecat-dev/OCNetORM
src/main/ets/query/QueryCache.ets
arkts
deepCloneEntityData
深拷贝 EntityData 对象 避免缓存数据被外部修改污染 @param data 原始 EntityData @param visited 已访问映射(用于处理循环引用) @returns 深拷贝后的 EntityData
private deepCloneEntityData(data: EntityData, visited: Map<EntityData, EntityData> = new Map()): EntityData { const existing = visited.get(data) if (existing !== undefined) { return existing } const cloned = new EntityData(data.entityName) visited.set(data, cloned) // 复制所有属性 // 优先从...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left deepCloneEntityData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie...
private deepCloneEntityData(data: EntityData, visited: Map<EntityData, EntityData> = new Map()): EntityData { const existing = visited.get(data) if (existing !== undefined) { return existing } const cloned = new EntityData(data.entityName) visited.set(data, cloned) // 复制所有属性 // 优先从...
https://github.com/offlinecat-dev/OCNetORM
15217bc5ab3bd9d91057b1afe7b4c1b8b5e68b5b
github
openharmony-sig/knowledge_demo_entainment
FA/BombGame/entry/src/main/ets/MainAbility/pages/game.ets
arkts
setBombAnimate
设置游戏动画
setBombAnimate() { if (!this.isPlayAnimate) { return } this.stopAnimate() this.interval = setInterval(() => { animateTo({ duration: 1500, curve: Curve.Sharp }, () => { this.toggle = !this.toggle; }) }, 1600) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setBombAnimate 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#Lef...
setBombAnimate() { if (!this.isPlayAnimate) { return } this.stopAnimate() this.interval = setInterval(() => { animateTo({ duration: 1500, curve: Curve.Sharp }, () => { this.toggle = !this.toggle; }) }, 1600) }
https://gitee.com/openharmony-sig/knowledge_demo_entainment.git
701929fc70c44cb86a682a63c7738eec6a516489
gitee
openharmony/codelabs
ETSUI/MemoTime/entry/src/main/ets/pages/ScheduleEditPage.ets
arkts
toggleReminder
切换提醒选中状态
toggleReminder(timing: ReminderTiming): void { const index = this.selectedReminders.indexOf(timing) if (index >= 0) { this.selectedReminders.splice(index, 1) } else { this.selectedReminders.push(timing) } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toggleReminder AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left timing AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ReminderTiming AST#identifier#Right AST...
toggleReminder(timing: ReminderTiming): void { const index = this.selectedReminders.indexOf(timing) if (index >= 0) { this.selectedReminders.splice(index, 1) } else { this.selectedReminders.push(timing) } }
https://gitcode.com/openharmony/codelabs
c3a9cb0eec48a28e1d10fcdb5ee342bb74978f5a
gitcode
Kira-Yagami-Light/Kira-Projects
TodoTask/entry/src/main/ets/data/repository/CategoryRepository.ets
arkts
toValueBucket
将 TaskCategoryData 转换为 ValuesBucket @param category 分类模型 @returns relationalStore.ValuesBucket
private toValueBucket(category: TaskCategoryData): relationalStore.ValuesBucket { return { name: category.name, color: category.color }; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left toValueBucket AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left category AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#...
private toValueBucket(category: TaskCategoryData): relationalStore.ValuesBucket { return { name: category.name, color: category.color }; }
https://github.com/Kira-Yagami-Light/Kira-Projects
189ce2ad9f745b5d32c68c4572d44964d189564d
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/ChartModel.ets
arkts
getOnTouchListener
Returns an instance of the currently active touch listener. @return
public getOnTouchListener(): ChartTouchListener<ChartModel<ChartData<IDataSet<EntryOhos>>>> | null { return this.mChartTouchListener; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getOnTouchListener 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#L...
public getOnTouchListener(): ChartTouchListener<ChartModel<ChartData<IDataSet<EntryOhos>>>> | null { return this.mChartTouchListener; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
50a7a89c9f99b85a9b0a9a9e3bfcf374110316cd
gitee
YANGZX22/Voot
entry/src/main/ets/services/ModelDownloadService.ets
arkts
calculateSpeed
计算下载速度
private calculateSpeed(currentBytes: number): string { const now = Date.now(); const timeDiff = (now - this.lastTimestamp) / 1000; // 秒 if (timeDiff < 0.5) { return this.lastTimestamp > 0 ? '计算中...' : ''; } const bytesDiff = currentBytes - this.lastDownloadedBytes; const bytesPerSe...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left calculateSpeed AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left currentBytes AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST...
private calculateSpeed(currentBytes: number): string { const now = Date.now(); const timeDiff = (now - this.lastTimestamp) / 1000; // 秒 if (timeDiff < 0.5) { return this.lastTimestamp > 0 ? '计算中...' : ''; } const bytesDiff = currentBytes - this.lastDownloadedBytes; const bytesPerSe...
https://github.com/YANGZX22/Voot
e0378c9973463b6a554b10933989faa008426de8
github
webabcd/HarmonyDemo
entry/src/main/ets/pages/component/selection/RatingDemo.ets
arkts
buildRating
自定义 Rating
@Builder function buildRating(config: RatingConfiguration) { /* * RatingConfiguration - 自定义 Rating 的相关信息 * enabled - 是否可用 * contentModifier - 绑定的 ContentModifier 对象 * rating - 评分值 * indicator - 是否仅用于显示 * stars - 星星的总数量 * stepSize - 评分的步长 * triggerChange() - 触发 Rating 的 onChange()...
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 buildRating AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#requi...
@Builder function buildRating(config: RatingConfiguration) { /* * RatingConfiguration - 自定义 Rating 的相关信息 * enabled - 是否可用 * contentModifier - 绑定的 ContentModifier 对象 * rating - 评分值 * indicator - 是否仅用于显示 * stars - 星星的总数量 * stepSize - 评分的步长 * triggerChange() - 触发 Rating 的 onChange()...
https://github.com/webabcd/HarmonyDemo
424f7a74abaf4b8e22d7b992a45b576f2ddaf3ac
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Storage/StorageAnalyzer.ets
arkts
analyzeCoverFiles
分析封面文件
private async analyzeCoverFiles(): Promise<StorageItem> { try { const coversPath = this.sandboxManager.getDirectory('covers'); const dirInfo = await this.getDirectoryInfo(coversPath); const size = dirInfo.size; const count = dirInfo.count; return { type: StorageType.CO...
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 analyzeCoverFiles AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right...
private async analyzeCoverFiles(): Promise<StorageItem> { try { const coversPath = this.sandboxManager.getDirectory('covers'); const dirInfo = await this.getDirectoryInfo(coversPath); const size = dirInfo.size; const count = dirInfo.count; return { type: StorageType.CO...
https://github.com/DaLongZhuaZi/manxia
0d1bcbe8bb1c34e4495bcd66a8b53378c81c192b
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
set
Copies all elements of arr to the current Uint8Array starting from insertPos. {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set} @param { FixedArray<int> } arr - array to copy data from @param { int } insertPos - start index where data from arr will be inserted @thro...
public set(arr: FixedArray<int>, insertPos: int): void { if (insertPos < 0 || insertPos + arr.length > this.lengthInt) { throw new RangeError("set(insertPos: int, arr: FixedArray<int>): size of arr is greater than Uint8Array.length") } for (let i = 0; i < arr.length; i++) { ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#...
public set(arr: FixedArray<int>, insertPos: int): void { if (insertPos < 0 || insertPos + arr.length > this.lengthInt) { throw new RangeError("set(insertPos: int, arr: FixedArray<int>): size of arr is greater than Uint8Array.length") } for (let i = 0; i < arr.length; i++) { ...
https://gitcode.com/iop123123/arkts-static-skills
02ee688303cc48a8d22ae7d7b7c555c53c7f6df7
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/usbdriver/NativeHidParserService.ets
arkts
getGamepadType
获取手柄类型 @param vendorId 设备厂商 ID @param productId 设备产品 ID @returns 手柄类型枚举值
getGamepadType(vendorId: number, productId: number): NativeGamepadType { if (!this.gamepadModule) { return NativeGamepadType.UNKNOWN; } try { return this.gamepadModule.getGamepadType(vendorId, productId) as NativeGamepadType; } catch (err) { return NativeGamepadType.UNKNOWN; } ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getGamepadType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left vendorId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , AST#...
getGamepadType(vendorId: number, productId: number): NativeGamepadType { if (!this.gamepadModule) { return NativeGamepadType.UNKNOWN; } try { return this.gamepadModule.getGamepadType(vendorId, productId) as NativeGamepadType; } catch (err) { return NativeGamepadType.UNKNOWN; } ...
https://github.com/AlkaidLab/moonlight-harmony
d5c6181422e1d76651858eeadd6cd07fa43287fa
github
codelably/HCompass
packages/auth/src/main/ets/AuthModule.ets
arkts
onReject
守卫拒绝时的回调 @param context 路由上下文 @param result 守卫结果
onReject(context: RouteContext, result: GuardResult): void { // 跳转到登录页 const navigation = getContainer().tryResolve<NavigationService>(CoreServiceKeys.NavigationService); navigation?.navigateTo(AuthRoutes.Login, context.params); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onReject AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left RouteContext AST#identifier#Right AST#,#Left...
onReject(context: RouteContext, result: GuardResult): void { // 跳转到登录页 const navigation = getContainer().tryResolve<NavigationService>(CoreServiceKeys.NavigationService); navigation?.navigateTo(AuthRoutes.Login, context.params); }
https://github.com/codelably/HCompass
055f18a3ca43a6cbc631fb0a1a32c048b156704d
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/SharedLedgerService.ets
arkts
validateSplits
验证分摊金额
private static validateSplits( totalAmount: number, splitMethod: string, splits: BillSplit[] ): boolean { if (splitMethod === 'by_amount') { let sum = 0; for (let i = 0; i < splits.length; i++) { sum += splits[i].amount; } return Math.abs(sum - totalAmount) < 0.01; //...
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 validateSplits AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left totalAmount AST#identifier#Right AST#ERROR#Left AST#...
private static validateSplits( totalAmount: number, splitMethod: string, splits: BillSplit[] ): boolean { if (splitMethod === 'by_amount') { let sum = 0; for (let i = 0; i < splits.length; i++) { sum += splits[i].amount; } return Math.abs(sum - totalAmount) < 0.01; //...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
a5a15d5c0c7eb48bb588a0f899e92cd5efdf4048
github
openharmony-sig/arkanalyzer
tests/resources/dummyMain/entry_methods_order/AAA.ets
arkts
foo
Don't change the file name
function foo(context: UIContext) { let node = typeNode.createNode(context, "Image"); node.attribute.onClick(() => { }) return node; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left foo AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST...
function foo(context: UIContext) { let node = typeNode.createNode(context, "Image"); node.attribute.onClick(() => { }) return node; }
https://gitcode.com/openharmony-sig/arkanalyzer
30fbbe42fd756689e1e752c4bc6de86fba756a8a
gitcode
HarmonyOS_Samples/hmosworld
HMOSWorld/Application/features/discover/src/main/ets/model/DiscoverModel.ets
arkts
clearSearchHistory
clear search history
clearSearchHistory(): void { this.preferenceManager.deleteValue('searchHistory').then(res => { this.searchHistory = []; Logger.error(TAG, 'Delete search History success.' + JSON.stringify(res)); }).catch((err: BusinessError) => Logger.error(TAG, 'Delete search History Failed. Cause: ' + err)); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clearSearchHistory 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...
clearSearchHistory(): void { this.preferenceManager.deleteValue('searchHistory').then(res => { this.searchHistory = []; Logger.error(TAG, 'Delete search History success.' + JSON.stringify(res)); }).catch((err: BusinessError) => Logger.error(TAG, 'Delete search History Failed. Cause: ' + err)); }
https://gitcode.com/HarmonyOS_Samples/hmosworld
5fdf6d1004de1fbdb0e9f6accc078bc4b2681f36
gitcode
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test_original_index.ets
arkts
testStringOps
=== Data Types ===
function testStringOps(s: string): string { return s.toUpperCase() + '!' + String(s.length); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testStringOps AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left s AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right...
function testStringOps(s: string): string { return s.toUpperCase() + '!' + String(s.length); }
https://github.com/miaochiahao/ark-ghidra
8dd7c41ef4fea4cd6d363b4413dd48a54279e694
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/MangaSourceEngine.ets
arkts
extractNumberFromTitle
从章节标题中提取章节号 [增强] 支持多种语言、符号格式,提高准确性和兼容性 @param title 章节标题 @returns 提取的章节号,无法提取返回null
private extractNumberFromTitle(title: string): number | null { if (!title) return null; // 预处理:去除首尾空格 const cleanTitle = title.trim(); // 中文数字映射(扩展支持) const chineseNumMap: Record<string, number> = { '零': 0, '〇': 0, '一': 1, '壹': 1, '二': 2, '贰': 2, '两': 2, '三': 3, '叁': 3, ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left extractNumberFromTitle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left title AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ident...
private extractNumberFromTitle(title: string): number | null { if (!title) return null; // 预处理:去除首尾空格 const cleanTitle = title.trim(); // 中文数字映射(扩展支持) const chineseNumMap: Record<string, number> = { '零': 0, '〇': 0, '一': 1, '壹': 1, '二': 2, '贰': 2, '两': 2, '三': 3, '叁': 3, ...
https://github.com/DaLongZhuaZi/manxia
aa2ea58d047105028c6d44242956b21d5bc5bf53
github
arkui-x/samples
CodeLab/Cases/feature/imagecompression/src/main/ets/view/ImageCompression.ets
arkts
getSelectFormat
获取当前选中的输出格式 @returns selectFormat 格式名
getSelectFormat(): string { let selectFormat: string = ''; switch (this.outputFormatIndex) { case 0: // 原格式 selectFormat = this.beforeCompressFmt; break; case 1: // PNG selectFormat = 'png'; break; case 2: // JPEG selectFormat = 'jpeg'; break; ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getSelectFormat 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#statem...
getSelectFormat(): string { let selectFormat: string = ''; switch (this.outputFormatIndex) { case 0: // 原格式 selectFormat = this.beforeCompressFmt; break; case 1: // PNG selectFormat = 'png'; break; case 2: // JPEG selectFormat = 'jpeg'; break; ...
https://gitcode.com/arkui-x/samples
ae43486d9ff94248e9954c087c069dcd468c3b4d
gitcode
tdcare/tdwebrtc
src/main/ets/WebRTCManager.ets
arkts
getPreferredVideoCodec
v36: 获取接收端视频编解码器(用于解码器选择) 优先级: negotiatedVideoCodec (SDP协商结果) > 设备检测 bestRecvCodec > VP8 兜底 非对称编解码场景:设备只有 H264 解码 → bestRecvCodec=H264 → Android 发 H264 → OHOS 硬解码
public getPreferredVideoCodec(): string { if (this.negotiatedVideoCodec !== null) { return this.negotiatedVideoCodec; } return this.codecCapabilities?.bestRecvCodec ?? this.config.preferredVideoCodec ?? 'VP8'; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getPreferredVideoCodec 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 str...
public getPreferredVideoCodec(): string { if (this.negotiatedVideoCodec !== null) { return this.negotiatedVideoCodec; } return this.codecCapabilities?.bestRecvCodec ?? this.config.preferredVideoCodec ?? 'VP8'; }
https://github.com/tdcare/tdwebrtc
44b29e97a3ec09d175a2ae7bb994469ff9d4dc47
github
CLMC2025/Vignette
entry/src/main/ets/sync/VersionControl.ets
arkts
clearChangeLog
清空变更日志
clearChangeLog(): void { this.changeLog = []; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clearChangeLog AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_blo...
clearChangeLog(): void { this.changeLog = []; }
https://github.com/CLMC2025/Vignette
f83bc70442a5df04519aca5bbcc4016c7f83b57b
github
LJ666-ui/harmony-health-care
entry/src/main/ets/store/AppStore.ets
arkts
setError
Action: 设置错误
public setError(error: string | null): void { this.setState({ error }); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setError AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left error AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left...
public setError(error: string | null): void { this.setState({ error }); }
https://github.com/LJ666-ui/harmony-health-care
69b35a57a64d2404d8d6ccc292232c9970605d86
github
codelably/tuniao-ui
core/tuniaoui/src/main/ets/components/icon/TnIcon.ets
arkts
isImageIcon
判断图标名称是否为图片路径 @param name 图标名称 @returns 是否为图片图标
function isImageIcon(name: string | Resource): boolean { if (typeof name !== "string") { return true; } if (name.length === 0) { return false; } return name.indexOf("/") >= 0 || name.startsWith("http"); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left isImageIcon AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left name AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Righ...
function isImageIcon(name: string | Resource): boolean { if (typeof name !== "string") { return true; } if (name.length === 0) { return false; } return name.indexOf("/") >= 0 || name.startsWith("http"); }
https://github.com/codelably/tuniao-ui
ae477b293200864ae481a3a29f931edabb1f6979
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/usbdriver/AbstractDualSenseController.ets
arkts
start
启动控制器
start(): boolean { console.info(`${TAG} 启动控制器: VID=0x${this.vendorId.toString(16)}, PID=0x${this.productId.toString(16)}, DDK=${this.ddkPollingEnabled}`); this.markInitializing(); // 查找端点 if (!this.findEndpoints()) { console.error(`${TAG} 查找端点失败`); return false; } // ====...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left start 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#statement_blo...
start(): boolean { console.info(`${TAG} 启动控制器: VID=0x${this.vendorId.toString(16)}, PID=0x${this.productId.toString(16)}, DDK=${this.ddkPollingEnabled}`); this.markInitializing(); // 查找端点 if (!this.findEndpoints()) { console.error(`${TAG} 查找端点失败`); return false; } // ====...
https://github.com/AlkaidLab/moonlight-harmony
68cb45930b59e8ef70b135dec0414543f4aa52f2
github
LongLiveY96/chatcube
entry/src/main/ets/models/ChatModels.ets
arkts
getImageAttachments
获取图片附件
getImageAttachments(): MessageAttachment[] { return this.attachments.filter(a => a.type === AttachmentType.IMAGE) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getImageAttachments AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression...
getImageAttachments(): MessageAttachment[] { return this.attachments.filter(a => a.type === AttachmentType.IMAGE) }
https://github.com/LongLiveY96/chatcube
6895b434de0e9b4652c135a9c8318dbbc38cf5e8
github
openharmony/update_update_app
feature/ota/src/main/ets/notify/NotificationHelper.ets
arkts
isServiceReady
检查notification服务是否启动
async isServiceReady(): Promise<void> { const retryTimes: number = 10; let count: number = 0; let isReady: boolean = false; while (count < retryTimes) { try { await notification.isDistributedEnabled().then(() => { this.logInfo('notification service is ready'); isReady...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left isServiceReady AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#gener...
async isServiceReady(): Promise<void> { const retryTimes: number = 10; let count: number = 0; let isReady: boolean = false; while (count < retryTimes) { try { await notification.isDistributedEnabled().then(() => { this.logInfo('notification service is ready'); isReady...
https://gitee.com/openharmony/update_update_app.git
84cf2c289ccaf2220b5094ab3899d1ec5e15408a
gitee
openharmony/codelabs
ETSUI/ChatAppDemo/entry/src/main/ets/utils/ChatHandler.ets
arkts
insertMessage
显式声明返回类型 Promise<number>
async insertMessage(msg: Message, owner: string, targetPhone: string): Promise<number> { const valueBucket: relationalStore.ValuesBucket = { 'id': msg.id, 'owner': owner, 'targetPhone': targetPhone, 'nickName': msg.nickName, 'content': msg.content, 'time': msg.time, 'isSe...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left insertMessage AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left msg AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS...
async insertMessage(msg: Message, owner: string, targetPhone: string): Promise<number> { const valueBucket: relationalStore.ValuesBucket = { 'id': msg.id, 'owner': owner, 'targetPhone': targetPhone, 'nickName': msg.nickName, 'content': msg.content, 'time': msg.time, 'isSe...
https://gitcode.com/openharmony/codelabs
a94aac60fd729f59e3cbb70092bc726f463fead4
gitcode
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/ChartData.ets
arkts
getIndexOfDataSet
Returns the index of the provided DataSet in the DataSet array of this data object, or -1 if it does not exist. @param dataSet @return
public getIndexOfDataSet(dataSet: T): number { if (this.mDataSets) { return this.mDataSets.indexOf(dataSet); } return -1; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getIndexOfDataSet AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left dataSet AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#ident...
public getIndexOfDataSet(dataSet: T): number { if (this.mDataSets) { return this.mDataSets.indexOf(dataSet); } return -1; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
b4f2685aa4e7a5fefbc01f1e1b8f7a1de78d4a4e
gitee
openharmony-sig/applications_clock
feature/alarmclock/src/main/ets/components/PCBuilder/index.ets
arkts
PCAlarmFormPopupBuilder
PC 端 新建闹钟 popup
@Builder function PCAlarmFormPopupBuilder(props: IPCAlarmFormPopupBuilderProps) { Flex() { if (props.visible) { ManageAlarmClock({ isPCView: props.isPCView, onConfirmCallback: props.onConfirm, onCancelCallback: props.onCancel, }) } } .size({ width: $r('app.float.pc_...
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 PCAlarmFormPopupBuilder AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Rig...
@Builder function PCAlarmFormPopupBuilder(props: IPCAlarmFormPopupBuilderProps) { Flex() { if (props.visible) { ManageAlarmClock({ isPCView: props.isPCView, onConfirmCallback: props.onConfirm, onCancelCallback: props.onCancel, }) } } .size({ width: $r('app.float.pc_...
https://gitee.com/openharmony-sig/applications_clock.git
42a528cb5c79ac800d22ec999138303422345b10
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Tracking/trackers/SuwayomiTracker.ets
arkts
getSources
==================== 图源模式 API ==================== 获取所有源
public async getSources(): Promise<SuwayomiSource[]> { const query = ` query { sources { nodes { id name lang iconUrl isNsfw } } } `; const data = await this.executeGraphQL(query); return data?....
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 getSources AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Lef...
public async getSources(): Promise<SuwayomiSource[]> { const query = ` query { sources { nodes { id name lang iconUrl isNsfw } } } `; const data = await this.executeGraphQL(query); return data?....
https://github.com/DaLongZhuaZi/manxia
5faa9475ce2944bf9fec05dfc92bae840aa8421b
github
aimilin6688/KeePassHO
entry/src/main/ets/common/oauth2/BaseOAuth2Provider.ets
arkts
setConfig
设置提供者配置 @param config OAuth2配置
public setConfig(config: OAuth2Config): void { this.config = config; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setConfig 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 OAut...
public setConfig(config: OAuth2Config): void { this.config = config; }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/oauth2/BaseOAuth2Provider.ets#L205-L207
9c22153dbc081971bee9f68dcfa424fc8346680d
github
xufei5789651/HmWan
commons/utils/src/main/ets/web/WebNodeController.ets
arkts
initWeb
初始化web 组件 @param url @param uiContext @param control @param onPageEndAction
initWeb(url: string, uiContext: UIContext, control: WebviewController, isDark?:boolean,onPageEndAction?: Function) { if (this.rootNode != null) { return; } // uiContext is required for creating a node. this.rootNode = new BuilderNode(uiContext); this.rootNode.dispose() // Creating an Off...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left initWeb AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#...
initWeb(url: string, uiContext: UIContext, control: WebviewController, isDark?:boolean,onPageEndAction?: Function) { if (this.rootNode != null) { return; } // uiContext is required for creating a node. this.rootNode = new BuilderNode(uiContext); this.rootNode.dispose() // Creating an Off...
https://github.com/xufei5789651/HmWan
377814595c914a7bd43e54afdfbe56060e36bd86
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/TypeShelfManager.ets
arkts
createShelf
创建新书架 同时在BookshelfCategoryManager中创建对应的分类
async createShelf(params: CreateShelfParams): Promise<TypeShelf> { const maxOrder = this.shelves.reduce((max, s) => Math.max(max, s.order), 0); const now = Date.now(); const shelfId = `shelf_${now}`; const newShelf: TypeShelf = { id: shelfId, name: params.name, shelfType: params...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left createShelf AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left params AST#identifier#Right AST#type_annotation#Left AST#:#Left : A...
async createShelf(params: CreateShelfParams): Promise<TypeShelf> { const maxOrder = this.shelves.reduce((max, s) => Math.max(max, s.order), 0); const now = Date.now(); const shelfId = `shelf_${now}`; const newShelf: TypeShelf = { id: shelfId, name: params.name, shelfType: params...
https://github.com/DaLongZhuaZi/manxia
eb2a84278645bd58b85ecd79672b2a543c1b4f35
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/DeviceSensorService.ets
arkts
setGyroState
启用/禁用陀螺仪
private setGyroState(reportRateHz: number): void { // 先取消已有订阅 if (this.gyroEnabled) { try { sensor.off(sensor.SensorId.GYROSCOPE); } catch (err) { console.warn(`[DeviceSensor] 取消陀螺仪订阅失败: ${err}`); } this.gyroEnabled = false; } this.gyroReportRateHz = reportRate...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left setGyroState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left reportRateHz AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#n...
private setGyroState(reportRateHz: number): void { // 先取消已有订阅 if (this.gyroEnabled) { try { sensor.off(sensor.SensorId.GYROSCOPE); } catch (err) { console.warn(`[DeviceSensor] 取消陀螺仪订阅失败: ${err}`); } this.gyroEnabled = false; } this.gyroReportRateHz = reportRate...
https://github.com/AlkaidLab/moonlight-harmony
a84fd33585949312384ed2f79c9399953c8db989
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Source/SignatureHandler.ets
arkts
validateConfig
验证签名配置
static validateConfig(config: SignatureConfig): boolean { if (!config.enabled) { return true; } if (!config.algorithm || !config.key || !config.signatureFormat) { logger.error(TAG, '签名配置不完整'); return false; } return true; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left validateConfig 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...
static validateConfig(config: SignatureConfig): boolean { if (!config.enabled) { return true; } if (!config.algorithm || !config.key || !config.signatureFormat) { logger.error(TAG, '签名配置不完整'); return false; } return true; }
https://github.com/DaLongZhuaZi/manxia
30b1290eeb0381e49159a3b9d8bbfcbafbbd187c
github
Eklps/harmony-mall-perf
entry/src/main/ets/viewmodel/ListDataSource.ets
arkts
totalCount
最高价 LazyForEach 调用这个方法获取可见区域总数
public totalCount(): number { return this.listData.length; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left totalCount 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#numb...
public totalCount(): number { return this.listData.length; }
https://github.com/Eklps/harmony-mall-perf
792ebab05418a2cf5931fe517c54a098c051e6ea
github
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/services/LibFreeRDP.ets
arkts
configureAudio
Configure audio settings @param playback Enable audio playback @param capture Enable audio capture (microphone) @param quality Audio quality: 0=dynamic, 1=medium, 2=high
static configureAudio(inst: number, playback: boolean, capture: boolean, quality: number): boolean { if (!LibFreeRDP.ensureNativeReady()) { return false; } if (inst === 0) { return false; } try { return freerdpNative!.freerdpConfigureAudio(inst, playback, capture, quality); }...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left configureAudio AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left inst AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left n...
static configureAudio(inst: number, playback: boolean, capture: boolean, quality: number): boolean { if (!LibFreeRDP.ensureNativeReady()) { return false; } if (inst === 0) { return false; } try { return freerdpNative!.freerdpConfigureAudio(inst, playback, capture, quality); }...
https://github.com/tangwengang-del/freerdp-harmonyos
a8cd1ff7059d8b15a4889ff2058fe213c1539bbc
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Workflow/WorkflowCapabilities.ets
arkts
initializeCapabilities
从JSON配置初始化能力
initializeCapabilities(sourceConfig: Record<string, Object>): Map<CapabilityType, Object> { const capabilities = new Map<CapabilityType, Object>(); // 1. URL解析能力 if (this.hasCapability(sourceConfig, 'metadata', 'alternativeUrls')) { const metadata = sourceConfig['metadata'] as Record<string, Ob...
AST#program#Left AST#expression_statement#Left AST#sequence_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left initializeCapabilities AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left sourceConfig AST#identifier#Ri...
initializeCapabilities(sourceConfig: Record<string, Object>): Map<CapabilityType, Object> { const capabilities = new Map<CapabilityType, Object>(); // 1. URL解析能力 if (this.hasCapability(sourceConfig, 'metadata', 'alternativeUrls')) { const metadata = sourceConfig['metadata'] as Record<string, Ob...
https://github.com/DaLongZhuaZi/manxia
ae07b4df16761dc8c3cc8891c6da003c086ee8ea
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/TarPackager.ets
arkts
writeString
写入字符串到 Uint8Array (UTF-8编码) [修复] 正确处理UTF-8编码,支持中文等多字节字符
private writeString(view: Uint8Array, offset: number, str: string, maxLength: number): void { try { // 使用TextEncoder将字符串转换为UTF-8字节数组 const encoder = new util.TextEncoder(); const encoded: Uint8Array = encoder.encodeInto(str); if (!encoded || encoded.length === 0) { // 如果编码失败...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left writeString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left view AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left U...
private writeString(view: Uint8Array, offset: number, str: string, maxLength: number): void { try { // 使用TextEncoder将字符串转换为UTF-8字节数组 const encoder = new util.TextEncoder(); const encoded: Uint8Array = encoder.encodeInto(str); if (!encoded || encoded.length === 0) { // 如果编码失败...
https://github.com/DaLongZhuaZi/manxia
1878d26bcea2c4213f339aa90fc89805f757d7af
github
Tencent-RTC/TUIKit_Harmony
atomic_x/src/main/ets/messagelist/components/MessageList.ets
arkts
showForwardTargetSelector
Show the forward target selector dialog (public method for parent component)
showForwardTargetSelector() { this.forwardDialogController = new CustomDialogController({ builder: ForwardTargetSelector({ currentConversationID: this.conversationID, onConfirm: (conversationIDs: string[]) => { this.forwardMessagesToConversations(conversationIDs); }, ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left showForwardTargetSelector 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#statemen...
showForwardTargetSelector() { this.forwardDialogController = new CustomDialogController({ builder: ForwardTargetSelector({ currentConversationID: this.conversationID, onConfirm: (conversationIDs: string[]) => { this.forwardMessagesToConversations(conversationIDs); }, ...
https://github.com/Tencent-RTC/TUIKit_Harmony
e22a9d03af41732e151412f1bdf42bd00e454cad
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/String.ets
arkts
substring
Selects a substring of this String, starting at a specified index and ending at index before another specified index. @param begin to start substring @param end to end before at @throws StringIndexOutOfBoundsException if begin is negative or >= length @throws StringIndexOutOfBoundsException if end >= length @returns ne...
public substring(begin: number, end: number): String { return this.substring(begin as int, end as int) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left substring AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left begin AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left numbe...
public substring(begin: number, end: number): String { return this.substring(begin as int, end as int) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
1ceb04e00ac88eca466b817efcf66517fdd42dcd
gitee
CLMC2025/Vignette
entry/src/main/ets/ui/EnhancedCards.ets
arkts
createDefaultState
创建默认卡片状态
static createDefaultState(): CardState { return new CardState(); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createDefaultState 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 Car...
static createDefaultState(): CardState { return new CardState(); }
https://github.com/CLMC2025/Vignette
342eec265ac950b081810785d2d5f4f3516fce07
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/SharedLedgerService.ets
arkts
getUserLedgers
获取用户的所有账本
static async getUserLedgers(userId: number): Promise<SharedLedger[]> { try { return await SharedLedgerDAO.getByUserId(userId); } catch (error) { console.error('[SharedLedgerService] 获取用户账本失败:', error); return []; } }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left getUserLedgers AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : ...
static async getUserLedgers(userId: number): Promise<SharedLedger[]> { try { return await SharedLedgerDAO.getByUserId(userId); } catch (error) { console.error('[SharedLedgerService] 获取用户账本失败:', error); return []; } }
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
87ddea0b7b7eb3d48dd497a1fa32f7c41542ef68
github