nwo
stringclasses
449 values
path
stringlengths
9
173
language
stringclasses
1 value
identifier
stringlengths
1
53
docstring
stringlengths
5
4.13k
function
stringlengths
10
87.2k
ast_function
stringlengths
351
354k
obf_function
stringlengths
10
87.2k
url
stringlengths
30
175
function_sha
stringlengths
40
40
source
stringclasses
3 values
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/ThemeManager.ets
arkts
detectSystemTheme
检测系统主题
private detectSystemTheme(): void { try { const context = getContext(); if (!context) { logger.warn(TAG, '无法获取上下文,使用默认深色主题'); this.actualTheme = ThemeType.DARK; return; } if (!context.config) { logger.warn(TAG, '无法获取系统配置,使用默认深色主题'); this.actualTheme...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left detectSystemTheme 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 AS...
private detectSystemTheme(): void { try { const context = getContext(); if (!context) { logger.warn(TAG, '无法获取上下文,使用默认深色主题'); this.actualTheme = ThemeType.DARK; return; } if (!context.config) { logger.warn(TAG, '无法获取系统配置,使用默认深色主题'); this.actualTheme...
https://github.com/DaLongZhuaZi/manxia
d901c8ca1e900450dbc9c1a442812de7e46ac85a
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/AppStateService.ets
arkts
onBackground
应用进入后台
onBackground(): void { if (this.currentState !== AppState.BACKGROUND) { this.currentState = AppState.BACKGROUND; console.info('[AppStateService] 应用进入后台'); this.notifyListeners(); this.emitEvent(); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onBackground 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...
onBackground(): void { if (this.currentState !== AppState.BACKGROUND) { this.currentState = AppState.BACKGROUND; console.info('[AppStateService] 应用进入后台'); this.notifyListeners(); this.emitEvent(); } }
https://github.com/AlkaidLab/moonlight-harmony
9fc16a48578d376ebf3fd90c14a8022f22fa6d05
github
openharmony/applications_dlp_manager
entry/src/main/ets/OpenDlpFile/manager/OpeningDialogManager.ets
arkts
getCanStartAbility
判断是否可以拉起沙箱,即用户是否手动终止弹框
public getCanStartAbility(requestId: string): boolean { this.printAllDecryptingMap(); const isDecrypting = this._decryptingMap.has(requestId); HiLog.info(TAG, `getCanStartAbility requestId ${requestId}, isDecrypting ${isDecrypting}`); return isDecrypting; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCanStartAbility AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left requestId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#s...
public getCanStartAbility(requestId: string): boolean { this.printAllDecryptingMap(); const isDecrypting = this._decryptingMap.has(requestId); HiLog.info(TAG, `getCanStartAbility requestId ${requestId}, isDecrypting ${isDecrypting}`); return isDecrypting; }
https://gitee.com/openharmony/applications_dlp_manager.git
bcdd809d5da8819531179a6a6074253f0d5fb79c
gitee
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ets
arkts
isDataView
Check whether the entered value is of DataView type. @param { Object } value - A DataView value @returns { boolean } Returns true if the value is a built-in DataView instance.
isDataView(value: Object): boolean { return value instanceof DataView; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isDataView 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 Object AST#identifier#Right AST#)#Left ) AST...
isDataView(value: Object): boolean { return value instanceof DataView; }
https://gitcode.com/iop123123/arkts-static-skills
7e5319d3067beeb077ca3d5ef307f3fe065f4175
gitcode
HarmonyOS_Samples/MusicHome
common/musicbasic/src/main/ets/model/SongDataSource.ets
arkts
notifyDataChange
Notifies listeners that one row’s content changed. @param index Index of the changed row.
public notifyDataChange(index: number): void { this.listeners.forEach(listener => { listener.onDataChange(index); }); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left notifyDataChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
public notifyDataChange(index: number): void { this.listeners.forEach(listener => { listener.onDataChange(index); }); }
https://gitcode.com/HarmonyOS_Samples/MusicHome
56638b690e4e35128c46170fe11928f8c81aad72
gitcode
openharmony/codelabs
ETSUI/MemoTime/entry/src/main/ets/pages/ScheduleDetailPage.ets
arkts
getTagColor
获取标签颜色
getTagColor(tagId: string): string { const tag = this.tags.find((t: Tag) => t.id === tagId) return tag ? tag.color : '#999999' }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getTagColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tagId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AS...
getTagColor(tagId: string): string { const tag = this.tags.find((t: Tag) => t.id === tagId) return tag ? tag.color : '#999999' }
https://gitcode.com/openharmony/codelabs
cb4de3b5508623ff90185a851a6dd07fd034bda9
gitcode
openharmony/testfwk_arkxtest
jsunit/src_static/module/assert/deepEquals/DeepTypeUtils.ets
arkts
getAllKeys
获取obj对象的所有属性 @param obj obj对象
static getAllKeys(obj: object): Array<string> { const keyList = new Array<string>(); if (obj === null) { return keyList; } const keys = Object.keys(obj); for (const key of keys) { keyList.push(key); } return keyList; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getAllKeys AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left object...
static getAllKeys(obj: object): Array<string> { const keyList = new Array<string>(); if (obj === null) { return keyList; } const keys = Object.keys(obj); for (const key of keys) { keyList.push(key); } return keyList; }
https://gitee.com/openharmony/testfwk_arkxtest.git
631c28d558b0756afe1da59b8cc5fa0ad6f1040a
gitee
Yebingiscn/SweetVideo
entry/src/main/ets/utils/IsoFileUtil.ets
arkts
getPlayablePath
获取ISO文件的可播放路径 @param isoPath ISO文件路径 @param type ISO文件类型(可选) @returns 可播放路径 (bd://longest 或 dvd://)
static async getPlayablePath(isoPath: string, type?: IsoFileType): Promise<string> { try { salmonLogger.addLog(TAG, `获取ISO可播放路径: ${isoPath}`, false) // 根据类型选择协议 const isoType = type || await IsoFileUtil.detectIsoType(isoPath) let playablePath: string if (isoType === IsoFileType.DVD...
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 getPlayablePath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isoPath AST#identifier#Right AST#ERROR#Left AST#:#Left ...
static async getPlayablePath(isoPath: string, type?: IsoFileType): Promise<string> { try { salmonLogger.addLog(TAG, `获取ISO可播放路径: ${isoPath}`, false) // 根据类型选择协议 const isoType = type || await IsoFileUtil.detectIsoType(isoPath) let playablePath: string if (isoType === IsoFileType.DVD...
https://github.com/Yebingiscn/SweetVideo
f3a26b6cf933c46e7f8044070a87b622eb601594
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/EnhancedBackupManager.ets
arkts
restoreBackupDataWithOptions
恢复备份数据(支持选择性恢复和冲突处理)
private async restoreBackupDataWithOptions(backupData: BackupData, options: RestoreOptions): Promise<void> { logger.info(TAG, `开始选择性数据恢复,策略: ${options.conflictStrategy}`); logger.info(TAG, `备份数据检查: manga=${!!backupData.manga}, manga.library=${!!backupData.manga?.library}, 数量=${backupData.manga?.library?.lengt...
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 restoreBackupDataWithOptions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left backupData AST#identifie...
private async restoreBackupDataWithOptions(backupData: BackupData, options: RestoreOptions): Promise<void> { logger.info(TAG, `开始选择性数据恢复,策略: ${options.conflictStrategy}`); logger.info(TAG, `备份数据检查: manga=${!!backupData.manga}, manga.library=${!!backupData.manga?.library}, 数量=${backupData.manga?.library?.lengt...
https://github.com/DaLongZhuaZi/manxia
0fd43a4e7254fb6eeeab2b9f570d29e4e3ffa8d7
github
Joker-x-dev/CoolMallArkTS
core/data/src/main/ets/repository/OrderRepository.ets
arkts
confirmReceive
确认收货 @param orderId 订单 ID @returns 是否成功
async confirmReceive(orderId: number): Promise<NetworkResponse<boolean>> { return this.networkDataSource.confirmReceive(orderId); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left confirmReceive AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left orderId AST#identifier#Right AST#type_annotation#Left AST#:#Left...
async confirmReceive(orderId: number): Promise<NetworkResponse<boolean>> { return this.networkDataSource.confirmReceive(orderId); }
https://github.com/Joker-x-dev/CoolMallArkTS
6543efce942a75ecf08d042aa3d8d7eda0c6196b
github
openharmony/applications_app_samples
code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/videotrimmer/VideoTrimmerView.ets
arkts
videoClip
TODO: 知识点: 视频剪辑。scaleCmd为视频压缩命令
videoClip(sTime: string, eTime: string, srcFilePath: string, outFilePath: string, scaleCmd: string, callback: ICallBack) { let ffmpegCmd: string = ''; if (scaleCmd !== '') { ffmpegCmd = 'ffmpeg -y -i ' + srcFilePath + ' -vf ' + scaleCmd + ' -c:v mpeg4 -c:a aac -ss ' + sTime + ' -to ' + eTime...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left videoClip AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left sTime AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AS...
videoClip(sTime: string, eTime: string, srcFilePath: string, outFilePath: string, scaleCmd: string, callback: ICallBack) { let ffmpegCmd: string = ''; if (scaleCmd !== '') { ffmpegCmd = 'ffmpeg -y -i ' + srcFilePath + ' -vf ' + scaleCmd + ' -c:v mpeg4 -c:a aac -ss ' + sTime + ' -to ' + eTime...
https://github.com/openharmony/applications_app_samples
3daa9ff8629b7ff4d228be96904d5c53654a28f8
github
HarmonyOS_Samples/HarmonyOSComponentUXExamples
commons/componentuxexamplesbase/src/main/ets/utils/ComponentDataUtil.ets
arkts
loadCodeSourceUrl
Loads code source URL from a JSON file in rawfile resources. @param context - UIAbilityContext for accessing resource manager @param jsonFileName - Name of the JSON file, e.g., 'code-source-url.json' @returns Main source URL string, or empty string if loading fails
public static loadCodeSourceUrl(context: common.UIAbilityContext, jsonFileName: string): string { try { const resMgr = context.resourceManager; const fileData = resMgr.getRawFileContentSync(jsonFileName); const decoder = util.TextDecoder.create('utf-8', { ignoreBOM: true }); const jsonStri...
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 loadCodeSourceUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Le...
public static loadCodeSourceUrl(context: common.UIAbilityContext, jsonFileName: string): string { try { const resMgr = context.resourceManager; const fileData = resMgr.getRawFileContentSync(jsonFileName); const decoder = util.TextDecoder.create('utf-8', { ignoreBOM: true }); const jsonStri...
https://gitcode.com/HarmonyOS_Samples/HarmonyOSComponentUXExamples
bebe340de63b0f4d1bd7eef7f9e67802c1d73448
gitcode
robotzzh/AgricultureApp
entry/src/main/ets/models/StringUtils.ets
arkts
uint8Array2String
Uint8Array 转 String @param input
uint8Array2String(input: Uint8Array) { let textDecoder = util.TextDecoder.create("utf-8", { ignoreBOM: true }) return textDecoder.decodeWithStream(input, { stream: false }); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left uint8Array2String AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left input AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Uint8Array AST#identif...
uint8Array2String(input: Uint8Array) { let textDecoder = util.TextDecoder.create("utf-8", { ignoreBOM: true }) return textDecoder.decodeWithStream(input, { stream: false }); }
https://github.com/robotzzh/AgricultureApp
e8e9973a670442b40d67dda6f99d38ce1533179d
github
Cool_foolisher1/ArkTSRepository
GuardianAssistant/entry/src/main/ets/manager/PermissionManager.ets
arkts
checkPermissions
检查是否授权 @param permissions 权限列表 @returns 返回授权结果
checkPermissions(permissions: Permissions[]) { // 1. 创建应用权限管理器 const atManager = abilityAccessCtrl.createAtManager() // 2. 获取 bundle 包信息,Sync 写法 const bundleInfo = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION) // 3. 提取 tokenID const tokenID =...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left checkPermissions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left permissions AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#ide...
checkPermissions(permissions: Permissions[]) { // 1. 创建应用权限管理器 const atManager = abilityAccessCtrl.createAtManager() // 2. 获取 bundle 包信息,Sync 写法 const bundleInfo = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION) // 3. 提取 tokenID const tokenID =...
https://gitcode.com/Cool_foolisher1/ArkTSRepository
61cd487cb38f39c856eccdaec273592ca3e7c29a
gitcode
yangyongzhen/hmmovie
entry/src/main/ets/utils/HelperUtil.ets
arkts
isEmpty
是否空字符串 @param value
static isEmpty(value: string) { if (value == undefined || value == "") { return true; } else { return false; } }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isEmpty AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string ...
static isEmpty(value: string) { if (value == undefined || value == "") { return true; } else { return false; } }
https://github.com/yangyongzhen/hmmovie
1ad23ea03f604ccc4c960fb42ea73f8d0c5714d2
github
SMAT-Lab/ArkAnalyzer-HapRay
test_hap/test_suite/src/main/ets/testcases/imageknife/pages/DefaultPage.ets
arkts
getImagePath
获取图片路径(优先使用缓存)
getImagePath(url: string): string { return this.imageCacheMap.get(url) || url; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getImagePath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST...
getImagePath(url: string): string { return this.imageCacheMap.get(url) || url; }
https://github.com/SMAT-Lab/ArkAnalyzer-HapRay
a18cbd02bdcb199866e830c68825abc05c493dd6
github
openharmony/codelabs
ETSUI/LifeBalance/entry/src/main/ets/model/HealthConsultFavoriteModel.ets
arkts
getFavorite
Get health consult favorite state.
async getFavorite(id: number) { let favoriteData1 = await this.getFavoriteSetData(); return favoriteData1.has(id); }
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getFavorite AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_annotation#Left AST#:#Lef...
async getFavorite(id: number) { let favoriteData1 = await this.getFavoriteSetData(); return favoriteData1.has(id); }
https://gitcode.com/openharmony/codelabs
462ac7cf31a69217c60c0240be899ac2674fc561
gitcode
the-wwyang/kids-learning-app
src/main/ets/common/UserService.ets
arkts
callSmsApi
调用短信API(通过自建后端服务器)
private async callSmsApi(phone: string, code: string): Promise<boolean> { try { const httpRequest = http.createHttp(); const response = await httpRequest.request( SmsConfig.SMS_API_URL, { method: http.RequestMethod.POST, header: { 'Content-Type': 'applic...
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 callSmsApi AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left phone AST#identifier#Right AST#:#Left : AS...
private async callSmsApi(phone: string, code: string): Promise<boolean> { try { const httpRequest = http.createHttp(); const response = await httpRequest.request( SmsConfig.SMS_API_URL, { method: http.RequestMethod.POST, header: { 'Content-Type': 'applic...
https://github.com/the-wwyang/kids-learning-app
73e83411ccebd63f753891b9ea75c39bd4698fd4
github
chenchl/GMLogger-HarmonyOS
gmlogger/src/main/ets/components/security/logger/LoggerFileUtil.ets
arkts
getLogFile
获取一个可用的日志文件。 该方法会检查日志文件的大小,如果当前文件大小超过最大限制,则创建一个新的日志文件。 @returns {fs.File} 返回一个可读写的日志文件对象。
private getLogFile() { let index = 0 let filePath = `${this.logPath}log_${index}.txt` // 检查当前日志文件的大小,如果超过最大大小,则递增索引,寻找下一个可用的日志文件 while (fs.accessSync(filePath) && fs.statSync(filePath).size >= this.MAX_SIZE) { index++ filePath = `${this.logPath}log_${index}.txt` } // 以读写、创建、追加模式打...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getLogFile 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 {...
private getLogFile() { let index = 0 let filePath = `${this.logPath}log_${index}.txt` // 检查当前日志文件的大小,如果超过最大大小,则递增索引,寻找下一个可用的日志文件 while (fs.accessSync(filePath) && fs.statSync(filePath).size >= this.MAX_SIZE) { index++ filePath = `${this.logPath}log_${index}.txt` } // 以读写、创建、追加模式打...
https://github.com/chenchl/GMLogger-HarmonyOS
6a16fec2a4bf7527d1b0d080077e08a54607a7ef
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets
arkts
getStringAsync
获取字符串结果(异步版本) 支持JS规则的异步执行
async getStringAsync(ruleStr: string | undefined): Promise<string> { if (!ruleStr || ruleStr.trim() === '') { return ''; } try { const processedRule = await this.preprocessRuleTextAsync(ruleStr); // 处理规则分割符 const splitResult = this.splitRuleStr(processedRule); if (splitResu...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getStringAsync AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left ruleStr AST#identifier#Right A...
async getStringAsync(ruleStr: string | undefined): Promise<string> { if (!ruleStr || ruleStr.trim() === '') { return ''; } try { const processedRule = await this.preprocessRuleTextAsync(ruleStr); // 处理规则分割符 const splitResult = this.splitRuleStr(processedRule); if (splitResu...
https://github.com/DaLongZhuaZi/manxia
e6496a6fc73e0c5fa4b7d69d6dd62ec2b35cd1da
github
Joker-x-dev/CoolMallArkTS
feature/goods/src/main/ets/component/GoodsBanner.ets
arkts
build
构建轮播图视图 @returns {void} 无返回值
build(): void { if (this.bannerList && this.bannerList.length > 0) { Swiper() { ForEach(this.bannerList, (item: string, index: number): void => { Image(item) .width(P100) .height(P100) .objectFit(this.imageFit); }, (item: string, index: number): ...
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 { if (this.bannerList && this.bannerList.length > 0) { Swiper() { ForEach(this.bannerList, (item: string, index: number): void => { Image(item) .width(P100) .height(P100) .objectFit(this.imageFit); }, (item: string, index: number): ...
https://github.com/Joker-x-dev/CoolMallArkTS
983eedf7636ba549d6cf6870b8b4e6f3f60a73ad
github
Cool_foolisher1/ArkTSRepository
MultiCalculator/features/calculator/src/main/ets/components/Calculator.ets
arkts
deepCopy
对一个表达式进行深拷贝
deepCopy(): Array<string> { let copyExpressions: Array<string> = Array.from(this.expressions) return copyExpressions }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left deepCopy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : A...
deepCopy(): Array<string> { let copyExpressions: Array<string> = Array.from(this.expressions) return copyExpressions }
https://gitcode.com/Cool_foolisher1/ArkTSRepository
932539a457748eff09f2953f22ddfa95fb50036d
gitcode
midori52000/ArkPilot
Agent/entry/src/main/ets/apim/ApiManagementService.ets
arkts
checkProviderHealth
========== 健康检查 ==========
checkProviderHealth(provider: ProviderRecord): void { if (provider.apiKey.trim().length === 0) { provider.healthStatus = 'unknown'; return; } if (provider.lastValidatedAt > 0 && (Date.now() - provider.lastValidatedAt) < 300000) { return; } provider.healthStatus = 'unknown';...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left checkProviderHealth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left provider AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ProviderRecord AST#identifier#Ri...
checkProviderHealth(provider: ProviderRecord): void { if (provider.apiKey.trim().length === 0) { provider.healthStatus = 'unknown'; return; } if (provider.lastValidatedAt > 0 && (Date.now() - provider.lastValidatedAt) < 300000) { return; } provider.healthStatus = 'unknown';...
https://github.com/midori52000/ArkPilot
dee59ccf662c8530bd632063453f80c5690ba89a
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/ArrayBuffer.ets
arkts
constructor
Creates ArrayBuffer with size equal to length parameter @param length size of ArrayBuffer
public constructor(length: int) { this.data = new byte[length] this.byteLength = length }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#ERROR#Right 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 length AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#...
public constructor(length: int) { this.data = new byte[length] this.byteLength = length }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
d82a039ec91b293c051eea180a5e91dcf102b3d3
gitee
David8Idira/AI-OA
packages/harmonyos/commons/src/main/ets/data/api/ApiClient.ets
arkts
getApprovalStatistics
获取审批统计数据
async getApprovalStatistics(): Promise<ApiResponse<any>> { return this.get<any>('/api/approval/statistics') }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getApprovalStatistics 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 AS...
async getApprovalStatistics(): Promise<ApiResponse<any>> { return this.get<any>('/api/approval/statistics') }
https://github.com/David8Idira/AI-OA
8c75089c41f15425b177bd65c132ae53124eaeee
github
Vsolon0401/MallShopping
features/home/src/main/ets/components/Home.ets
arkts
build
猜你喜欢(推荐 @Builder RecommendList() { Column() { Row({ space: 5 }) { Image($r('app.media.ic_love')) .objectFit(ImageFit.Contain) .width(25) Text('猜你喜欢') .fontColor(Color.Black) .fontSize($r('app.float.middle_font_size')) .fontWeight(StyleConstants.FONT_WEIGHT_FOUR) .lineHeight($r('app.float.commodity_desc_height')) } .pad...
build() { Stack({ alignContent: Alignment.Top }) { Image($r('app.media.ic_app_background')) .width(StyleConstants.FULL_WIDTH) .height($r('app.float.image_background_height')) .objectFit(ImageFit.Auto) Flex({ direction: FlexDirection.Column }) { this.SearchTitle() ...
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#object#Left AST#{#Left { AST#{#Right AST#method_def...
build() { Stack({ alignContent: Alignment.Top }) { Image($r('app.media.ic_app_background')) .width(StyleConstants.FULL_WIDTH) .height($r('app.float.image_background_height')) .objectFit(ImageFit.Auto) Flex({ direction: FlexDirection.Column }) { this.SearchTitle() ...
https://github.com/Vsolon0401/MallShopping
b75fa06d08d97ec16fe5ff65e1961451a000d6b8
github
openharmony/applications_mms
entry/src/main/ets/pages/conversation/conversationController.ets
arkts
getCurEdtFileSize
Obtains the size of the current MMS file.
getCurEdtFileSize() { this.curEdtFileSize = 0; if (!this.isEditMms || this.mmsEditList.length == 0) { return; } for (let element of this.mmsEditList) { this.curEdtFileSize += element.fileSize; } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getCurEdtFileSize 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#...
getCurEdtFileSize() { this.curEdtFileSize = 0; if (!this.isEditMms || this.mmsEditList.length == 0) { return; } for (let element of this.mmsEditList) { this.curEdtFileSize += element.fileSize; } }
https://gitee.com/openharmony/applications_mms.git
0d8dce01024bd2e136295e39c194273750a1c027
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
map
Creates a new Int32Array using fn(arr[i]) over all elements of current Int32Array @param fn a function to apply for each element of current Int32Array @returns a new Int32Array where for each element from current Int32Array fn was applied
public map(fn: (val: int) => int): Int32Array { let newF: (val: int, index: int) => int = (val: int, index: int): int => { return fn(val) } return this.map(newF) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left map AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right...
public map(fn: (val: int) => int): Int32Array { let newF: (val: int, index: int) => int = (val: int, index: int): int => { return fn(val) } return this.map(newF) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
2edb8df4468c57e14983ab3a05a4443a19d56d81
gitee
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/utils/JArrayList.ets
arkts
get
返回指定位置的元素
get(pos: number): T { return this.dataSource[pos]; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left get AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pos AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) AST#)#Right ...
get(pos: number): T { return this.dataSource[pos]; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
4731d87eac5f3d9e34f0cabf2f2de835c18de9f7
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
entries
Returns an array of key, value pairs for every entry in the Float32Array @returns { IterableIterator<[int, Number]> } - key, value pairs for every entry in the array @syscap SystemCapability.Utils.Lang @FaAndStageModel
public entries(): IterableIterator<[int, Number]> { return new Float32ArrayIteratorEntries(this) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left entries AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_sta...
public entries(): IterableIterator<[int, Number]> { return new Float32ArrayIteratorEntries(this) }
https://gitcode.com/iop123123/arkts-static-skills
b8439af99165b5d6dce23a6b9c7fa71702dcf1b4
gitcode
terryma2024/happyword
harmonyos/entry/src/ohosTest/ets/test/PackManagerFlow.ui.test.ets
arkts
togglePackAndReturnHome
Toggle a single pack in PackManagerPage and return all the way back to HomePage. Wraps the open / scroll / tap / leave dance used by the V0.6.7.4 "config-affects-home" tests so each `it` stays focused on its assertions, not the navigation plumbing.
async function togglePackAndReturnHome(driver: Driver, packId: string): Promise<void> { try { await openPackManagerFromHome(driver); await scrollPackRowIntoView(driver, packId); await clickByIdShared(driver, `PackToggle_${packId}`); // The toggle persists synchronously to AppStorage via // PackSel...
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left togglePackAndReturnHome AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left driver AST#identifier#Rig...
async function togglePackAndReturnHome(driver: Driver, packId: string): Promise<void> { try { await openPackManagerFromHome(driver); await scrollPackRowIntoView(driver, packId); await clickByIdShared(driver, `PackToggle_${packId}`); // The toggle persists synchronously to AppStorage via // PackSel...
https://github.com/terryma2024/happyword
73048e07048907935e668a17de1414f313c64d23
github
Harrisonls2004/WaterFlow
entry/src/main/ets/common/network/ApiService.ets
arkts
getStats
获取关注统计(支持查询任意用户)
static async getStats(userId?: number): Promise<FollowStatsResponse> { // 使用 /follows/count 端点,可选传入 userId 参数 const url = userId ? '/follows/count?userId=' + userId : '/follows/count'; console.info(`FollowApi.getStats: Calling ${url}`); const response = await httpClient.get(url); console.info(`Fol...
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 getStats AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#?#Left ? AST#?#...
static async getStats(userId?: number): Promise<FollowStatsResponse> { // 使用 /follows/count 端点,可选传入 userId 参数 const url = userId ? '/follows/count?userId=' + userId : '/follows/count'; console.info(`FollowApi.getStats: Calling ${url}`); const response = await httpClient.get(url); console.info(`Fol...
https://github.com/Harrisonls2004/WaterFlow
5e2e563b4962789a8ea0968a775f6d09d50965fc
github
Cool_foolisher1/ArkTSRepository
GraphicalCode/commons/src/main/ets/component/Toast.ets
arkts
showLongToast
展示长提示框 @param message 提示信息
public showLongToast(message: ResourceStr) { this.showToast(message, this.longToastTime) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left showLongToast AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left message AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left...
public showLongToast(message: ResourceStr) { this.showToast(message, this.longToastTime) }
https://gitcode.com/Cool_foolisher1/ArkTSRepository
149eaf88e7939e66b883319ad8b0c0e2e4ade996
gitcode
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/SharedLedgerService.ets
arkts
getLedgerBills
获取账本的所有账单
static async getLedgerBills(ledgerId: number): Promise<SharedBill[]> { try { return await SharedBillDAO.getByLedgerId(ledgerId); } catch (error) { console.error('[SharedLedgerService] 获取账本账单失败:', error); return []; } }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left getLedgerBills AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left ledgerId AST#identifier#Right AST#ERROR#Left AST#:#Left ...
static async getLedgerBills(ledgerId: number): Promise<SharedBill[]> { try { return await SharedBillDAO.getByLedgerId(ledgerId); } catch (error) { console.error('[SharedLedgerService] 获取账本账单失败:', error); return []; } }
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
6896048458c377abfd266ccd4f2403b5e2459640
github
yongoe1024/RdbPlus
rdbplus/src/main/ets/BaseMapper.ets
arkts
delete
条件删除 @param wrapper 删除条件 @returns sql执行结果:改变数量
async delete(wrapper: Wrapper, db?: Connection): Promise<relationalStore.ValueType> { let isClose: boolean = true if (db === undefined) { db = await this.getConnection() } else { isClose = false } let myWrapper = MyWrapper.build(wrapper) const sql = this.sqlUtils.delete(myWrapper.g...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left delete AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left wrapper AST#identifier#Right AST#type_annotation#Left AST#:#Lef...
async delete(wrapper: Wrapper, db?: Connection): Promise<relationalStore.ValueType> { let isClose: boolean = true if (db === undefined) { db = await this.getConnection() } else { isClose = false } let myWrapper = MyWrapper.build(wrapper) const sql = this.sqlUtils.delete(myWrapper.g...
https://github.com/yongoe1024/RdbPlus/blob/83f7347b7ac692941729d3464923155948e876bb/rdbplus/src/main/ets/BaseMapper.ets#L357-L371
899b4705c101062cc2eeb73266ee6abe65fe42c3
github
openharmony/arkui_ace_engine
examples/EventProject/entry/src/main/ets/pages/drag/DefaultDrag.ets
arkts
build
[End generate_pix_map]
build() { // [StartExclude default_drag] NavDestination() { Column({ space: 12 }) { // [EndExclude default_drag] Row() { Column() { Text('start Drag') .fontSize(18) .width('100%') .height(40) .margin(10) ...
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() { // [StartExclude default_drag] NavDestination() { Column({ space: 12 }) { // [EndExclude default_drag] Row() { Column() { Text('start Drag') .fontSize(18) .width('100%') .height(40) .margin(10) ...
https://gitcode.com/openharmony/arkui_ace_engine
402110242d000971e0d32f9b75357d86aa13b7fa
gitcode
openharmony/applications_call
entry/src/main/ets/common/components/BottomBtn.ets
arkts
onImgClick
Button Event
onImgClick(type) { if (type == 'keyboard') { this.onItemClick(); } if (type == 'hangUP') { this.onHangUp(); } if (type == 'speakerphone') { this.onSpeakerButtonClicked(); } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onImgClick AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left type AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expressi...
onImgClick(type) { if (type == 'keyboard') { this.onItemClick(); } if (type == 'hangUP') { this.onHangUp(); } if (type == 'speakerphone') { this.onSpeakerButtonClicked(); } }
https://gitee.com/openharmony/applications_call.git
f9b6e6566e1bfe9d1fd590fe57aa7efb4adef34a
gitee
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test46_original_index.ets
arkts
testObjectEntries
--- Object.entries ---
function testObjectEntries(): string { let data: Record<string, number> = {}; data['alpha'] = 1; data['beta'] = 2; data['gamma'] = 3; let keys: string[] = Object.keys(data); let result: string = ''; for (let i: number = 0; i < keys.length; i++) { let key: string = keys[i]; let val: number = data[k...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testObjectEntries AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefine...
function testObjectEntries(): string { let data: Record<string, number> = {}; data['alpha'] = 1; data['beta'] = 2; data['gamma'] = 3; let keys: string[] = Object.keys(data); let result: string = ''; for (let i: number = 0; i < keys.length; i++) { let key: string = keys[i]; let val: number = data[k...
https://github.com/miaochiahao/ark-ghidra
960c32010b4b219390170bc7154d540e717ff2f9
github
LZZLHY/hlib
entry/src/main/ets/utils/I18n.ets
arkts
bindContext
由 EntryAbility.onCreate 调用,注入 ApplicationContext 供后续静态方法用。
static bindContext(ctx: common.Context): void { I18n.appContext = ctx; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left bindContext AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ctx AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Lef...
static bindContext(ctx: common.Context): void { I18n.appContext = ctx; }
https://github.com/LZZLHY/hlib
815b2366f28f98cacc54321f0d779ef888949cf9
github
zmuxuny/ai-guardian-star
entry/src/main/ets/database/DatabaseHelper.ets
arkts
queryHealthEvents
查询健康事件列表,只返回保留天数内、指定用户的记录,可按类型过滤,按时间倒序
public async queryHealthEvents(eventType?: string, username?: string): Promise<HealthEvent[]> { const cutoff = Date.now() - this.getRetentionDays() * 24 * 60 * 60 * 1000; const predicates = new relationalStore.RdbPredicates("t_health_event"); predicates.greaterThanOrEqualTo("event_time", cutoff); // ...
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 queryHealthEvents AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left eventType AST#identifier#Right AST#ERROR#Left AST#?#L...
public async queryHealthEvents(eventType?: string, username?: string): Promise<HealthEvent[]> { const cutoff = Date.now() - this.getRetentionDays() * 24 * 60 * 60 * 1000; const predicates = new relationalStore.RdbPredicates("t_health_event"); predicates.greaterThanOrEqualTo("event_time", cutoff); // ...
https://github.com/zmuxuny/ai-guardian-star/blob/87ab023d8b9aab4303a9fc1e97508e1f8ee01e07/entry/src/main/ets/database/DatabaseHelper.ets#L507-L564
adc1269c8388cd6122f788492a4ed7466e47e6ba
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/usbdriver/UsbDriverService.ets
arkts
stopRescanTimer
停止定期重新扫描定时器
private stopRescanTimer(): void { if (this.rescanTimerId !== null) { clearInterval(this.rescanTimerId); this.rescanTimerId = null; console.info(`${TAG} 停止设备重新扫描定时器`); } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left stopRescanTimer 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#exp...
private stopRescanTimer(): void { if (this.rescanTimerId !== null) { clearInterval(this.rescanTimerId); this.rescanTimerId = null; console.info(`${TAG} 停止设备重新扫描定时器`); } }
https://github.com/AlkaidLab/moonlight-harmony
b0076c1a08624a13c972da1bdefb857645c2ac80
github
codelably/tuniao-ui
core/tuniaoui/src/main/ets/components/count-down/TnCountDown.ets
arkts
getDaysText
获取天数显示文本
getDaysText(): string { return padZero(Math.floor(this.getTotalSec() / DAY_S)); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getDaysText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement_...
getDaysText(): string { return padZero(Math.floor(this.getTotalSec() / DAY_S)); }
https://github.com/codelably/tuniao-ui
bf207f009552a9ffdb3d4e97f4bb7cc59e4b2558
github
SMAT-Lab/PhantomRendering
Harmoney_Next-Tiktok/entry/src/main/ets/pages/ChatDetail/ChatDetail.ets
arkts
sendTextMessage
发送文本信息
sendTextMessage(content: string) { /** * 这里的mess是我发的信息,里面的发送用户是当前登录的用户*/ let mess = new MessageInfoModel({ messageContent: content, //消息内容 sendUser: this.currentUser, //我发的消息 connectUser: this.talkUser, //联系人发的消息 } as MessageInfo) this.messList.push(mess) //追加消息 new Tiktok(g...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left sendTextMessage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left content AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AS...
sendTextMessage(content: string) { /** * 这里的mess是我发的信息,里面的发送用户是当前登录的用户*/ let mess = new MessageInfoModel({ messageContent: content, //消息内容 sendUser: this.currentUser, //我发的消息 connectUser: this.talkUser, //联系人发的消息 } as MessageInfo) this.messList.push(mess) //追加消息 new Tiktok(g...
https://github.com/SMAT-Lab/PhantomRendering
9365211f7490a1d35b88b39b81a363dba17f61a3
github
openharmony/codelabs
ETSUI/CoinNote/entry/src/main/ets/component/CalendarView.ets
arkts
aboutToAppear
当前展示的月份
aboutToAppear() { // 初始化当前月份为选中日期的月份 this.currentMonth = new Date(this.selectedDate.getFullYear(), this.selectedDate.getMonth(), 1); }
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.currentMonth = new Date(this.selectedDate.getFullYear(), this.selectedDate.getMonth(), 1); }
https://gitcode.com/openharmony/codelabs
fa3fd20c6ef58d78b9cf535f567b8ae5f7d5ca36
gitcode
LongLiveY96/chatcube
entry/src/main/ets/services/PreferencesService.ets
arkts
getCurrentModelName
获取当前选中的模型名称
async getCurrentModelName(): Promise<string> { return await this.getString(PreferenceKeys.CURRENT_MODEL_NAME, '') }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getCurrentModelName 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#...
async getCurrentModelName(): Promise<string> { return await this.getString(PreferenceKeys.CURRENT_MODEL_NAME, '') }
https://github.com/LongLiveY96/chatcube
546e091f85d0d74fa7bc784484d389ae0095ebd9
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/PieRadarChartBaseModel.ets
arkts
setRotationAngle
Set an offset for the rotation of the RadarChart in degrees. Default 270f --> top (NORTH) @param angle
public setRotationAngle(angle: number): void { this.mRawRotationAngle = angle; this.mRotationAngle = Utils.getNormalizedAngle(this.mRawRotationAngle); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setRotationAngle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left angle AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
public setRotationAngle(angle: number): void { this.mRawRotationAngle = angle; this.mRotationAngle = Utils.getNormalizedAngle(this.mRawRotationAngle); }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
e47f5f7b661a4487f312e51e6a64f3e0b22ac3cb
gitee
openharmony-sig/ohos_checksum
library/src/main/ets/sha1.ets
arkts
AlignSHA1
The standard SHA1 needs the input string to fit into a block This function align the input string to meet the requirement
AlignSHA1(str: string): number[] { let nblk: number = ((str.length + 8) >> 6) + 1, blks: number[] = new Array(nblk * 16); for (let i = 0; i < nblk * 16; i++) blks[i] = 0; for (let i = 0; i < str.length; i++) { blks[i >> 2] |= str.charCodeAt(i) << (24 - (i & 3) * 8); blks[i >> 2]...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left AlignSHA1 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#...
AlignSHA1(str: string): number[] { let nblk: number = ((str.length + 8) >> 6) + 1, blks: number[] = new Array(nblk * 16); for (let i = 0; i < nblk * 16; i++) blks[i] = 0; for (let i = 0; i < str.length; i++) { blks[i >> 2] |= str.charCodeAt(i) << (24 - (i & 3) * 8); blks[i >> 2]...
https://gitee.com/openharmony-sig/ohos_checksum.git
510fd3980f500fcfbe70770f1360e1881c9a10fe
gitee
openharmony-sig/applications_clock
common/src/main/ets/manager/PageStateManager.ets
arkts
getClockShowState
Obtains showTextClock value. @return showTextClock
async getClockShowState(): Promise<boolean> { const preferences = await this.getPreferences(); const showTextClock = await preferences.get(showTextClockKey, false); LogUtil.info(TAG, 'get showTextClock from Sp:' + showTextClock); return Boolean(showTextClock); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getClockShowState 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#ge...
async getClockShowState(): Promise<boolean> { const preferences = await this.getPreferences(); const showTextClock = await preferences.get(showTextClockKey, false); LogUtil.info(TAG, 'get showTextClock from Sp:' + showTextClock); return Boolean(showTextClock); }
https://gitee.com/openharmony-sig/applications_clock.git
182977b552ba775dd7f2349d7ab138dd01f185ae
gitee
Joker-x-dev/CoolMallArkTS
feature/common/src/main/ets/view/SettingsPage.ets
arkts
build
构建设置页面 @returns {void} 无返回值
build() { AppNavDestination({ title: "设置", viewModel: this.vm }) { this.SettingsContent(); } }
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#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c...
build() { AppNavDestination({ title: "设置", viewModel: this.vm }) { this.SettingsContent(); } }
https://github.com/Joker-x-dev/CoolMallArkTS
49d625b8bae96174253eb1e8f395c7bc3bc1cd5f
github
guyu0327/HarmonyGomoku
entry/src/main/ets/pages/Second.ets
arkts
init
初始化棋盘方法
init() { // 计算宽度,适配横屏 if (this.context.width < this.context.height) { this.board_width = this.context.width - 40 } else { this.board_width = this.context.height - 40 } this.board_x = (this.context.width - this.board_width) / 2 this.board_y = (this.context.height - this.board_width)...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left init AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#comment#Left // 计算宽度,适配横屏 AST#co...
init() { // 计算宽度,适配横屏 if (this.context.width < this.context.height) { this.board_width = this.context.width - 40 } else { this.board_width = this.context.height - 40 } this.board_x = (this.context.width - this.board_width) / 2 this.board_y = (this.context.height - this.board_width)...
https://github.com/guyu0327/HarmonyGomoku
8cefd60c65bd8a7f26216c0f475b61973b313794
github
openharmony/codelabs
ETSUI/PassNote/entry/src/main/ets/common/NoteManager.ets
arkts
getNotes
获取所有便签(带排序逻辑)
static async getNotes(): Promise<Note[]> { try { const pref = await dataPreferences.getPreferences(NoteManager.context, NoteManager.PREF_NAME); const dataStr = await pref.get(NoteManager.KEY_NOTES, '[]') as string; let notes = JSON.parse(dataStr) as Note[]; // 排序逻辑: // 1. isPinned (...
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 getNotes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left ...
static async getNotes(): Promise<Note[]> { try { const pref = await dataPreferences.getPreferences(NoteManager.context, NoteManager.PREF_NAME); const dataStr = await pref.get(NoteManager.KEY_NOTES, '[]') as string; let notes = JSON.parse(dataStr) as Note[]; // 排序逻辑: // 1. isPinned (...
https://gitcode.com/openharmony/codelabs
e532e7e04165b0128f3d06d88fac30326572b3e4
gitcode
suoniuge/arkts-ai-guard-en
examples/bad-to-good.ets
arkts
fail
Bad: throwing a string. throw 'failed'; Better: throw Error.
function fail(message: string): never { throw new Error(message); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left fail AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left message AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AS...
function fail(message: string): never { throw new Error(message); }
https://github.com/suoniuge/arkts-ai-guard-en
f5589e2f7a1a329886cc864c0ae62829881368b3
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/WebViewAuthManager.ets
arkts
deserializeCookies
从 JSON 反序列化为 CookieEntry 数组
private deserializeCookies(json: string): CookieEntry[] { if (!json || json.length === 0) { return []; } try { const arr = SafeUtils.parseArr(json) as Object[]; const result: CookieEntry[] = []; let i: number = 0; while (i < arr.length) { const item: Object = arr[i] a...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left deserializeCookies AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left json AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier...
private deserializeCookies(json: string): CookieEntry[] { if (!json || json.length === 0) { return []; } try { const arr = SafeUtils.parseArr(json) as Object[]; const result: CookieEntry[] = []; let i: number = 0; while (i < arr.length) { const item: Object = arr[i] a...
https://github.com/DaLongZhuaZi/manxia
ae51dc96fb60a616d3b270f0693e44e61914f1dd
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Double.ets
arkts
isSafeInteger
Checks if double is a safe integer value @returns { boolean } true if the underlying double is a safe integer @syscap SystemCapability.Utils.Lang @FaAndStageModel
public isSafeInteger(): boolean { return Double.isSafeInteger(this.value); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isSafeInteger 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...
public isSafeInteger(): boolean { return Double.isSafeInteger(this.value); }
https://gitcode.com/iop123123/arkts-static-skills
6e304caec013d619b86d566e8be227d40d3638fd
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Storage/DownloadDirManager.ets
arkts
getUri
获取Download目录URI
public getUri(): string { return this.downloadDirUri; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getUri AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#R...
public getUri(): string { return this.downloadDirUri; }
https://github.com/DaLongZhuaZi/manxia
e06750a07613ff79f100c120a47721a13029a527
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/DataView.ets
arkts
getUint16
=== Uint16 === Read bytes as they represent given type @param byteOffset zero index to read @returns read value (big endian)
public getUint16(byteOffset: number): number { return this.getUint16(byteOffset as int) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getUint16 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left byteOffset AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Ri...
public getUint16(byteOffset: number): number { return this.getUint16(byteOffset as int) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
e6db9c874b6ed0747989812268a0b19424e72fe0
gitee
PollenWang6/HiXD
entry/src/main/ets/utils/HttpUtil.ets
arkts
postNoRedirect
发送 POST 请求但不自动跟随重定向。 与 getNoRedirect 相同原理,但支持 POST body。
async postNoRedirect(url: string, bodyStr: string, headers?: Record<string, string>): Promise<HttpResponse> { await this.loadCookies(); return this.requestNoRedirect(url, http.RequestMethod.POST, bodyStr, headers); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left postNoRedirect AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left url AST#identifier#Right AST#type_annotation#Left AST#:#Left : A...
async postNoRedirect(url: string, bodyStr: string, headers?: Record<string, string>): Promise<HttpResponse> { await this.loadCookies(); return this.requestNoRedirect(url, http.RequestMethod.POST, bodyStr, headers); }
https://github.com/PollenWang6/HiXD
088f04cb62266c63d258d7edb55ff45cf158a9cb
github
Joker-x-dev/CoolMallArkTS
core/base/src/main/ets/viewmodel/BaseNetWorkViewModel.ets
arkts
setErrorState
设置错误状态 @returns {void} 无返回值
protected setErrorState(): void { this.uiState = BaseNetWorkUiState.ERROR; }
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left setErrorState 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...
protected setErrorState(): void { this.uiState = BaseNetWorkUiState.ERROR; }
https://github.com/Joker-x-dev/CoolMallArkTS
95f4b67906769e4261e71c1bc06a80e5be940959
github
webabcd/HarmonyDemo
entry/src/main/ets/entryformability/EntryFormAbility.ets
arkts
copyFile
将指定的资源文件复制到指定的沙箱目录
copyFile(src: Resource, dst: string) { let resourceManager = this.context.getApplicationContext().resourceManager let buffer = resourceManager.getMediaContentSync(src.id).buffer let outputStream = fs.createStreamSync(dst, 'w+'); let writeLength = outputStream.writeSync(buffer, { offset: 0, ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left copyFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left src AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Resource AST#identifier#Right AST...
copyFile(src: Resource, dst: string) { let resourceManager = this.context.getApplicationContext().resourceManager let buffer = resourceManager.getMediaContentSync(src.id).buffer let outputStream = fs.createStreamSync(dst, 'w+'); let writeLength = outputStream.writeSync(buffer, { offset: 0, ...
https://github.com/webabcd/HarmonyDemo
361b6b1bb885465b6ca3566747de516b5fc5d3e9
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
set
Copies elements from an ArrayLike object to the Int16Array. @param { ArrayLike<number> } array - An ArrayLike object containing the elements to copy. @param { int } [offset] - Optional. The offset into the target array at which to begin writing values from the source array. The default value is 0. @throws { RangeError ...
public set(array: ArrayLike<number>, offset: int = 0): void { const insertPos = offset if (insertPos < 0 || insertPos + array.length > this.lengthInt) { throw new RangeError("offset is out of bounds") } for (let i = 0; i < array.length; ++i) { this.setUnsafe(i...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left array AST#identifier#Right AST#:#Left : AST#:#Right AST#ERRO...
public set(array: ArrayLike<number>, offset: int = 0): void { const insertPos = offset if (insertPos < 0 || insertPos + array.length > this.lengthInt) { throw new RangeError("offset is out of bounds") } for (let i = 0; i < array.length; ++i) { this.setUnsafe(i...
https://gitcode.com/iop123123/arkts-static-skills
37ffc2e177c465f542093525e5868e20e1f43f3c
gitcode
openharmony/vendor_unionman
unionpi_tiger/sample_api10/app/adc_module_app/entry/src/main/ets/pages/widgets.ets
arkts
writetemptofile
link index.ets中的tempinfotable对象
private async writetemptofile() { let intervalID = setInterval(() => { let adc_value = adc_napi.get_adc_value(); console.log("adc_value" + adc_value.toString()); let temperature = adc_value * 0.042; if (adc_value <= 800 && adc_value >= 500) { systemTime.getDate((error, date) => { ...
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 writetemptofile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A...
private async writetemptofile() { let intervalID = setInterval(() => { let adc_value = adc_napi.get_adc_value(); console.log("adc_value" + adc_value.toString()); let temperature = adc_value * 0.042; if (adc_value <= 800 && adc_value >= 500) { systemTime.getDate((error, date) => { ...
https://gitee.com/openharmony/vendor_unionman.git
f04d4ffed6b8ca1751ceec40008dc4309b5cc84d
gitee
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/BinaryEncodingVisitor.ets
arkts
visitRepeatedSfixed64
访问 repeated sfixed64 字段
visitRepeatedSfixed64(value: bigint[], fieldNumber: number): void { for (const item of value) { this.visitSfixed64(item, fieldNumber) } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitRepeatedSfixed64 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left big...
visitRepeatedSfixed64(value: bigint[], fieldNumber: number): void { for (const item of value) { this.visitSfixed64(item, fieldNumber) } }
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
d17f3e27de9731edabb49c3d5c69f437eff41ca8
gitcode
LongLiveY96/chatcube
entry/src/main/ets/viewmodels/ChatViewModel.ets
arkts
resolveEffectiveMaxOutputTokens
解析"本次请求要发的 max output tokens", 0 / undefined 一律返回 undefined, 让 AIApiService 在各 provider 路径里决定是否下发字段(只有 Claude 必传时会兜底 128_000)。 override 优先于助手配置, 用于 sendMessage 这种从 ChatSendFlow 传入显式覆盖值的入口。
private async resolveEffectiveMaxOutputTokens(override?: number): Promise<number | undefined> { if (override !== undefined && override > 0) { return override } const fromAssistant = await this.getMaxOutputTokens() return fromAssistant > 0 ? fromAssistant : undefined }
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 resolveEffectiveMaxOutputTokens AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left override AST#identifier#Right AST#ER...
private async resolveEffectiveMaxOutputTokens(override?: number): Promise<number | undefined> { if (override !== undefined && override > 0) { return override } const fromAssistant = await this.getMaxOutputTokens() return fromAssistant > 0 ? fromAssistant : undefined }
https://github.com/LongLiveY96/chatcube
f93e7795c2fdd45ded7a67e450f64aa7d3a2c9e1
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/network/WakeOnLan.ets
arkts
sendBroadcast
==================== 发送方法 ==================== 广播发送(独立 socket,设置 broadcast 标志)
private static async sendBroadcast(payload: ArrayBuffer, ports: number[]): Promise<void> { const udpSocket: socket.UDPSocket = socket.constructUDPSocketInstance(); try { await udpSocket.bind({ address: '0.0.0.0', port: 0, family: 1 }); await udpSocket.setExtraOptions({ broadcast: true }); f...
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 sendBroadcast AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left p...
private static async sendBroadcast(payload: ArrayBuffer, ports: number[]): Promise<void> { const udpSocket: socket.UDPSocket = socket.constructUDPSocketInstance(); try { await udpSocket.bind({ address: '0.0.0.0', port: 0, family: 1 }); await udpSocket.setExtraOptions({ broadcast: true }); f...
https://github.com/AlkaidLab/moonlight-harmony
229f872aaed4d69eea49a71cf5548651e47fd483
github
yangyongzhen/hmmovie
entry/src/main/ets/utils/EfAVPlayer.ets
arkts
_onTimeUpdate
私有用于处理时间更新事件。
private async _onTimeUpdate() { const avPlayer = await this.init(); avPlayer.on("timeUpdate", (time: number) => { this.currentTime = time; this.timeUpdateCallback && this.timeUpdateCallback(time); }); }
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 _onTimeUpdate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST...
private async _onTimeUpdate() { const avPlayer = await this.init(); avPlayer.on("timeUpdate", (time: number) => { this.currentTime = time; this.timeUpdateCallback && this.timeUpdateCallback(time); }); }
https://github.com/yangyongzhen/hmmovie
a6f72948729ed37ebf0fbe012c298d68f7673b12
github
richshaw2015/nds
ohos/entry/src/main/ets/types/MelonDSNative.ets
arkts
registerXComponent
注册 XComponent @param xcomponentId XComponent 的 ID 字符串 @param context XComponent 上下文对象 @returns 注册是否成功
static registerXComponent(xcomponentId: string, context: object): boolean { return MelonDSNative.native.registerXComponent(xcomponentId, context); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left registerXComponent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left xcomponentId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AS...
static registerXComponent(xcomponentId: string, context: object): boolean { return MelonDSNative.native.registerXComponent(xcomponentId, context); }
https://github.com/richshaw2015/nds
5214cb643165b33ab6fa2331205e358894d2edac
github
codelably/tuniao-ui
core/tuniaoui/src/main/ets/components/notify/TnNotify.ets
arkts
closeImmediate
立即关闭(用于连续调用场景)
private closeImmediate(): void { this.clearTimer(); if (this.contentNode !== null && this.uiContext !== null) { const node: ComponentContent<TnNotifyParams> = this.contentNode; try { this.uiContext.getPromptAction().closeCustomDialog(node); } catch (_e) { // 忽略异常 } ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left closeImmediate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expr...
private closeImmediate(): void { this.clearTimer(); if (this.contentNode !== null && this.uiContext !== null) { const node: ComponentContent<TnNotifyParams> = this.contentNode; try { this.uiContext.getPromptAction().closeCustomDialog(node); } catch (_e) { // 忽略异常 } ...
https://github.com/codelably/tuniao-ui
6b34ee27faad4b3f0229f50440b9878c35f1bd69
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.LinkedList.ets
arkts
getIndexOf
Gets the index of the first occurrence of the specified element. @param element The element to locate. @returns The index of the first occurrence of the element, or -1 if not found.
public getIndexOf(element: T): int { let index: int = 0; let currentNode: ListNode<T> | undefined = this.head; while (currentNode !== undefined) { if (currentNode!.element == element) { return index; } currentNode = currentNode!.next; ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getIndexOf AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left element AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#R...
public getIndexOf(element: T): int { let index: int = 0; let currentNode: ListNode<T> | undefined = this.head; while (currentNode !== undefined) { if (currentNode!.element == element) { return index; } currentNode = currentNode!.next; ...
https://gitcode.com/iop123123/arkts-static-skills
9750978760226567205de0b06178e79ac3d194a7
gitcode
tdcare/tdwebrtc
src/main/ets/VideoDecoderVP8.ets
arkts
setSurfaceById
设置输出 Surface(通过 surfaceId)
public setSurfaceById(surfaceId: string): boolean { this.surfaceId = surfaceId; if (this.vp8Decoder !== null) { this.vp8Decoder.setSurface(surfaceId); LogUtil.info(`[VideoDecoderVP8] Surface 已设置: ${surfaceId}`); return true; } LogUtil.info(`[VideoDecoderVP8] SurfaceId 已保存,将在初始化时设置:...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setSurfaceById AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left surfaceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#strin...
public setSurfaceById(surfaceId: string): boolean { this.surfaceId = surfaceId; if (this.vp8Decoder !== null) { this.vp8Decoder.setSurface(surfaceId); LogUtil.info(`[VideoDecoderVP8] Surface 已设置: ${surfaceId}`); return true; } LogUtil.info(`[VideoDecoderVP8] SurfaceId 已保存,将在初始化时设置:...
https://github.com/tdcare/tdwebrtc
fcc963caac991d5167ef1f145c46a33be2885477
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/DemoDataService.ets
arkts
seedAnomalyData
---------------- 异常检测数据填充 ----------------
private static async seedAnomalyData(userId: number, categories: Category[]) { try { const existingBaselines = await UserSpendingBaselineDAO.getAllByUser(userId); if (existingBaselines.length > 0) { console.info('[DemoDataService] 异常检测数据已存在,跳过生成'); return; } const now = ne...
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 seedAnomalyData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left...
private static async seedAnomalyData(userId: number, categories: Category[]) { try { const existingBaselines = await UserSpendingBaselineDAO.getAllByUser(userId); if (existingBaselines.length > 0) { console.info('[DemoDataService] 异常检测数据已存在,跳过生成'); return; } const now = ne...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
63cd0a4c2bc612135bef4c478b405f79714421a3
github
openharmony-sig/ohos_video_trimmer
entry/src/main/ets/pages/FileUtils.ets
arkts
deleteFolderSync
同步删除文件目录 必须保证文件夹里面没有文件 @param path 待删除目录的绝对路径
deleteFolderSync(path: string): void { if (this.existFolder(path)) { fs.rmdirSync(path); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left deleteFolderSync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ...
deleteFolderSync(path: string): void { if (this.existFolder(path)) { fs.rmdirSync(path); } }
https://gitee.com/openharmony-sig/ohos_video_trimmer.git
e2ec89c4c5c7610e9b8ee04e661f50b70e116d68
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
constructor
Creates an Int32Array with respect to data accessed via Iterable<Number> interface @param { Iterable<Number> } elements - an iterable object @syscap SystemCapability.Utils.Lang @FaAndStageModel
public constructor(elements: Iterable<Number>) { const items: Object = elements as Object if (items instanceof ArrayLike) { const arr = reflect.internals.Types.identity_cast<Number>(items as ArrayLike<Number>) this.byteLength = arr.length * Int32Array.BYTES_PER_ELEMENT ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left elements AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_ex...
public constructor(elements: Iterable<Number>) { const items: Object = elements as Object if (items instanceof ArrayLike) { const arr = reflect.internals.Types.identity_cast<Number>(items as ArrayLike<Number>) this.byteLength = arr.length * Int32Array.BYTES_PER_ELEMENT ...
https://gitcode.com/iop123123/arkts-static-skills
22f3d083ac7b798078a3e4acad4e9524543b6bde
gitcode
openharmony-sig/qr-code-generator
library/src/main/ets/components/MainPage/qrcodegen.ets
arkts
finderPenaltyCountPatterns
Can only be called immediately after a white run is added, and returns either 0, 1, or 2. A helper function for getPenaltyScore().
private finderPenaltyCountPatterns(runHistory: Array<int>): int { const n: int = runHistory[1]; if (n > this.size * 3) throw new Error("Assertion error"); const core: boolean = n > 0 && runHistory[2] == n && runHistory[3] == n * 3 && runHistory[4] == n && runHistory[5] == n; return (co...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left finderPenaltyCountPatterns AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left runHistory AST#identifier#Right AST#ERROR#Left AST#:#L...
private finderPenaltyCountPatterns(runHistory: Array<int>): int { const n: int = runHistory[1]; if (n > this.size * 3) throw new Error("Assertion error"); const core: boolean = n > 0 && runHistory[2] == n && runHistory[3] == n * 3 && runHistory[4] == n && runHistory[5] == n; return (co...
https://gitee.com/openharmony-sig/qr-code-generator.git
f08a017bd0cfcd44b6ec92e305d52938eb41910c
gitee
apap6628114/nga_oh
entry/src/main/ets/store/AppStore.ets
arkts
settings
---------- Facade: Settings ----------
get settings(): SettingsState { return this.settingsStore.state }
AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left settings 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 SettingsState AST#iden...
get settings(): SettingsState { return this.settingsStore.state }
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/store/AppStore.ets#L138-L140
382ad66b130cead8d36b1132e9c145fe7eea0237
github
openharmony-tpc/XmlGraphicsBatik
library/src/main/ets/batik/svggen/SVGRect.ets
arkts
getY
获取y坐标
public getY(): number{ return this._y; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left getY AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Righ...
public getY(): number{ return this._y; }
https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git
2eaa61106ab7f0e4e8ed4b63e57c32b06630d74d
gitee
HarmonyOS_Samples/accountkit-samplecode-clientdemo-arkts
hmos-account-kit-quicklogin-client/assets/QuickLoginPage.ets
arkts
showToast
Toast提示
showToast(resource: string) { try { this.getUIContext().getPromptAction().showToast({ message: resource, duration: 2000 }); } catch (error) { const message = (error as BusinessError).message const code = (error as BusinessError).code hilog.error(this.domainId, thi...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left showToast AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left resource AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#L...
showToast(resource: string) { try { this.getUIContext().getPromptAction().showToast({ message: resource, duration: 2000 }); } catch (error) { const message = (error as BusinessError).message const code = (error as BusinessError).code hilog.error(this.domainId, thi...
https://gitcode.com/HarmonyOS_Samples/accountkit-samplecode-clientdemo-arkts
823d894a67a48f1e1877a434fbb53b1c001ed24f
gitcode
arkui-x/samples
CodeLab/Cases/feature/calendarswitch/src/main/ets/pages/CustomCalendarSample.ets
arkts
getCurrentScreenWidth
获取当前屏幕宽度
getCurrentScreenWidth(): number { let screenWidth: number = px2vp(display.getDefaultDisplaySync().width); // 适配cases中Navigation在不同mode时,计算相对需要使用的屏幕宽度。当屏幕宽度大于600vp时,cases工程Navigation的mode采用Split模式显示,需要重新计算实际页面所需的屏幕宽度。 if (!this.isPlugin && screenWidth >= this.DEVICESIZE) { return screenWidth / 2; ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCurrentScreenWidth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#...
getCurrentScreenWidth(): number { let screenWidth: number = px2vp(display.getDefaultDisplaySync().width); // 适配cases中Navigation在不同mode时,计算相对需要使用的屏幕宽度。当屏幕宽度大于600vp时,cases工程Navigation的mode采用Split模式显示,需要重新计算实际页面所需的屏幕宽度。 if (!this.isPlugin && screenWidth >= this.DEVICESIZE) { return screenWidth / 2; ...
https://gitcode.com/arkui-x/samples
ae3be72b367573ab0483172ad5a83dd523b025aa
gitcode
tdcare/tdwebrtc
src/main/ets/utils/LogUtil.ets
arkts
setDomain
设置日志对应的领域标识,范围是0x0~0xFFFF。(该方法建议在Ability里调用) @param domain
static setDomain(domain: number = LogUtil.domain) { LogUtil.domain = domain }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setDomain AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left domain AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expressio...
static setDomain(domain: number = LogUtil.domain) { LogUtil.domain = domain }
https://github.com/tdcare/tdwebrtc
cc452474077c524c2e6f55b952b08a935ae65fd4
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Set.ets
arkts
constructor
Creates a new FinalMap instance with the specified initial capacity. @param { int } initialCapacity - The initial capacity of the map. @syscap SystemCapability.Utils.Lang @FaAndStageModel
constructor(initialCapacity: int) { super(initialCapacity) }
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 initialCapacity AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#Right AST#ERROR...
constructor(initialCapacity: int) { super(initialCapacity) }
https://gitcode.com/iop123123/arkts-static-skills
20b0737393966eec9597e940f4bd71a88a4bee2c
gitcode
bluedeer000/HarmonyCalendar
entry/src/main/ets/services/CalendarSourceAdapterRegistry.ets
arkts
unregisterAdapter
注销适配器
unregisterAdapter(type: string): boolean { // 不注销内置类型 if (type === "caldav" || type === "ics-subscription") { return false; } return this.registrations.delete(type); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left unregisterAdapter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left...
unregisterAdapter(type: string): boolean { // 不注销内置类型 if (type === "caldav" || type === "ics-subscription") { return false; } return this.registrations.delete(type); }
https://github.com/bluedeer000/HarmonyCalendar
352dc76a9bad7890430e0909a4b5cd1a3e06f614
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
of
Returns a new array from a set of elements. @returns { Uint32Array } - a new Uint32Array @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static of(): Uint32Array { return new Uint32Array(0) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#of#Left of AST#of#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression...
public static of(): Uint32Array { return new Uint32Array(0) }
https://gitcode.com/iop123123/arkts-static-skills
44eea407ab791e6024015f0025366421ce0e29b7
gitcode
aimilin6688/KeePassHO
entry/src/main/ets/services/template/TemplateBuilder.ets
arkts
withStandardFields
批量设置标准字段
withStandardFields(fields: StandardFieldsMap): TemplateBuilder { if (fields.title !== undefined && fields.title !== '') { this.withTitle(fields.title); } if (fields.username !== undefined && fields.username !== '') { this.withUsername(fields.username); } if (fields.password !== undefin...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left withStandardFields AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left fields AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left StandardFieldsMap AST#identifier#Ri...
withStandardFields(fields: StandardFieldsMap): TemplateBuilder { if (fields.title !== undefined && fields.title !== '') { this.withTitle(fields.title); } if (fields.username !== undefined && fields.username !== '') { this.withUsername(fields.username); } if (fields.password !== undefin...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/template/TemplateBuilder.ets#L106-L123
3f533ba8e5a99b20cdc63116cfc8ca5461e0c3bd
github
SMAT-Lab/PhantomRendering
Harmoney_Next-Tiktok/entry/src/main/ets/buiders/CardBuider.ets
arkts
CardBuiDer
全局buiDer
@Builder function CardBuiDer() { Column() { Column() { } .width('100%') } .padding({ left: 15, right: 15 }) .backgroundColor(Color.White) .width('100%') }
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 CardBuiDer AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left...
@Builder function CardBuiDer() { Column() { Column() { } .width('100%') } .padding({ left: 15, right: 15 }) .backgroundColor(Color.White) .width('100%') }
https://github.com/SMAT-Lab/PhantomRendering
a0644e28d545ca54324005f7fe0dfb16c2b25793
github
HarmonyOS_Samples/hmosworld
HMOSWorld/Application/commons/audioplayer/src/main/ets/service/AudioRenderService.ets
arkts
initAudioRenderInit
Create an audio renderer and write audio data to a file
public initAudioRenderInit(audioRendererOptions?: audio.AudioRendererOptions): Promise<void> { // Callback function for listening to the audio stream written by audio render return audio.createAudioRenderer(audioRendererOptions ?? DEFAULT_AUDIO_RENDERER_OPTIONS).then(renderer => { this.renderer = render...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left initAudioRenderInit AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left audioRendererOptions AST#identifier#Right AST#ERROR#Left AST#?#Left ? A...
public initAudioRenderInit(audioRendererOptions?: audio.AudioRendererOptions): Promise<void> { // Callback function for listening to the audio stream written by audio render return audio.createAudioRenderer(audioRendererOptions ?? DEFAULT_AUDIO_RENDERER_OPTIONS).then(renderer => { this.renderer = render...
https://gitcode.com/HarmonyOS_Samples/hmosworld
eee41ba84d5c8d9bd50a7c698e99b48c60199e13
gitcode
codelably/HCompass
core/network/src/main/ets/DefaultResponseParser.ets
arkts
constructor
构造函数 @param config 解析器配置,可选
constructor(config?: Partial<ResponseParserConfig>) { this.config = ObjectAssign({} as ResponseParserConfig, DEFAULT_PARSER_CONFIG, config); }
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 config AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expr...
constructor(config?: Partial<ResponseParserConfig>) { this.config = ObjectAssign({} as ResponseParserConfig, DEFAULT_PARSER_CONFIG, config); }
https://github.com/codelably/HCompass
a3898f3738de40eb0f77b2dc6aaccd300032c502
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/renderer/AxisRenderer.ets
arkts
getPaintGrid
Returns the Paint object that is used for drawing the grid-lines of the axis. @return
public getPaintGrid(): Paint { return this.mGridPaint; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getPaintGrid 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 Paint AST...
public getPaintGrid(): Paint { return this.mGridPaint; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
968272ebfaea6a00308e5660d56ce325b6463e8b
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebDAV/WebDAVAutoBackupScheduler.ets
arkts
getBackupIntervalMs
7天 根据间隔类型获取间隔毫秒数
function getBackupIntervalMs(interval: 'daily' | 'weekly'): number { if (interval === 'daily') { return BACKUP_INTERVAL_DAILY; } else { return BACKUP_INTERVAL_WEEKLY; } }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getBackupIntervalMs AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left interval AST#identifier#Right AST#type_annotation#Left AST#:#Left ...
function getBackupIntervalMs(interval: 'daily' | 'weekly'): number { if (interval === 'daily') { return BACKUP_INTERVAL_DAILY; } else { return BACKUP_INTERVAL_WEEKLY; } }
https://github.com/DaLongZhuaZi/manxia
88fc2d8ed5d4930e6417fceebad154e4d0930420
github
erosTeam/NextE
shared/src/main/ets/services/CachedImageFileService.ets
arkts
stat
File count + total bytes of the reader image cache directory, for the cache page.
static async stat(context: common.UIAbilityContext): Promise<CacheStat> { const out: CacheStat = new CacheStat() const dir: string = `${context.cacheDir}/${CACHE_DIR_NAME}` try { if (!fileIo.accessSync(dir)) { return out } const names: string[] = fileIo.listFileSync(dir) ou...
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 stat AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Rig...
static async stat(context: common.UIAbilityContext): Promise<CacheStat> { const out: CacheStat = new CacheStat() const dir: string = `${context.cacheDir}/${CACHE_DIR_NAME}` try { if (!fileIo.accessSync(dir)) { return out } const names: string[] = fileIo.listFileSync(dir) ou...
https://github.com/erosTeam/NextE
2b656e9b7af1c23427510dbb6ba76c32819faa5e
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/database/BatchQueryHelper.ets
arkts
bulkInsert
批量插入数据 @param tableName 表名 @param records 要插入的记录数组 @returns 插入成功的记录数 性能优化: - 自动分批处理,每批 100 条 - 使用事务确保原子性 - 批量插入比逐条插入快 10-50 倍
static async bulkInsert( tableName: string, records: relationalStore.ValuesBucket[] ): Promise<number> { if (!records || records.length === 0) { console.log('[BatchQueryHelper] 没有数据需要插入'); return 0; } const store = DatabaseManager.getDatabase(); const totalRecords = records.leng...
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 bulkInsert AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left tableName AST#identifier#Right AST#ERROR#Left AST#:#Left : A...
static async bulkInsert( tableName: string, records: relationalStore.ValuesBucket[] ): Promise<number> { if (!records || records.length === 0) { console.log('[BatchQueryHelper] 没有数据需要插入'); return 0; } const store = DatabaseManager.getDatabase(); const totalRecords = records.leng...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
58aaadb073476fe716ce24aab724452870efb0df
github
openharmony/applications_contacts
entry/src/main/ets/model/ContactAbilityModel.ets
arkts
getDisplayName
Read the name, which needs to be optimized. Edit Contact @param {Object} addParams Contact Information @return {string} Contact Name
getDisplayName(addParams: ContactInfo): string { let displayName = ''; if (addParams.display_name != undefined && addParams.display_name.length > 0) { displayName = addParams.display_name; } else if (addParams.nickname != undefined && addParams.nickname.length > 0) { displayName = addParams.ni...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getDisplayName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left addParams AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ContactInfo AST#identifier#Right AST...
getDisplayName(addParams: ContactInfo): string { let displayName = ''; if (addParams.display_name != undefined && addParams.display_name.length > 0) { displayName = addParams.display_name; } else if (addParams.nickname != undefined && addParams.nickname.length > 0) { displayName = addParams.ni...
https://gitee.com/openharmony/applications_contacts.git
15383e4ed00bf0bc55542d331f1ac1485bfacbcb
gitee
aimilin6688/KeePassHO
entry/src/main/ets/common/utils/ResourceUtils.ets
arkts
isResourceStr
判断是否是ResourceStr @param resource @returns
public static isResourceStr(resource: Object): boolean { if (typeof resource == 'string') { return true; } const keys = Object.keys(resource); return keys.indexOf('bundleName') !== -1 && keys.indexOf('id') !== -1; }
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 isResourceStr AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left resource AST#identifier#Right AST#ERROR#Left AST#:#Left ...
public static isResourceStr(resource: Object): boolean { if (typeof resource == 'string') { return true; } const keys = Object.keys(resource); return keys.indexOf('bundleName') !== -1 && keys.indexOf('id') !== -1; }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/ResourceUtils.ets#L7-L13
92cc42c69030bbee27026745f0e2a667dace2e5d
github
751496032/ZRouter
RouterApi/src/main/ets/api/RouterMgr.ets
arkts
redirect
重定向页面 @param name
public redirect<T>(name: string, builder?: NavDestBuilder<T>) { const redirectType = builder?.options?.redirectType if (redirectType === RedirectType.REPLACE) { this.replacePathByName(name, builder?.getParam(), builder?.options.animated, builder) } else if (redirectType === RedirectType.REMOVE) { ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#binary_expression#Left AST#identifier#Left redirect AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Righ...
public redirect<T>(name: string, builder?: NavDestBuilder<T>) { const redirectType = builder?.options?.redirectType if (redirectType === RedirectType.REPLACE) { this.replacePathByName(name, builder?.getParam(), builder?.options.animated, builder) } else if (redirectType === RedirectType.REMOVE) { ...
https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/api/RouterMgr.ets#L295-L312
858bb00ec4cdf81eb840e064289106b6e768edd2
github
openharmony-sig/jtar
library/src/main/ets/ohos_tar.ets
arkts
setUnTarName
修改解包目标的Untar文件名
public setUnTarName(name: string) { this.untarFileName = name + ".tar"; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setUnTarName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left str...
public setUnTarName(name: string) { this.untarFileName = name + ".tar"; }
https://gitee.com/openharmony-sig/jtar.git
38cc4e5f0c6f756d60249a640f3be84727f9d28f
gitee
OSpark-Team/Free-PCM
library/src/main/ets/utils/AudioRendererPlayer.ets
arkts
setVolumeWithRamp
平滑渐变音量到目标值 @param volume - 目标音量(0.0 ~ 1.0) @param durationMs - 渐变时长(毫秒) @remarks - 音量会在指定时间内平滑地从当前值渐变到目标值 - 渐变是线性的 - 适用于淡入淡出效果 @throws - AudioRenderer 未初始化
public setVolumeWithRamp(volume: number, durationMs: number): void { if (!this.renderer) { throw new Error('AudioRenderer not initialized'); } this.renderer.setVolumeWithRamp(volume, durationMs); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setVolumeWithRamp AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left volume AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
public setVolumeWithRamp(volume: number, durationMs: number): void { if (!this.renderer) { throw new Error('AudioRenderer not initialized'); } this.renderer.setVolumeWithRamp(volume, durationMs); }
https://github.com/OSpark-Team/Free-PCM/blob/3440e7220d07d28815d172b4b3237145434075ee/library/src/main/ets/utils/AudioRendererPlayer.ets#L464-L469
bec92d6dc55e2e60431fba33b252bac9c7a2fa6a
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
entries
Returns an array of key, value pairs for every entry in the Int16Array @returns { IterableIterator<[int, Number]> } - key, value pairs for every entry in the array @syscap SystemCapability.Utils.Lang @FaAndStageModel
public entries(): IterableIterator<[int, Number]> { return new Int16ArrayIteratorEntries(this) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left entries AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_sta...
public entries(): IterableIterator<[int, Number]> { return new Int16ArrayIteratorEntries(this) }
https://gitcode.com/iop123123/arkts-static-skills
e004146d4122445fa6232498687883ff6b6f2afe
gitcode
Harrisonls2004/WaterFlow
entry/src/main/ets/common/utils/CartManager.ets
arkts
getSelectedCount
Get total count of SELECTED items.
static getSelectedCount(): number { let count = 0; for (let i = 0; i < cachedCartList.length; i++) { let item = cachedCartList[i]; if (item.isSelected) { count += item.quantity || 0; } } console.log(`CartManager: getSelectedCount = ${count}`); return count; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getSelectedCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AS...
static getSelectedCount(): number { let count = 0; for (let i = 0; i < cachedCartList.length; i++) { let item = cachedCartList[i]; if (item.isSelected) { count += item.quantity || 0; } } console.log(`CartManager: getSelectedCount = ${count}`); return count; }
https://github.com/Harrisonls2004/WaterFlow
89b78e8e82cce06ec8fa9a8ddc16b0edda5e6c44
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Source/SuwayomiSourceExecutor.ets
arkts
getLibraryPaginated
获取库中的漫画列表(分页+排序) @param categoryId 分类ID,-1表示所有 @param offset 偏移量 @param limit 每页数量 @param sortType 排序类型 @param sortDirection 排序方向
public async getLibraryPaginated( categoryId: number = -1, offset: number = 0, limit: number = 50, sortType: MangaSortType = 'TITLE', sortDirection: SortDirection = 'ASC' ): Promise<PaginatedResult<ComicInfo>> { try { return await this.suwayomiSource.getLibraryMangasPaginated(categoryI...
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 getLibraryPaginated AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left categoryId AST#identifier#Right AST#...
public async getLibraryPaginated( categoryId: number = -1, offset: number = 0, limit: number = 50, sortType: MangaSortType = 'TITLE', sortDirection: SortDirection = 'ASC' ): Promise<PaginatedResult<ComicInfo>> { try { return await this.suwayomiSource.getLibraryMangasPaginated(categoryI...
https://github.com/DaLongZhuaZi/manxia
67c8ba7c99dbb011e12ae771fa2caebe5af0311d
github
robotzzh/AgricultureApp
entry/src/main/ets/DB/relationDB.ets
arkts
updateDatas
对数据进行修改
async updateDatas(tableName: string, valueBucket, key, val) { let predicates = new relationalStore.RdbPredicates(tableName); // 创建表tableName的predicates predicates.equalTo(key, val); // 匹配表tableName中key为val的字段 if (store != undefined) { (store as relationalStore.RdbStore).update(valueBucket, predicate...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left updateDatas AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left tableName AST#identifier#Right AST#type_annotation#Left AS...
async updateDatas(tableName: string, valueBucket, key, val) { let predicates = new relationalStore.RdbPredicates(tableName); // 创建表tableName的predicates predicates.equalTo(key, val); // 匹配表tableName中key为val的字段 if (store != undefined) { (store as relationalStore.RdbStore).update(valueBucket, predicate...
https://github.com/robotzzh/AgricultureApp
0c140be4295508289e1ea88e8a1ee6ad7a511be7
github
LZZLHY/hlib
entry/src/main/ets/utils/UrlUtils.ets
arkts
joinUrl
把 path 与 base domain 拼成完整 URL(支持传入绝对 URL 直接返回)。
static joinUrl(domain: string, path: string): string { if (path.startsWith('http://') || path.startsWith('https://')) { return path; } const cleanDomain = domain.replace(/^https?:\/\//, '').replace(/\/$/, ''); if (path.startsWith('/')) { return `https://${cleanDomain}${path}`; } re...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left joinUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left domain AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string...
static joinUrl(domain: string, path: string): string { if (path.startsWith('http://') || path.startsWith('https://')) { return path; } const cleanDomain = domain.replace(/^https?:\/\//, '').replace(/\/$/, ''); if (path.startsWith('/')) { return `https://${cleanDomain}${path}`; } re...
https://github.com/LZZLHY/hlib
e330cbe701634e2aecfab2d1e0f6d03fdaa78229
github
bhengubv/aether-protocol
arkts/src/main/ets/protocol/MeshPacket.ets
arkts
newId
Generates an RFC-4122 version-4-shaped identifier. This is a convenience id only — it is never signed and never part of a canonical byte layout, so a lightweight generator is sufficient and avoids an external dependency.
private static newId(): string { const hex: string[] = new Array<string>(36); for (let i = 0; i < 36; i++) { if (i === 8 || i === 13 || i === 18 || i === 23) { hex[i] = '-'; } else if (i === 14) { hex[i] = '4'; } else { const r: number = Math.floor(Math.random() * 16)...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left private AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left newId AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right...
private static newId(): string { const hex: string[] = new Array<string>(36); for (let i = 0; i < 36; i++) { if (i === 8 || i === 13 || i === 18 || i === 23) { hex[i] = '-'; } else if (i === 14) { hex[i] = '4'; } else { const r: number = Math.floor(Math.random() * 16)...
https://github.com/bhengubv/aether-protocol
6bd8cc29df88ac8c52f36f245b2e6abb8c0ca973
github