nwo
stringclasses
449 values
path
stringlengths
9
173
language
stringclasses
1 value
identifier
stringlengths
1
53
docstring
stringlengths
5
4.13k
function
stringlengths
10
87.2k
ast_function
stringlengths
351
354k
obf_function
stringlengths
10
87.2k
url
stringlengths
30
175
function_sha
stringlengths
40
40
source
stringclasses
3 values
DaLongZhuaZi/manxia
entry/src/main/ets/libs/htmlparser/LegadoHtmlBridge.ets
arkts
parseIndexStr
解析索引字符串
private parseIndexStr(indexStr: string, result: IndexResult): void { if (indexStr.includes(':')) { const parts = indexStr.split(':'); result.start = parts[0] ? parseInt(parts[0]) : 0; result.end = parts.length > 1 && parts[1] ? parseInt(parts[1]) : -1; } else { result.indexes.push(pars...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseIndexStr AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left indexStr AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#stri...
private parseIndexStr(indexStr: string, result: IndexResult): void { if (indexStr.includes(':')) { const parts = indexStr.split(':'); result.start = parts[0] ? parseInt(parts[0]) : 0; result.end = parts.length > 1 && parts[1] ? parseInt(parts[1]) : -1; } else { result.indexes.push(pars...
https://github.com/DaLongZhuaZi/manxia
e4402b5bc4525620db80cb16b77eb3d53a4e487b
github
harmonyos/codelabs
HarmonyOS_NEXT/MultiFinancialManagement/features/fund/src/main/ets/viewmodel/ChartViewModel.ets
arkts
getLineChartModel
Get LineChartModel. @param width @param height @returns LineChartModel
getLineChartModel(width?: number, height?: number): LineChartModel { this.lineChartModel = new LineChartModel(); this.topAxis.setDrawAxisLine(false); this.bottomAxis.setLabelCount(3, true); this.bottomAxis.setPosition(XAxisPosition.BOTTOM); this.bottomAxis.setAxisMinimum(0); this.bottomAxis....
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getLineChartModel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left width AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#i...
getLineChartModel(width?: number, height?: number): LineChartModel { this.lineChartModel = new LineChartModel(); this.topAxis.setDrawAxisLine(false); this.bottomAxis.setLabelCount(3, true); this.bottomAxis.setPosition(XAxisPosition.BOTTOM); this.bottomAxis.setAxisMinimum(0); this.bottomAxis....
https://gitee.com/harmonyos/codelabs.git
76d90b3ff4a31ed140b938c1add65619146848c4
gitee
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/AnomalyDetectionDAO.ets
arkts
getStatistics
获取异常统计
static async getStatistics(userId: number): Promise<AnomalyStatistics> { let resultSet: relationalStore.ResultSet | null = null; try { const store = DatabaseManager.getDatabase(); // 获取总数和未确认数 const countSql = ` SELECT COUNT(*) as total_count, SUM(CASE WHEN is_ac...
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 getStatistics AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : A...
static async getStatistics(userId: number): Promise<AnomalyStatistics> { let resultSet: relationalStore.ResultSet | null = null; try { const store = DatabaseManager.getDatabase(); // 获取总数和未确认数 const countSql = ` SELECT COUNT(*) as total_count, SUM(CASE WHEN is_ac...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
275b2cfc84fe1241dc3ffb4374465c4a10102bb2
github
openharmony-tpc/openharmony_tpc_samples
SmartRefreshLayout/library/src/main/ets/components/topRefresh/BezierRadarRefresh.ets
arkts
drawWave
绘制背景波形 @param canvas 画布 @param width 宽度
drawWave(canvas: CanvasRenderingContext2D, width: number) { canvas.clearRect(0, 0, this.mWidth, this.mHeight); canvas.beginPath(); canvas.moveTo(0, 0); canvas.lineTo(0, px2vp(this.mWaveTop)); canvas.quadraticCurveTo(px2vp(this.mWaveOffsetX >= 0 ? (this.mWaveOffsetX) : width / 2), px2vp...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left drawWave AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left canvas AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left CanvasRenderingContext2D AST#i...
drawWave(canvas: CanvasRenderingContext2D, width: number) { canvas.clearRect(0, 0, this.mWidth, this.mHeight); canvas.beginPath(); canvas.moveTo(0, 0); canvas.lineTo(0, px2vp(this.mWaveTop)); canvas.quadraticCurveTo(px2vp(this.mWaveOffsetX >= 0 ? (this.mWaveOffsetX) : width / 2), px2vp...
https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git
38c5fddc5bc42af1e2a5a047d14283a30277312e
gitee
HarmonyOS_Samples/BestPracticeSnippets
ArkUI/UI_Component_Performance_Optimization/entry/src/main/ets/segment/segment8.ets
arkts
UserCardBuilder
[Start Case6] 1. Customizing @Builder Function Components
@Builder function UserCardBuilder(name: string, age?: number, avatarImage?: ResourceStr) { Row() { Row() { Image(avatarImage) .size({ width: 50, height: 50 }) .borderRadius(25) .margin(8) Text(name) .fontSize(30) } Text(`age:${age?.toString()}`) .fontSize(...
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 UserCardBuilder AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#r...
@Builder function UserCardBuilder(name: string, age?: number, avatarImage?: ResourceStr) { Row() { Row() { Image(avatarImage) .size({ width: 50, height: 50 }) .borderRadius(25) .margin(8) Text(name) .fontSize(30) } Text(`age:${age?.toString()}`) .fontSize(...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
46e94a15909920213bef9bf111b3a789e9b2ab01
gitcode
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/common/utils/DAOHelper.ets
arkts
restore
恢复软删除的记录 @param tableName 表名 @param idColumn 主键列名 @param id 主键值 @param errorPrefix 错误消息前缀
static async restore( tableName: string, idColumn: string, id: number, errorPrefix: string = '[DAO]' ): Promise<void> { const store = DatabaseManager.getDatabase(); const now = new Date().toISOString(); const sql = `UPDATE ${tableName} SET is_deleted = 0, updated_at = ? WHERE ${idColumn}...
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 restore AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left tableName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#...
static async restore( tableName: string, idColumn: string, id: number, errorPrefix: string = '[DAO]' ): Promise<void> { const store = DatabaseManager.getDatabase(); const now = new Date().toISOString(); const sql = `UPDATE ${tableName} SET is_deleted = 0, updated_at = ? WHERE ${idColumn}...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
fbe35694caf72365e0f07efd7a8ecd0c00e8cbaf
github
azhu0001/localsend-harmony
entry/src/main/ets/utils/FileProvider.ets
arkts
getDefaultFileDir
文件默认缓存目录 @param context @returns
static getDefaultFileDir(context: Context): string { return `${context.filesDir}/received` }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getDefaultFileDir 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#...
static getDefaultFileDir(context: Context): string { return `${context.filesDir}/received` }
https://gitcode.com/azhu0001/localsend-harmony
96d361f854c642aa3fb420f6a63d175a7b3c1152
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/TypeCreator.ets
arkts
checkNotFrozen
Checks if modificatiosn are allowed @param freezable to check if modifications are allowed @throws TypeAPICreateException if it is frozen
function checkNotFrozen(freezable: Freezable): void throws { if (freezable.isFrozen()) { throw new TypeAPICreateException("modifying frozen entity") } }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left checkNotFrozen AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left freezable AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS...
function checkNotFrozen(freezable: Freezable): void throws { if (freezable.isFrozen()) { throw new TypeAPICreateException("modifying frozen entity") } }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
50a36145ea0ffe90c3924328c300a947476c775d
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/AsyncMutex.ets
arkts
unlock
Releases the mutex, allowing other coroutines to acquire it. @syscap SystemCapability.Utils.Lang
public unlock(): void { if (this.waiters_.load() == 0) { throw new IllegalLockStateError(); } if (this.waiters_.fetchSub(1) == 1) { return; } this.waitersList_.resume(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left unlock 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 A...
public unlock(): void { if (this.waiters_.load() == 0) { throw new IllegalLockStateError(); } if (this.waiters_.fetchSub(1) == 1) { return; } this.waitersList_.resume(); }
https://gitcode.com/iop123123/arkts-static-skills
762d5da1e463f43f3ca4f9b721d3e96c689380d6
gitcode
openharmony-sig/knowledge_demo_shopping
FA/MyAccountBook/entry/src/main/ets/MainAbility/pages/index.ets
arkts
startAbilityContinuation
分布式拉起
startAbilityContinuation(remoteDevice:RemoteDevice) { this.packageName = 'com.example.myaccountbook' var wantValue = { bundleName: 'com.example.myaccountbook', abilityName: 'com.example.myaccountbook.MainAbility', deviceId: remoteDevice.deviceId, parameters: { data: 1 } ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left startAbilityContinuation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left remoteDevice AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left RemoteDevice AST#identif...
startAbilityContinuation(remoteDevice:RemoteDevice) { this.packageName = 'com.example.myaccountbook' var wantValue = { bundleName: 'com.example.myaccountbook', abilityName: 'com.example.myaccountbook.MainAbility', deviceId: remoteDevice.deviceId, parameters: { data: 1 } ...
https://gitee.com/openharmony-sig/knowledge_demo_shopping.git
86dff3c2b20019c274a371435d863f480b583acb
gitee
kumaleap/ArkLuban
library/src/main/ets/luban/LubanUtils.ets
arkts
copyToCache
@deprecated 请使用 copyToTemp 方法 将受权限限制的文件复制到应用缓存目录
static async copyToCache(srcFileUri: string, targetDir: string = "luban_temp"): Promise<string> { LogUtil.warn('⚠️ copyToCache 方法已废弃,请使用 copyToTemp 方法'); return await LubanUtils.copyToTemp(srcFileUri, targetDir); }
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 copyToCache AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left srcFileUri AST#identifier#Right AST#ERROR#Left AST#:#Left :...
static async copyToCache(srcFileUri: string, targetDir: string = "luban_temp"): Promise<string> { LogUtil.warn('⚠️ copyToCache 方法已废弃,请使用 copyToTemp 方法'); return await LubanUtils.copyToTemp(srcFileUri, targetDir); }
https://github.com/kumaleap/ArkLuban
1161bb41c427aaf32fd4a66dff101f5926591038
github
Joker-x-dev/CoolMallArkTS
core/designsystem/src/main/ets/component/Scroll.ets
arkts
build
构建带小内边距的垂直滚动布局 @returns {void} 无返回值
build(): void { VerticalScroll({ scroller: this.scroller, fillMaxSize: this.fillMaxSize, fillMaxWidth: this.fillMaxWidth, widthValue: this.widthValue, heightValue: this.heightValue, scrollBarState: this.scrollBarState, paddingValue: $r("app.float.space_padding_small"), ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#...
build(): void { VerticalScroll({ scroller: this.scroller, fillMaxSize: this.fillMaxSize, fillMaxWidth: this.fillMaxWidth, widthValue: this.widthValue, heightValue: this.heightValue, scrollBarState: this.scrollBarState, paddingValue: $r("app.float.space_padding_small"), ...
https://github.com/Joker-x-dev/CoolMallArkTS
5edb8472a74ab4e0735b9490a0b9f3164325db2f
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets
arkts
constructor
Constructor for StringType @syscap SystemCapability.Utils.Lang @FaAndStageModel
public constructor() { super(TypeAPI.convertTypeDescriptor("std.core.String"), getBootRuntimeLinker()) }
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#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { A...
public constructor() { super(TypeAPI.convertTypeDescriptor("std.core.String"), getBootRuntimeLinker()) }
https://gitcode.com/iop123123/arkts-static-skills
f85ee4df8738c98f41b4f3a6e3250cf8a7d752ae
gitcode
zhubowen-bot/Bowen_ArkWeb_framework
entry/src/main/ets/delegate/IWebDownloadFile.ets
arkts
checkPathExists
路径存在性检查
private checkPathExists(path: string): boolean { try { return fileIo.accessSync(path) } catch { return false } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left checkPathExists AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le...
private checkPathExists(path: string): boolean { try { return fileIo.accessSync(path) } catch { return false } }
https://github.com/zhubowen-bot/Bowen_ArkWeb_framework
c4e109a09cc86b18b9fd7307a3cb53f984909682
github
openharmony/codelabs
Media/ImageEdit/entry/src/main/ets/viewModel/Ratio.ets
arkts
constructor
Constructor. @param w @param h
constructor(w: number, h: number) { this.w = w; this.h = h; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left w AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#...
constructor(w: number, h: number) { this.w = w; this.h = h; }
https://gitee.com/openharmony/codelabs.git
8b56b4684e18ee6bfc8e6bc04e8f488d6c880f6a
gitee
Joker-x-dev/CoolMallArkTS
core/data/src/main/ets/repository/AddressRepository.ets
arkts
updateAddress
修改地址 @param params 地址信息 @returns 修改结果
async updateAddress(params: Address): Promise<NetworkResponse<void>> { return this.networkDataSource.updateAddress(params); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left updateAddress 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 :...
async updateAddress(params: Address): Promise<NetworkResponse<void>> { return this.networkDataSource.updateAddress(params); }
https://github.com/Joker-x-dev/CoolMallArkTS
2c50cab9bfe254542db65fa93e2df4774a90c90a
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/SharedLedgerService.ets
arkts
checkPermission
==================== 权限检查 ==================== 检查用户权限
static async checkPermission( ledgerId: number, userId: number, requiredRole: 'owner' | 'admin' | 'member' | 'viewer' ): Promise<boolean> { try { const member = await LedgerMemberDAO.getMember(ledgerId, userId); if (!member) { return false; } // 获取成员角色等级 let me...
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 checkPermission AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left ledgerId AST#identifier#Right AST#ERROR#Left AST#:#Left...
static async checkPermission( ledgerId: number, userId: number, requiredRole: 'owner' | 'admin' | 'member' | 'viewer' ): Promise<boolean> { try { const member = await LedgerMemberDAO.getMember(ledgerId, userId); if (!member) { return false; } // 获取成员角色等级 let me...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
f8df5448163ad1e7fbc595abf91ccf0fc28a4c81
github
arkui-x/samples
CodeLab/Cases/feature/backgroundblur/src/main/ets/pages/CustomTabsComponent.ets
arkts
build
TabContent组件
build() { Stack({ alignContent: Alignment.Bottom }) { Tabs({ index: this.selectedIndex, barPosition: BarPosition.End, controller: this.controller }) { ForEach(this.tabsInfoList, (item: TabInfo) => { TabContent() { item.tabContent.builder(item.title) } .expan...
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() { Stack({ alignContent: Alignment.Bottom }) { Tabs({ index: this.selectedIndex, barPosition: BarPosition.End, controller: this.controller }) { ForEach(this.tabsInfoList, (item: TabInfo) => { TabContent() { item.tabContent.builder(item.title) } .expan...
https://gitcode.com/arkui-x/samples
1a0497bdc138bfbd1cb8d0770dedf244c7aceecc
gitcode
honjow/Next2V
shared/src/main/ets/storage/LocalDataCloudSync.ets
arkts
ensurePermission
Request the user-grant DISTRIBUTED_DATASYNC permission that setDistributedTables requires. Pops the system dialog only when not already decided; returns true when granted.
static async ensurePermission(context: common.UIAbilityContext): Promise<boolean> { try { const at: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager() const result = await at.requestPermissionsFromUser(context, [SYNC_PERMISSION]) const authResults: number[] = result.authResults ...
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 ensurePermission AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left...
static async ensurePermission(context: common.UIAbilityContext): Promise<boolean> { try { const at: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager() const result = await at.requestPermissionsFromUser(context, [SYNC_PERMISSION]) const authResults: number[] = result.authResults ...
https://github.com/honjow/Next2V
9cdfba8bfcdf31d28e933ce26a4996f300591759
github
SMAT-Lab/Homecheck-Sec2026
test/unittest/sample/NoExtraBooleanCast/ets/NoExtraBooleanCastReport1.ets
arkts
foo
Adjacent tokens tests
function *foo() { yield(!!a || d) ? b : c }
AST#program#Left AST#generator_function_declaration#Left AST#function#Left function AST#function#Right AST#*#Left * AST#*#Right AST#identifier#Left foo 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#...
function *foo() { yield(!!a || d) ? b : c }
https://github.com/SMAT-Lab/Homecheck-Sec2026
638bc4321a9267a2383a880cb2cba62339e01940
github
kumaleap/ArkLuban
library/src/main/ets/luban/Luban.ets
arkts
with
创建 Luban 构建器 @param paths 图片路径,可以是单个路径或路径数组 @returns Luban 构建器实例
static with(paths: string | string[]): LubanBuilder { return new LubanBuilder(paths); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#ERROR#Right AST#with_statement#Left AST#with#Left with AST#with#Right AST#parenthesized_expression#Left AST#(#Left ( AST#(#Right AST#identifier#Left paths AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#union_type#Lef...
static with(paths: string | string[]): LubanBuilder { return new LubanBuilder(paths); }
https://github.com/kumaleap/ArkLuban
9953c5881f12837d2029d4c081514b4b8d8b552a
github
tdcare/tdwebrtc
src/main/ets/utils/StrUtil.ets
arkts
repeat
将字符串重复指定次数 @param str 要重复的字符串 @param n 重复的次数 @returns
static repeat(str: string = '', n: number = 1): string { return str.repeat(n); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left repeat AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left...
static repeat(str: string = '', n: number = 1): string { return str.repeat(n); }
https://github.com/tdcare/tdwebrtc
b77fe31e317a56be57bf88699f2727a733f970c2
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/ThemeManager.ets
arkts
getCustomThemeSplashBackground
获取当前自定义主题的开屏背景图片路径
public getCustomThemeSplashBackground(): string { return AppStorage.get<string>(CUSTOM_THEME_KEYS.SPLASH_BACKGROUND_IMAGE) || ''; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCustomThemeSplashBackground 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#...
public getCustomThemeSplashBackground(): string { return AppStorage.get<string>(CUSTOM_THEME_KEYS.SPLASH_BACKGROUND_IMAGE) || ''; }
https://github.com/DaLongZhuaZi/manxia
ea35c56dae583e40a55d9a8185aa98d0f81dd5f9
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/DataManager.ets
arkts
clearUserReadHistory
清除用户阅读历史
public async clearUserReadHistory(userId: string): Promise<void> { try { await this.databaseManager.delete('read_history', 'userId = ?', [userId]); logger.info(TAG, `用户 ${userId} 的阅读历史已清除`); } catch (error) { logger.error(TAG, `清除阅读历史失败: ${error}`); throw error as Error; } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left clearUserReadHistory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#L...
public async clearUserReadHistory(userId: string): Promise<void> { try { await this.databaseManager.delete('read_history', 'userId = ?', [userId]); logger.info(TAG, `用户 ${userId} 的阅读历史已清除`); } catch (error) { logger.error(TAG, `清除阅读历史失败: ${error}`); throw error as Error; } }
https://github.com/DaLongZhuaZi/manxia
92e118002e85c8cf397e09a04e3398c9a3caddf0
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test26_original_index.ets
arkts
testEpsilonCompare
--- Number.EPSILON comparison ---
function testEpsilonCompare(): string { let a: number = 0.1 + 0.2; let b: number = 0.3; let diff: number = a - b; if (diff < 0) { diff = -diff; } let close: boolean = diff < 0.0001; return String(close); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testEpsilonCompare AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefin...
function testEpsilonCompare(): string { let a: number = 0.1 + 0.2; let b: number = 0.3; let diff: number = a - b; if (diff < 0) { diff = -diff; } let close: boolean = diff < 0.0001; return String(close); }
https://github.com/miaochiahao/ark-ghidra
8db23ed22df83cc9f4f8fcbeed346428f8ab37bd
github
ChangJing01/HarmonyOS-FinalProject
entry/src/main/ets/pages/ShoppingCartPage.ets
arkts
aboutToAppear
组件加载时也运行一次
aboutToAppear() { this.onCartChange(); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left...
aboutToAppear() { this.onCartChange(); }
https://github.com/ChangJing01/HarmonyOS-FinalProject
a93d3d0edaf1f8fe874e04af137359b7bcf3e208
github
offlinecat-dev/OCNetORM
example/UsageExample.ets
arkts
paginationExample
分页查询示例
async function paginationExample(): Promise<void> { const repository = new Repository('ArticleEntity') // 使用 Repository 的分页方法 const page1 = await repository.findPaginated(1, 10) console.info(`第一页数据: ${page1.data.length} 条`) console.info(`总记录数: ${page1.total}`) console.info(`总页数: ${page1.totalPages}`) con...
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left paginationExample AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left A...
async function paginationExample(): Promise<void> { const repository = new Repository('ArticleEntity') // 使用 Repository 的分页方法 const page1 = await repository.findPaginated(1, 10) console.info(`第一页数据: ${page1.data.length} 条`) console.info(`总记录数: ${page1.total}`) console.info(`总页数: ${page1.totalPages}`) con...
https://github.com/offlinecat-dev/OCNetORM
9b838eca4630b88ed1f0bf214a1b9f85a957cde6
github
zgzm78/VMALL
entry/src/main/ets/view/WaterFlowComponent.ets
arkts
onSearchKeywordChange
Handle search keyword change.
onSearchKeywordChange(): void { this.updateDataSource(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onSearchKeywordChange 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#statem...
onSearchKeywordChange(): void { this.updateDataSource(); }
https://github.com/zgzm78/VMALL
4a3cea19b7e7b6ee70cb9c67b403d763979bd72a
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/database/DatabaseConfigOptimizer.ets
arkts
setSynchronousMode
设置同步模式为 NORMAL 配置: - synchronous = NORMAL(中等安全级别) 模式对比: - FULL(默认):每次写入都同步到磁盘,最安全但最慢 - NORMAL:关键时刻同步,平衡性能和安全 - OFF:不同步,最快但可能丢失数据 优势: - 写入性能提升 30-50% - 仍保持较高的数据安全性 - 适合移动应用场景 权衡: - 优点:性能提升明显 - 缺点:极端情况下(如系统崩溃)可能丢失最后几个事务 - 移动设备场景:风险可接受
private static async setSynchronousMode(store: relationalStore.RdbStore): Promise<void> { try { await store.executeSql('PRAGMA synchronous=NORMAL;'); console.log('[DatabaseConfigOptimizer] ✓ 同步模式已设置为 NORMAL'); console.log(' - 写入性能提升 30-50%'); console.log(' - 保持较高数据安全性'); console.lo...
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 setSynchronousMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#L...
private static async setSynchronousMode(store: relationalStore.RdbStore): Promise<void> { try { await store.executeSql('PRAGMA synchronous=NORMAL;'); console.log('[DatabaseConfigOptimizer] ✓ 同步模式已设置为 NORMAL'); console.log(' - 写入性能提升 30-50%'); console.log(' - 保持较高数据安全性'); console.lo...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
01fad0ed50a42386c15641f882f8cdc2c57da677
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ets
arkts
compare
Compares the current RationalNumber object with the target RationalNumber object and returns the comparison result. @param { RationalNumber } other RationalNumber object. @returns { number } if equal return 0, If the givens smaller than the current return 1, otherwise return -1.
public compare(other: RationalNumber): int { if (this.mnum === other.mnum && this.mden === other.mden) { return 0; } else if (this.isNaN()) { return 1; } else if (other.isNaN()) { return -1; } else if ((this.mden ===...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left compare AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Rationa...
public compare(other: RationalNumber): int { if (this.mnum === other.mnum && this.mden === other.mden) { return 0; } else if (this.isNaN()) { return 1; } else if (other.isNaN()) { return -1; } else if ((this.mden ===...
https://gitcode.com/iop123123/arkts-static-skills
1914c2ab50819fa76159be2be548076263ca59a1
gitcode
openharmony/codelabs
Media/ImageEdit/entry/src/main/ets/viewModel/CropShow.ets
arkts
isCropRectTouch
Get touch rect area. @param x @param y @returns
isCropRectTouch(x: number, y: number): boolean { let w = this.touchBound; let h = this.touchBound; let crop = this.cropRect; let outer = new RectF(); outer.set(crop.left - w, crop.top - h, crop.right + w, crop.bottom + h); let inner = new RectF(); inner.set(crop.left + w, crop.top + h, cro...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isCropRectTouch AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left x AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left , AS...
isCropRectTouch(x: number, y: number): boolean { let w = this.touchBound; let h = this.touchBound; let crop = this.cropRect; let outer = new RectF(); outer.set(crop.left - w, crop.top - h, crop.right + w, crop.bottom + h); let inner = new RectF(); inner.set(crop.left + w, crop.top + h, cro...
https://gitee.com/openharmony/codelabs.git
63a863a0c12446bebb5d1627f89a60c74680a659
gitee
HarmonyOS_Samples/guide-snippets
ArkTS/ArkTSCompilationToolchain/ArkBytecode/FundamentalsAndNamingConventions/entry/src/main/ets/pages/Index.ets
arkts
foo
[End renaming_index] [Start original_function_name]
function foo() {}; // 原函数名为"foo"
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#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#}#Left } AST#}#Right AS...
function foo() {}; // 原函数名为"foo"
https://gitcode.com/HarmonyOS_Samples/guide-snippets
a0d564231b71ee3ee86a87956e12af721368744b
gitcode
Joker-x-dev/CoolMallArkTS
core/base/src/main/ets/viewmodel/BaseViewModel.ets
arkts
onDidBuild
组件构建完成(API 12+) @returns {void} 无返回值
onDidBuild(): void { }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onDidBuild AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left...
onDidBuild(): void { }
https://github.com/Joker-x-dev/CoolMallArkTS
d82fe83bac7f4b22f5fb69d1bc601f338a9eafbc
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/ChartData.ets
arkts
getMaxEntryCountSet
Returns the DataSet object with the maximum number of entries or null if there are no DataSets. @return
public getMaxEntryCountSet(): T | null { if (this.mDataSets == null || this.mDataSets.isEmpty()) return null; let max: T = this.mDataSets.get(0); for (let data of this.mDataSets.dataSource) { if (data.getEntryCount() > max.getEntryCount()) max = data; } return max; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getMaxEntryCountSet 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#...
public getMaxEntryCountSet(): T | null { if (this.mDataSets == null || this.mDataSets.isEmpty()) return null; let max: T = this.mDataSets.get(0); for (let data of this.mDataSets.dataSource) { if (data.getEntryCount() > max.getEntryCount()) max = data; } return max; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
6bc22c69167f29e4628f19b1ca441b9b547c1132
gitee
YANGZX22/Voot
entry/src/main/ets/entryformability/EntryFormAbility.ets
arkts
onUpdateForm
Called by system for interval-based updates (every 30 min when updateDuration = 1)
onUpdateForm(formId: string) { console.info('[EntryFormAbility] onUpdateForm: ' + formId); this.updateFormData(formId); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onUpdateForm AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left formId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Righ...
onUpdateForm(formId: string) { console.info('[EntryFormAbility] onUpdateForm: ' + formId); this.updateFormData(formId); }
https://github.com/YANGZX22/Voot
380c0afac77f80b41a7b4fb84a5cf29acf038432
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/BaseEntry.ets
arkts
setData
Sets additional data this Entry should represent. @param data
public setData(data: Object): void { this.mData = data; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setData 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#identifier#Left Object A...
public setData(data: Object): void { this.mData = data; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
c76ad70f6a4943667744c61c40af27903b0fa2f8
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/BookshelfCategoryManager.ets
arkts
autoUpdateCategoryCovers
自动更新分类封面(使用分类中前4个内容的封面) @param categoryId 分类ID @param coverPaths 封面路径数组(按添加顺序)
async autoUpdateCategoryCovers(categoryId: string, coverPaths: string[]): Promise<void> { const category = this.categories.find(c => c.id === categoryId); if (category) { // 取前4个有效封面 const validCovers = coverPaths.filter(p => p && p.length > 0).slice(0, 4); category.coverImages = validCovers...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left autoUpdateCategoryCovers AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left categoryId AST#identifier#Right AST#type_annotation#Le...
async autoUpdateCategoryCovers(categoryId: string, coverPaths: string[]): Promise<void> { const category = this.categories.find(c => c.id === categoryId); if (category) { // 取前4个有效封面 const validCovers = coverPaths.filter(p => p && p.length > 0).slice(0, 4); category.coverImages = validCovers...
https://github.com/DaLongZhuaZi/manxia
117982f8ffeebfef4ab3844eeaf9fa27b2d6779a
github
iHongRen/harmony-study-demo
entry/src/main/ets/pages/myemitter/myemitter.ets
arkts
on
注册观察者回调 @param observer 观察者对象 @param callback 回调函数,泛型T
public static on<T>(observer: Object, callback: UserCallback<T>): void { UserEmitter.map.set(observer, callback as UserCallback<T>); }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left on AST#identifier#Right AST#ERROR#Right AST#<#Left < AST#<#Right AST#identifier#Left T A...
public static on<T>(observer: Object, callback: UserCallback<T>): void { UserEmitter.map.set(observer, callback as UserCallback<T>); }
https://github.com/iHongRen/harmony-study-demo
a48e34cb1f72ca1f50739b644c26ecc045dbb250
github
openharmony-tpc/ohos_coap
libcoap/src/main/ets/components/mainpage/CoapClient.ets
arkts
setPort
客户端设置请求端口号 @param port 端口号
setPort(port: number) { this.coapClient.setPort(port.toString(), this.classId); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setPort AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left port AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)...
setPort(port: number) { this.coapClient.setPort(port.toString(), this.classId); }
https://gitee.com/openharmony-tpc/ohos_coap.git
1a95d2def46a40271ca7818f0f49e4ca2cd218e1
gitee
openharmony/applications_calendar_data
datamanager/src/main/ets/processor/instances/InstanceQueryParams.ets
arkts
parseOrderByFromQueryMap
try parse orderBy params from queryMap @param queryMap params map parsed from uri @param params the object to save parse result
function parseOrderByFromQueryMap(queryMap: Map<string, string>, params: InstancesQueryParams): void { const orderByAsc = queryMap.get(KEY_ORDER_BY_ASC) as string; if (isUninterrupted(orderByAsc)) { params.setOrderByAsc(orderByAsc); } const orderByDesc = queryMap.get(KEY_ORDER_BY_DESC) as string; if (isUn...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left parseOrderByFromQueryMap AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left queryMap AST#identifier#Right AST#type_annotation#Left AST#:#...
function parseOrderByFromQueryMap(queryMap: Map<string, string>, params: InstancesQueryParams): void { const orderByAsc = queryMap.get(KEY_ORDER_BY_ASC) as string; if (isUninterrupted(orderByAsc)) { params.setOrderByAsc(orderByAsc); } const orderByDesc = queryMap.get(KEY_ORDER_BY_DESC) as string; if (isUn...
https://gitee.com/openharmony/applications_calendar_data.git
af2398fb4e9b20067ba7de1df21165a7daedcba5
gitee
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/hosts/userdata/settings/classes/meowManagedSettings.ets
arkts
requestSaveToDisk
Save settings to disk. Has a 500 ms timeout by default. @returns true if success, false if failed.
requestSaveToDisk(timeout: number = 500) { if (!this.ready) { meow(`Rejected. Settings not ready`, 'meowSettings][requestSaveToDisk', meowLevel.WARN); return false; } clearTimeout(this.timeoutIdSaveToDisk); this.timeoutIdSaveToDisk = setTimeout(async () => { this.timeoutIdSaveToDisk...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left requestSaveToDisk AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left timeout AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#ident...
requestSaveToDisk(timeout: number = 500) { if (!this.ready) { meow(`Rejected. Settings not ready`, 'meowSettings][requestSaveToDisk', meowLevel.WARN); return false; } clearTimeout(this.timeoutIdSaveToDisk); this.timeoutIdSaveToDisk = setTimeout(async () => { this.timeoutIdSaveToDisk...
https://github.com/awaLiny2333/LinysBrowser_NEXT
ca32c40644f5710fceb2a3e971d27913c91375d3
github
openharmony/applications_calendar_data
datamanager/src/main/ets/processor/reminders/RemindersProcessor.ets
arkts
isEventSameWithReminderId
检查待插入的 reminder 与 event 表中是否存在相同 event_id 的元组 @param rdbStore rdb数据库 @param values 插入操作的数据 @return true 相同 false 不相同
async function isEventSameWithReminderId(rdbStore: data_rdb.RdbStore, values: data_rdb.ValuesBucket): Promise<boolean> { Log.debug(TAG, 'isEventSameWithReminderId start'); let resultSet = await queryEventIdAndCreatorByReminder(rdbStore, values); try { if (resultSet ===...
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left isEventSameWithReminderId AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left rdbStore AST#identifier...
async function isEventSameWithReminderId(rdbStore: data_rdb.RdbStore, values: data_rdb.ValuesBucket): Promise<boolean> { Log.debug(TAG, 'isEventSameWithReminderId start'); let resultSet = await queryEventIdAndCreatorByReminder(rdbStore, values); try { if (resultSet ===...
https://gitee.com/openharmony/applications_calendar_data.git
63f0f798688ea518fe8c59099fb2135a619528c3
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Parsers/EBookParser.ets
arkts
extractTagsFromFileName
从文件名提取标签
private extractTagsFromFileName(fileName: string): string[] { const tags: string[] = ['TXT']; const tagKeywords = ['玄幻', '都市', '言情', '科幻', '武侠', '仙侠', '历史', '军事', '网游', '竞技', '灵异', '同人']; for (const keyword of tagKeywords) { if (fileName.includes(keyword)) { tags.push(keyword); } }...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left extractTagsFromFileName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left fileName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left strin...
private extractTagsFromFileName(fileName: string): string[] { const tags: string[] = ['TXT']; const tagKeywords = ['玄幻', '都市', '言情', '科幻', '武侠', '仙侠', '历史', '军事', '网游', '竞技', '灵异', '同人']; for (const keyword of tagKeywords) { if (fileName.includes(keyword)) { tags.push(keyword); } }...
https://github.com/DaLongZhuaZi/manxia
12deb894804896228bb35d81d91dbc05b2b5395b
github
HarmonyOS_Samples/sample_in_harmonyos
common/src/main/ets/util/AppTypeUtil.ets
arkts
getAppType
Get app type. @returns
private static getAppType(): string | undefined { return AppStorage.get(AppTypeUtil.appTypeKey); }
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 getAppType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:...
private static getAppType(): string | undefined { return AppStorage.get(AppTypeUtil.appTypeKey); }
https://gitcode.com/HarmonyOS_Samples/sample_in_harmonyos
dbe129ceaa624c1f376c4ef66075342c8643f3c8
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Task/BackgroundTaskManager.ets
arkts
updateTaskProgress
更新任务进度
private updateTaskProgress(taskId: string, current: number, total: number, message: string): void { const task = this.tasks.get(taskId); if (!task) { return; } const safeTotal = total > 0 ? total : 0; const safeCurrent = safeTotal > 0 ? Math.max(0, Math.min(current, safeTotal)) ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left updateTaskProgress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left taskId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi...
private updateTaskProgress(taskId: string, current: number, total: number, message: string): void { const task = this.tasks.get(taskId); if (!task) { return; } const safeTotal = total > 0 ? total : 0; const safeCurrent = safeTotal > 0 ? Math.max(0, Math.min(current, safeTotal)) ...
https://github.com/DaLongZhuaZi/manxia
e236502e785391a97e327c1fdb6e5724b59423bc
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Task/BackgroundTaskHelper.ets
arkts
stopAutoRefresh
停止自动续期
private static stopAutoRefresh(): void { if (BackgroundTaskHelper.refreshTimer !== -1) { clearInterval(BackgroundTaskHelper.refreshTimer); BackgroundTaskHelper.refreshTimer = -1; logger.info(TAG, '后台长时任务自动续期已停止'); } }
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 stopAutoRefresh AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right ...
private static stopAutoRefresh(): void { if (BackgroundTaskHelper.refreshTimer !== -1) { clearInterval(BackgroundTaskHelper.refreshTimer); BackgroundTaskHelper.refreshTimer = -1; logger.info(TAG, '后台长时任务自动续期已停止'); } }
https://github.com/DaLongZhuaZi/manxia
2ea07e1d79a173acf4b8faf4a7017ac518605233
github
openharmony-tpc/openharmony_tpc_samples
EspBlufiForHarmony/entry/src/main/ets/pages/ConfigureOptions.ets
arkts
checkSoftAP
SoftAP
checkSoftAP(params: BlufiConfigureParams): boolean { if (this.softAPSSID !== null && this.softAPPassword !== null) { let channel: number = new Number(this.softAPChannel) as number; params.setSoftAPChannel(channel); let connect: number = new Number(this.softAPConnect) as number; params.setS...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left checkSoftAP AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left params AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left BlufiConfigureParams AST#identifier#Right ...
checkSoftAP(params: BlufiConfigureParams): boolean { if (this.softAPSSID !== null && this.softAPPassword !== null) { let channel: number = new Number(this.softAPChannel) as number; params.setSoftAPChannel(channel); let connect: number = new Number(this.softAPConnect) as number; params.setS...
https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git
b4bf2777c6187a37b91f06dd5c533afb2cb0ae3e
gitee
openharmony-tpc/mp4parser
library/src/main/ets/mp4parser/MP4Parser.ets
arkts
ffmpegCmd
ffmpeg cmd @param cmd @param callBack
static ffmpegCmd(cmd: string, callBack: ICallBack) { mp4parser_napi.exeFFmpegCmd(cmd) .then((res: number) => { callBack.callBackResult(res) }); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left ffmpegCmd AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left cmd AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string ...
static ffmpegCmd(cmd: string, callBack: ICallBack) { mp4parser_napi.exeFFmpegCmd(cmd) .then((res: number) => { callBack.callBackResult(res) }); }
https://gitee.com/openharmony-tpc/mp4parser.git
4ee95bf304319efbc12c3061b0d26840ae4fa4ee
gitee
FadingLight9291117/vscode-arkts
examples/method-jump-test.ets
arkts
syncOpenStatus
方法定义 1
syncOpenStatus() { console.log('Syncing open status:', this.isOpen); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left syncOpenStatus 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...
syncOpenStatus() { console.log('Syncing open status:', this.isOpen); }
https://github.com/FadingLight9291117/vscode-arkts
047740f5dfb1311902340569d202e7e8150f3c0a
github
AetheriumSimulator/qemu-hmos
entry/src/main/ets/managers/QemuVMManager.ets
arkts
takeScreenshot
通过 QMP screendump 获取虚拟机屏幕截图 由于 VNC 后端崩溃,使用这个作为替代方案显示 VM 预览 @param vmName 虚拟机名称 @param outputPath 输出文件路径(PPM 格式) @returns 是否成功
async takeScreenshot(vmName: string, outputPath: string): Promise<boolean> { try { const native = await this.ensureNative() if (native.takeScreenshot) { return native.takeScreenshot(vmName, outputPath) } console.error('[QemuVMManager] takeScreenshot 不可用') return false } c...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left takeScreenshot AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left vmName AST#identifier#Right AST#type_annotation#Left AST#:#Left ...
async takeScreenshot(vmName: string, outputPath: string): Promise<boolean> { try { const native = await this.ensureNative() if (native.takeScreenshot) { return native.takeScreenshot(vmName, outputPath) } console.error('[QemuVMManager] takeScreenshot 不可用') return false } c...
https://github.com/AetheriumSimulator/qemu-hmos
e18011bf668cfc3db10a44a28f9becba8b7b5d87
github
HarmonyOS_Samples/HarmonyOSComponentUXExamples
products/pc/src/main/ets/components/container/list/components/ContentList.ets
arkts
BasicImageTextListItem
Reusable Builder for standard static image-text ListItems. Centralizes UI configuration to drastically reduce repetitive boilerplate code.
@Builder function BasicImageTextListItem(param: BasicImageTextListItemTypes) { ListItem() { Row() { HdsListItemCard({ prefixItem: new PrefixImage({ image: param.imageRes, modifier: getAvatarImageModifier(param.imgWidth, param.imgHeight, CornerRadiusToken.CORNER_RADIUS_8) ...
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 BasicImageTextListItem AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Righ...
@Builder function BasicImageTextListItem(param: BasicImageTextListItemTypes) { ListItem() { Row() { HdsListItemCard({ prefixItem: new PrefixImage({ image: param.imageRes, modifier: getAvatarImageModifier(param.imgWidth, param.imgHeight, CornerRadiusToken.CORNER_RADIUS_8) ...
https://gitcode.com/HarmonyOS_Samples/HarmonyOSComponentUXExamples
e3150f950a1f86d2de591901c679170f05462af1
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/ReadingAnalyticsManager.ets
arkts
resetAskedPermission
重置权限询问状态(用于清除数据并关闭功能时)
public async resetAskedPermission(): Promise<void> { this.settings.hasAskedPermission = false; await this.saveSettings(); logger.info(TAG, '已重置权限询问状态'); }
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 resetAskedPermission AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right...
public async resetAskedPermission(): Promise<void> { this.settings.hasAskedPermission = false; await this.saveSettings(); logger.info(TAG, '已重置权限询问状态'); }
https://github.com/DaLongZhuaZi/manxia
33b7d7e792a5b0585aac23181c266a76a1cca8a7
github
AetheriumSimulator/qemu-hmos
entry/src/main/ets/utils/RDPPerformanceManager.ets
arkts
getRecommendedConfig
获取推荐配置
getRecommendedConfig(): PerformanceConfig { const networkQuality = this.networkAdapter.getCurrentQuality() const baseConfig = { ...this.config } switch (networkQuality) { case NetworkQuality.POOR: return { ...baseConfig, imageCompression: CompressionAlgorithm.JP...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getRecommendedConfig 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 PerformanceConfig AST#identifier#Right AS...
getRecommendedConfig(): PerformanceConfig { const networkQuality = this.networkAdapter.getCurrentQuality() const baseConfig = { ...this.config } switch (networkQuality) { case NetworkQuality.POOR: return { ...baseConfig, imageCompression: CompressionAlgorithm.JP...
https://github.com/AetheriumSimulator/qemu-hmos
61b648d274f742e5fe4ffede431214a238bc2be0
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Animation/AnimatedGridState.ets
arkts
getMovedItemIds
获取移动的条目ID列表
public getMovedItemIds(): string[] { const movedIds: string[] = []; this.currentItems.forEach(item => { const currPos = this.currentPositions.get(item.id); const prevPos = this.previousPositions.get(item.id); if (currPos && prevPos) { // 检查位置是否变化 if (currPos.x !==...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getMovedItemIds 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 string...
public getMovedItemIds(): string[] { const movedIds: string[] = []; this.currentItems.forEach(item => { const currPos = this.currentPositions.get(item.id); const prevPos = this.previousPositions.get(item.id); if (currPos && prevPos) { // 检查位置是否变化 if (currPos.x !==...
https://github.com/DaLongZhuaZi/manxia
73d7dd20f5e02001182385e5c786cf986b4168aa
github
electronicminer/Harmony-Markdown-Editor
entry/src/main/ets/utils/AIConfig.ets
arkts
isConfigValid
检查配置是否完整
static isConfigValid(cfg: AIConfigClass): boolean { return cfg.apiUrl.length > 0 && cfg.apiKey.length > 0; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isConfigValid AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left cfg AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left AIC...
static isConfigValid(cfg: AIConfigClass): boolean { return cfg.apiUrl.length > 0 && cfg.apiKey.length > 0; }
https://github.com/electronicminer/Harmony-Markdown-Editor
ada946303b45b67805ede9f336ab8dfcb1966967
github
openharmony/applications_contacts
feature/call/src/main/ets/missedcall/MissedCallNotifier.ets
arkts
sendUnreadCallNotification
send Unread Call Notification
public async sendUnreadCallNotification(map: Map<string, string>) { let id: number = await sharedPreferencesUtils.getFromPreferences(KEY_ID, -1) as number; let displayName: string = await sharedPreferencesUtils.getFromPreferences(KEY_DISPLAY_NAME, '') as string; let count: number = await sharedPreferencesUtils.getFromP...
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 sendUnreadCallNotification AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left map AST#identifier#Right AST#...
public async sendUnreadCallNotification(map: Map<string, string>) { let id: number = await sharedPreferencesUtils.getFromPreferences(KEY_ID, -1) as number; let displayName: string = await sharedPreferencesUtils.getFromPreferences(KEY_DISPLAY_NAME, '') as string; let count: number = await sharedPreferencesUtils.getFromP...
https://gitee.com/openharmony/applications_contacts.git
bc7d220941850fdc202b9eafd2059e892868318e
gitee
openharmony/distributedhardware_distributed_hardware_fwk
application/entry/src/main/ets/utils/TipsJumpUtils.ets
arkts
jumpAppGallery
Jump to AppGallery by uri @param startAbleContext:common.UIAbilityContext | common.ServiceExtensionContext
private static jumpAppGallery(context: startAbleContext) { hilog.info(DOMAIN_ID, TAG, 'try to jump to AppGallery'); const want: Want = { bundleName: MODULE_NAME_APPGALLERY, uri: URI_APPGALLERY }; context.startAbility(want).then(() => { hilog.info(DOMAIN_ID, TAG, 'jump to AppGallery success'); })...
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 jumpAppGallery AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Le...
private static jumpAppGallery(context: startAbleContext) { hilog.info(DOMAIN_ID, TAG, 'try to jump to AppGallery'); const want: Want = { bundleName: MODULE_NAME_APPGALLERY, uri: URI_APPGALLERY }; context.startAbility(want).then(() => { hilog.info(DOMAIN_ID, TAG, 'jump to AppGallery success'); })...
https://gitee.com/openharmony/distributedhardware_distributed_hardware_fwk.git
80c0b29f332d8c38d63aacb973b73400a9bdc575
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/Char.ets
arkts
constructor
constructor(Char) creates a Char object from another Char object. @param value a Char object to copy from.
public constructor(value: Char) { this.value = value.unboxed(); }
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#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Char AST#identifier...
public constructor(value: Char) { this.value = value.unboxed(); }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
ec3a68327363b4f8463bac5d67fed85ca87774cc
gitee
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/BarLineChartBaseModel.ets
arkts
setRendererRightYAxis
Sets a custom axis renderer for the right acis and overwrites the existing one. @param rendererRightYAxis
public setRendererRightYAxis(rendererRightYAxis: YAxisRenderer): void { this.mAxisRendererRight = rendererRightYAxis; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setRendererRightYAxis AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left rendererRightYAxis AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#L...
public setRendererRightYAxis(rendererRightYAxis: YAxisRenderer): void { this.mAxisRendererRight = rendererRightYAxis; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
550b3fd74c31cb65728dd9560981d953c8e5b90a
gitee
somnio-software/my-bot-pal
entry/src/main/ets/features/chat/repository/ChatRepository.ets
arkts
processApiResponse
Process API response into ChatMessage objects
private processApiResponse(apiResponse: ChatApiResponse): ChatMessage[] { const aiMessages = apiResponse.messages.filter(msg => msg.type === ApiMessageType.AI); const toolMessages = apiResponse.messages.filter(msg => msg.type === ApiMessageType.TOOL); let locationRequired: boolean | undefined = false; ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left processApiResponse AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left apiResponse AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ide...
private processApiResponse(apiResponse: ChatApiResponse): ChatMessage[] { const aiMessages = apiResponse.messages.filter(msg => msg.type === ApiMessageType.AI); const toolMessages = apiResponse.messages.filter(msg => msg.type === ApiMessageType.TOOL); let locationRequired: boolean | undefined = false; ...
https://github.com/somnio-software/my-bot-pal
277351b33e5f51c98f6142db043a1a388f26da31
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/MangaSourceActionEngine.ets
arkts
executeCondition
执行条件判断操作
private async executeCondition(action: ConditionAction, context: ActionContext): Promise<ActionResult[]> { const selector = this.replaceVariables(action.selector, context.variables); logger.info(TAG, `条件判断: ${selector}`); let conditionMet = false; if (action.exists !== undefined) { const exist...
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 executeCondition AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left action AST#identifier#Right AST#:#Le...
private async executeCondition(action: ConditionAction, context: ActionContext): Promise<ActionResult[]> { const selector = this.replaceVariables(action.selector, context.variables); logger.info(TAG, `条件判断: ${selector}`); let conditionMet = false; if (action.exists !== undefined) { const exist...
https://github.com/DaLongZhuaZi/manxia
ea6ec107cab9a570227dd357090aef2d174a1431
github
Joker-x-dev/CoolMallArkTS
core/ui/src/main/ets/component/address/AddressCard.ets
arkts
build
构建收货地址卡片 @returns {void} 无返回值
build(): void { Card({ onTap: (): void => this.onTap() }) { if (this.address) { this.buildAddressContent(this.address); } else { this.buildEmptyContent(); } } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#...
build(): void { Card({ onTap: (): void => this.onTap() }) { if (this.address) { this.buildAddressContent(this.address); } else { this.buildEmptyContent(); } } }
https://github.com/Joker-x-dev/CoolMallArkTS
1fe90871be131f22a6913df034416d39da65e6c4
github
arkui-x/samples
CodeLab/Cases/feature/imagecompression/src/main/ets/view/ImageCompression.ets
arkts
aboutToAppear
测试图片uri
aboutToAppear(): void { // 虚拟键盘抬起时,页面的避让模式设置为RESIZE模式 let context = getContext(this) as common.UIAbilityContext; context.windowStage.getMainWindowSync().getUIContext().setKeyboardAvoidMode(KeyboardAvoidMode.RESIZE); window.getLastWindow(getContext(this)).then(currentWindow => { currentWindow.on(...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc...
aboutToAppear(): void { // 虚拟键盘抬起时,页面的避让模式设置为RESIZE模式 let context = getContext(this) as common.UIAbilityContext; context.windowStage.getMainWindowSync().getUIContext().setKeyboardAvoidMode(KeyboardAvoidMode.RESIZE); window.getLastWindow(getContext(this)).then(currentWindow => { currentWindow.on(...
https://gitcode.com/arkui-x/samples
a6db890a483baacee8e53bee49787775c6a8ef8b
gitcode
Joker-x-dev/CoolMallArkTS
feature/order/src/main/ets/viewmodel/OrderDetailViewModel.ets
arkts
showRebuyModal
显示再次购买弹窗 @returns {void} 无返回值
showRebuyModal(): void { this.rebuyModalVisible = true; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left showRebuyModal 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...
showRebuyModal(): void { this.rebuyModalVisible = true; }
https://github.com/Joker-x-dev/CoolMallArkTS
f43f57c3e375031561f295d18c4b1a64243fdf8a
github
LongLiveY96/chatcube
entry/src/main/ets/services/PreferencesService.ets
arkts
setString
设置字符串值
async setString(key: string, value: string): Promise<void> { if (this.dataPreferences === null) { return } try { await this.dataPreferences.put(key, value) await this.dataPreferences.flush() } catch (error) { console.error('PreferencesService', `Failed to set string: ${JSON.str...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left setString AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left key AST#identifier#Right AST#type_a...
async setString(key: string, value: string): Promise<void> { if (this.dataPreferences === null) { return } try { await this.dataPreferences.put(key, value) await this.dataPreferences.flush() } catch (error) { console.error('PreferencesService', `Failed to set string: ${JSON.str...
https://github.com/LongLiveY96/chatcube
b1e4ed3b5d6727925acd57024ccc742ad211bc29
github
openharmony-sig/online_event
solution_student_challenge/基于OpenHarmony的OpenGit_潘骏翔/OpenGit/entry/src/main/ets/MainAbility/common/viewmodels/implements/UserListViewModel.ets
arkts
constructor
是否已初始化
constructor(userPath: string, userListType: number) { this.userPath = userPath this.userListType = userListType this._users = new Array<UserLite>() this._isInit = false }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left userPath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,...
constructor(userPath: string, userListType: number) { this.userPath = userPath this.userListType = userListType this._users = new Array<UserLite>() this._isInit = false }
https://gitee.com/openharmony-sig/online_event.git
3935f3328006be5846df446906148eaa99967169
gitee
openharmony-tpc/openharmony_tpc_samples
SmartRefreshLayout/library/src/main/ets/components/topRefresh/BezierRadarRefresh.ets
arkts
drawRipple
绘制刷新完成 白色扩散动画 @param canvas 画布 @param width 宽度 @param height 高度
drawRipple(canvas: CanvasRenderingContext2D, width: number, height: number) { if (this.mRippleRadius > 0) { canvas.fillStyle = this.mAccentColor; canvas.beginPath(); canvas.arc(px2vp(width / 2), px2vp(height / this.location), px2vp(this.mRippleRadius), Math.PI - (Math.PI / 7), Math.PI ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left drawRipple AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left canvas AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left CanvasRenderingContext2D AST...
drawRipple(canvas: CanvasRenderingContext2D, width: number, height: number) { if (this.mRippleRadius > 0) { canvas.fillStyle = this.mAccentColor; canvas.beginPath(); canvas.arc(px2vp(width / 2), px2vp(height / this.location), px2vp(this.mRippleRadius), Math.PI - (Math.PI / 7), Math.PI ...
https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git
af991d740633a6d0ec0b258af26865bbb506f15c
gitee
LongLiveY96/chatcube
entry/src/main/ets/services/AssistantService.ets
arkts
initialize
应用启动时调用,保证 assistants 列表和 currentAssistantId 都被加载到内存, 并把当前 id 校正到一个在 DB 里实际存在的 assistant(若当前引用已失效则回落默认)
async initialize(): Promise<void> { await this.store.ensureAssistantsInitialized() await this.ensureValidCurrentAssistant() }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left initialize 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_t...
async initialize(): Promise<void> { await this.store.ensureAssistantsInitialized() await this.ensureValidCurrentAssistant() }
https://github.com/LongLiveY96/chatcube
91c880472b9171dd0c13c2f9268fbcf246d71fd0
github
LJ666-ui/harmony-health-care
entry/src/main/ets/mock/smartwardMock_realdata.ets
arkts
getWardOverview
获取病房概览统计信息
public getWardOverview(): WardOverviewInfo { return { totalRooms: 10, occupiedRooms: 7, totalPatients: 7, criticalPatients: 2, activeAlerts: 6, onlineDevices: 48, offlineDevices: 2, avgEnvironmentScore: 85.5, lastUpdated: Date.now() }; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getWardOverview 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 WardOv...
public getWardOverview(): WardOverviewInfo { return { totalRooms: 10, occupiedRooms: 7, totalPatients: 7, criticalPatients: 2, activeAlerts: 6, onlineDevices: 48, offlineDevices: 2, avgEnvironmentScore: 85.5, lastUpdated: Date.now() }; }
https://github.com/LJ666-ui/harmony-health-care
c5f88032a73762659dd3e05423fa07c9321b1f3f
github
openharmony/codelabs
ETSUI/ArkTSComponents/entry/src/main/ets/viewmodel/MainViewModel.ets
arkts
getSettingListData
Get data of the setting list. @return {Array<PageResource>} settingListData.
getSettingListData(): Array<ItemData> { let settingListData: ItemData[] = [ new ItemData($r('app.string.setting_list_news'), $r("app.media.news"), $r("app.string.setting_toggle")), new ItemData($r('app.string.setting_list_data'), $r("app.media.data")), new ItemData($r('app.string.setting_list_me...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getSettingListData 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#...
getSettingListData(): Array<ItemData> { let settingListData: ItemData[] = [ new ItemData($r('app.string.setting_list_news'), $r("app.media.news"), $r("app.string.setting_toggle")), new ItemData($r('app.string.setting_list_data'), $r("app.media.data")), new ItemData($r('app.string.setting_list_me...
https://gitee.com/openharmony/codelabs.git
e797a5c835112c7da6e2c54ffa4a375fda9e1c28
gitee
openharmony/multimedia_camera_framework
frameworks/js/camera_napi/demo/entry/src/main/ets/common/SettingItem.ets
arkts
selectMode
隐藏显示图标 对应点击模式设置下所选的设置参数
selectMode(): void { Logger.info(TAG, `selectMode settingMessageNum: ${this.settingMessageNum}`); let globalContext: GlobalContext = GlobalContext.get(); let cameraConfig: CameraConfig = globalContext.getObject('cameraConfig') as CameraConfig; switch (this.settingMessageNum) { case 2: ca...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left selectMode 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#L...
selectMode(): void { Logger.info(TAG, `selectMode settingMessageNum: ${this.settingMessageNum}`); let globalContext: GlobalContext = GlobalContext.get(); let cameraConfig: CameraConfig = globalContext.getObject('cameraConfig') as CameraConfig; switch (this.settingMessageNum) { case 2: ca...
https://gitee.com/openharmony/multimedia_camera_framework.git
3516c5442a3407148c7ab1b35cbd1eac26e660f9
gitee
chenchl/GMLogger-HarmonyOS
gmlogger/src/main/ets/components/security/logger/LoggerFileUtil.ets
arkts
splitUint8Array
将给定的 Uint8Array 按照特定的分隔符进行分割,并返回分割后的 Uint8Array 数组。 @param uint8Array - 需要分割的 Uint8Array 数据。 @returns 返回一个 Uint8Array 数组,每个元素是原数组按照分隔符分割后的子数组。
private splitUint8Array(uint8Array: Uint8Array): Uint8Array[] { const result: Uint8Array[] = [] // 定义分隔符,分隔符是一个包含5个字节的数组 const delimiter: number[] = this.LINES_DELIMITER let start = 0 // 遍历 Uint8Array,查找分隔符并进行分割 for (let i = 0; i < uint8Array.length; i++) { // 如果剩余的元素不足5个,则停止查找 if ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left splitUint8Array AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uint8Array AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif...
private splitUint8Array(uint8Array: Uint8Array): Uint8Array[] { const result: Uint8Array[] = [] // 定义分隔符,分隔符是一个包含5个字节的数组 const delimiter: number[] = this.LINES_DELIMITER let start = 0 // 遍历 Uint8Array,查找分隔符并进行分割 for (let i = 0; i < uint8Array.length; i++) { // 如果剩余的元素不足5个,则停止查找 if ...
https://github.com/chenchl/GMLogger-HarmonyOS
96d12a3d16dcf58f657618c45be7aec39c086a58
github
xblLab/HarmonyProjectTemplate
features/mine/src/main/ets/components/Toast.ets
arkts
loadingBuilder
loading builder
@Builder function loadingBuilder(option: ToastOption) { Column() { LoadingProgress().width(40).height(40) Text(option.message ?? '加载中') } .padding({ top: 20, bottom: 20, left: 25, right: 25, }) .backgroundColor($r('sys.color.background_primary')) .borderRadius(12) }
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 loadingBuilder AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#re...
@Builder function loadingBuilder(option: ToastOption) { Column() { LoadingProgress().width(40).height(40) Text(option.message ?? '加载中') } .padding({ top: 20, bottom: 20, left: 25, right: 25, }) .backgroundColor($r('sys.color.background_primary')) .borderRadius(12) }
https://github.com/xblLab/HarmonyProjectTemplate
db446f5c3d2acdbb6253dd4ac3732fc85e147a0f
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Tracking/trackers/AniListTracker.ets
arkts
refreshAccessToken
刷新访问令牌
public async refreshAccessToken(): Promise<boolean> { // AniList 的访问令牌是长期有效的,通常不需要刷新 // 如果令牌过期,用户需要重新登录 if (this.authState.expiresAt > 0 && Date.now() > this.authState.expiresAt) { this.log('访问令牌已过期,需要重新登录'); await this.logout(); return false; } return true; }
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 refreshAccessToken AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A...
public async refreshAccessToken(): Promise<boolean> { // AniList 的访问令牌是长期有效的,通常不需要刷新 // 如果令牌过期,用户需要重新登录 if (this.authState.expiresAt > 0 && Date.now() > this.authState.expiresAt) { this.log('访问令牌已过期,需要重新登录'); await this.logout(); return false; } return true; }
https://github.com/DaLongZhuaZi/manxia
0d0be7c1e3e85959456a781f6ed8250722c6f408
github
aimilin6688/KeePassHO
entry/src/main/ets/services/template/TemplateService.ets
arkts
getUserTemplates
获取用户自定义模板
getUserTemplates(kdbx: Kdbx): IUserTemplate[] { if (!kdbx) { return []; } return this.userStrategy.getTemplates(kdbx); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getUserTemplates AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left kdbx AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Kdbx AST#identifier#Right AST#)#Left ) ...
getUserTemplates(kdbx: Kdbx): IUserTemplate[] { if (!kdbx) { return []; } return this.userStrategy.getTemplates(kdbx); }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/template/TemplateService.ets#L114-L119
d841fa6cfaa271039cb4d5d7b20d22f3ffe9f831
github
yangyongzhen/hmmovie
entry/src/main/ets/utils/EfAVPlayer.ets
arkts
seek
用于跳转到指定时间。 @param time - 要跳转的时间。
async seek(time: number) { const avPlayer = await this.init(); avPlayer.seek(time); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left seek AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left time AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Righ...
async seek(time: number) { const avPlayer = await this.init(); avPlayer.seek(time); }
https://github.com/yangyongzhen/hmmovie
429ae8360e02a8d6f4f9564b47a32aaece958b63
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.stream.ets
arkts
listenerCount
Find the event count in the listener. @param { string } event - The event to be found its count in the listener. @returns { int } The event count in the listener.
listenerCount(event: string): int { return this.handlers.has(event) ? this.handlers.get(event)!.length.toInt() : 0; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left listenerCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) ...
listenerCount(event: string): int { return this.handlers.has(event) ? this.handlers.get(event)!.length.toInt() : 0; }
https://gitcode.com/iop123123/arkts-static-skills
3016d114249bd6365440289bbfba95635b67fc84
gitcode
webabcd/HarmonyHttpServer
harmony_httpserver/src/main/ets/HttpServer.ets
arkts
handleHttpRequestAsync
处理本地 http 请求(异步)
public handleHttpRequestAsync(requestAndResponseAsync: RequestAndResponseAsync) { this.requestAndResponse = undefined this.requestAndResponseAsync = requestAndResponseAsync }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left handleHttpRequestAsync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestAndResponseAsync AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#...
public handleHttpRequestAsync(requestAndResponseAsync: RequestAndResponseAsync) { this.requestAndResponse = undefined this.requestAndResponseAsync = requestAndResponseAsync }
https://github.com/webabcd/HarmonyHttpServer
bedeac7f8bdeb450cdd9ec3601a778132f65b089
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/customkey/CustomKeyStore.ets
arkts
loadGameProfile
根据游戏自动加载关联配置。 如果该游戏有记忆的配置,自动切换到该配置。 @returns 加载的配置,无关联则返回 null(不改变当前配置)
static async loadGameProfile(appId: number): Promise<CustomKeyProfile | null> { const name = await CustomKeyStore.getGameProfileName(appId); if (!name) return null; // 已经是当前配置则不重复切换 if (name === CustomKeyStore.activeProfileName) return null; return CustomKeyStore.switchProfile(name); }
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 loadGameProfile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left appId AST#identifier#Right AST#:#Left : ...
static async loadGameProfile(appId: number): Promise<CustomKeyProfile | null> { const name = await CustomKeyStore.getGameProfileName(appId); if (!name) return null; // 已经是当前配置则不重复切换 if (name === CustomKeyStore.activeProfileName) return null; return CustomKeyStore.switchProfile(name); }
https://github.com/AlkaidLab/moonlight-harmony
977e053e204a5d2721b3debb911b48fca571b8c2
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/LineDataSet.ets
arkts
setDrawCircles
set this to true to enable the drawing of circle indicators for this DataSet, default true @param enabled
public setDrawCircles(enabled: boolean): void { this.mDrawCircles = enabled; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setDrawCircles AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
public setDrawCircles(enabled: boolean): void { this.mDrawCircles = enabled; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
c05c1f8322f92d02836778e6593bbaf62cbf6fd7
gitee
Zhiyilang074811/enterprise-ai-assistant
harmony_app/entry/src/main/ets/services/ApiService.ets
arkts
streamChat
发送聊天消息(SSE流式响应)
async streamChat( tenantId: string, agentId: string, question: string, onChunk: (content: string, knowledgeHits?: KnowledgeHit[]) => void, onComplete: () => void, onError: (error: string) => void ): Promise<void> { const httpRequest = http.createHttp(); try { const respons...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left streamChat AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left tenantId AST#identifier#Right AST#type_annotation#Left AST#:#Left : ...
async streamChat( tenantId: string, agentId: string, question: string, onChunk: (content: string, knowledgeHits?: KnowledgeHit[]) => void, onComplete: () => void, onError: (error: string) => void ): Promise<void> { const httpRequest = http.createHttp(); try { const respons...
https://github.com/Zhiyilang074811/enterprise-ai-assistant
f4839672484a5a2c6be0b9d1f2a86a6e9c91fe1a
github
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnRateViewModel.ets
arkts
setRateValue2
设置评分组件2的评分值 @param value 新的评分值
setRateValue2(value: number): void { this.rateValue2 = value; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setRateValue2 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) ...
setRateValue2(value: number): void { this.rateValue2 = value; }
https://github.com/codelably/tuniao-ui
3b85dd1b9439acee99e67100e1b074e9ed5281b7
github
openharmony/codelabs
Media/AudioPlayer/entry/src/main/ets/controller/PlayBarController.ets
arkts
getNextMusic
Get next song. @param musicList @param playState
getNextMusic(musicList: Array<MusicItem>) { // Random mode, which is used to obtain the next song randomly. if (this.playBarModel.playMode === PlayMode.RANDOM_PLAY) { // Obtain the previous song in the random list. let randomList = GlobalContext.getContext().getObject('randomList') as number[]; ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getNextMusic AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left musicList AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Array...
getNextMusic(musicList: Array<MusicItem>) { // Random mode, which is used to obtain the next song randomly. if (this.playBarModel.playMode === PlayMode.RANDOM_PLAY) { // Obtain the previous song in the random list. let randomList = GlobalContext.getContext().getObject('randomList') as number[]; ...
https://gitee.com/openharmony/codelabs.git
3bed096d8a0145ceddd8f9cd15faad6e038f963a
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
reduce
Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. @param { function } callbackfn - A function that accepts four arguments. The reduce method calls the call...
public reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: int, array: Float32Array) => number): number { if (this.lengthInt == 0) { throw new TypeError("Reduce of empty array with no initial value") } let accumulatedValue = (this.getUnsafe(0)).toDoubl...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left reduce AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left callbackfn AST#identifier#Right AST#ERROR#Left AST#:#Left :...
public reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: int, array: Float32Array) => number): number { if (this.lengthInt == 0) { throw new TypeError("Reduce of empty array with no initial value") } let accumulatedValue = (this.getUnsafe(0)).toDoubl...
https://gitcode.com/iop123123/arkts-static-skills
9ea9796d9aebae262fbe821a2c5ed3eba4bde44d
gitcode
DaLongZhuaZi/manxia
tmp/ohpm_research/unrar/package/src/main/ets/components/MainPage/UnrarApi.ets
arkts
RarFiles_Extract
异步步解压文件 @param path 文件包路径 @param dest 要解压文件存放的路径 @param callBack 返回值,解压成功则返回解压成功,否则返回失败 @param password 密码.
static RarFiles_Extract(path: string, dest: string, callBack: ICallBack, password?: string): void { unrar_napi.RarFiles_Extract(path, dest, password).then( (value:string)=> { callBack.callBackResult(value) }); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left RarFiles_Extract AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left...
static RarFiles_Extract(path: string, dest: string, callBack: ICallBack, password?: string): void { unrar_napi.RarFiles_Extract(path, dest, password).then( (value:string)=> { callBack.callBackResult(value) }); }
https://github.com/DaLongZhuaZi/manxia
a2fa5f3cc0a8df1aab5e626dc565bcab6e0c4d53
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/TypeShelfManager.ets
arkts
getCategoryManager
获取BookshelfCategoryManager实例(用于封面管理等)
getCategoryManager(): BookshelfCategoryManager { return this.categoryManager; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCategoryManager 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 BookshelfCategoryManager AST#identifier#Rig...
getCategoryManager(): BookshelfCategoryManager { return this.categoryManager; }
https://github.com/DaLongZhuaZi/manxia
2abcf32a7c48005cea6b2166fac0f77fd8bc2395
github
pangpang20/antennaPodHM
entry/src/main/ets/service/DatabaseService.ets
arkts
migrateToVersion
迁移到指定版本 在这里添加每个版本的迁移逻辑
private async migrateToVersion(version: number): Promise<void> { if (!this.rdbStore) return; console.info(`[DatabaseService] Migrating to v${version}`); switch (version) { case 1: // v1: 初始版本,创建基础表 await this.createTables(); break; case 2: // v2: 添加 isFetchFa...
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 migrateToVersion AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left version AST#identifier#Right AST#ERROR#Left AST#:#L...
private async migrateToVersion(version: number): Promise<void> { if (!this.rdbStore) return; console.info(`[DatabaseService] Migrating to v${version}`); switch (version) { case 1: // v1: 初始版本,创建基础表 await this.createTables(); break; case 2: // v2: 添加 isFetchFa...
https://github.com/pangpang20/antennaPodHM
6fdf6a989ef2966f73a2bcbf477f4001f400f6f1
github
fbinba3955/Flymby
common/src/main/ets/utils/StringUtil.ets
arkts
formatSpeed
格式化网速
static formatSpeed(speed: number): string { if (speed < 1024) { return speed + 'B/s' } else if (speed < 1024 * 1024) { return (speed / 1024).toFixed(2) + 'KB/s' } else if (speed < 1024 * 1024 * 1024) { return (speed / 1024 / 1024).toFixed(2) + 'MB/s' } else { return (speed / 10...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left formatSpeed AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left speed AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left num...
static formatSpeed(speed: number): string { if (speed < 1024) { return speed + 'B/s' } else if (speed < 1024 * 1024) { return (speed / 1024).toFixed(2) + 'KB/s' } else if (speed < 1024 * 1024 * 1024) { return (speed / 1024 / 1024).toFixed(2) + 'MB/s' } else { return (speed / 10...
https://github.com/fbinba3955/Flymby
f96b40e0d3323f7622159c7573428f075ddd7548
github
the-wwyang/kids-learning-app
src/main/ets/storage/WrongQuestionStorageService.ets
arkts
saveWrongQuestions
保存错题记录列表 @param records 错题记录列表
static async saveWrongQuestions(records: WrongQuestionRecord[]): Promise<void> { try { await dataStorage.saveObject( WrongQuestionStorageService.STORE_NAME, WrongQuestionStorageService.KEY_RECORDS, records ); // 保存统计信息 await dataStorage.saveNumber( WrongQue...
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 saveWrongQuestions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left records AST#identifier#Right AST#:#Le...
static async saveWrongQuestions(records: WrongQuestionRecord[]): Promise<void> { try { await dataStorage.saveObject( WrongQuestionStorageService.STORE_NAME, WrongQuestionStorageService.KEY_RECORDS, records ); // 保存统计信息 await dataStorage.saveNumber( WrongQue...
https://github.com/the-wwyang/kids-learning-app
0d86637db8a96e4fa4dad7abde11f507c6a65aad
github
yang-kun-long/HarmonyAccounting
entry/src/main/ets/view/DialogComponent.ets
arkts
showDatePickerDialog
显示日期选择对话框 通过调用DatePickerDialog.show方法,为用户界面弹出一个日期选择器 用户可以选择或者取消选择一个日期,并且这些操作会有对应的回调函数来处理
showDatePickerDialog() { // 初始化日期选择器,并配置其属性 DatePickerDialog.show({ // 设置可选日期范围的开始日期 start: new Date('2022-1-1'), // 设置可选日期范围的结束日期 end: new Date('2050-12-31'), // 设置默认选中的日期 selected: this.selectedDate, // 设置是否显示农历日期,此处设置为不显示 lunar: false, // 当用户确认选择日期时的回调函...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left showDatePickerDialog 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_blo...
showDatePickerDialog() { // 初始化日期选择器,并配置其属性 DatePickerDialog.show({ // 设置可选日期范围的开始日期 start: new Date('2022-1-1'), // 设置可选日期范围的结束日期 end: new Date('2050-12-31'), // 设置默认选中的日期 selected: this.selectedDate, // 设置是否显示农历日期,此处设置为不显示 lunar: false, // 当用户确认选择日期时的回调函...
https://github.com/yang-kun-long/HarmonyAccounting
56952e5fa193fc072e39a87aa4b9045367a34a77
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/DataManager.ets
arkts
convertRecordToOnlineComicInfo
==================== 在线漫画强类型转换 ====================
private convertRecordToOnlineComicInfo(record: DatabaseRecord): OnlineComicInfo { const obj: ESObject = record as ESObject; const tagsJson: string = (obj.tags as string) || '[]'; let tags: string[] = []; try { const parsed: ESObject = SafeUtils.parseObj(tagsJson) as ESObject; const keys: s...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left convertRecordToOnlineComicInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left record AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right ...
private convertRecordToOnlineComicInfo(record: DatabaseRecord): OnlineComicInfo { const obj: ESObject = record as ESObject; const tagsJson: string = (obj.tags as string) || '[]'; let tags: string[] = []; try { const parsed: ESObject = SafeUtils.parseObj(tagsJson) as ESObject; const keys: s...
https://github.com/DaLongZhuaZi/manxia
ad417fcbb5071b88f80e5a6595e15e352afa8b70
github
apap6628114/nga_oh
entry/src/main/ets/store/SettingsStore.ets
arkts
addOrUpdateNote
--- Notes ---
addOrUpdateNote(userId: string, nickName: string, note: string): void { this.noteSettings.addOrUpdateNote(userId, nickName, note) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addOrUpdateNote AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left...
addOrUpdateNote(userId: string, nickName: string, note: string): void { this.noteSettings.addOrUpdateNote(userId, nickName, note) }
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/store/SettingsStore.ets#L155-L157
bc0e76231287932b85515077a77f8af5ec7679df
github
OHPG/FinVideo
entry/src/main/ets/data/Repository.ets
arkts
searchMedia
搜索媒体 @param keyword @returns
public searchMedia(keyword: string): Promise<Array<FinItem>> { return this.requireApi().search(keyword) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left searchMedia AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left keyword AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Rig...
public searchMedia(keyword: string): Promise<Array<FinItem>> { return this.requireApi().search(keyword) }
https://github.com/OHPG/FinVideo
4549e68aea658404170af538c729642aae2a1c50
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/BackgroundStreamService.ets
arkts
getIsRunning
获取当前运行状态
getIsRunning(): boolean { return this.isRunning; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getIsRunning AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statem...
getIsRunning(): boolean { return this.isRunning; }
https://github.com/AlkaidLab/moonlight-harmony
ff0b6b9898aed92d25556044f480203d9f8b7a8c
github
LJ666-ui/harmony-health-care
entry/src/main/ets/ar/VoiceGuide.ets
arkts
processQueue
处理播报队列
private processQueue(): void { if (this.announcementQueue.length > 0 && !this.isSpeaking) { const nextText = this.announcementQueue.shift()!; this.speak(nextText); } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left processQueue 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#expres...
private processQueue(): void { if (this.announcementQueue.length > 0 && !this.isSpeaking) { const nextText = this.announcementQueue.shift()!; this.speak(nextText); } }
https://github.com/LJ666-ui/harmony-health-care
7cd722ed6ceea250ee1c1fb55bbba4b53dc30e2e
github
harmonyos/codelabs
HarmonyOS_NEXT/LoginDemo/entry/src/main/ets/common/utils/CommonUtils.ets
arkts
routerPage
Router page @param {string} url page url
public routerPage(url: string): void { router.replaceUrl({ url: url }).catch((error: Error) => { Logger.error(CommonConstants.TAG_COMMON_UTILS, 'replace url error ' + JSON.stringify(error)); }); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left routerPage 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...
public routerPage(url: string): void { router.replaceUrl({ url: url }).catch((error: Error) => { Logger.error(CommonConstants.TAG_COMMON_UTILS, 'replace url error ' + JSON.stringify(error)); }); }
https://gitee.com/harmonyos/codelabs.git
7b8db979e5955004d64865b947602bd2b7677614
gitee
ibestservices/ibest-ui
library/src/main/ets/components/popup/index.ets
arkts
landScapeChange
弹框打开时, 屏幕转向, 内容会错位, 暂时这样处理, 后续在再优化
landScapeChange(){ if(this.visible){ this.visible = false setTimeout(() => { this.visible = true }, hideDuration * 2) } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left landScapeChange 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...
landScapeChange(){ if(this.visible){ this.visible = false setTimeout(() => { this.visible = true }, hideDuration * 2) } }
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/popup/index.ets#L397-L404
b42b37879b63d5cfdcec32cb18119d028dbf5fa3
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Scraper/ScraperManager.ets
arkts
mergeAndDeduplicateResults
==================== 辅助方法 ==================== 合并和去重搜索结果
private mergeAndDeduplicateResults(results: ScrapedMetadata[]): ScrapedMetadata[] { const seen = new Map<string, ScrapedMetadata>(); for (const item of results) { // 使用标题的规范化形式作为去重键 const normalizedTitle = this.normalizeTitle(item.title); if (!seen.has(normalizedTitle)) { see...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left mergeAndDeduplicateResults AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left results AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST...
private mergeAndDeduplicateResults(results: ScrapedMetadata[]): ScrapedMetadata[] { const seen = new Map<string, ScrapedMetadata>(); for (const item of results) { // 使用标题的规范化形式作为去重键 const normalizedTitle = this.normalizeTitle(item.title); if (!seen.has(normalizedTitle)) { see...
https://github.com/DaLongZhuaZi/manxia
62bc6393b56e15ba388db1bf9c376f3dc87ee176
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Components/FontAware.ets
arkts
initializeFontAware
初始化组件的字体感知功能
public static initializeFontAware( componentId: string, state: FontAwareState, callback?: FontChangeCallback ): void { // 确保全局初始化 FontAwareHelper.initialize(); // 同步当前设置 state.syncFromFontManager(); // 注册回调 if (callback) { const wrappedCallback: FontChangeCallback...
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 initializeFontAware AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left componentId AST#identifier#Right AST#ERROR#Left AS...
public static initializeFontAware( componentId: string, state: FontAwareState, callback?: FontChangeCallback ): void { // 确保全局初始化 FontAwareHelper.initialize(); // 同步当前设置 state.syncFromFontManager(); // 注册回调 if (callback) { const wrappedCallback: FontChangeCallback...
https://github.com/DaLongZhuaZi/manxia
87b36da4b5e9caa4345086101ad23c515d4d6b2e
github
openharmony/developtools_profiler
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/RadarDataSet.ets
arkts
setHighlightCircleStrokeColor
Sets the stroke color for highlight circle. Set to Utils.COLOR_NONE in order to use the color of the dataset;
public setHighlightCircleStrokeColor(color): void { this.mHighlightCircleStrokeColor = color; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setHighlightCircleStrokeColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left color AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_express...
public setHighlightCircleStrokeColor(color): void { this.mHighlightCircleStrokeColor = color; }
https://gitee.com/openharmony/developtools_profiler.git
b0c194fb6476f4c15e73caa794aa285156349c66
gitee