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
openharmony/codelabs
Media/ImageEdit/entry/src/main/ets/viewModel/CropShow.ets
arkts
swapCurrentRatio
Swap ratio.
private swapCurrentRatio() { let W = this.ratio.getW(); let H = this.ratio.getH(); this.ratio.set(H, W); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left swapCurrentRatio AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#...
private swapCurrentRatio() { let W = this.ratio.getW(); let H = this.ratio.getH(); this.ratio.set(H, W); }
https://gitee.com/openharmony/codelabs.git
5611fa26340ffd01df4350f24b452be0841aaded
gitee
NissonCX/CQU-HarmonyOS-APP-Dev-Final
entry/src/main/ets/utils/ExportManager.ets
arkts
generateAllDataCSV
生成全部数据 CSV(多个表格)
private async generateAllDataCSV(): Promise<string> { let csv = '=== 健康记录 ===\n'; csv += await this.generateHealthRecordsCSV(); csv += '\n=== 健康目标 ===\n'; csv += await this.generateHealthGoalsCSV(); csv += '\n=== 提醒设置 ===\n'; csv += await this.generateRemindersCSV(); return csv; }
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 generateAllDataCSV AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ...
private async generateAllDataCSV(): Promise<string> { let csv = '=== 健康记录 ===\n'; csv += await this.generateHealthRecordsCSV(); csv += '\n=== 健康目标 ===\n'; csv += await this.generateHealthGoalsCSV(); csv += '\n=== 提醒设置 ===\n'; csv += await this.generateRemindersCSV(); return csv; }
https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final
19fde208a7d92ef05779553fb0283687a1b6c9ae
github
CLMC2025/Vignette
entry/src/main/ets/algorithm/Algorithm.ets
arkts
processReview
Process a review and return updated word @param word The word being reviewed @param rating User's rating @param lastReviewMs Timestamp of last review (for elapsed calculation) @returns Updated WordItem with new state and history
processReview( word: WordItem, rating: Rating, lastReviewMs: number = 0, useLocalInterval: boolean = false, localIntervalDays: number = 0, elapsedDays: number = -1 ): WordItem { // Calculate elapsed days let finalElapsedDays = 0; if (elapsedDays >= 0) { finalElapsedDays = e...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left processReview AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left word AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left WordItem AST#identifier#Right AST#,#Left ,...
processReview( word: WordItem, rating: Rating, lastReviewMs: number = 0, useLocalInterval: boolean = false, localIntervalDays: number = 0, elapsedDays: number = -1 ): WordItem { // Calculate elapsed days let finalElapsedDays = 0; if (elapsedDays >= 0) { finalElapsedDays = e...
https://github.com/CLMC2025/Vignette
9bf8d35145fa91de4a079d5b12134f7b01f5a0e1
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/String.ets
arkts
localeCompare
Comparison between this String and another one based on default host locale. The result is -1 if this string sorts before the another string, 0 if they are equal, and 1 otherwise. @param another String to compare with @throws RangeError if the locale tag is invalid or not found @throws NullPointerException if another p...
public localeCompare(another: String): short { return this.localeCompare(another, null); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left localeCompare AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left another AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left String AST#iden...
public localeCompare(another: String): short { return this.localeCompare(another, null); }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
4300cd7eb90758173fe885d2ef1b56e5b3113198
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
of
Creates a new BigUint64Array using initializer @param { FixedArray<BigInt> } data - initializer @returns { BigUint64Array } - a new BigUint64Array from data @throws { Error } - function not implemented @syscap SystemCapability.Utils.Lang @FaAndStageModel
public of(...data: FixedArray<BigInt>): BigUint64Array { throw new Error("BigUint64Array.of: not implemented") }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left of AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#ERROR#Left AST#identifier#Left data A...
public of(...data: FixedArray<BigInt>): BigUint64Array { throw new Error("BigUint64Array.of: not implemented") }
https://gitcode.com/iop123123/arkts-static-skills
647aa072fb49947fdd71fcfb747939a84d5ce5bd
gitcode
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.uri.ets
arkts
host
Gets the hostname portion of the URI without a port. @returns { string | null }
get host(): string | null { let s: string = this.uriEntry.getHost(); return s == '' ? null : s; }
AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left host 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 ...
get host(): string | null { let s: string = this.uriEntry.getHost(); return s == '' ? null : s; }
https://gitcode.com/iop123123/arkts-static-skills
a8a537a97fc1eecc2499667772c3bed5263b3d97
gitcode
openharmony/applications_app_samples
code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/videotrimmer/RangeSeekBarView.ets
arkts
showThumbText
调用时间转换函数显示时间
showThumbText(time: number): string { return TimeUtils.msToHHMMSS(time); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left showThumbText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left time AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) A...
showThumbText(time: number): string { return TimeUtils.msToHHMMSS(time); }
https://github.com/openharmony/applications_app_samples
7a942aa8d28c405fc0ad0481959dfb88a608896f
github
huaiminqin/TankWar-Master-with-Many-Tasks
game/src/main/ets/actors/actor/SupplyTruck.ets
arkts
paint
自定义绘制卡车图标
paint(g: CanvasRenderingContext2D): void { if (!this.isVisible()) return; const x = this.getX() + this.getOffsetX(); const y = this.getY() + this.getOffsetY(); const w = this.getWidth(); const h = this.getHeight(); // 绘制卡车车身(绿色) g.fillStyle = '#2e7d32'; g.fillRect(x + w * 0.1, y + h ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left paint AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left g AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left CanvasRenderingContext2D AST#identifier#Right AST#)#L...
paint(g: CanvasRenderingContext2D): void { if (!this.isVisible()) return; const x = this.getX() + this.getOffsetX(); const y = this.getY() + this.getOffsetY(); const w = this.getWidth(); const h = this.getHeight(); // 绘制卡车车身(绿色) g.fillStyle = '#2e7d32'; g.fillRect(x + w * 0.1, y + h ...
https://github.com/huaiminqin/TankWar-Master-with-Many-Tasks
38afff1f3a58a5bdf8776fea437b9e0071bc5406
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/SettingsManager.ets
arkts
refreshCache
强制刷新缓存(从 Preferences 重新加载) @returns 操作结果
public async refreshCache(): Promise<SettingsResult<void>> { if (!this.initialized || !this.dataPreferences) { return createErrorResult(SettingsErrorCode.ERR_PREFERENCES_INIT_FAILED); } try { this.settingsCache.clear(); await this.loadAllSettings(); console.info(`${TAG} Cache refr...
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 refreshCache AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L...
public async refreshCache(): Promise<SettingsResult<void>> { if (!this.initialized || !this.dataPreferences) { return createErrorResult(SettingsErrorCode.ERR_PREFERENCES_INIT_FAILED); } try { this.settingsCache.clear(); await this.loadAllSettings(); console.info(`${TAG} Cache refr...
https://github.com/richshaw2015/nds
938f423a5dc8b4aade7c488dcb76dfb5c843c107
github
DaLongZhuaZi/manxia
entry/src/main/ets/Utils/SafeUtils.ets
arkts
parseBool
安全解析JSON字符串为布尔值。解析失败返回 false。
static parseBool(jsonStr: string | undefined | null): boolean { if (!jsonStr || jsonStr.trim() === '') { return false; } try { return JSON.parse(jsonStr) as boolean; } catch (error) { logger.error(TAG, `JSON parse error (Bool): ${String(error)}, prefix: ${jsonStr.substring(0, 100)}`)...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left parseBool AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left jsonStr AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#L...
static parseBool(jsonStr: string | undefined | null): boolean { if (!jsonStr || jsonStr.trim() === '') { return false; } try { return JSON.parse(jsonStr) as boolean; } catch (error) { logger.error(TAG, `JSON parse error (Bool): ${String(error)}, prefix: ${jsonStr.substring(0, 100)}`)...
https://github.com/DaLongZhuaZi/manxia
5d3ab8062cfeaed0f3b90a021993a4b29b6ed132
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Source/SourceExecutor.ets
arkts
mapToComicInfo
映射到ComicInfo
private mapToComicInfo(item: ESObject): ComicInfo { return { id: item.id as string || '', title: item.title as string || '', author: item.author as string, coverUrl: item.coverUrl as string, description: item.description as string, status: item.status as string, tags: ite...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left mapToComicInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left item AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
private mapToComicInfo(item: ESObject): ComicInfo { return { id: item.id as string || '', title: item.title as string || '', author: item.author as string, coverUrl: item.coverUrl as string, description: item.description as string, status: item.status as string, tags: ite...
https://github.com/DaLongZhuaZi/manxia
08762a43b96c59c650398dd38975f5de90fd973e
github
HarmonyOS_Samples/MultiVideoApplication
features/multivideorecommended/src/main/ets/view/BannerView.ets
arkts
getBannerNewHeight
Calculates banner height for LG/XL breakpoints based on window width and aspect ratio.
getBannerNewHeight(windowWidth: number): string { let result: number = this.getUIContext().px2vp(windowWidth) - new BreakpointType(MainPageConstants.VIDEO_GRID_MARGIN[0], MainPageConstants.VIDEO_GRID_MARGIN[0], MainPageConstants.VIDEO_GRID_MARGIN[1], MainPageConstants.VIDEO_GRID_MARGIN[2],...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getBannerNewHeight AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left windowWidth AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left...
getBannerNewHeight(windowWidth: number): string { let result: number = this.getUIContext().px2vp(windowWidth) - new BreakpointType(MainPageConstants.VIDEO_GRID_MARGIN[0], MainPageConstants.VIDEO_GRID_MARGIN[0], MainPageConstants.VIDEO_GRID_MARGIN[1], MainPageConstants.VIDEO_GRID_MARGIN[2],...
https://gitcode.com/HarmonyOS_Samples/MultiVideoApplication
3db401cd7492dc5109cc0fc48988fd3252191aa9
gitcode
richshaw2015/nds
ohos/entry/src/main/ets/types/MelonDSNative.ets
arkts
setDownloadDir
设置下载目录路径 @param path 下载目录绝对路径 @returns 设置是否成功
static setDownloadDir(path: string): boolean { return MelonDSNative.native.setDownloadDir(path); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setDownloadDir 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 s...
static setDownloadDir(path: string): boolean { return MelonDSNative.native.setDownloadDir(path); }
https://github.com/richshaw2015/nds
d93b32096b97435cb6d2825b852ae053c9db2bce
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets
arkts
setHours
Sets the hours for a specified date according to local time. @param { int } value new hours @param { int } min @param { int } sec @param { int } ms @returns { long } get new date value @syscap SystemCapability.Utils.Lang @FaAndStageModel
public setHours(value: int, min: int, sec: int, ms: int): long { this.setHours(value); this.setMinutes(min); this.setSeconds(sec); this.setMilliseconds(ms); return this.ms; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setHours AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#Rig...
public setHours(value: int, min: int, sec: int, ms: int): long { this.setHours(value); this.setMinutes(min); this.setSeconds(sec); this.setMilliseconds(ms); return this.ms; }
https://gitcode.com/iop123123/arkts-static-skills
920cb33ae468876d7a09feaaccc9c56281ed79f4
gitcode
LambdaYH/ScrcpyForHarmonyOS
app/src/main/ets/helper/AdbKeyManager.ets
arkts
initFromKeyData
从序列化数据初始化(Worker 线程中使用,不需要 Context)
async initFromKeyData(data: AdbKeySerialData): Promise<void> { try { this.privateKeyBase64 = data.privateKeyBase64; this.publicKeyBase64 = data.publicKeyBase64; this.adbPublicKeyBase64 = data.adbPublicKeyBase64; this.keyGeneration = data.keyGeneration; // 从 base64 字符串重建 KeyPair(使用 c...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left initFromKeyData AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left data AST#identifier#Right AST#type_annotation#Left AST#:#Left :...
async initFromKeyData(data: AdbKeySerialData): Promise<void> { try { this.privateKeyBase64 = data.privateKeyBase64; this.publicKeyBase64 = data.publicKeyBase64; this.adbPublicKeyBase64 = data.adbPublicKeyBase64; this.keyGeneration = data.keyGeneration; // 从 base64 字符串重建 KeyPair(使用 c...
https://github.com/LambdaYH/ScrcpyForHarmonyOS
528085fae872388d5e74fba259451d04d7393ac5
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/SeasonalityDetectionService.ets
arkts
createEmptyResult
创建空结果
private static createEmptyResult(categoryId: number, categoryName: string): SeasonalityAnalysisResult { return { categoryId: categoryId, categoryName: categoryName, hasSeasonality: false, strength: SEASONALITY_STRENGTH_NONE, period: 0, confidence: 0, acfScore: 0, cv...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left createEmptyResult AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left categoryId AST#identifier#Right AST#ERROR#Left AS...
private static createEmptyResult(categoryId: number, categoryName: string): SeasonalityAnalysisResult { return { categoryId: categoryId, categoryName: categoryName, hasSeasonality: false, strength: SEASONALITY_STRENGTH_NONE, period: 0, confidence: 0, acfScore: 0, cv...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
370f2a1dd5eed82e83955f1dc6c703241feef494
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/ThemeManager.ets
arkts
getUserThemeProfile
获取当前用户主题配置
public getUserThemeProfile(): UserThemeProfile { return UserThemeConfigManager.getInstance().getCurrentProfile(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getUserThemeProfile 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 Us...
public getUserThemeProfile(): UserThemeProfile { return UserThemeConfigManager.getInstance().getCurrentProfile(); }
https://github.com/DaLongZhuaZi/manxia
ace613d4acd2c77061a253653eb4e42095788a8f
github
HarmonyOS_Samples/MusicHome
features/player/src/main/ets/util/LrcUtils.ets
arkts
toString
Debug string listing all four edges.
public toString(): string { return `[Rectangle] = ${this.left}, ${this.top}, ${this.right},${this.bottom}`; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toString 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...
public toString(): string { return `[Rectangle] = ${this.left}, ${this.top}, ${this.right},${this.bottom}`; }
https://gitcode.com/HarmonyOS_Samples/MusicHome
4abb7db88f6a2e8fcd6c603f6cd27c3da4e33a2b
gitcode
DaLongZhuaZi/NGF
ngf_framework/src/main/ets/contentSource/facades/AuthInterceptorFacade.ets
arkts
setPrefix
设置 Token 前缀 @param prefix Token 前缀,默认 'Bearer '
setPrefix(prefix: string): void { this.prefix = prefix; logger.info(TAG, 'Token 前缀已设置为: ' + prefix); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setPrefix AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left prefix AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST...
setPrefix(prefix: string): void { this.prefix = prefix; logger.info(TAG, 'Token 前缀已设置为: ' + prefix); }
https://github.com/DaLongZhuaZi/NGF
212508fc127f103df12640b3134d05a7cb6283ab
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Console.ets
arkts
log
Prints log-level messages If first argument is a string it is treated as a format string @param {...Any[]} vals - Variable number of values to be logged @returns {void} @public
public log(...vals: Any[]): void { this.printRest(LogLevel.LOG, ...vals) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left log AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#ERROR#Left AST#identifier#Left vals ...
public log(...vals: Any[]): void { this.printRest(LogLevel.LOG, ...vals) }
https://gitcode.com/iop123123/arkts-static-skills
950e7e0040ff0a7d4cb70704ac13ad16f841d205
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoJsExtensions.ets
arkts
unzipFile
==================== 压缩文件操作 ==================== 解压zip文件 @param zipPath 压缩文件的相对路径 @returns 解压后的目录相对路径
async unzipFile(zipPath: string): Promise<string> { return this.unArchiveFile(zipPath); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left unzipFile AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left zipPath AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS...
async unzipFile(zipPath: string): Promise<string> { return this.unArchiveFile(zipPath); }
https://github.com/DaLongZhuaZi/manxia
dd78214cb465c2f5224e128758de52f1a15bdf3b
github
who7708/harmonyos-codelabs
HmosWorld/features/discover/src/main/ets/model/DiscoverModel.ets
arkts
getResourceDetail
Get feed detail or article detail by resourceId @param resourceId
getResourceDetail(resourceId: string): Promise<void> { return new Promise((resolve, reject) => { this.detailLoadingStatus = LoadingStatus.LOADING; this.resourcesRepository.getResourceDetail(resourceId).then((res: ResourceDetail) => { this.detailData = res; this.setViewsCount(resourceId...
AST#program#Left AST#expression_statement#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left getResourceDetail AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left resourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left str...
getResourceDetail(resourceId: string): Promise<void> { return new Promise((resolve, reject) => { this.detailLoadingStatus = LoadingStatus.LOADING; this.resourcesRepository.getResourceDetail(resourceId).then((res: ResourceDetail) => { this.detailData = res; this.setViewsCount(resourceId...
https://github.com/who7708/harmonyos-codelabs
3254ef5b650060aa89a27e0d8407362bff64efc0
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/DownloadSyncManager.ets
arkts
createReservedFolders
创建保留文件夹
private async createReservedFolders(downloadDirPath: string): Promise<void> { let createdCount = 0; let existingCount = 0; let nomediaCount = 0; for (const folderName of RESERVED_FOLDERS) { try { const folderPath = `${downloadDirPath}/${folderName}`; try { Saf...
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 createReservedFolders AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left downloadDirPath AST#identifier#Right AST#ERROR...
private async createReservedFolders(downloadDirPath: string): Promise<void> { let createdCount = 0; let existingCount = 0; let nomediaCount = 0; for (const folderName of RESERVED_FOLDERS) { try { const folderPath = `${downloadDirPath}/${folderName}`; try { Saf...
https://github.com/DaLongZhuaZi/manxia
1bc23742c11c2cbc74c79d5157a14301a07da727
github
ASweetBite/HarmonyPulse
entry/src/main/ets/utils/managers/LyricManager.ets
arkts
parseLrc
解析 .lrc 格式歌词 (这个逻辑不依赖 context,可以保持 static)
static parseLrc(lrcContent: string): LyricLine[] { // ============ 新增:前置全量合法性校验【核心】 ============ // 1. 空内容、纯空白 → 非法格式 if (!lrcContent || lrcContent.trim() === '') { return []; } const pureContent = lrcContent.trim(); const timeExp = /\[(\d{2}):(\d{2})\.(\d{2,3})\]/g; const lines = pu...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left parseLrc AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left lrcContent AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Rig...
static parseLrc(lrcContent: string): LyricLine[] { // ============ 新增:前置全量合法性校验【核心】 ============ // 1. 空内容、纯空白 → 非法格式 if (!lrcContent || lrcContent.trim() === '') { return []; } const pureContent = lrcContent.trim(); const timeExp = /\[(\d{2}):(\d{2})\.(\d{2,3})\]/g; const lines = pu...
https://github.com/ASweetBite/HarmonyPulse/blob/a7fcf153a20bafa29ac1fb8c25743dd5350dc54c/entry/src/main/ets/utils/managers/LyricManager.ets#L27-L66
d782a546ea143884ebd75e4f711ce60b26e270c1
github
openharmony/vendor_isoftstone
yangfan/samples/hhording/entry/src/main/ets/mainability/common/utlis/WindowUtils.ets
arkts
setSystemBarEnable
设置状态栏和导航栏的显示 @param names需要隐藏的栏(数组形式)
setSystemBarEnable( names: Array<'status' | 'navigation'> ) { return new Promise<void>((resolve, reject) => { window.getTopWindow().then((win) => { try { win.setSystemBarEnable(names).then(() => { resolve() }).catch((err) => { reject(err) }) ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setSystemBarEnable AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left names AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#ide...
setSystemBarEnable( names: Array<'status' | 'navigation'> ) { return new Promise<void>((resolve, reject) => { window.getTopWindow().then((win) => { try { win.setSystemBarEnable(names).then(() => { resolve() }).catch((err) => { reject(err) }) ...
https://gitee.com/openharmony/vendor_isoftstone.git
4cb2ae5a362f911cdaa44f01b8dd78415a7e6017
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Exceptions.ets
arkts
constructor
Constructs an ArgumentOutOfRangeError instance. @param { String } [ message ] The error message. @param { ErrorOptions } [ options ] Error options, usually containing the error stack information. @syscap SystemCapability.Utils.Lang @FaAndStageModel
constructor(message?: String, options?: ErrorOptions) { super("ArgumentOutOfRangeError", message, options) }
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 message AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#identifier#Left String AST#identi...
constructor(message?: String, options?: ErrorOptions) { super("ArgumentOutOfRangeError", message, options) }
https://gitcode.com/iop123123/arkts-static-skills
0e180b6a3b0c78c5767906ee57bc0416d293a920
gitcode
HarmonyOS_Samples/MusicHome
common/musicbasic/src/main/ets/util/MusicDbApi.ets
arkts
getPrivateSongDisplayList
First 12 catalog songs with carousel-specific labels and display indices. @returns Song DTOs tailored for the private-song strip UI.
public getPrivateSongDisplayList(): SongApiDto[] { const out: SongApiDto[] = []; for (let displayIndex = 0; displayIndex < 12; displayIndex++) { const songId = displayIndex + 1; const row = this.store.songs.find((songRow) => songRow.id === songId); if (row === undefined) { continue; ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getPrivateSongDisplayList 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#L...
public getPrivateSongDisplayList(): SongApiDto[] { const out: SongApiDto[] = []; for (let displayIndex = 0; displayIndex < 12; displayIndex++) { const songId = displayIndex + 1; const row = this.store.songs.find((songRow) => songRow.id === songId); if (row === undefined) { continue; ...
https://gitcode.com/HarmonyOS_Samples/MusicHome
5f8fea20e2f886efeeba8096f30aef0bd3306c64
gitcode
Countly/countly-sdk-hos
library/src/main/ets/internal/modules/ModuleConsent.ets
arkts
hasActiveTimers
Test seam — true while the consent-snapshot 1s coalesce timer is armed.
public hasActiveTimers(): boolean { return this.pendingCoalesceTimer !== null; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left hasActiveTimers 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 A...
public hasActiveTimers(): boolean { return this.pendingCoalesceTimer !== null; }
https://github.com/Countly/countly-sdk-hos
c31fdcf89ce51ce28a85571378eb079027c7d7ba
github
Countly/countly-sdk-hos
library/src/main/ets/internal/modules/ModulePush.ets
arkts
onTokenRefresh
Called by the host when the platform pushes a new/refreshed token. Matches `CountlyInstance.onTokenRefresh` per the dev guide; debounced on identical (token, provider) pairs within TOKEN_DEBOUNCE_MS.
public async onTokenRefresh(token: string, provider: MessagingProvider): Promise<void> { if (Utils.isNullOrEmpty(token)) { this.config.logger.w('[ModulePush] onTokenRefresh, token is null/empty, use clearPushNotificationToken() to unregister'); return; } if (!this.core.consentModule.hasConsent...
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 onTokenRefresh AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left token AST#identifier#Right AST#:#Left : A...
public async onTokenRefresh(token: string, provider: MessagingProvider): Promise<void> { if (Utils.isNullOrEmpty(token)) { this.config.logger.w('[ModulePush] onTokenRefresh, token is null/empty, use clearPushNotificationToken() to unregister'); return; } if (!this.core.consentModule.hasConsent...
https://github.com/Countly/countly-sdk-hos
142c9b17a0472f265124af40a06eca89b6d0eb7f
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/DataManager.ets
arkts
updateOnlineComicSourceNameById
根据内部ID更新在线漫画的sourceName
public async updateOnlineComicSourceNameById(comicId: string, sourceName: string): Promise<void> { try { const sql = 'UPDATE online_comic_info SET sourceName = ?, updateTime = ? WHERE id = ?'; await this.databaseManager.executeSql(sql, [sourceName, Date.now(), comicId]); logger.info(TAG, `更新在线漫画...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left updateOnlineComicSourceNameById AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left comicId AST#identifier#Right AST#ERROR#...
public async updateOnlineComicSourceNameById(comicId: string, sourceName: string): Promise<void> { try { const sql = 'UPDATE online_comic_info SET sourceName = ?, updateTime = ? WHERE id = ?'; await this.databaseManager.executeSql(sql, [sourceName, Date.now(), comicId]); logger.info(TAG, `更新在线漫画...
https://github.com/DaLongZhuaZi/manxia
a9eded56ee47a4bf4a30157fee290747ab2651f9
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/EAWorker.ets
arkts
constructor
Create EAWorker instance @param { boolean } [needInterop=false] true if need to create JS runtime
constructor(needInterop: boolean = false) { this("EAWorker", needInterop); }
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 needInterop AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#identif...
constructor(needInterop: boolean = false) { this("EAWorker", needInterop); }
https://gitcode.com/iop123123/arkts-static-skills
6fae0cf8a5e130fdde78e96f3630ca4e1cd30dbf
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/taskpool.ets
arkts
sendData
Send data to host side and trigger the registered callback @param { ...Any } args arguments for the registered callback @throws Error if the function is not called from a taskpool task @throws Error if the callback is not registered
static sendData(...args: FixedArray<Any>): void { return Task.sendData(...args); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left sendData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#ERROR#Left AST#identifier#Left args AST#identifier#Right AST#:#Left : ...
static sendData(...args: FixedArray<Any>): void { return Task.sendData(...args); }
https://gitcode.com/iop123123/arkts-static-skills
ed9375c5f97131b726797abde9dc45b9ab6bbaa7
gitcode
richshaw2015/nds
ohos/entry/src/main/ets/components/game/VirtualButtonLayer.ets
arkts
build
---- 主构建 ----
build() { Stack() { if (this.customLayout.length > 0) { this.CustomLayoutBuilder() } else if (this.isLandscape) { this.LandscapeLayout() } else { this.PortraitLayout() } // 更多菜单浮层 if (this.showMoreMenu) { this.MoreMenuOverlay() } } ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST...
build() { Stack() { if (this.customLayout.length > 0) { this.CustomLayoutBuilder() } else if (this.isLandscape) { this.LandscapeLayout() } else { this.PortraitLayout() } // 更多菜单浮层 if (this.showMoreMenu) { this.MoreMenuOverlay() } } ...
https://github.com/richshaw2015/nds
62564f5a14225165dc8cc125e76bb3f770fe6172
github
youyeyejie/ZhiXing_ActHub
entry/src/main/ets/app/AppNav.ets
arkts
resolveOverlayHeight
兜底覆盖页高度,空字符串时回退默认值。
private resolveOverlayHeight(height: string, fallback: string): string { const normalized = `${height}`.trim(); if (normalized.length === 0) { return fallback; } return normalized; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left resolveOverlayHeight AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left height AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi...
private resolveOverlayHeight(height: string, fallback: string): string { const normalized = `${height}`.trim(); if (normalized.length === 0) { return fallback; } return normalized; }
https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/app/AppNav.ets#L170-L176
998745fb6c6523872e2987c14c119cc4b7b860c6
github
Countly/countly-sdk-hos
library/src/main/ets/internal/modules/ModuleCrashes.ets
arkts
handleUnhandledException
Bridge from `CountlyErrorObserver.onUnhandledException` into the regular record pipeline. The `errMsg` string already carries the full "Name: message\nstack" payload that HarmonyOS synthesises for the uncaught exception; we parse the head line to recover `name` and `message`, then set `Error.stack` to the original payl...
public handleUnhandledException(errMsg: string): void { if (this.rejectIfHalted('ModuleCrashes', 'handleUnhandledException')) return; const err: Error = ModuleCrashes.errorFromMessage(errMsg); // Log a rejection from the auto-handler path rather than swallowing it, // if crash recording fails (e.g. en...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left handleUnhandledException AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left errMsg AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ident...
public handleUnhandledException(errMsg: string): void { if (this.rejectIfHalted('ModuleCrashes', 'handleUnhandledException')) return; const err: Error = ModuleCrashes.errorFromMessage(errMsg); // Log a rejection from the auto-handler path rather than swallowing it, // if crash recording fails (e.g. en...
https://github.com/Countly/countly-sdk-hos
a319905dc4d5460991ba8d7aaf1989b52bb359cc
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/subtraction/subtraction_ubyte.ets
arkts
main
--- desc: check subtraction of two unsigned bytes ---
function main(): void { const a: ubyte = {{v.left}} const b: ubyte = {{v.right}} assert (a - b) == {{v.result}}
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A...
function main(): void { const a: ubyte = {{v.left}} const b: ubyte = {{v.right}} assert (a - b) == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
e848c4dba90cb1bc005a4873b63bb445b2137c16
gitee
RedRackham-R/WanAndroidHarmoney
entry/src/main/ets/global/viewmodel/GlobalSettingViewModel.ets
arkts
getThemeNum
主获取题编号 @returns
public getThemeNum(): number { return this.currentThemeNum }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getThemeNum AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#num...
public getThemeNum(): number { return this.currentThemeNum }
https://github.com/RedRackham-R/WanAndroidHarmoney
4c40c398edb04af0f077a6688b0b01b49763fc33
github
openharmony-tpc/openharmony_tpc_samples
OhosVideoCache/library/src/main/ets/HttpProxyCacheServerBuilder.ets
arkts
maxCacheFilesCount
Sets max cache files count. All files that exceeds limit will be deleted using LRU strategy. Note this method overrides result of calling {@link #maxCacheSize(long)} @param count max cache files count. @return a builder.
public maxCacheFilesCount(count: number): HttpProxyCacheServerBuilder { this.diskUsage = new TotalCountLruDiskUsage(count); return this; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left maxCacheFilesCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left count AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
public maxCacheFilesCount(count: number): HttpProxyCacheServerBuilder { this.diskUsage = new TotalCountLruDiskUsage(count); return this; }
https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git
5fc798d7633f057ba0d56bec4395b7ea74cfc38f
gitee
AlkaidLab/moonlight-harmony
entry/src/main/ets/utils/CryptoUtil.ets
arkts
rsaSign
RSA SHA256 签名
static async rsaSign(data: Uint8Array, privateKey: cryptoFramework.PriKey): Promise<Uint8Array> { const signer = cryptoFramework.createSign('RSA2048|PKCS1|SHA256'); await signer.init(privateKey); const dataBlob = CryptoUtil.createDataBlob(data); await signer.update(dataBlob); const signData = awai...
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 rsaSign AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Rig...
static async rsaSign(data: Uint8Array, privateKey: cryptoFramework.PriKey): Promise<Uint8Array> { const signer = cryptoFramework.createSign('RSA2048|PKCS1|SHA256'); await signer.init(privateKey); const dataBlob = CryptoUtil.createDataBlob(data); await signer.update(dataBlob); const signData = awai...
https://github.com/AlkaidLab/moonlight-harmony
ef821ea1544da8e235616e254a64256e5f5e56b7
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
constructor
Creates an BigInt64Array with respect to data, byteOffset and length. @param { ArrayBuffer } buf - data initializer @param { Number | undefined } byteOffset - byte offset from begin of the buf @param { Number | undefined } length - size of elements of type long in newly created BigInt64Array @throws { RangeError } - In...
public constructor(buf: ArrayBuffer, byteOffset: Number | undefined, length: Number | undefined) { let intByteOffset: int = 0 if (byteOffset != undefined) { intByteOffset = byteOffset.toInt() if (intByteOffset < 0) { throw new RangeError("Range Error: byteOffs...
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 buf AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Array...
public constructor(buf: ArrayBuffer, byteOffset: Number | undefined, length: Number | undefined) { let intByteOffset: int = 0 if (byteOffset != undefined) { intByteOffset = byteOffset.toInt() if (intByteOffset < 0) { throw new RangeError("Range Error: byteOffs...
https://gitcode.com/iop123123/arkts-static-skills
ac6a38560e46bde6e975cc28fa4cb940e540eb92
gitcode
aimilin6688/KeePassHO
entry/src/main/ets/services/RecentFilesService.ets
arkts
clearSearchHistory
清空文件数据库的搜索历史 @param filePath 最近文件 @returns 结果
public static clearSearchHistory(filePath: string): Promise<boolean> { return RecentFilesService.getRecentFile(filePath).then((recentFile) => { if (!recentFile) { return false; } recentFile.searchHistory = []; return RecentFilesService.addRecentFile(recentFile).then(result => { ...
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 clearSearchHistory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath AST#identifier#Right AST#ERROR#Left AST#:#...
public static clearSearchHistory(filePath: string): Promise<boolean> { return RecentFilesService.getRecentFile(filePath).then((recentFile) => { if (!recentFile) { return false; } recentFile.searchHistory = []; return RecentFilesService.addRecentFile(recentFile).then(result => { ...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/RecentFilesService.ets#L501-L514
a6a01cad28bcac8011c0dea420135f02759390d2
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/WeakMap.ets
arkts
has
The has() method returns a boolean indicating whether an element with the specified key exists in the WeakMap @param { K } key - The key to check @returns { boolean } Returns true if the key exists in the WeakMap, otherwise returns false @syscap SystemCapability.Utils.Lang
has(key: K): boolean { const keyHash = Runtime.getHashCode(key) const keyRefs = this.keyHashToKeyRefs.get(keyHash) if (keyRefs === undefined) { return false } const keyRef = this.findKeyRef(keyRefs, key) if (keyRef === undefined) { return fal...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left has AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left key AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left K AST#identifier#Right AST#ERROR#Right AST#)#Left ) AST#)#Right AST#a...
has(key: K): boolean { const keyHash = Runtime.getHashCode(key) const keyRefs = this.keyHashToKeyRefs.get(keyHash) if (keyRefs === undefined) { return false } const keyRef = this.findKeyRef(keyRefs, key) if (keyRef === undefined) { return fal...
https://gitcode.com/iop123123/arkts-static-skills
080e1b54272e867e3684a2f71115f0e601b148a5
gitcode
Dabing-0x19d/berverage_HarmonyOS6.0
entry/src/main/ets/utils/AGCloudFunction.ets
arkts
loginWithHuaweiID
调用华为账号登录云函数 @param authorizationCode 华为账号授权码
async loginWithHuaweiID(authorizationCode: string): Promise<CloudFunctionResponse<LoginData>> { console.info('[CloudFunction] 开始调用AGC云函数'); try { const result = await cloudFunction.call({ name: CLOUD_FUNCTION_NAME, version: CLOUD_FUNCTION_VERSION, data: { authCode: aut...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left loginWithHuaweiID AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left authorizationCode AST#identifier#Right AST#type_anno...
async loginWithHuaweiID(authorizationCode: string): Promise<CloudFunctionResponse<LoginData>> { console.info('[CloudFunction] 开始调用AGC云函数'); try { const result = await cloudFunction.call({ name: CLOUD_FUNCTION_NAME, version: CLOUD_FUNCTION_VERSION, data: { authCode: aut...
https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0
e78f018b5cb5afee0f420d1e03243ea7a65b7a2e
github
openharmony/codelabs
ETSUI/LifeTrack/entry/src/main/ets/pages/ContactManager.ets
arkts
groupContactsByInitial
分组联系人(按首字母) - 供UI层使用
public groupContactsByInitial(contacts: ContactsItem[]): Map<string, ContactsItem[]> { const grouped = new Map<string, ContactsItem[]>(); for (const contact of contacts) { const initial = contact.initial || '#'; if (!grouped.has(initial)) { grouped.set(initial, []); } grouped....
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left groupContactsByInitial AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left contacts AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subsc...
public groupContactsByInitial(contacts: ContactsItem[]): Map<string, ContactsItem[]> { const grouped = new Map<string, ContactsItem[]>(); for (const contact of contacts) { const initial = contact.initial || '#'; if (!grouped.has(initial)) { grouped.set(initial, []); } grouped....
https://gitcode.com/openharmony/codelabs
29e95e5c63d8224bfcb0dd0e7defd2bd6a0980bc
gitcode
aimilin6688/KeePassHO
entry/src/main/ets/services/beans/LocationParam.ets
arkts
constructor
如果是保存模式,需要设置文件名 @param mode 模式 @param fileName 文件名
private constructor(mode: LocationMode, fileSuffix?: Array<string>, fileName?: string, onLocation?: (param: LocationInfo) => void) { this.mode = mode; this.fileSuffix = fileSuffix || []; this.fileName = fileName; this.onLocation = onLocation || this.onLocation; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#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#ERROR#Left AST#identifier#Left mode AST#identifier#Right AST#:#Left : AST...
private constructor(mode: LocationMode, fileSuffix?: Array<string>, fileName?: string, onLocation?: (param: LocationInfo) => void) { this.mode = mode; this.fileSuffix = fileSuffix || []; this.fileName = fileName; this.onLocation = onLocation || this.onLocation; }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/beans/LocationParam.ets#L85-L90
3bed5da529d205bcee5ed33809eb7558de459e74
github
HarmonyCandies/image_cropper
image_cropper/src/main/ets/model/Geometry.ets
arkts
greaterThanOrEqual
Greater-than-or-equal-to operator.
greaterThanOrEqual(other: OffsetBase): boolean { return this._dx >= other._dx && this._dy >= other._dy; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left greaterThanOrEqual AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left OffsetBase AST#identifier#Right AST#...
greaterThanOrEqual(other: OffsetBase): boolean { return this._dx >= other._dx && this._dy >= other._dy; }
https://github.com/HarmonyCandies/image_cropper/blob/dd3664946b413166307b736a5763f998084364e1/image_cropper/src/main/ets/model/Geometry.ets#L43-L45
af0a6fa80fb4aa601c5e1d183eba8be6288585e3
github
YDYm233/EasyRandom_HarmonyNextApp
common/SystemUtils/src/main/ets/utils/VibratorManager.ets
arkts
vibrateConfirm
确认反馈 — 中等强度单次振动,表示操作已确认
static vibrateConfirm(): void { VibratorManager.logExecution('vibrateConfirm'); VibratorManager.vibratePreset(HapticEffect.HARD, 1, 60, VibrationUsage.TOUCH); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left vibrateConfirm AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#express...
static vibrateConfirm(): void { VibratorManager.logExecution('vibrateConfirm'); VibratorManager.vibratePreset(HapticEffect.HARD, 1, 60, VibrationUsage.TOUCH); }
https://github.com/YDYm233/EasyRandom_HarmonyNextApp
acb59b1bfd5d787556838a64f25264f91173e35d
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/NvHttp.ets
arkts
buildLaunchQuery
构建启动查询参数
private buildLaunchQuery(appId: number, config: LaunchConfig, verb: string): string { // 处理 FPS:NVIDIA 服务器软件在 FPS > 60 时需要设为 0 以避免 SOPS 默认到 720p60 // 但 Sunshine 不需要这个处理,我们检测 appVersion 是否包含 "-1" 来判断是否是 Sunshine let fps = config.fps; const params: string[] = [ `appid=${appId}`, `mode=${con...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildLaunchQuery AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left appId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#...
private buildLaunchQuery(appId: number, config: LaunchConfig, verb: string): string { // 处理 FPS:NVIDIA 服务器软件在 FPS > 60 时需要设为 0 以避免 SOPS 默认到 720p60 // 但 Sunshine 不需要这个处理,我们检测 appVersion 是否包含 "-1" 来判断是否是 Sunshine let fps = config.fps; const params: string[] = [ `appid=${appId}`, `mode=${con...
https://github.com/AlkaidLab/moonlight-harmony
ff46f5a089e352b24f5f45fd37ea7edce9ae3fb3
github
Joker-x-dev/CoolMallArkTS
core/model/src/main/ets/entity/CategoryTree.ets
arkts
convertNestedNode
递归转换带 children 的节点 @param {Category} category - 原始分类节点 @returns {CategoryTree} 转换后的分类树节点
private static convertNestedNode(category: Category): CategoryTree { const node: CategoryTree = CategoryTree.fromCategory(category); const children: Category[] = category.children ?? []; if (children.length > 0) { node.children = children.map((child: Category): CategoryTree => CategoryTree.convertNe...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left convertNestedNode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left category AST#identifier#Right AST#...
private static convertNestedNode(category: Category): CategoryTree { const node: CategoryTree = CategoryTree.fromCategory(category); const children: Category[] = category.children ?? []; if (children.length > 0) { node.children = children.map((child: Category): CategoryTree => CategoryTree.convertNe...
https://github.com/Joker-x-dev/CoolMallArkTS
ef7d06f6523261da461694272d89a17d9fc42fd2
github
erosTeam/NextE
shared/src/main/ets/settings/SearchFilterSettings.ets
arkts
reset
Reset persisted search filters to the clean default profile and notify any open Search page.
static async reset(context: common.UIAbilityContext): Promise<void> { const f = connectSearchFilter() f.searchScope = SEARCH_SCOPE_GALLERY f.selectedCats = 0 f.advancedEnabled = false f.minRating = 0 f.pagesFrom = 0 f.pagesTo = 0 f.requireTorrent = false f.showExpunged = false ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left reset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Ri...
static async reset(context: common.UIAbilityContext): Promise<void> { const f = connectSearchFilter() f.searchScope = SEARCH_SCOPE_GALLERY f.selectedCats = 0 f.advancedEnabled = false f.minRating = 0 f.pagesFrom = 0 f.pagesTo = 0 f.requireTorrent = false f.showExpunged = false ...
https://github.com/erosTeam/NextE
354a52fae5deeb2ea6976eb09c539e13e29ce324
github
openharmony/applications_mms
entry/src/main/ets/service/ContractService.ets
arkts
searchContracts
Fuzzy search for contacts @param actionData @callback callback
searchContracts(actionData, callback) { let result: LooseObject = {}; globalThis.DataWorker.sendRequest('searchContracts', { actionData: actionData, context: globalThis.mmsContext }, (res) =>{ result.code = res.code if (res.code == common.int.S...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left searchContracts AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left actionData AST#identifier#Right AST#,#Left , AST#,#Right AST#identifier#Left callback AST#identifier#Right AST#)#Left ) AST#)#R...
searchContracts(actionData, callback) { let result: LooseObject = {}; globalThis.DataWorker.sendRequest('searchContracts', { actionData: actionData, context: globalThis.mmsContext }, (res) =>{ result.code = res.code if (res.code == common.int.S...
https://gitee.com/openharmony/applications_mms.git
398d1a40c2be6471aa6dd7dee998ce1ec3227970
gitee
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/TagDAO.ets
arkts
setTagsForBill
批量为账单设置标签(替换现有标签)- 使用 DAOHelper 统一事务处理 @param billId 账单ID @param tagIds 标签ID数组
static async setTagsForBill(billId: number, tagIds: number[]): Promise<void> { await DAOHelper.transaction(async () => { const store = DatabaseManager.getDatabase(); // 获取当前标签 const currentTags = await TagDAO.getTagsByBillId(billId); const currentTagIds = currentTags.map(bt => bt.tagId); ...
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 setTagsForBill AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left billId AST#identifier#Right AST#:#Left : ...
static async setTagsForBill(billId: number, tagIds: number[]): Promise<void> { await DAOHelper.transaction(async () => { const store = DatabaseManager.getDatabase(); // 获取当前标签 const currentTags = await TagDAO.getTagsByBillId(billId); const currentTagIds = currentTags.map(bt => bt.tagId); ...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
1a70e26fceb87b66d382037d3daf223c610b17e6
github
arkui-x/samples
CodeLab/Cases/feature/customaddresspicker/src/main/ets/customaddresspicker/utils/JsonUtils.ets
arkts
getAddressJson
获取省市区信息的json文件数据 @param mockFileDir 要传入的json文件。这里指存放在rawfile下的address.json @returns 返回json中省信息数组
static getAddressJson(mockFileDir: string): Array<Province> { const jsonObj: JsonObject = new JsonObject(mockFileDir); const modelMockData: Array<Province> = jsonObj.getAddressData(); return modelMockData; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getAddressJson AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left mockFileDir AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#str...
static getAddressJson(mockFileDir: string): Array<Province> { const jsonObj: JsonObject = new JsonObject(mockFileDir); const modelMockData: Array<Province> = jsonObj.getAddressData(); return modelMockData; }
https://gitcode.com/arkui-x/samples
2b35711bf5c97682d2b00765073b6cf794dca087
gitcode
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.LinkedList.ets
arkts
removeLast
Removes the last element of the list. @returns The removed element, or undefined if the list is empty.
public removeLast(): T | undefined { this.checkEmptyContainer(); return this.removeByIndex(this.elementNum - 1); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left removeLast 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_...
public removeLast(): T | undefined { this.checkEmptyContainer(); return this.removeByIndex(this.elementNum - 1); }
https://gitcode.com/iop123123/arkts-static-skills
f4810b4802d1cc815de240d7ab5fe5738ee17c93
gitcode
codelably/HCompass
core/navigation/src/main/ets/GuardManager.ets
arkts
executeGuard
执行单个守卫 @param guard 守卫实例 @param context 路由上下文 @returns 守卫结果
private async executeGuard(guard: RouteGuard, context: RouteContext): Promise<GuardResult> { const result = await guard.canActivate(context); if (typeof result === 'boolean') { return { canActivate: result }; } return result; }
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 executeGuard AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left guard AST#identifier#Right AST#:#Left : ...
private async executeGuard(guard: RouteGuard, context: RouteContext): Promise<GuardResult> { const result = await guard.canActivate(context); if (typeof result === 'boolean') { return { canActivate: result }; } return result; }
https://github.com/codelably/HCompass
dc751407e1f2d2e11cb616846e5825d2b251063d
github
Harrisonls2004/WaterFlow
entry/src/main/ets/common/utils/FavoritesManager.ets
arkts
removeFavorite
Remove a favorite
static async removeFavorite(productId: string, username: string): Promise<boolean> { try { console.info('FavoritesManager: Removing favorite:', productId, 'SERVER_ENABLED:', SERVER_ENABLED); if (!FavoritesManager.preferencesInstance) { console.error('FavoritesManager: Preferences not initiali...
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 removeFavorite AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left productId AST#identifier#Right AST#ERROR#Left AST#:#Left...
static async removeFavorite(productId: string, username: string): Promise<boolean> { try { console.info('FavoritesManager: Removing favorite:', productId, 'SERVER_ENABLED:', SERVER_ENABLED); if (!FavoritesManager.preferencesInstance) { console.error('FavoritesManager: Preferences not initiali...
https://github.com/Harrisonls2004/WaterFlow
4c27a54bff1d42dd4f372dbcdce9b60f77a05615
github
cheinlu/HarmonyOS-groundhog-charging-system
TbsChargeHarmonyOs/common/src/main/ets/model/CommonDataSource.ets
arkts
pushData
向列表追加数据
public pushData(data: T | T[]): void { let fromIndex = this.items.length if (Array.isArray(data)) { this.items.push(...data) } else { this.items.push(data) } this.notifyDatasetAdd(fromIndex, this.items.length - fromIndex) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left pushData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#identifier#Left data AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#L...
public pushData(data: T | T[]): void { let fromIndex = this.items.length if (Array.isArray(data)) { this.items.push(...data) } else { this.items.push(data) } this.notifyDatasetAdd(fromIndex, this.items.length - fromIndex) }
https://github.com/cheinlu/HarmonyOS-groundhog-charging-system
6be9df3b109fe7bebc07c7fec4f9866b680d9035
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Database/DatabaseManager.ets
arkts
update
更新记录 - 使用统一的更新接口
public async update( tableName: string, record: UpdateRecordData, whereClause: string, whereArgs: DatabaseValue[] ): Promise<number> { try { const store = this.getStore(); const dbRecord = this.convertRecordToDbFormat(tableName, record); // 排除id字段,因为id是主键不应该被更新 ...
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 update AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left tableName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:...
public async update( tableName: string, record: UpdateRecordData, whereClause: string, whereArgs: DatabaseValue[] ): Promise<number> { try { const store = this.getStore(); const dbRecord = this.convertRecordToDbFormat(tableName, record); // 排除id字段,因为id是主键不应该被更新 ...
https://github.com/DaLongZhuaZi/manxia
8e3008ae8f45c80ed969f68952952d9c981a2fb3
github
apap6628114/nga_oh
entry/src/main/ets/common/managers/ThreadPaginationManager.ets
arkts
prependPosts
向前插入上一页帖子(反向预取),按 lou 去重。 @param rawPosts - 待前置的帖子 @param page - 该批对应的页码 @returns 实际新增(去重后)的帖子
prependPosts(rawPosts: PostInfo[], page: number): PostInfo[] { const deduped: PostInfo[] = [] for (let i = 0; i < rawPosts.length; i++) { if (!this.loadedLouSet.has(rawPosts[i].lou)) { deduped.push(rawPosts[i]) } this.loadedLouSet.add(rawPosts[i].lou) } if (deduped.length ===...
AST#program#Left AST#expression_statement#Left AST#assignment_expression#Left AST#subscript_expression#Left AST#call_expression#Left AST#identifier#Left prependPosts AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left rawPosts AST#identifier#Right AST#:#Left : AST#:#Right...
prependPosts(rawPosts: PostInfo[], page: number): PostInfo[] { const deduped: PostInfo[] = [] for (let i = 0; i < rawPosts.length; i++) { if (!this.loadedLouSet.has(rawPosts[i].lou)) { deduped.push(rawPosts[i]) } this.loadedLouSet.add(rawPosts[i].lou) } if (deduped.length ===...
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/common/managers/ThreadPaginationManager.ets#L113-L145
7ea0a59ee558cd2ec695b9308a5120cbe6c06cd4
github
openharmony/codelabs
Security/StringCipherArkTS/entry/src/main/ets/common/utils/PromptUtil.ets
arkts
promptMessage
A dialog box is displayed. @param message Message info. @param Time duration.
promptMessage(message: string | Resource, time: number, bottom: string | number = CommonConstants.PROMPT_BOTTOM) { promptAction.showToast({ message: message, duration: time, bottom: bottom }); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left promptMessage 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#binary_expression#Left AST#identifier#Le...
promptMessage(message: string | Resource, time: number, bottom: string | number = CommonConstants.PROMPT_BOTTOM) { promptAction.showToast({ message: message, duration: time, bottom: bottom }); }
https://gitee.com/openharmony/codelabs.git
d82838ab0769267c6019789ebe30312bb93d8df4
gitee
aimilin6688/KeePassHO
entry/src/main/ets/common/utils/CryptoUtils.ets
arkts
decryptText
解密密码 @param alias @param encryptedData base64编码的字符串 @returns
public static async decryptText(encryptedData: string): Promise<string> { if (!encryptedData) { return Promise.resolve(''); } await CryptoUtils.generateKey(); const combined = new util.Base64Helper().decodeSync(encryptedData); let decryptResult: string = ''; let options: huks.HuksOptions...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left decryptText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left encryptedData AST#ide...
public static async decryptText(encryptedData: string): Promise<string> { if (!encryptedData) { return Promise.resolve(''); } await CryptoUtils.generateKey(); const combined = new util.Base64Helper().decodeSync(encryptedData); let decryptResult: string = ''; let options: huks.HuksOptions...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/CryptoUtils.ets#L152-L176
c5543c9f0a98822eff2c22dcbfcc962e3bc45c75
github
harmonyos/codelabs
HarmonyOS_NEXT/TargetManagement/entry/src/main/ets/view/TargetListItem.ets
arkts
onClickIndexChanged
Listening click index.
onClickIndexChanged() { if (this.clickIndex !== this.index) { this.isExpanded = false; } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onClickIndexChanged 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_bloc...
onClickIndexChanged() { if (this.clickIndex !== this.index) { this.isExpanded = false; } }
https://gitee.com/harmonyos/codelabs.git
2b52bfa229b93535241d10be49d3c7103783a5f8
gitee
the-wwyang/kids-learning-app
src/main/ets/utils/AudioManager.ets
arkts
setSoundEnabled
设置音效开关
setSoundEnabled(enabled: boolean): void { this.settings.soundEnabled = enabled; if (!enabled) { // 停止所有非音乐音效 for (const type of this.soundConfigs.keys()) { if (!this.isBackgroundMusic(type)) { this.stopSound(type); } } } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setSoundEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right AST#)#Le...
setSoundEnabled(enabled: boolean): void { this.settings.soundEnabled = enabled; if (!enabled) { // 停止所有非音乐音效 for (const type of this.soundConfigs.keys()) { if (!this.isBackgroundMusic(type)) { this.stopSound(type); } } } }
https://github.com/the-wwyang/kids-learning-app
65917ef7c4a8c28117fee343bc5486df264e01f7
github
Delsin-Yu/JustPDF
entry/src/main/ets/pages/pdfview/PDFAnnotationController.ets
arkts
extractFileNameFromUri
从 URI 中提取文件名部分。
private extractFileNameFromUri(uri: string): string { const queryIndex = uri.indexOf('?'); const cleanUri = queryIndex >= 0 ? uri.substring(0, queryIndex) : uri; const lastSlash = cleanUri.lastIndexOf('/'); return lastSlash >= 0 ? cleanUri.substring(lastSlash + 1) : cleanUri; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left extractFileNameFromUri AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uri AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif...
private extractFileNameFromUri(uri: string): string { const queryIndex = uri.indexOf('?'); const cleanUri = queryIndex >= 0 ? uri.substring(0, queryIndex) : uri; const lastSlash = cleanUri.lastIndexOf('/'); return lastSlash >= 0 ? cleanUri.substring(lastSlash + 1) : cleanUri; }
https://github.com/Delsin-Yu/JustPDF/blob/07d9dd917e7592f584d67821fb06a7369bd3f15b/entry/src/main/ets/pages/pdfview/PDFAnnotationController.ets#L646-L651
a3377e566a8c3c25052f618134a68ceb0f70df3f
github
DaLongZhuaZi/NGF
ngf_framework/src/main/ets/deviceAwareness/facades/AccessibilityFacade.ets
arkts
isScreenReaderEnabled
查询屏幕朗读(TalkBack/读屏)是否启用
isScreenReaderEnabled(): boolean { try { return accessibility.isOpenTouchGuideSync(); } catch (e) { logger.warn(TAG, '屏幕朗读状态查询失败: ' + e); return false; } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isScreenReaderEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right A...
isScreenReaderEnabled(): boolean { try { return accessibility.isOpenTouchGuideSync(); } catch (e) { logger.warn(TAG, '屏幕朗读状态查询失败: ' + e); return false; } }
https://github.com/DaLongZhuaZi/NGF
8344a22ab6edc6948c3a8dd878154dcaf91168b4
github
RoooyHe/toona-ohos
toona/src/main/ets/database/LocalDatabase.ets
arkts
saveRoom
── Room CRUD ──
async saveRoom(room: RoomModel): Promise<void> { if (!this.roomDao) { throw new Error('Database not initialized'); } try { const entity = this.roomToEntity(room); await this.roomDao.insert(entity); } catch (error) { LocalDatabase.logger.error('Failed to save room:', error); ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left saveRoom AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left room AST#identifier#Right AST#type_a...
async saveRoom(room: RoomModel): Promise<void> { if (!this.roomDao) { throw new Error('Database not initialized'); } try { const entity = this.roomToEntity(room); await this.roomDao.insert(entity); } catch (error) { LocalDatabase.logger.error('Failed to save room:', error); ...
https://github.com/RoooyHe/toona-ohos
5a7e9a3da2c761e2eb56daa848a108d53b7775f1
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.uri.ets
arkts
userInfo
Gets Obtains the user information part of the URI. @returns { string | null }
get userInfo(): string | null { let s: string = this.uriEntry.getUserinfo(); return s == '' ? null : decodeURIComponent(s); }
AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left userInfo 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#L...
get userInfo(): string | null { let s: string = this.uriEntry.getUserinfo(); return s == '' ? null : decodeURIComponent(s); }
https://gitcode.com/iop123123/arkts-static-skills
c9cdbfce90ff776940301ed400d275bbfe19d5c5
gitcode
openharmony/communication_wifi
wifi/application/wifi_direct_demo/entry/src/main/ets/MainAbility/common/StorageUtil.ets
arkts
getDataToDef
获取数据并指定默认
getDataToDef(key, def) { let data; if (mPreferences && mPreferences.hasSync(key)) { data = mPreferences.getSync(key, def); } else { data = def; } LogUtil.info('getDataToDef key == ' + key + ' data == ' + data); return data; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getDataToDef AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left key AST#identifier#Right AST#,#Left , AST#,#Right AST#identifier#Left def AST#identifier#Right AST#)#Left ) AST#)#Right AST#argume...
getDataToDef(key, def) { let data; if (mPreferences && mPreferences.hasSync(key)) { data = mPreferences.getSync(key, def); } else { data = def; } LogUtil.info('getDataToDef key == ' + key + ' data == ' + data); return data; }
https://gitee.com/openharmony/communication_wifi.git
34f39c4f35072f7cd4d52e19a3ee1f33a33efbb3
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/remainder/remainder_ushort.ets
arkts
main
--- desc: check remainder of division operation for two unsigned short integer operands ---
function main(): void { const a: ushort = {{v.left}} const b: ushort = {{v.right}} assert (a % b) == {{v.result}}
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A...
function main(): void { const a: ushort = {{v.left}} const b: ushort = {{v.right}} assert (a % b) == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
bc8df5558fe33c1675274665a25b2561a80ccb75
gitee
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/customkey/CustomKeyManager.ets
arkts
reset
重置所有输入状态 在串流结束时调用,确保不残留虚拟按键状态
reset(): void { if (this.gamepadInputMap !== 0 || this.gamepadLeftTrigger !== 0 || this.gamepadRightTrigger !== 0 || this.leftStickX !== 0 || this.leftStickY !== 0 || this.rightStickX !== 0 || this.rightStickY !== 0) { this.gamepadInputMap = 0; this.gamepadLeftTrigger = 0; this.gamepadRi...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left reset 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#...
reset(): void { if (this.gamepadInputMap !== 0 || this.gamepadLeftTrigger !== 0 || this.gamepadRightTrigger !== 0 || this.leftStickX !== 0 || this.leftStickY !== 0 || this.rightStickX !== 0 || this.rightStickY !== 0) { this.gamepadInputMap = 0; this.gamepadLeftTrigger = 0; this.gamepadRi...
https://github.com/AlkaidLab/moonlight-harmony
aa1a6157003a6d1f18b1d8e1bbf3878972d90131
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/Exception.ets
arkts
constructor
Constructs a new exception instance with provided message @param msg message of the exception
constructor(msg: String) { this.msg = msg; this.cause = this; this.provisionStackTrace() }
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 msg AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left String AST#identifier#Right AS...
constructor(msg: String) { this.msg = msg; this.cause = this; this.provisionStackTrace() }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
96c7e81eaf2a4d890c66c88310f70b54e7eae727
gitee
erosTeam/NextE
shared/src/main/ets/state/FavSelectionState.ets
arkts
remoteTotalCount
Sum remote 0-9 favorite slots for the synthetic "all favorites" chip.
remoteTotalCount(): number { let total: number = 0 this.favList.forEach((f: Favcat) => { if (FavSelectionState.isRemoteSlot(f.favId) && f.totNum > 0) { total += f.totNum } }) return total }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left remoteTotalCount 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#state...
remoteTotalCount(): number { let total: number = 0 this.favList.forEach((f: Favcat) => { if (FavSelectionState.isRemoteSlot(f.favId) && f.totNum > 0) { total += f.totNum } }) return total }
https://github.com/erosTeam/NextE
1679b91f90464175e94ab05a4c2ba555980e9a72
github
openharmony-sig/applications_clock
feature/worldclock/src/main/ets/pages/TimeZoneUtil.ets
arkts
getCityLocalDisplayName
获取某时区城市的本地化显示
static getCityLocalDisplayName(cityID: string): string { let locale = new intl.Locale(i18n.System.getSystemLanguage()); return i18n.TimeZone.getCityDisplayName(cityID, locale.toString()); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getCityLocalDisplayName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left cityID AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi...
static getCityLocalDisplayName(cityID: string): string { let locale = new intl.Locale(i18n.System.getSystemLanguage()); return i18n.TimeZone.getCityDisplayName(cityID, locale.toString()); }
https://gitee.com/openharmony-sig/applications_clock.git
47d32a46a838fbbecf2f92717bb69fcd8102a5d0
gitee
openharmony/codelabs
ETSUI/AccountApp/entry/src/main/ets/database/RdbHelper.ets
arkts
queryUser
查询用户 (登录验证 / 查重)
public queryUser(username: string): Promise<User | null> { return new Promise((resolve) => { if (!this.rdbStore) { resolve(null); return; } try { let predicates = new relationalStore.RdbPredicates('USER_TABLE'); predicates.equalTo('username', username); this.rdbStore.query(pr...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left queryUser AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left username AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Righ...
public queryUser(username: string): Promise<User | null> { return new Promise((resolve) => { if (!this.rdbStore) { resolve(null); return; } try { let predicates = new relationalStore.RdbPredicates('USER_TABLE'); predicates.equalTo('username', username); this.rdbStore.query(pr...
https://gitcode.com/openharmony/codelabs
0c188199d00d15ebd989422e57e4480d74e894fb
gitcode
heeh02/superconnect
harmony/entry/src/main/ets/input/KeyboardHandler.ets
arkts
onWillInsert
Soft-keyboard insert → committed text (return false: don't insert into the field).
onWillInsert(info: InsertValue): boolean { this.sender.sendText(info.insertValue); return false; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onWillInsert AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left info AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left InsertValue AST#identifier#Right AST#)#Left...
onWillInsert(info: InsertValue): boolean { this.sender.sendText(info.insertValue); return false; }
https://github.com/heeh02/superconnect
b9348de087c29ab6b8b61bcf8b019ef04c289809
github
jjjjjjava/ffmpeg_tools
src/main/ets/ffmpeg/FFmpegManager.ets
arkts
notifyWorker
唤醒工作线程
private notifyWorker(): void { if (this.taskResolver) { this.taskResolver(); this.taskResolver = null; } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left notifyWorker AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expres...
private notifyWorker(): void { if (this.taskResolver) { this.taskResolver(); this.taskResolver = null; } }
https://github.com/jjjjjjava/ffmpeg_tools
0c7d2f7cd75fb3fb38a018a63ddf3a825362ae6a
github
tdcare/tdwebrtc
src/main/ets/utils/LogUtil.ets
arkts
uniLog
统一日志输出
private static uniLog(message: string[] | object[], level: hilog.LogLevel) { if (!LogUtil.showLog) { return; //不打印日志 } let topLine = LogUtil.getLine(LogUtil.tag); LogUtil.levelLog(topLine, level); if (level === hilog.LogLevel.ERROR || level === hilog.LogLevel.FATAL) { let locationLog =...
AST#program#Left AST#expression_statement#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 uniLog AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifie...
private static uniLog(message: string[] | object[], level: hilog.LogLevel) { if (!LogUtil.showLog) { return; //不打印日志 } let topLine = LogUtil.getLine(LogUtil.tag); LogUtil.levelLog(topLine, level); if (level === hilog.LogLevel.ERROR || level === hilog.LogLevel.FATAL) { let locationLog =...
https://github.com/tdcare/tdwebrtc
f6e66773bc43b2d27cc26d41289a014e1f5dc069
github
DaLongZhuaZi/manxia
entry/src/main/ets/Utils/CompressionUtils.ets
arkts
getFileNameFromUri
从URI中提取文件名 @param uri URI路径 @returns 文件名
private getFileNameFromUri(uri: string): string { try { const parts = uri.split('/'); let fileName = parts[parts.length - 1] || 'unknown_file'; // 解码URL编码的文件名 fileName = decodeURIComponent(fileName); return fileName; } catch (error) { const errorStr = String(e...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getFileNameFromUri AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uri AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#...
private getFileNameFromUri(uri: string): string { try { const parts = uri.split('/'); let fileName = parts[parts.length - 1] || 'unknown_file'; // 解码URL编码的文件名 fileName = decodeURIComponent(fileName); return fileName; } catch (error) { const errorStr = String(e...
https://github.com/DaLongZhuaZi/manxia
0dd008d59a6afc73a90114794c535aa6e5d2e167
github
XJTUWYD/ArkDiff
entry/src/main/ets/viewmodel/DiffSessionViewModel.ets
arkts
runTextDiff
从文本输入执行 Diff
runTextDiff(): void { if (this.textA.length === 0 && this.textB.length === 0) return; this.isComputing = true; this.isFileMode = false; this.lastError = null; try { const options: DiffOptions = { ignoreBlankLines: this.ignoreBlankLines, enableCharDiff: this.enableCharDiff, ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left runTextDiff 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#{#Left { AST#{#Right AST#propert...
runTextDiff(): void { if (this.textA.length === 0 && this.textB.length === 0) return; this.isComputing = true; this.isFileMode = false; this.lastError = null; try { const options: DiffOptions = { ignoreBlankLines: this.ignoreBlankLines, enableCharDiff: this.enableCharDiff, ...
https://github.com/XJTUWYD/ArkDiff
474e578e81ac496e514d9b4419fb33c9dfefbd20
github
XHXYT/Pixark
entry/src/main/ets/entryability/EntryAbility.ets
arkts
registerWindowListeners
注册窗口大小与模式变化监听
private registerWindowListeners(windowClass: window.Window, UIContext: UIContext) { // 监听窗口大小变化 windowClass.on('windowSizeChange', async (data) => { logger.info('WindowChange', 'Succeeded in enabling the listener for window size changes. Data: ' + JSON.stringify(data)) let WindowWidth = UIContext....
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left registerWindowListeners AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left windowClass AST#identifier#Right AST#ERROR#Left AST#:#Left : AST...
private registerWindowListeners(windowClass: window.Window, UIContext: UIContext) { // 监听窗口大小变化 windowClass.on('windowSizeChange', async (data) => { logger.info('WindowChange', 'Succeeded in enabling the listener for window size changes. Data: ' + JSON.stringify(data)) let WindowWidth = UIContext....
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/entryability/EntryAbility.ets#L384-L410
67bc967af0140ac6cab644cba624ebf8fbff10a3
github
openharmony-sig/applications_inputmethod
entry/src/main/ets/common/downMenu.ets
arkts
build
搜索关键字 在各个字母点击事件内调用接口
build() { Flex({ justifyContent: FlexAlign.End, alignItems: ItemAlign.Center }) { Stack() { // Flex({ // direction: FlexDirection.Row, // alignItems: ItemAlign.Start, // justifyContent: FlexAlign.Start // }) { // Text(this.promptText).fontSize(20).backgroun...
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() { Flex({ justifyContent: FlexAlign.End, alignItems: ItemAlign.Center }) { Stack() { // Flex({ // direction: FlexDirection.Row, // alignItems: ItemAlign.Start, // justifyContent: FlexAlign.Start // }) { // Text(this.promptText).fontSize(20).backgroun...
https://gitee.com/openharmony-sig/applications_inputmethod.git
2dd60424a2e6d36b54e0bccfb2e77a53c3b5b0da
gitee
erosTeam/NextE
shared/src/main/ets/network/EhApiService.ets
arkts
updateMyTagsTagset
Manage My Tags tagsets (eros_fe actionCreatTagSet / actionRenameTagSet / actionDeleteTagSet).
async updateMyTagsTagset(update: MyTagsTagsetUpdate): Promise<void> { const action: string = update.action.trim() if (action !== 'create' && action !== 'rename' && action !== 'delete') { throw new Error('mytags tagset: invalid action') } if ((action === 'rename' || action === 'delete') && update...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left updateMyTagsTagset AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left update AST#identifier#Right AST#type_annotation#Left AST#:#L...
async updateMyTagsTagset(update: MyTagsTagsetUpdate): Promise<void> { const action: string = update.action.trim() if (action !== 'create' && action !== 'rename' && action !== 'delete') { throw new Error('mytags tagset: invalid action') } if ((action === 'rename' || action === 'delete') && update...
https://github.com/erosTeam/NextE
501cfb390b73d2042402e42563d57d4a4c1751cc
github
Cierra-Runis/Honey
app/entry/src/main/ets/commom/Token.ets
arkts
getToken
获取存储的 token
static getToken(): string { return AppStorage.Get<string>(this.TOKEN_KEY) || ''; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getToken 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...
static getToken(): string { return AppStorage.Get<string>(this.TOKEN_KEY) || ''; }
https://github.com/Cierra-Runis/Honey
f46062919d65ff0d9d695489f256f3a116ab7abf
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Theme/AppColors.ets
arkts
getColorForCurrentTheme
获取当前主题下的颜色值 优先使用用户自定义主色(通过ThemeManager),否则使用默认调色板 @param role 颜色角色 @returns 当前主题对应的颜色字符串
function getColorForCurrentTheme(role: ColorRole): string { const themeManager = ThemeManager.getInstance(); const isDark = themeManager.isDarkThemeSync(); // 尝试获取用户自定义主色(通过ThemeManager的自定义主题功能) if (role === ColorRole.PRIMARY || role === ColorRole.BUTTON_PRIMARY) { const customPrimaryColor = themeManager...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getColorForCurrentTheme AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left role AST#identifier#Right AST#type_annotation#Left AST#:#Left ...
function getColorForCurrentTheme(role: ColorRole): string { const themeManager = ThemeManager.getInstance(); const isDark = themeManager.isDarkThemeSync(); // 尝试获取用户自定义主色(通过ThemeManager的自定义主题功能) if (role === ColorRole.PRIMARY || role === ColorRole.BUTTON_PRIMARY) { const customPrimaryColor = themeManager...
https://github.com/DaLongZhuaZi/manxia
09ad5d9e81fcbcb433945f8cbe0a95db932d6294
github
apap6628114/nga_oh
entry/src/main/ets/common/datasource/BaseLazyDataSource.ets
arkts
updateAt
更新指定下标的元素并触发该位置的数据变更通知。 越界下标将被忽略。 @param index - 目标下标 @param item - 新元素
updateAt(index: number, item: T): void { if (index < 0 || index >= this.dataList.length) { return } this.dataList[index] = item this.notifyDataChange(index) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateAt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left , AST#,...
updateAt(index: number, item: T): void { if (index < 0 || index >= this.dataList.length) { return } this.dataList[index] = item this.notifyDataChange(index) }
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/common/datasource/BaseLazyDataSource.ets#L104-L110
f24f0cc972fced4d6c8bc3286b01de1f36b8e6a3
github
Goway-Hui/harmonyos-next-dev
harmonyos-next-dev/assets/database-crud-template.ets
arkts
queryAllUsers
==================== READ ====================
async queryAllUsers(): Promise<User[]> { if (!this.rdbStore) throw new Error('DB not initialized'); let predicates = new relationalStore.RdbPredicates('users'); predicates.orderByDesc('created_at'); let resultSet = await this.rdbStore.query(predicates, ['id', 'name', 'age', 'email', 'created_at']); ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left queryAllUsers 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...
async queryAllUsers(): Promise<User[]> { if (!this.rdbStore) throw new Error('DB not initialized'); let predicates = new relationalStore.RdbPredicates('users'); predicates.orderByDesc('created_at'); let resultSet = await this.rdbStore.query(predicates, ['id', 'name', 'age', 'email', 'created_at']); ...
https://github.com/Goway-Hui/harmonyos-next-dev
5ae139cb4c7e8ead5d5839c58b47268a3763a03c
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.PlainArray.ets
arkts
getKeyAt
Finds the key of the index. @param index the index of the element to get the key of @returns the key of the index @throws BusinessError if the index is out of range.
public getKeyAt(index: int): int { this.checkIndexType(index); if (index < 0 || index >= this.length) { return -1; } return this.buckets.getKeyAt(index)!; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getKeyAt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left index AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#Rig...
public getKeyAt(index: int): int { this.checkIndexType(index); if (index < 0 || index >= this.length) { return -1; } return this.buckets.getKeyAt(index)!; }
https://gitcode.com/iop123123/arkts-static-skills
4095edea17fa7632fb513dea1c238b9bf7f2e9a8
gitcode
openharmony/codelabs
ETSUI/LifeTrack/entry/src/main/ets/dao/ContactDao.ets
arkts
updateContact
更新联系人
public async updateContact(contact: ContactsItem): Promise<OperationResult> { try { const rdbStore = await this.ensureDBInitialized(); // 生成首字母 const initial = this.generateInitial(contact.name); // 创建更新条件 const predicates = new relationalStore.RdbPredicates('contacts'); pred...
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 updateContact AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left contact AST#identifier#Right AST#:#Left : ...
public async updateContact(contact: ContactsItem): Promise<OperationResult> { try { const rdbStore = await this.ensureDBInitialized(); // 生成首字母 const initial = this.generateInitial(contact.name); // 创建更新条件 const predicates = new relationalStore.RdbPredicates('contacts'); pred...
https://gitcode.com/openharmony/codelabs
c1862cf99df693181e4c6ab91539d209ee8e76ce
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Source/SourceRepositoryManager.ets
arkts
initialize
初始化仓库管理器
async initialize(context: Context): Promise<void> { try { this.context = context; // 设置仓库目录路径 const filesDir = context.filesDir; this.repositoryDir = `${filesDir}/extensions-source`; this.indexFilePath = `${this.repositoryDir}/index.main.json`; this.savedRepositoriesPath...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left initialize AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#Right AST#type_annotation#Left AST#:#Left : A...
async initialize(context: Context): Promise<void> { try { this.context = context; // 设置仓库目录路径 const filesDir = context.filesDir; this.repositoryDir = `${filesDir}/extensions-source`; this.indexFilePath = `${this.repositoryDir}/index.main.json`; this.savedRepositoriesPath...
https://github.com/DaLongZhuaZi/manxia
f73e706166f641ba01028a1ad98918203059acfe
github
LJ666-ui/harmony-health-care
entry/src/main/ets/common/utils/HttpUtil.ets
arkts
getDoctorToken
==================== 医生相关方法 ==================== 获取医生Token
static getDoctorToken(): string | null { try { const tokenFromAppStorage: string | undefined = AppStorage.get<string>('doctorToken'); if (tokenFromAppStorage && tokenFromAppStorage.length > 0) { return tokenFromAppStorage; } const settings: SettingsUtil = SettingsUtil.getInstance()...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getDoctorToken AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left ...
static getDoctorToken(): string | null { try { const tokenFromAppStorage: string | undefined = AppStorage.get<string>('doctorToken'); if (tokenFromAppStorage && tokenFromAppStorage.length > 0) { return tokenFromAppStorage; } const settings: SettingsUtil = SettingsUtil.getInstance()...
https://github.com/LJ666-ui/harmony-health-care
74450a7994cb33da5cf64a141ae6bf35bfcfc50e
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/String.ets
arkts
$_invoke
Creates a new instance of a String @returns { string } A new String instance @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
static $_invoke(): string { return new String(); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left $_invoke AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string...
static $_invoke(): string { return new String(); }
https://gitcode.com/iop123123/arkts-static-skills
6d239001f9e473a9aea949d235eb127007aaee44
gitcode
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/services/RdpSessionManager.ets
arkts
initialize
Initialize session manager and all subsystems
async initialize(): Promise<boolean> { console.info(`${TAG}: Initializing session manager`); try { // Initialize network manager await NetworkManager.initialize(); // Initialize audio focus manager await AudioFocusManager.initialize(); // Set up network callbac...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left initialize 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#...
async initialize(): Promise<boolean> { console.info(`${TAG}: Initializing session manager`); try { // Initialize network manager await NetworkManager.initialize(); // Initialize audio focus manager await AudioFocusManager.initialize(); // Set up network callbac...
https://github.com/tangwengang-del/freerdp-harmonyos
05db33364b0426c749402fdc1c530a64a1381bd2
github
codelably/tuniao-ui
core/tuniaoui/src/main/ets/components/notify/TnNotify.ets
arkts
tnNotifyBuilder
通知内容 Builder 函数 @param params 通知参数
@Builder function tnNotifyBuilder(params: TnNotifyParams): void { TnNotifyContent({ params: params }); }
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 tnNotifyBuilder AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#r...
@Builder function tnNotifyBuilder(params: TnNotifyParams): void { TnNotifyContent({ params: params }); }
https://github.com/codelably/tuniao-ui
5df465759c81ba2b4b7ebadc255498f2d8651365
github
arkui-x/samples
CodeLab/Cases/feature/expandtitle/src/main/ets/utils/TitleExpansion.ets
arkts
getTitleHeightChangeOptions
获取标题栏高度变化参数 @param offset: 当前产生的偏移 @returns {number} 标题栏高度变化值
getTitleHeightChangeOptions(offset: number): number { return Math.max(Math.min(offset, this.animationAttribute.expandTitleHeight - this.heightValue), this.animationAttribute.normalTitleHeight - this.heightValue); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getTitleHeightChangeOptions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left offset AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Righ...
getTitleHeightChangeOptions(offset: number): number { return Math.max(Math.min(offset, this.animationAttribute.expandTitleHeight - this.heightValue), this.animationAttribute.normalTitleHeight - this.heightValue); }
https://gitcode.com/arkui-x/samples
ff688b60555da1540377b35d5523fd4da2310be5
gitcode
YDYm233/EasyRandom_HarmonyNextApp
product/wearable/src/main/ets/utils/WearScreenUtil.ets
arkts
screenWidth
获取屏幕宽度 (vp)
static get screenWidth(): number { WearScreenUtil._initDimensions(); return WearScreenUtil._screenWidth; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left get AST#identifier#Right AST#call_expression#Left AST#identifier#Left screenWidth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left...
static get screenWidth(): number { WearScreenUtil._initDimensions(); return WearScreenUtil._screenWidth; }
https://github.com/YDYm233/EasyRandom_HarmonyNextApp
c60505e304c34ac09f836978d61bfdf553bf060e
github
Vsolon0401/MallShopping
features/home/src/main/ets/model/homeService.ets
arkts
fetchRecommendProductList
分页获取推荐商品
async fetchRecommendProductList(params) { return Request.get('/home/recommendProductList', { params: params }) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left fetchRecommendProductList AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left params AST#identifier#Right AST#)#Left ...
async fetchRecommendProductList(params) { return Request.get('/home/recommendProductList', { params: params }) }
https://github.com/Vsolon0401/MallShopping
32e6e8aad6bfbeed56907d6263e57df2ee45d078
github
Explore-In-HMOS-Wearable/how-to-use-weather-kit
entry/src/main/ets/utils/WeatherIconHelper.ets
arkts
getWeatherIcon
Get weather icon resource for a given condition Uses switch statement to avoid indexed access
getWeatherIcon(condition?: WeatherCondition): Resource { if (!condition) { return this.fallbackIcon; } // Check custom icons first if (this.customIcons) { const customIcon = this.getCustomIcon(condition); if (customIcon) { return customIcon; } } // Fal...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getWeatherIcon AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left condition AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left WeatherCond...
getWeatherIcon(condition?: WeatherCondition): Resource { if (!condition) { return this.fallbackIcon; } // Check custom icons first if (this.customIcons) { const customIcon = this.getCustomIcon(condition); if (customIcon) { return customIcon; } } // Fal...
https://github.com/Explore-In-HMOS-Wearable/how-to-use-weather-kit
c4628ea016b0336a20d856b860e7a40e88445f16
github
CLMC2025/Vignette
entry/src/main/ets/ui/EnhancedCards.ets
arkts
basic
创建基础卡片样式
static basic(): CardStyle { return new CardStyle( CardType.BASIC, DesignTokens.Colors.SURFACE_PRIMARY, DesignTokens.BorderRadius.LG, 0, DesignTokens.Colors.SHADOW_DARK, 0.1, { left: DesignTokens.Spacing.LG, right: DesignTokens.Spacing.LG, top: D...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left basic AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Rig...
static basic(): CardStyle { return new CardStyle( CardType.BASIC, DesignTokens.Colors.SURFACE_PRIMARY, DesignTokens.BorderRadius.LG, 0, DesignTokens.Colors.SHADOW_DARK, 0.1, { left: DesignTokens.Spacing.LG, right: DesignTokens.Spacing.LG, top: D...
https://github.com/CLMC2025/Vignette
c7fe9f3c57f9495d693488fc3a57e02b7174c2fb
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelSettingsManager.ets
arkts
getMaxConcurrentSources
获取最大并发搜索数
getMaxConcurrentSources(): number { return this.searchSettings.maxConcurrentSources; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getMaxConcurrentSources 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 AS...
getMaxConcurrentSources(): number { return this.searchSettings.maxConcurrentSources; }
https://github.com/DaLongZhuaZi/manxia
91e01a0aba1159bebe88e2958373dd40c217b537
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Workflow/WorkflowCapabilities.ets
arkts
applyChineseConverter
应用简繁转换能力
applyChineseConverter( data: Record<string, Object>, context: WorkflowContext ): Record<string, Object> { const capability = context.capabilities.get('chineseConverter'); if (!capability) { return data; } const config = capability as ChineseConversionConfig; return this.chineseCon...
AST#program#Left AST#expression_statement#Left AST#sequence_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left applyChineseConverter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right...
applyChineseConverter( data: Record<string, Object>, context: WorkflowContext ): Record<string, Object> { const capability = context.capabilities.get('chineseConverter'); if (!capability) { return data; } const config = capability as ChineseConversionConfig; return this.chineseCon...
https://github.com/DaLongZhuaZi/manxia
a75dc4288e42990e4e115198812d65e6f984a037
github