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
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Errors.ets
arkts
$_invoke
Constructs a new SyntaxError instance with provided message and error specific information @param { String | undefined } message - Error text @param { ErrorOptions | undefined } options - Error options @returns { SyntaxError } @static @syscap SystemCapability.Utils.Lang
static $_invoke(message?: String, options?: ErrorOptions): SyntaxError { return new SyntaxError(message, options) }
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#identifier#Left message AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#identifier#...
static $_invoke(message?: String, options?: ErrorOptions): SyntaxError { return new SyntaxError(message, options) }
https://gitcode.com/iop123123/arkts-static-skills
c01224ff69ae72b7923ba9aea98f31636824b0e0
gitcode
FinalScave/SweetLine
platform/OHOS/sweetline/src/main/ets/Index.ets
arkts
analyzeIndentGuidesInLineRange
Perform indent guide analysis for the specified visible line range @param visibleRange Visible line range @returns Indent guide analysis result for the specified line range
public analyzeIndentGuidesInLineRange(visibleRange: LineRange): IndentGuideResult { if (this.nativeHandle == 0) { return new IndentGuideResult(); } let buffer: Int32Array = lib.DocumentAnalyzer_AnalyzeIndentGuidesInLineRange( this.nativeHandle, visibleRange.startLine, visib...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left analyzeIndentGuidesInLineRange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left visibleRange AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifie...
public analyzeIndentGuidesInLineRange(visibleRange: LineRange): IndentGuideResult { if (this.nativeHandle == 0) { return new IndentGuideResult(); } let buffer: Int32Array = lib.DocumentAnalyzer_AnalyzeIndentGuidesInLineRange( this.nativeHandle, visibleRange.startLine, visib...
https://github.com/FinalScave/SweetLine
a1f4ecfa9a409ebb92a677c56d0c7c6d1d36167c
github
the-wwyang/kids-learning-app
src/main/ets/storage/AppStorageManager.ets
arkts
clearCurrentUser
清除当前用户(登出)
public clearCurrentUser(): void { this.currentUserData = null; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left clearCurrentUser 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#expre...
public clearCurrentUser(): void { this.currentUserData = null; }
https://github.com/the-wwyang/kids-learning-app
0398a4db87247f56af6f338fa49958d6653bb23f
github
openharmony/applications_calendar_data
datamanager/src/main/ets/processor/instances/InstancesProcessor.ets
arkts
queryByInstanceUri
解析 uri,根据 uri 进行 Instance 的联表查询 @param rdbStore rdb数据库 @param uri DataShare的uri,包含查询参数 @param columns 查询的列名 @param callerName 调用方app的bundle_name @param callback 回调方法
async queryByInstanceUri(rdbStore: data_rdb.RdbStore, uri: string, columns: Array<string>, callerName: string, callback: Function) { const params: InstancesQueryParams = parseParamsFromUri(uri) as InstancesQueryParams; if (!isValidQueryParams(params)) { const err: BusinessErro...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left queryByInstanceUri AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left rdbStore AST#identifier#Right AST#type_annotation#Left AST#:...
async queryByInstanceUri(rdbStore: data_rdb.RdbStore, uri: string, columns: Array<string>, callerName: string, callback: Function) { const params: InstancesQueryParams = parseParamsFromUri(uri) as InstancesQueryParams; if (!isValidQueryParams(params)) { const err: BusinessErro...
https://gitee.com/openharmony/applications_calendar_data.git
db3f81f2efd25a4c377d7cb62f36c3ac886ffe1b
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/DuplicateDetection/DuplicateDetectionService.ets
arkts
getContentTypesToCheck
根据检测范围决定检查哪些类型
private getContentTypesToCheck(inputType: DuplicateCheckContentType, scope: DuplicateCheckScope): DuplicateCheckContentType[] { if (scope === DuplicateCheckScope.SAME_TYPE) { return [inputType]; } // ALL_TYPES: 检查所有三种类型 return [DuplicateCheckContentType.MANGA, DuplicateCheckContentType.EBOOK, Du...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getContentTypesToCheck AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left inputType AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#i...
private getContentTypesToCheck(inputType: DuplicateCheckContentType, scope: DuplicateCheckScope): DuplicateCheckContentType[] { if (scope === DuplicateCheckScope.SAME_TYPE) { return [inputType]; } // ALL_TYPES: 检查所有三种类型 return [DuplicateCheckContentType.MANGA, DuplicateCheckContentType.EBOOK, Du...
https://github.com/DaLongZhuaZi/manxia
a814a4d5dee9d2bf8002f950edf863dba2e7443c
github
Explore-In-HMOS-Wearable/music-player
entry/src/main/ets/utils/MediaController.ets
arkts
loadSongUrl
load song file music.
private async loadSongUrl() { if (!this.player || !this.context) { return; } try { hilog.info(audioDomain, audioPrefix, `song to start: ${this.songList[this.musicIndex].src}`); hilog.info(audioDomain, audioPrefix, `song to start state: ${this.player.state}`); await this.player.res...
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 loadSongUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#E...
private async loadSongUrl() { if (!this.player || !this.context) { return; } try { hilog.info(audioDomain, audioPrefix, `song to start: ${this.songList[this.musicIndex].src}`); hilog.info(audioDomain, audioPrefix, `song to start state: ${this.player.state}`); await this.player.res...
https://github.com/Explore-In-HMOS-Wearable/music-player
8fa71e126aec784d341c9ee3ddbb2c343fd0f9a1
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/export/utils/EncryptionModule.ets
arkts
uint8ArrayToString
将 Uint8Array 转换为字符串 (UTF-8解码) @param bytes 要转换的字节数组 @returns 字符串
private static uint8ArrayToString(bytes: Uint8Array): string { // 手动实现 UTF-8 解码 let result = ''; let i = 0; while (i < bytes.length) { let byte1 = bytes[i++]; if (byte1 < 0x80) { result += String.fromCharCode(byte1); } else if ((byte1 >> 5) === 0x06) { const byte2 = b...
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 uint8ArrayToString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bytes AST#identifier#Right AST#:#...
private static uint8ArrayToString(bytes: Uint8Array): string { // 手动实现 UTF-8 解码 let result = ''; let i = 0; while (i < bytes.length) { let byte1 = bytes[i++]; if (byte1 < 0x80) { result += String.fromCharCode(byte1); } else if ((byte1 >> 5) === 0x06) { const byte2 = b...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
a8c4c5e9620af6a0e6fdfbfc4c909a1ef2184528
github
openharmony/arkui_ace_engine
advanced_ui_component/treeviewv2/source/treeviewv2.ets
arkts
offNodeMove
Destroy node move callback event. @syscap SystemCapability.ArkUI.ArkUI.Full @since 26
public offNodeMove(callback?: OnChangedCallback): void { if (callback === undefined) { this.nodeMoveEvents = []; this.nodeMoveOnceEvents = []; } else { let index = this.nodeMoveEvents.indexOf(callback); if (index >= 0) { this.nodeMoveEvents.splice(index, 1); } } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left offNodeMove AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#R...
public offNodeMove(callback?: OnChangedCallback): void { if (callback === undefined) { this.nodeMoveEvents = []; this.nodeMoveOnceEvents = []; } else { let index = this.nodeMoveEvents.indexOf(callback); if (index >= 0) { this.nodeMoveEvents.splice(index, 1); } } }
https://gitcode.com/openharmony/arkui_ace_engine
e9f7acb2df0592ac578a72f12e370b696eeae8e6
gitcode
the-wwyang/kids-learning-app
src/main/ets/services/ProfileService.ets
arkts
setCurrentProfileId
设置当前档案ID
private async setCurrentProfileId(profileId: string): Promise<boolean> { if (this.dataPreferences === null) { return false; } try { await this.dataPreferences.put(StorageKeys.CURRENT_PROFILE, profileId); await this.dataPreferences.flush(); return true; } catch (err) { co...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left setCurrentProfileId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left profileId AST#identifier#Right AST#ERROR#Left AS...
private async setCurrentProfileId(profileId: string): Promise<boolean> { if (this.dataPreferences === null) { return false; } try { await this.dataPreferences.put(StorageKeys.CURRENT_PROFILE, profileId); await this.dataPreferences.flush(); return true; } catch (err) { co...
https://github.com/the-wwyang/kids-learning-app
51513ddf3a714c75170cbbcbb772865b357056e8
github
Countly/countly-sdk-hos
library/src/main/ets/internal/modules/ModulePush.ets
arkts
recordPushActionEvent
Records a `[CLY]_push_action` event for a notification body/button tap and optionally opens the action URL. Consent + immediate flush are applied inside the events pipeline. `buttonIndex=0` = notification body tap; `1..n` = action button index from the payload's `c.b` array. URL handling order: 1. If `actionHandler` re...
public async recordPushActionEvent( notificationId: string, buttonIndex: number, url: string | null, openUrlFn: ((url: string) => void) | null ): Promise<void> { if (Utils.isNullOrEmpty(notificationId)) { this.config.logger.w('[ModulePush] recordPushActionEvent, notificationId is null/empt...
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 recordPushActionEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left notificationId AST#identifier#Right AST#ERROR#Lef...
public async recordPushActionEvent( notificationId: string, buttonIndex: number, url: string | null, openUrlFn: ((url: string) => void) | null ): Promise<void> { if (Utils.isNullOrEmpty(notificationId)) { this.config.logger.w('[ModulePush] recordPushActionEvent, notificationId is null/empt...
https://github.com/Countly/countly-sdk-hos
fe22c657883385b11a07e690388eb8f021c95560
github
RedRackham-R/WanAndroidHarmoney
entry/src/main/ets/global/viewmodel/GlobalCollectViewModel.ets
arkts
subscribeCollectUrlEvent
收藏Url事件 @param key @param callback
subscribeCollectUrlEvent(key: string, callback: (eventData: emitter.EventData) => void) { EventBus.getInstance().regist(WanEventId.EVENT_COLLECT_URL, key, callback) }
AST#program#Left AST#ERROR#Left AST#identifier#Left subscribeCollectUrlEvent AST#identifier#Right AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Right AST#call_expression#Lef...
subscribeCollectUrlEvent(key: string, callback: (eventData: emitter.EventData) => void) { EventBus.getInstance().regist(WanEventId.EVENT_COLLECT_URL, key, callback) }
https://github.com/RedRackham-R/WanAndroidHarmoney
85556fd41a93529ee0e6b4e3000831593bddf79a
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/DataView.ets
arkts
getBigInt64
=== Int64 === Read bytes as they represent given type @param byteOffset zero index to read @returns read value (big endian)
public getBigInt64(byteOffset: number): Long { return this.getBigInt64(byteOffset as int) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getBigInt64 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left byteOffset AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#...
public getBigInt64(byteOffset: number): Long { return this.getBigInt64(byteOffset as int) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
b04cd4fda9248b5fdad324f8501f419dcf30c3cd
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Theme/AppColors.ets
arkts
getColorForTheme
根据颜色角色和主题获取颜色 @param role 颜色角色 @param theme 主题类型 @returns 指定主题对应的颜色字符串
static getColorForTheme(role: ColorRole, theme: ThemeType): string { return getColorForTheme(role, theme); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getColorForTheme AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left role AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left...
static getColorForTheme(role: ColorRole, theme: ThemeType): string { return getColorForTheme(role, theme); }
https://github.com/DaLongZhuaZi/manxia
e9b7b550a9b4bf2db490c56f558fd69b1d2ff916
github
webabcd/HarmonyDemo
entry/src/main/ets/pages/arkts/concurrent/TaskPoolDemo.ets
arkts
fun4
@Concurrent 函数无法调用同文件内的其他函数或类 如果要在 @Concurrent 函数内调用其他函数或类,那么被调用的函数或类必须定义在其他 .ets 文件中(参见 TaskPoolDemo_1.ets 中的示例)
@Concurrent async function fun4(): Promise<string> { await new Promise<void>((r) => { setTimeout(r, 1000) }) let a = myFunction() let b = new MyClass().name let c = new MyClass().hello() return `${a}, ${b}, ${c}` }
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Concurrent AST#identifier#Right AST#decorator#Right AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left fun4 AST#identifier#Right AST#formal_parameters#Left A...
@Concurrent async function fun4(): Promise<string> { await new Promise<void>((r) => { setTimeout(r, 1000) }) let a = myFunction() let b = new MyClass().name let c = new MyClass().hello() return `${a}, ${b}, ${c}` }
https://github.com/webabcd/HarmonyDemo
9425859d5d57928c95fd5ecbe36deb1e8f7f406b
github
openharmony/codelabs
Data/PersonalAssistantPro/entry/src/main/ets/services/NotificationService.ets
arkts
cancelReminder
取消提醒 @param reminderId 提醒ID
static async cancelReminder(reminderId: number): Promise<void> { if (reminderId < 0) { return; } try { await reminderAgentManager.cancelReminder(reminderId); logger.info(`Reminder ${reminderId} canceled.`); } catch (err) { logger.error(`Cancel reminder failed code:${err.code} m...
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 cancelReminder AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left reminderId AST#identifier#Right AST#ERROR#Left AST#:#Lef...
static async cancelReminder(reminderId: number): Promise<void> { if (reminderId < 0) { return; } try { await reminderAgentManager.cancelReminder(reminderId); logger.info(`Reminder ${reminderId} canceled.`); } catch (err) { logger.error(`Cancel reminder failed code:${err.code} m...
https://gitcode.com/openharmony/codelabs
2f76ebc149ad047fe6be406814181c971c7cf6e0
gitcode
the-wwyang/kids-learning-app
src/main/ets/services/ProfileService.ets
arkts
getAllProfiles
获取所有档案
public async getAllProfiles(): Promise<UserProfile[]> { if (this.dataPreferences === null) { return []; } try { const profilesJson = await this.dataPreferences.get(StorageKeys.PROFILES_LIST, '[]') as string; const profilesData = JSON.parse(profilesJson) as Array<Record<string, string | ...
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 getAllProfiles AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:...
public async getAllProfiles(): Promise<UserProfile[]> { if (this.dataPreferences === null) { return []; } try { const profilesJson = await this.dataPreferences.get(StorageKeys.PROFILES_LIST, '[]') as string; const profilesData = JSON.parse(profilesJson) as Array<Record<string, string | ...
https://github.com/the-wwyang/kids-learning-app
ef601d22000212a6aca7c5eb0fab92fcf6c7cd85
github
DaLongZhuaZi/manxia
entry/src/main/ets/Utils/Logger.ets
arkts
shouldOutputToHilog
检查指定级别的日志是否应该输出到hilog @param level - 要检查的日志级别
private shouldOutputToHilog(level: LogLevel): boolean { // 如果hilog输出级别设置为OFF,则不输出任何日志 if (this.hilogOutputLevel === LogLevel.OFF) { return false; } // 只有高于或等于hilog输出级别的日志才输出 return level >= this.hilogOutputLevel; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left shouldOutputToHilog AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left level AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi...
private shouldOutputToHilog(level: LogLevel): boolean { // 如果hilog输出级别设置为OFF,则不输出任何日志 if (this.hilogOutputLevel === LogLevel.OFF) { return false; } // 只有高于或等于hilog输出级别的日志才输出 return level >= this.hilogOutputLevel; }
https://github.com/DaLongZhuaZi/manxia
e1886d89a5d029a52a0f2b60aa037fcbaebbf490
github
Nekofox-POT/LinMusic
entry/src/main/ets/建筑垃圾堆/class_audio_ffmpeg_player.ets
arkts
end_timing
取消定时 //
end_timing() { if (this.is_timed) { notice('睡眠定时已取消。') } this.is_timed = false this.wait_end = false this.timed = 0 this.clear_timer_interval() // 广播定时状态到前端 emitter.emit({ eventId: 719 }, { data: { timed: 0, is_timed: false, wait_end: false } }) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left end_timing AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AS...
end_timing() { if (this.is_timed) { notice('睡眠定时已取消。') } this.is_timed = false this.wait_end = false this.timed = 0 this.clear_timer_interval() // 广播定时状态到前端 emitter.emit({ eventId: 719 }, { data: { timed: 0, is_timed: false, wait_end: false } }) }
https://github.com/Nekofox-POT/LinMusic
6c980794558f206f84af4e0f1656e2d395db3055
github
the-wwyang/kids-learning-app
src/main/ets/common/UserService.ets
arkts
sendVerifyCode
发送验证码
public async sendVerifyCode(phone: string): Promise<OperationResult> { if (!this.isValidPhone(phone)) { return new OperationResult(false, '请输入正确的手机号'); } // 生成6位随机验证码 const code = Math.floor(100000 + Math.random() * 900000).toString(); const expireTime = Date.now() + 5 * 60 * 1000; // 5分钟有效...
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 sendVerifyCode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left phone AST#identifier#Right AST#:#Left : A...
public async sendVerifyCode(phone: string): Promise<OperationResult> { if (!this.isValidPhone(phone)) { return new OperationResult(false, '请输入正确的手机号'); } // 生成6位随机验证码 const code = Math.floor(100000 + Math.random() * 900000).toString(); const expireTime = Date.now() + 5 * 60 * 1000; // 5分钟有效...
https://github.com/the-wwyang/kids-learning-app
88ce6aa003e76ea845fe05b0314a9e467dcc3cb8
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/TaskExecutor.ets
arkts
registerTasks
批量注册任务
registerTasks(tasks: Record<string, TaskDefinition>): void { const taskIds = Object.keys(tasks); for (let i = 0; i < taskIds.length; i++) { const taskId = taskIds[i]; const task = tasks[taskId]; if (task) { task.id = taskId; this.registerTask(task); } } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left registerTasks AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tasks AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identifier#Left Record ...
registerTasks(tasks: Record<string, TaskDefinition>): void { const taskIds = Object.keys(tasks); for (let i = 0; i < taskIds.length; i++) { const taskId = taskIds[i]; const task = tasks[taskId]; if (task) { task.id = taskId; this.registerTask(task); } } }
https://github.com/DaLongZhuaZi/manxia
0c5e307e7807eeda2284027b0436de3f91d831d1
github
tdcare/tdwebrtc
example/SignalingClientExample.ets
arkts
getCurrentRoomId
获取当前房间 ID
public getCurrentRoomId(): string { return this.currentRoomId; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCurrentRoomId 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 AS...
public getCurrentRoomId(): string { return this.currentRoomId; }
https://github.com/tdcare/tdwebrtc
f39ecb15a5b16cc4a0b348403c444abc02470d31
github
aimilin6688/KeePassHO
entry/src/main/ets/storage/cache/CacheStorage.ets
arkts
ensureCacheDir
确保缓存目录存在 @param cacheDir 缓存目录路径
private ensureCacheDir(cacheDir: string): void { try { fs.mkdirSync(cacheDir, true); hilog.debug(DOMAIN, TAG, 'Cache dir created: %{public}s', cacheDir); } catch (error) { hilog.info(DOMAIN, TAG, 'Ensure cache dir: %{public}s, error: %{public}s', cacheDir, error?.message); } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left ensureCacheDir AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left cacheDir AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#str...
private ensureCacheDir(cacheDir: string): void { try { fs.mkdirSync(cacheDir, true); hilog.debug(DOMAIN, TAG, 'Cache dir created: %{public}s', cacheDir); } catch (error) { hilog.info(DOMAIN, TAG, 'Ensure cache dir: %{public}s, error: %{public}s', cacheDir, error?.message); } }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/cache/CacheStorage.ets#L355-L362
17df260255588b9e77175861051f33774ea576d0
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test22_original_index.ets
arkts
testJsonRoundTrip
--- JSON round-trip ---
function testJsonRoundTrip(): string { let obj: Record<string, number> = {}; obj['x'] = 10; obj['y'] = 20; let json: string = JSON.stringify(obj); let parsed: Record<string, number> = JSON.parse(json) as Record<string, number>; return String(parsed['x']) + ',' + String(parsed['y']); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testJsonRoundTrip AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefine...
function testJsonRoundTrip(): string { let obj: Record<string, number> = {}; obj['x'] = 10; obj['y'] = 20; let json: string = JSON.stringify(obj); let parsed: Record<string, number> = JSON.parse(json) as Record<string, number>; return String(parsed['x']) + ',' + String(parsed['y']); }
https://github.com/miaochiahao/ark-ghidra
cf4394c5e4c67392055f7aa9b2a9f40064c486c5
github
David8Idira/AI-OA
packages/harmonyos/commons/src/main/ets/services/AttendanceService.ets
arkts
getSchedule
获取排班计划 @param startDate 开始日期 @param endDate 结束日期
async getSchedule(startDate: string, endDate: string): Promise<ApiResponse<any[]>> { return this.client.get<any[]>('/api/v1/attendance/schedule', { startDate, endDate }) }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getSchedule AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left startDate AST#identifier#Right AST#type_annotation#Left AST#:#Left ...
async getSchedule(startDate: string, endDate: string): Promise<ApiResponse<any[]>> { return this.client.get<any[]>('/api/v1/attendance/schedule', { startDate, endDate }) }
https://github.com/David8Idira/AI-OA
d01dcce95f9fe39fd381fc509a8adcc84b8e9ec6
github
Amaz1ny/HarmonyDO-public
entry/src/main/ets/common/theme/ThemeManager.ets
arkts
hexToColor
将十六进制颜色字符串转为 number 例如 "FF5733" -> 0xFFFF5733
static hexToColor(hex: string): number { let colorHex: string = hex; if (colorHex.startsWith('#')) { colorHex = colorHex.substring(1); } // 补齐 alpha if (colorHex.length === 6) { colorHex = `FF${colorHex}`; } return parseInt(colorHex, 16); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left hexToColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left hex AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string...
static hexToColor(hex: string): number { let colorHex: string = hex; if (colorHex.startsWith('#')) { colorHex = colorHex.substring(1); } // 补齐 alpha if (colorHex.length === 6) { colorHex = `FF${colorHex}`; } return parseInt(colorHex, 16); }
https://github.com/Amaz1ny/HarmonyDO-public
d1441afe0e6a0cd71a6751e3534990a758d8bf97
github
heeh02/superconnect
harmony/entry/src/main/ets/input/PenHandler.ets
arkts
msSincePen
Milliseconds since the last pen activity (router's palm-grace window).
msSincePen(): number { return Date.now() - this.lastPenMs; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left msSincePen AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statement_b...
msSincePen(): number { return Date.now() - this.lastPenMs; }
https://github.com/heeh02/superconnect
dd2b2a563c2dfb8e6f686dc9d6c624f3f8cbcbe3
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Source/SourceManager.ets
arkts
pinSource
==================== 置顶功能 ==================== 置顶图源
async pinSource(sourceId: number): Promise<void> { await this.dataManager.addSourceToPinnedList(sourceId); logger.info(TAG, `图源已置顶: ${sourceId}`); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left pinSource AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceId AST#identifier#Right AST#type_annotation#Left AST#:#Left : A...
async pinSource(sourceId: number): Promise<void> { await this.dataManager.addSourceToPinnedList(sourceId); logger.info(TAG, `图源已置顶: ${sourceId}`); }
https://github.com/DaLongZhuaZi/manxia
c36cfa9960d56f2a42fe9fdf1834abe7e43fae87
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Source/SourceRepositoryManager.ets
arkts
syncRepositoryFromUrl
从URL同步仓库(带进度回调)
async syncRepositoryFromUrl(url: string, repositoryName?: string, progressCallback?: SyncProgressCallback): Promise<SyncResult> { const log = (level: 'info' | 'warn' | 'error', message: string) => { if (level === 'info') logger.info(TAG, message); else if (level === 'warn') logger.warn(TAG, message); ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left syncRepositoryFromUrl AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left url AST#identifier#Right AST#type_annotation#Left AST#:#L...
async syncRepositoryFromUrl(url: string, repositoryName?: string, progressCallback?: SyncProgressCallback): Promise<SyncResult> { const log = (level: 'info' | 'warn' | 'error', message: string) => { if (level === 'info') logger.info(TAG, message); else if (level === 'warn') logger.warn(TAG, message); ...
https://github.com/DaLongZhuaZi/manxia
a8cb804603c1d31a23591783ea35ac0df554c124
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets
arkts
toFraction
Return an array representing the value of this Decimal as a simple fraction with an integer numerator and an integer denominator. @returns { Decimal[] } the Decimal[] type
public toFraction(): Decimal[] { return this.fraction(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toFraction 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 toFraction(): Decimal[] { return this.fraction(); }
https://gitcode.com/iop123123/arkts-static-skills
8df8f63a56a6e9ef0670a06f69b1937963eea1ea
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets
arkts
getParameter
Returns ith parameter of function type @param {long} i index @throws {TypeError} when i greater then number of parameters @return {TypeAPIParameter} TypeAPIParameter, corresponding ith parameter in signature @syscap SystemCapability.Utils.Lang @FaAndStageModel
public getParameter(i: long): TypeAPIParameter { const paramDescriptor = this.getParameterDescriptor(i) if (paramDescriptor) { const paramType = Type.resolve(paramDescriptor, this.getContextLinker())! return this.getParameter(i, paramType) } throw new TypeErro...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getParameter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left i AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left long A...
public getParameter(i: long): TypeAPIParameter { const paramDescriptor = this.getParameterDescriptor(i) if (paramDescriptor) { const paramType = Type.resolve(paramDescriptor, this.getContextLinker())! return this.getParameter(i, paramType) } throw new TypeErro...
https://gitcode.com/iop123123/arkts-static-skills
e1fa1d602d41e0f70e97527f0e0d76a52c2b4b8d
gitcode
xblLab/HarmonyProjectTemplate
commons/lib_account/src/main/ets/services/AccountApi.ets
arkts
huaweiLogin
华为账号登录
public huaweiLogin(nickPhone: string) { const user = MineServiceApi.signIn('hw', nickPhone); if (user) { this.userInfoModel.loginChannel = 'hw'; this.handleUserInfo(user); } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left huaweiLogin AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left nickPhone AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#R...
public huaweiLogin(nickPhone: string) { const user = MineServiceApi.signIn('hw', nickPhone); if (user) { this.userInfoModel.loginChannel = 'hw'; this.handleUserInfo(user); } }
https://github.com/xblLab/HarmonyProjectTemplate
05ffa431fdd74b4db5fa2ad898b19efc8bb4ec92
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/DataManager.ets
arkts
batchAddChapters
批量添加章节
public async batchAddChapters(comicId: string, chapterData: ChapterInfo[]): Promise<void> { try { const now = Date.now(); const records: ChapterInfoDatabaseRecord[] = chapterData.map(chapter => { const record: ChapterInfoDatabaseRecord = { id: chapter.id, comicId: chapter.c...
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 batchAddChapters AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left comicId AST#identifier#Right AST#ERROR#Left AST#:#Left...
public async batchAddChapters(comicId: string, chapterData: ChapterInfo[]): Promise<void> { try { const now = Date.now(); const records: ChapterInfoDatabaseRecord[] = chapterData.map(chapter => { const record: ChapterInfoDatabaseRecord = { id: chapter.id, comicId: chapter.c...
https://github.com/DaLongZhuaZi/manxia
8e35c6deb97b8abe0c800a93ec4c5c35c8d1ff4f
github
CPF-ApplicationTPC/imageknifepro
library/src/main/ets/ImageKnife.ets
arkts
removeFileCache
清除指定文件缓存 @param url 图片url或图片加载配置项ImageKnifeOption 如果需要清除小端文件缓存的文件,在ImageKnifeOption.fileCacheName设置对应的小端文件缓存名称
removeFileCache(url: string | ImageKnifeOption | ImageKnifeOptionV2): void { let imageKnifeOption: ImageKnifeOption | ImageKnifeOptionV2; if (typeof url == 'string') { imageKnifeOption = { loadSrc: url }; } else { imageKnifeOption = url; } nativeNode.removeFileCache(image...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left removeFileCache AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#binary_expression#Left AST#ide...
removeFileCache(url: string | ImageKnifeOption | ImageKnifeOptionV2): void { let imageKnifeOption: ImageKnifeOption | ImageKnifeOptionV2; if (typeof url == 'string') { imageKnifeOption = { loadSrc: url }; } else { imageKnifeOption = url; } nativeNode.removeFileCache(image...
https://gitcode.com/CPF-ApplicationTPC/imageknifepro/blob/5b2c39b2925d2e6c4a267ce62edc340b3150dcb9/library/src/main/ets/ImageKnife.ets#L494-L504
723d70b60de7a68b2bb37f70bb621beafedcbf32
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/usbdriver/SwitchProController.ets
arkts
enableIMU
启用 IMU
private async enableIMU(enable: boolean): Promise<boolean> { const result = await this.sendSubcommand(0x40, new Uint8Array([enable ? 0x01 : 0x00])); return result !== null; }
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 enableIMU AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enable AST#identifier#Right AST#:#Left : AS...
private async enableIMU(enable: boolean): Promise<boolean> { const result = await this.sendSubcommand(0x40, new Uint8Array([enable ? 0x01 : 0x00])); return result !== null; }
https://github.com/AlkaidLab/moonlight-harmony
ebcc911b48bc7686aa49fb93e60dd721a1fe5a25
github
LJ666-ui/harmony-health-care
entry/src/main/ets/services/NotificationService.ets
arkts
getNotifications
获取通知列表
getNotifications(type?: string, status?: string): Notification[] { let notifications = Array.from(this.notifications.values()); if (type) { notifications = notifications.filter((n: Notification) => n.type === type); } if (status) { notifications = notifications.filter((n: Notific...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getNotifications AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#type#Left type AST#type#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#...
getNotifications(type?: string, status?: string): Notification[] { let notifications = Array.from(this.notifications.values()); if (type) { notifications = notifications.filter((n: Notification) => n.type === type); } if (status) { notifications = notifications.filter((n: Notific...
https://github.com/LJ666-ui/harmony-health-care
096d926e9cbe8d35df42232c4edb53bb8187f60a
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 @param { Any } value The value to be converted to a string. Can be an Object or null. @returns { string } A new String instance @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
static $_invoke(value: Any): string { return new String(value); }
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#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Any AST#identifier#Rig...
static $_invoke(value: Any): string { return new String(value); }
https://gitcode.com/iop123123/arkts-static-skills
19b1de858fd6a78c42e59200c08e43b4493fb2df
gitcode
apap6628114/nga_oh
entry/src/main/ets/common/managers/TopicPaginationManager.ets
arkts
setPrefetchedPage
缓存一页预取主题。 @param page - 页码 @param threads - 该页主题 @param totalPages - 总页数
setPrefetchedPage(page: number, threads: object[], totalPages: number): void { this.setPrefetchedRaw(page, threads, totalPages) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setPrefetchedPage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left page AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left...
setPrefetchedPage(page: number, threads: object[], totalPages: number): void { this.setPrefetchedRaw(page, threads, totalPages) }
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/common/managers/TopicPaginationManager.ets#L83-L85
d7ebb885207acc6a0522ae10fc1e8a86cc8754f8
github
openharmony-tpc/ImageKnife
library/src/main/ets/ImageKnife.ets
arkts
getCurrentCacheNum
gets the number of images currently cached @param cacheType @returns
getCurrentCacheNum(cacheType: CacheStrategy): number | undefined { if (cacheType == undefined || cacheType == CacheStrategy.Default) { cacheType = CacheStrategy.Memory; } if (cacheType == CacheStrategy.Memory) { return (this.memoryCache as MemoryLruCache).size(); } else { if (this.is...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getCurrentCacheNum AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left cacheType AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi...
getCurrentCacheNum(cacheType: CacheStrategy): number | undefined { if (cacheType == undefined || cacheType == CacheStrategy.Default) { cacheType = CacheStrategy.Memory; } if (cacheType == CacheStrategy.Memory) { return (this.memoryCache as MemoryLruCache).size(); } else { if (this.is...
https://gitee.com/openharmony-tpc/ImageKnife.git
64d94153c8aa1dddfbe888c6382c794ddd19e7f6
gitee
openharmony/arkui_advanced_ui_component
customappbar/source/custom_app_bar_forpc.ets
arkts
setCustomCallback
监听来自arkui侧的回调 @param eventName 事件名 @param param 参数
setCustomCallback(eventName: string, param: string) { if (eventName === ARKUI_APP_BAR_COLOR_CONFIGURATION) { this.onColorConfigurationUpdate(this.parseBoolean(param)); } else if (eventName === ARKUI_APP_BAR_CONTENT_SAFE_AREA) { //top left right bottom let splitArray: string[] = param.split('...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setCustomCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left eventName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Righ...
setCustomCallback(eventName: string, param: string) { if (eventName === ARKUI_APP_BAR_COLOR_CONFIGURATION) { this.onColorConfigurationUpdate(this.parseBoolean(param)); } else if (eventName === ARKUI_APP_BAR_CONTENT_SAFE_AREA) { //top left right bottom let splitArray: string[] = param.split('...
https://gitee.com/openharmony/arkui_advanced_ui_component.git
78b9c22ffbd21d75ffdbdb56928fb7c447bfc575
gitee
2763981847/Accounting-app
entry/src/main/ets/common/database/Rdb.ets
arkts
deleteData
删除数据 @param predicates - 删除数据的条件 @param callback - 删除成功后的回调函数
deleteData(predicates: relationalStore.RdbPredicates, callback: Function = () => { }): void { // 如果回调函数未提供,记录警告信息 if (!callback || typeof callback === 'undefined' || callback === undefined) { Logger.info(CommonConstants.RDB_TAG, 'deleteData() has no callback!'); return; } let resFlag: b...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left deleteData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left predicates AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Left relationalSt...
deleteData(predicates: relationalStore.RdbPredicates, callback: Function = () => { }): void { // 如果回调函数未提供,记录警告信息 if (!callback || typeof callback === 'undefined' || callback === undefined) { Logger.info(CommonConstants.RDB_TAG, 'deleteData() has no callback!'); return; } let resFlag: b...
https://github.com/2763981847/Accounting-app
f2d769e67ece65f9226af1f5f7a327afc619717b
github
aimilin6688/KeePassHO
entry/src/main/ets/services/template/TemplateService.ets
arkts
getTemplateIconId
获取模板图标ID
getTemplateIconId(template: ITemplate): number | string { if (isPresetTemplate(template)) { return this.presetStrategy.getTemplateIconId(template); } return this.userStrategy.getTemplateIconId(template); }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getTemplateIconId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left template AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi...
getTemplateIconId(template: ITemplate): number | string { if (isPresetTemplate(template)) { return this.presetStrategy.getTemplateIconId(template); } return this.userStrategy.getTemplateIconId(template); }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/template/TemplateService.ets#L355-L360
2f21ce1fc2f4db3b4de3bcab3dac519182baa597
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/NdsRomCache.ets
arkts
getCacheDir
获取缓存目录路径 使用外部下载目录(与游戏 ROM 读取位置一致),子目录名与安卓保持一致 路径: Download/{bundleName}/extracted_roms/
private getCacheDir(): string | null { const downloadDir = this.downloadDirManager.getDownloadDirPath(); if (!downloadDir) { hilog.warn(DOMAIN, TAG, 'Download directory not initialized, cannot get cache dir'); return null; } return `${downloadDir}/${ROMS_CACHE_DIR}`; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getCacheDir 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 ...
private getCacheDir(): string | null { const downloadDir = this.downloadDirManager.getDownloadDirPath(); if (!downloadDir) { hilog.warn(DOMAIN, TAG, 'Download directory not initialized, cannot get cache dir'); return null; } return `${downloadDir}/${ROMS_CACHE_DIR}`; }
https://github.com/richshaw2015/nds
afaf19a74737045912c47859b56a0a52f83b6363
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LargeFileJSONParser.ets
arkts
parseFromFile
从文件路径解析JSON数组 @param filePath 文件路径 @returns 解析结果
async parseFromFile(filePath: string): Promise<ParseResult<T>> { const startTime = Date.now(); const result: ParseResult<T> = { success: false, objects: [], totalParsed: 0, errors: [], elapsedMs: 0 }; let file: fs.File | null = null; try { // 获取文件大小 ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left parseFromFile AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left filePath AST#identifier#Right AST#type_annotation#Left AST#:#Left...
async parseFromFile(filePath: string): Promise<ParseResult<T>> { const startTime = Date.now(); const result: ParseResult<T> = { success: false, objects: [], totalParsed: 0, errors: [], elapsedMs: 0 }; let file: fs.File | null = null; try { // 获取文件大小 ...
https://github.com/DaLongZhuaZi/manxia
9a3f0bc6f8ae7178ad1464554dabeeda08c52b39
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test28_original_index.ets
arkts
cloneRecord
--- Deep clone manual ---
function cloneRecord(src: Record<string, number>): Record<string, number> { let dst: Record<string, number> = {}; let keys: string[] = Object.keys(src) as string[]; for (let i: number = 0; i < keys.length; i++) { let k: string = keys[i]; dst[k] = src[k]; } return dst; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left cloneRecord AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left src AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right...
function cloneRecord(src: Record<string, number>): Record<string, number> { let dst: Record<string, number> = {}; let keys: string[] = Object.keys(src) as string[]; for (let i: number = 0; i < keys.length; i++) { let k: string = keys[i]; dst[k] = src[k]; } return dst; }
https://github.com/miaochiahao/ark-ghidra
c60c6cf06c27ebca4af8fff8a272354ba0b1bd33
github
LJ666-ui/harmony-health-care
5-skill离线包/星云智联–分布式AI全周期智慧健康管理平台_skills/skills/AIConsultationSkill.ets
arkts
generateFallbackResponse
降级响应(当API调用失败时)
private static generateFallbackResponse(symptomInfo: SymptomInfo): ConsultationResult { const symptomName = this.getSymptomDisplayName(symptomInfo.mainSymptom); return { possibleCauses: [{ cause: `${symptomName}可能由多种原因引起`, probability: 0 }], recommendations: [ '注意休息,保证充足睡眠', '...
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 generateFallbackResponse AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left symptomInfo AST#identifier#...
private static generateFallbackResponse(symptomInfo: SymptomInfo): ConsultationResult { const symptomName = this.getSymptomDisplayName(symptomInfo.mainSymptom); return { possibleCauses: [{ cause: `${symptomName}可能由多种原因引起`, probability: 0 }], recommendations: [ '注意休息,保证充足睡眠', '...
https://github.com/LJ666-ui/harmony-health-care
29be8435994a89517e260e9af7aad93aaad16a8f
github
YDYm233/EasyRandom_HarmonyNextApp
common/SystemUtils/src/main/ets/utils/VibratorManager.ets
arkts
vibrateIncoming
═══════════════════════════════════════════════════════════════ 通知/提醒类快捷法 ═══════════════════════════════════════════════════════════════ 来电振动 — 长振间隔循环,模拟来电提醒
static vibrateIncoming(): void { VibratorManager.logExecution('vibrateIncoming'); VibratorManager.vibratePattern([400, 200, 400, 200, 400], 1, VibrationUsage.RING); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left vibrateIncoming 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...
static vibrateIncoming(): void { VibratorManager.logExecution('vibrateIncoming'); VibratorManager.vibratePattern([400, 200, 400, 200, 400], 1, VibrationUsage.RING); }
https://github.com/YDYm233/EasyRandom_HarmonyNextApp
5d3eeef526a3e8e280a080c43f78df8006dc55a6
github
openharmony/applications_notes
features/src/main/ets/components/FolderListComp.ets
arkts
onCreateConfirm
Folder Create Callback
onCreateConfirm(color: string, name: string) { let folderData = new FolderData(0, name, new Date().getTime() + "", color, FolderType.CusDef, Delete.No, new Date().getTime(), new Date().getTime()) // 新的的笔记本都是自定义类型 type为1 this.AllFolderArray.push(folderData) // insert folder to db RdbStoreUtil.insert(Ta...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onCreateConfirm AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left color AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Ri...
onCreateConfirm(color: string, name: string) { let folderData = new FolderData(0, name, new Date().getTime() + "", color, FolderType.CusDef, Delete.No, new Date().getTime(), new Date().getTime()) // 新的的笔记本都是自定义类型 type为1 this.AllFolderArray.push(folderData) // insert folder to db RdbStoreUtil.insert(Ta...
https://gitee.com/openharmony/applications_notes.git
0208dcea564856089b1c6e4753c8d3aa7e295ede
gitee
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/hosts/app/tabs/classes/meowTabsBunch.ets
arkts
isBusy
GETTERS Gets if any of the tabs are doing a webstate saving or history punching.
get isBusy() { let busy = false; for (const tab of this.tabs) { if (tab.wsBackupReqTmId != undefined || tab.saveHistoryTimeoutId != undefined) { busy = true; break; } } return busy; }
AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left isBusy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST...
get isBusy() { let busy = false; for (const tab of this.tabs) { if (tab.wsBackupReqTmId != undefined || tab.saveHistoryTimeoutId != undefined) { busy = true; break; } } return busy; }
https://github.com/awaLiny2333/LinysBrowser_NEXT
4fdb5278e3ede0237c1c70f5d9fc962eddb30070
github
openharmony/arkui_ace_engine
advanced_ui_component/treeviewv2/source/treeviewv2.ets
arkts
onceNodeAdd
Node add event registration and processing (once). @syscap SystemCapability.ArkUI.ArkUI.Full @since 26
public onceNodeAdd(callback: OnChangedCallback): void { this.nodeAddOnceEvents.push(callback); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left onceNodeAdd AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ...
public onceNodeAdd(callback: OnChangedCallback): void { this.nodeAddOnceEvents.push(callback); }
https://gitcode.com/openharmony/arkui_ace_engine
22836b43dd0fd6f8225ba15712dac34ff504e0d4
gitcode
HarmonyOS_Samples/BestPracticeSnippets
AdaptiveCapabilities/entry/src/main/ets/pages/typicalScene/multiScene/pages/MultiScene.ets
arkts
onPortrait
监听横竖屏
onPortrait(mediaQueryResult: mediaquery.MediaQueryResult) { if (mediaQueryResult.matches) { // 若设备为横屏状态,更改相应的页面布局 this.isVertical = true this.barWidth = 100 this.barHeight = 200 } else { this.isVertical = false this.barWidth = -1 this.barHeight = -1 } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onPortrait AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left mediaQueryResult AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left mediaqu...
onPortrait(mediaQueryResult: mediaquery.MediaQueryResult) { if (mediaQueryResult.matches) { // 若设备为横屏状态,更改相应的页面布局 this.isVertical = true this.barWidth = 100 this.barHeight = 200 } else { this.isVertical = false this.barWidth = -1 this.barHeight = -1 } }
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
54528455b066065a9f731a3d34780b1828df5145
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Debug/CrashRecorderService.ets
arkts
formatDateTime
格式化日期时间
private formatDateTime(timestamp: number): string { const d = new Date(timestamp); const year = d.getFullYear(); const month = (d.getMonth() + 1).toString().padStart(2, '0'); const day = d.getDate().toString().padStart(2, '0'); const hours = d.getHours().toString().padStart(2, '0'); const minu...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left formatDateTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left timestamp AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#nu...
private formatDateTime(timestamp: number): string { const d = new Date(timestamp); const year = d.getFullYear(); const month = (d.getMonth() + 1).toString().padStart(2, '0'); const day = d.getDate().toString().padStart(2, '0'); const hours = d.getHours().toString().padStart(2, '0'); const minu...
https://github.com/DaLongZhuaZi/manxia
71fda9635258bf6515ca172ea097c8aa51bffb21
github
openharmony-tpc/ImageKnife
library/src/main/ets/ImageKnifeDispatcher.ets
arkts
progressCallBack
回调下载进度 @param requestList 请求列表 @param data 进度
private progressCallBack(requestList:List<ImageKnifeRequestWithSource>, data: number) { for (let i = 0; i < requestList.length; i++) { let requestWithSource:ImageKnifeRequestWithSource = requestList[i] if (requestWithSource.request.imageKnifeOption.progressListener !== undefined && requestWithSource.s...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left progressCallBack AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left requestList AST#identifier#Right AST#ERROR#Left AST#:#Left : AST...
private progressCallBack(requestList:List<ImageKnifeRequestWithSource>, data: number) { for (let i = 0; i < requestList.length; i++) { let requestWithSource:ImageKnifeRequestWithSource = requestList[i] if (requestWithSource.request.imageKnifeOption.progressListener !== undefined && requestWithSource.s...
https://gitee.com/openharmony-tpc/ImageKnife.git
05ba6ec49e0a087b9af2f79c302692c59c22dbab
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Components/FontAware.ets
arkts
getEbookFontFamily
获取电子书字体族
public static getEbookFontFamily(): string { return FontAwareHelper.globalState.ebookFontFamily; }
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 getEbookFontFamily AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right ...
public static getEbookFontFamily(): string { return FontAwareHelper.globalState.ebookFontFamily; }
https://github.com/DaLongZhuaZi/manxia
b17fdda48119b9925997a628a4e9e98f8940f405
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/unsigned_right_shift/unsigned_right_shift_long.ets
arkts
main
--- desc: check unsigned right shift operation for long integer ---
function main(): void { const a: long = {{v.left}} const b: int = {{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: long = {{v.left}} const b: int = {{v.right}} assert (a >>> b) == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
c27913fb959e0410b7884328df6b095f73b27e74
gitee
bhengubv/aether-protocol
arkts/src/main/ets/vault/ReedSolomonCodec.ets
arkts
encode
Encodes `dataShards` (K byte arrays of equal length shardSize) into the full set of N shards. Shards 0…K-1 are the data shards unchanged (systematic); shards K…N-1 are the M Reed-Solomon parity shards. The returned shards are fresh copies — callers keep ownership of the input.
encode(dataShards: Uint8Array[]): Uint8Array[] { if (dataShards.length !== this.k) { throw new Error('vault: wrong number of data shards'); } const shardSize: number = dataShards[0].length; for (let j = 0; j < this.k; j++) { if (dataShards[j].length !== shardSize) { throw new Erro...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left encode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dataShards AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Lef...
encode(dataShards: Uint8Array[]): Uint8Array[] { if (dataShards.length !== this.k) { throw new Error('vault: wrong number of data shards'); } const shardSize: number = dataShards[0].length; for (let j = 0; j < this.k; j++) { if (dataShards[j].length !== shardSize) { throw new Erro...
https://github.com/bhengubv/aether-protocol
ec21015491a64fedc602793a51f9ce8d9d5ec061
github
offlinecat-dev/OCNetORM
src/main/ets/database/DatabaseManager.ets
arkts
close
关闭数据库连接 @returns Promise<void>
async close(): Promise<void> { // 停止健康检查 this.stopHealthCheck() const currentPool = this.storePool if (currentPool !== null) { try { await currentPool.close() } catch (e) { const errorMessage = e instanceof Error ? e.message : String(e) this.getLogger().logError(`关...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left close AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_type#L...
async close(): Promise<void> { // 停止健康检查 this.stopHealthCheck() const currentPool = this.storePool if (currentPool !== null) { try { await currentPool.close() } catch (e) { const errorMessage = e instanceof Error ? e.message : String(e) this.getLogger().logError(`关...
https://github.com/offlinecat-dev/OCNetORM
3d5769cb84dc45d304dfa096c42c63a12e9ab173
github
LongLiveY96/chatcube
entry/src/main/ets/services/DatabaseService.ets
arkts
getAttachments
获取消息的附件
private async getAttachments(messageId: string): Promise<MessageAttachment[]> { if (this.rdbStore === null) { return [] } const attachments: MessageAttachment[] = [] const predicates = new relationalStore.RdbPredicates(TableNames.ATTACHMENTS) predicates.equalTo('message_id', messageId) t...
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 getAttachments AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left messageId AST#identifier#Right AST#ERROR#Left AST#:#L...
private async getAttachments(messageId: string): Promise<MessageAttachment[]> { if (this.rdbStore === null) { return [] } const attachments: MessageAttachment[] = [] const predicates = new relationalStore.RdbPredicates(TableNames.ATTACHMENTS) predicates.equalTo('message_id', messageId) t...
https://github.com/LongLiveY96/chatcube
b6d05ebc4e1f5a0ba6d33d7c2a0c37a3769d74bb
github
codelably/tuniao-ui
packages/main/src/main/ets/MainModule.ets
arkts
registerRoutes
注册路由 @param registry 路由注册器
registerRoutes(registry: RouteRegistry): void { // 注册首页路由 registry.register(MainRoutes.Main, MainNavWrapper); // 注册主题颜色页面路由 registry.register(MainRoutes.ThemeColor, ThemeColorNavWrapper); // 注册内置颜色页面路由 registry.register(MainRoutes.BuiltInColor, BuiltInColorNavWrapper); // 注册渐变背景页面路由 re...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left registerRoutes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left registry AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left RouteRegistry AST#identifier#Right AS...
registerRoutes(registry: RouteRegistry): void { // 注册首页路由 registry.register(MainRoutes.Main, MainNavWrapper); // 注册主题颜色页面路由 registry.register(MainRoutes.ThemeColor, ThemeColorNavWrapper); // 注册内置颜色页面路由 registry.register(MainRoutes.BuiltInColor, BuiltInColorNavWrapper); // 注册渐变背景页面路由 re...
https://github.com/codelably/tuniao-ui
4f29b46a703cdbe3b7431203019c577d96a1f452
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/CloudSyncRecordDAO.ets
arkts
getStatistics
统计同步记录
static async getStatistics(userId: number): Promise<SyncStatisticsResult> { const store: relationalStore.RdbStore = DatabaseManager.getDatabase(); const sql: string = `SELECT COUNT(*) as total, SUM(CASE WHEN status = 'completed' THEN 1 ELSE 0 END) as completed, ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left getStatistics AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : A...
static async getStatistics(userId: number): Promise<SyncStatisticsResult> { const store: relationalStore.RdbStore = DatabaseManager.getDatabase(); const sql: string = `SELECT COUNT(*) as total, SUM(CASE WHEN status = 'completed' THEN 1 ELSE 0 END) as completed, ...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
e84b5add73e7d269a1193b9eda66869d200616ae
github
tdcare/tdwebrtc
src/main/ets/SignalingClient.ets
arkts
processMessage
---- 消息处理 ----
private processMessage(text: string): void { let envelope: SignalingEnvelope | null = null; try { envelope = JSON.parse(text) as SignalingEnvelope; } catch (e) { LogUtil.warn(`${TAG} JSON 解析失败: ${text}`); return; } if (envelope === null) return; const isEcho = envelope.is_ec...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left processMessage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
private processMessage(text: string): void { let envelope: SignalingEnvelope | null = null; try { envelope = JSON.parse(text) as SignalingEnvelope; } catch (e) { LogUtil.warn(`${TAG} JSON 解析失败: ${text}`); return; } if (envelope === null) return; const isEcho = envelope.is_ec...
https://github.com/tdcare/tdwebrtc
bb2d2a6050ad26841ba0c5ed624266941802dd78
github
arkui-x/samples
CodeLab/Cases/feature/h5cache/src/main/ets/diskLruCache/DiskLruCache.ets
arkts
get
获取key缓存数据 @param key 键值
get(key: string): ArrayBuffer | null { let path = this.path + '/' + key; if (FileUtils.exist(path)) { let content: ArrayBuffer = FileUtils.readFile(path); // 重新设置key,更新key的设置时间 this.putCacheMap(key, content.byteLength); return content; } else { return null; } }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left get AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#...
get(key: string): ArrayBuffer | null { let path = this.path + '/' + key; if (FileUtils.exist(path)) { let content: ArrayBuffer = FileUtils.readFile(path); // 重新设置key,更新key的设置时间 this.putCacheMap(key, content.byteLength); return content; } else { return null; } }
https://gitcode.com/arkui-x/samples
c09daa7acd99d49c2bf8ab288628bbc84d23bf78
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/AppInitializationManager.ets
arkts
beginPhase
开始某个阶段
beginPhase(phase: InitPhase): void { const phaseInfo = PHASE_CONFIG[phase]; this.state.currentPhase = phase; this.state.progress = phaseInfo.progress; this.state.displayText = phaseInfo.displayName + '...'; logger.info(TAG, `📍 开始阶段: ${phaseInfo.displayName} (${phaseInfo.progress}%)`); ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left beginPhase AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left phase AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left InitPhase AST#identifier#Right AST#)#Left ) ...
beginPhase(phase: InitPhase): void { const phaseInfo = PHASE_CONFIG[phase]; this.state.currentPhase = phase; this.state.progress = phaseInfo.progress; this.state.displayText = phaseInfo.displayName + '...'; logger.info(TAG, `📍 开始阶段: ${phaseInfo.displayName} (${phaseInfo.progress}%)`); ...
https://github.com/DaLongZhuaZi/manxia
b78f443d3d9f823c8c511769632f654134e5d376
github
Your-USTC/DailyNic_HMOS
entry/src/main/ets/utils/Classes/ScheduleManager.ets
arkts
renameSemester
重命名指定编号的学期 @param id 要重命名的学期编号 @param newName 学期的新名称 @returns 无异常时返回undefined,发生异常时返回异常信息的JSON字符串
renameSemester(id: number, newName: string): string | undefined { try { this.semesters[id].name = newName; UnifyPreferences.putSync('SemestersData', JSON.stringify(this.semesters)); return; } catch(err) { return JSON.stringify(err); } }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left renameSemester AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left n...
renameSemester(id: number, newName: string): string | undefined { try { this.semesters[id].name = newName; UnifyPreferences.putSync('SemestersData', JSON.stringify(this.semesters)); return; } catch(err) { return JSON.stringify(err); } }
https://github.com/Your-USTC/DailyNic_HMOS
79a9174bed544046a53be13fcf47fe9c17312790
github
Joker-x-dev/CoolMallArkTS
core/data/src/main/ets/repository/PageRepository.ets
arkts
getGoodsDetail
获取商品详情 @param goodsId 商品ID @returns 商品详情
async getGoodsDetail(goodsId: number): Promise<NetworkResponse<GoodsDetail>> { return this.networkDataSource.getGoodsDetail(goodsId); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getGoodsDetail AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left goodsId AST#identifier#Right AST#type_annotation#Left AST#:#Left...
async getGoodsDetail(goodsId: number): Promise<NetworkResponse<GoodsDetail>> { return this.networkDataSource.getGoodsDetail(goodsId); }
https://github.com/Joker-x-dev/CoolMallArkTS
2715b5d71c4d02ff77bef24d336c2fae977e6c74
github
erosTeam/NextE
feature/search/src/main/ets/viewmodel/SearchViewModel.ets
arkts
fetchPage
Fetch one page in the active scope: favorites.php (favorite scope) or the gallery list (normal). Both return GalleryList (.gallerys + .nextGid), so all the dataSource/paging plumbing is shared.
private fetchPage(next: string): Promise<GalleryList> { return this.effectiveFavoriteScope() ? EhApiService.getInstance().getFavoritesList(this.buildFavQuery(next)) : EhApiService.getInstance().getGalleryList(this.buildQuery(next)) }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left fetchPage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left next AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left str...
private fetchPage(next: string): Promise<GalleryList> { return this.effectiveFavoriteScope() ? EhApiService.getInstance().getFavoritesList(this.buildFavQuery(next)) : EhApiService.getInstance().getGalleryList(this.buildQuery(next)) }
https://github.com/erosTeam/NextE
bc7dc7abc6f7985aec40f327e4b75c29081ee29e
github
openharmony-sig/commons-cli
library/src/main/ets/components/cli/HelpFormatter.ets
arkts
getNewLine
Gets the 'newLine'. @return the 'newLine'
public getNewLine(): string { console.log(""); return this.defaultNewLine; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getNewLine 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#stri...
public getNewLine(): string { console.log(""); return this.defaultNewLine; }
https://gitee.com/openharmony-sig/commons-cli.git
0d60501eec9e462e57eef654b135ad42908f121d
gitee
the-wwyang/kids-learning-app
src/main/ets/services/LearningService.ets
arkts
getModuleProgress
获取模块学习进度
public async getModuleProgress(moduleName: string): Promise<LearningProgress | null> { return await appStorage.getLearningProgress(moduleName); }
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 getModuleProgress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left moduleName AST#identifier#Right AST#ERROR#Left AST#:#...
public async getModuleProgress(moduleName: string): Promise<LearningProgress | null> { return await appStorage.getLearningProgress(moduleName); }
https://github.com/the-wwyang/kids-learning-app
87fb0090a6959e4891154e50af71fa1738970fa4
github
revalue-o/HarmonyOS-Next-Hook-demo
source_codes/ArkTS-inject/entry/src/main/ets/utils/NativeLocationUtil.ets
arkts
getCurrentLocation
获取当前位置(Native 层异步调用) 通过 Promise 返回位置数据
static async getCurrentLocation(): Promise<NativeLocationResult | null> { try { hilog.info(DOMAIN, 'NativeLocationUtil', 'Getting current location via native API...'); const data: NativeLocationData = await nativeGetCurrentLocation(); if (data) { hilog.info(DOMAIN, 'NativeLocationUtil'...
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 getCurrentLocation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A...
static async getCurrentLocation(): Promise<NativeLocationResult | null> { try { hilog.info(DOMAIN, 'NativeLocationUtil', 'Getting current location via native API...'); const data: NativeLocationData = await nativeGetCurrentLocation(); if (data) { hilog.info(DOMAIN, 'NativeLocationUtil'...
https://github.com/revalue-o/HarmonyOS-Next-Hook-demo
2d59d8c5d3b7693a37ad2e7236e9e6901e3f9596
github
XHXYT/Pixark
entry/src/main/ets/viewmodel/DownloadsViewModel.ets
arkts
batchRemoveSelectedTasks
多选后批量删除
async batchRemoveSelectedTasks() { if (this.selectedIds.size === 0) return; // 获取待删除 ID const idsToDelete = Array.from(this.selectedIds); // 调用底层删除 await this.batchDeleteTasksByIds(idsToDelete); // 清空勾选、退出编辑模式 this.toggleEditMode(); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left batchRemoveSelectedTasks AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#ERROR#Right AST#statement_block#Left AST#{#Le...
async batchRemoveSelectedTasks() { if (this.selectedIds.size === 0) return; // 获取待删除 ID const idsToDelete = Array.from(this.selectedIds); // 调用底层删除 await this.batchDeleteTasksByIds(idsToDelete); // 清空勾选、退出编辑模式 this.toggleEditMode(); }
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/viewmodel/DownloadsViewModel.ets#L129-L137
d101529ece97dfac560d965b2d262ade9d112be4
github
RedRackham-R/WanAndroidHarmoney
entry/src/main/ets/ui/pages/main/MainPage.ets
arkts
aboutToAppear
配置沉浸式状态栏 当前API9无法使用 // 获取UIAbility上下文 context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext async setSystemBar() { // 获取当前应用窗口 let windowClass: window.Window = await window.getLastWindow(this.context) // 将状态栏和导航栏的背景色设置为跟应用窗口相同的颜色 await windowClass.setWindowSystemBarProperties({ navigationBarCol...
aboutToAppear() { globalVM_Setting.subscribeThemeChangeEvent(this.TAG, (event) => { const realEvent = event.data as ThemeChangeEvent this.theme = globalVM_Setting.getTheme() }) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left...
aboutToAppear() { globalVM_Setting.subscribeThemeChangeEvent(this.TAG, (event) => { const realEvent = event.data as ThemeChangeEvent this.theme = globalVM_Setting.getTheme() }) }
https://github.com/RedRackham-R/WanAndroidHarmoney
0b45447fc70dd84e31d4592330be1c3ead1c5363
github
Kira-Yagami-Light/Kira-Projects
TodoTask/entry/src/main/ets/data/database/TaskDao.ets
arkts
queryByName
根据任务名模糊查询 @param taskName 任务名(支持模糊匹配) @returns Promise<Array<Record<string, any>>> 任务记录数组
async queryByName(taskName: string): Promise<Array<Record<string, number | string | boolean>>> { const store = this.dbHelper.getRdbStore(); if (!store) { Logger.error(this.LOG_TAG, 'RdbStore is null'); return []; } try { const predicates = new relationalStore.RdbPredicates(this.tabl...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left queryByName AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left taskName AST#identifier#Right AST#type_annotation#Left AST#:#Left :...
async queryByName(taskName: string): Promise<Array<Record<string, number | string | boolean>>> { const store = this.dbHelper.getRdbStore(); if (!store) { Logger.error(this.LOG_TAG, 'RdbStore is null'); return []; } try { const predicates = new relationalStore.RdbPredicates(this.tabl...
https://github.com/Kira-Yagami-Light/Kira-Projects
0521a5b9b95a9bc7ab0a041dbf6ff2daa6d82941
github
Your-USTC/DailyNic_HMOS
entry/src/main/ets/utils/Classes/ScheduleManager.ets
arkts
coverExistSemester
覆盖或合并指定学期的课程数据。会保留原有的颜色和优先级 @param id 学期索引 @param newSchedule 新课程列表 @param insertMode 0:覆盖,1:覆盖出现过的同名课程,2:追加 @returns undefined,但如果发生错误则返回错误信息的字符串
coverExistSemester(id: number, newSchedule: classAttribute[], insertMode: COVER_MODE, fillAll: boolean = false): string | undefined { try { const originSchedule: classAttribute[] = JSON.parse(UnifyPreferences.getSync('SemesterDataAt' + String(this.semesters[id].createTime), '[]')); if (fillAll) { ...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left coverExistSemester AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le...
coverExistSemester(id: number, newSchedule: classAttribute[], insertMode: COVER_MODE, fillAll: boolean = false): string | undefined { try { const originSchedule: classAttribute[] = JSON.parse(UnifyPreferences.getSync('SemesterDataAt' + String(this.semesters[id].createTime), '[]')); if (fillAll) { ...
https://github.com/Your-USTC/DailyNic_HMOS
a7022bc5dce821e2286c9e7cf2fd9c6dae8139b0
github
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/components/parts/Downloads/Panel.ets
arkts
humanWordState
Human-readable descriptions for download state. @param state The webview.WebDownloadState. @returns The ResourceStr of description.
humanWordState(state: webview.WebDownloadState) { switch (state) { case webview.WebDownloadState.IN_PROGRESS: return $r('app.string.Downloads_state_in_progress'); case webview.WebDownloadState.COMPLETED: return $r('app.string.Downloads_state_completed'); case webview.WebDownloadS...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left humanWordState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left state AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Lef...
humanWordState(state: webview.WebDownloadState) { switch (state) { case webview.WebDownloadState.IN_PROGRESS: return $r('app.string.Downloads_state_in_progress'); case webview.WebDownloadState.COMPLETED: return $r('app.string.Downloads_state_completed'); case webview.WebDownloadS...
https://github.com/awaLiny2333/LinysBrowser_NEXT
8f6e188301ce3468b0d72c109156098af5dc184a
github
CPF-ApplicationTPC/openharmony_tpc_samples
bc_ohos/library/src/main/ets/ISO9797Alg3Mac.ets
arkts
updateByte
更新 MAC(单字节) @param input 输入字节
updateByte(input: number): void { if (this.bufOff === this.buf.length) { this.processBlock(); this.bufOff = 0; } this.buf[this.bufOff++] = input & 0xFF; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateByte AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left input AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) AST...
updateByte(input: number): void { if (this.bufOff === this.buf.length) { this.processBlock(); this.bufOff = 0; } this.buf[this.bufOff++] = input & 0xFF; }
https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples
97c4c95d8d17d292544aafda4bbe541c442706fa
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Theme/AppColors.ets
arkts
tertiary
==================== 第三色系 ====================
static get tertiary(): string { return getColorForCurrentTheme(ColorRole.TERTIARY); }
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 tertiary 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 tertiary(): string { return getColorForCurrentTheme(ColorRole.TERTIARY); }
https://github.com/DaLongZhuaZi/manxia
9e921a39d2f568842bedb0fedd5543e0a09a9537
github
Joker-x-dev/CoolMallArkTS
core/network/src/main/ets/datasource/address/AddressNetworkDataSourceImpl.ets
arkts
updateAddress
更新地址 @param {Address} params - 地址信息 @returns {Promise<NetworkResponse<void>>} 更新结果
async updateAddress(params: Address): Promise<NetworkResponse<void>> { const resp: AxiosResponse<NetworkResponse<void>> = await NetworkClient.http.post("user/address/update", params); return resp.data; }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left updateAddress AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left params AST#identifier#Right AST#type_annotation#Left AST#:#Left :...
async updateAddress(params: Address): Promise<NetworkResponse<void>> { const resp: AxiosResponse<NetworkResponse<void>> = await NetworkClient.http.post("user/address/update", params); return resp.data; }
https://github.com/Joker-x-dev/CoolMallArkTS
2af67db94b56e996e2c8fe3290f81040c90c6d5c
github
HarmonyOS_Samples/BestPracticeSnippets
HDRVivid/ProcessingInterfaceTest/entry/src/main/ets/utils/AVPlayerDemo.ets
arkts
avPlayerFdSrcDemo
以下demo为使用资源管理接口获取打包在HAP内的媒体资源文件并通过fdSrc属性进行播放示例
async avPlayerFdSrcDemo() { // 创建avPlayer实例对象 // this.avPlayer = await media.createAVPlayer(); await media.createAVPlayer() .then((data: media.AVPlayer) => { this.avPlayer = data; // 创建状态机变化回调函数 this.setAVPlayerCallback(data, this.callback); }) .catch((err: Busine...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left avPlayerFdSrcDemo AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AS...
async avPlayerFdSrcDemo() { // 创建avPlayer实例对象 // this.avPlayer = await media.createAVPlayer(); await media.createAVPlayer() .then((data: media.AVPlayer) => { this.avPlayer = data; // 创建状态机变化回调函数 this.setAVPlayerCallback(data, this.callback); }) .catch((err: Busine...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
4bd5a9cc57d31cfb0b79cf0eeac74766d72b3ed0
gitcode
LongLiveY96/chatcube
entry/src/main/ets/services/DatabaseService.ets
arkts
getProviderApiKey
获取单个服务商的 API Key
async getProviderApiKey(providerId: string): Promise<string> { await this.waitForInitialization() if (this.rdbStore === null) { return '' } const predicates = new relationalStore.RdbPredicates(TableNames.PROVIDERS) predicates.equalTo('id', providerId) try { const resultSet = await ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getProviderApiKey AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left providerId AST#identifier#Right AST#type_annotation#Left AST#...
async getProviderApiKey(providerId: string): Promise<string> { await this.waitForInitialization() if (this.rdbStore === null) { return '' } const predicates = new relationalStore.RdbPredicates(TableNames.PROVIDERS) predicates.equalTo('id', providerId) try { const resultSet = await ...
https://github.com/LongLiveY96/chatcube
6fcf3583d7d4e342aa3aca9574d4dd84cff0d3ef
github
openharmony/codelabs
Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets
arkts
onMirrorChange
Rotate and flip.
onMirrorChange(): void { Logger.debug(TAG, 'onMirrorChange'); if (this.isWaitingRefresh) { this.clearDelayRefresh(); this.cropShow.enlargeCropArea(); } else { if (MathUtils.isOddRotation(this.rotationAngle)) { this.isFlipVertically = !this.isFlipVertically; } else { ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onMirrorChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_blo...
onMirrorChange(): void { Logger.debug(TAG, 'onMirrorChange'); if (this.isWaitingRefresh) { this.clearDelayRefresh(); this.cropShow.enlargeCropArea(); } else { if (MathUtils.isOddRotation(this.rotationAngle)) { this.isFlipVertically = !this.isFlipVertically; } else { ...
https://gitee.com/openharmony/codelabs.git
f5bfc0f81fe14315457d61434719743b06491ba0
gitee
openharmony-sig/FastBle
library/src/main/ets/bluetooth/BleConnector.ets
arkts
writeCharacteristic
write
public writeCharacteristic(data: Uint8Array, bleWriteCallback: BleWriteCallback, uuid_write: string): void { if (data == null || data.length <= 0) { if (bleWriteCallback != null) { bleWriteCallback.onWriteFailure(new OtherException("the data to be written is empty")); } return; } ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left writeCharacteristic AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
public writeCharacteristic(data: Uint8Array, bleWriteCallback: BleWriteCallback, uuid_write: string): void { if (data == null || data.length <= 0) { if (bleWriteCallback != null) { bleWriteCallback.onWriteFailure(new OtherException("the data to be written is empty")); } return; } ...
https://gitee.com/openharmony-sig/FastBle.git
b0421ce20ed8539d7702a4a88b0a30802da5fc50
gitee
openharmony/applications_app_samples
code/BasicFeature/Connectivity/MultipleFilesDownload/casesfeature/multiplefilesdownload/src/main/ets/view/MultipleFilesDownload.ets
arkts
loadInitializationDataSource
读取historyDownloadResourceData.json中的数据源
loadInitializationDataSource() { const context: Context = getContext(this); // 读取historyDownloadResourceData.json中的数据 let jsonData: Uint8Array = context.resourceManager.getRawFileContentSync('historyDownloadResourceData.json'); // 将数据解码,转成字符串 let stringData: string = util.TextDecoder.create('utf-8...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left loadInitializationDataSource 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#state...
loadInitializationDataSource() { const context: Context = getContext(this); // 读取historyDownloadResourceData.json中的数据 let jsonData: Uint8Array = context.resourceManager.getRawFileContentSync('historyDownloadResourceData.json'); // 将数据解码,转成字符串 let stringData: string = util.TextDecoder.create('utf-8...
https://github.com/openharmony/applications_app_samples
01d7f84bf71a7569bf1031b73fff50546d434f5e
github
IoTAccessControl/ArkTSAnalysis
TestApps1/9.PaymentKit_CodelabDemo/entry/src/main/ets/pages/Index.ets
arkts
showFailureDialog
显示支付失败对话框
showFailureDialog(errorMsg: string) { this.dialogTitle = '支付结果'; this.dialogMessage = `支付失败: ${errorMsg}`; this.showDialog = true; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left showFailureDialog AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left errorMsg AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right...
showFailureDialog(errorMsg: string) { this.dialogTitle = '支付结果'; this.dialogMessage = `支付失败: ${errorMsg}`; this.showDialog = true; }
https://github.com/IoTAccessControl/ArkTSAnalysis
d892b3e41a5d2878b22936505188b261877594dc
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/UndefinableStringArray.ets
arkts
toArray
Gets the underlying array @returns { String[] } The underlying array containing all non-undefined elements @syscap SystemCapability.Utils.Lang
public toArray(): String[] { let newData = new (String)[this.curSize]("") for (let i = 0; i < this.curSize; ++i) { if (this.data[i] == null) { continue; } newData[i] = this.data[i]! } return newDa...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toArray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_sta...
public toArray(): String[] { let newData = new (String)[this.curSize]("") for (let i = 0; i < this.curSize; ++i) { if (this.data[i] == null) { continue; } newData[i] = this.data[i]! } return newDa...
https://gitcode.com/iop123123/arkts-static-skills
726c995eb2f3de8d11a9a99b5e6825548c147a8a
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Scraper/AniListScraper.ets
arkts
convertToMetadata
将AniList媒体转换为统一元数据格式
private convertToMetadata(media: AniListMedia): ScrapedMetadata { // 提取作者和画师 const authors: string[] = []; const artists: string[] = []; if (media.staff?.edges) { for (const edge of media.staff.edges as AniListStaffEdge[]) { const name = edge.node?.name?.full || edge.node?.name?.nat...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left convertToMetadata AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left media AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier...
private convertToMetadata(media: AniListMedia): ScrapedMetadata { // 提取作者和画师 const authors: string[] = []; const artists: string[] = []; if (media.staff?.edges) { for (const edge of media.staff.edges as AniListStaffEdge[]) { const name = edge.node?.name?.full || edge.node?.name?.nat...
https://github.com/DaLongZhuaZi/manxia
e3adf66e017818dca2e8ac31bd391f068a8aee6b
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
reduceRight
Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. @param { function } callbackfn - A function that accepts four arguments. The reduceR...
public reduceRight<U = number>( callbackfn: (previousValue: U, currentValue: number, currentIndex: int, array: Uint8ClampedArray) => U, initialValue: U): U { let accumulatedValue = initialValue for (let i = this.lengthInt - 1; i >= 0; i--) { accumulatedVal...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#ERROR#Right AST#expression_statement#Left AST#binary_expression#Left AST#identifier#Left reduceRight AST#identifier#Right AST#<#Left < AST#<#Right AST#assignment_expression#Left AST#identifier#Left U AST#identifier#Right AST#=#Left = AST#=#Righ...
public reduceRight<U = number>( callbackfn: (previousValue: U, currentValue: number, currentIndex: int, array: Uint8ClampedArray) => U, initialValue: U): U { let accumulatedValue = initialValue for (let i = this.lengthInt - 1; i >= 0; i--) { accumulatedVal...
https://gitcode.com/iop123123/arkts-static-skills
7a49379a05d6f8c9fff0e411e2e30e90c204aeea
gitcode
huaweicloud/huaweicloud-iot-device-sdk-arkts
huaweicloud_iot_device_library/src/main/ets/client/DeviceClient.ets
arkts
rawDeviceMessageListener
设置消息监听器,用于接收平台下发的消息 此监听器只能接收平台到直连设备的请求,子设备的请求由AbstractGateway处理 @param rawDeviceMessageListener 消息监听器
public set rawDeviceMessageListener(value: RawDeviceMessageListener | null) { this._rawDeviceMessageListener = value; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left set AST#identifier#Right AST#call_expression#Left AST#identifier#Left rawDeviceMessageListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#...
public set rawDeviceMessageListener(value: RawDeviceMessageListener | null) { this._rawDeviceMessageListener = value; }
https://github.com/huaweicloud/huaweicloud-iot-device-sdk-arkts
bcf8781847bb19322dcee756c7eb88b48870a0fc
github
openharmony/applications_permission_manager
permissionmanager/src/main/ets/common/base/BasePermissionStrategy.ets
arkts
isPermissionPendingGrant
判断当前权限是否为申请权限 @param permission 权限 @param callerAppInfo 调用方信息 return
public isPermissionPendingGrant(permission: Permission, callerAppInfo: CallerAppInfo): boolean { let isPendingPermission: boolean = false; if (callerAppInfo.reqPerms.includes(permission)) { isPendingPermission = true; } return isPendingPermission; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isPermissionPendingGrant AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left permission AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#i...
public isPermissionPendingGrant(permission: Permission, callerAppInfo: CallerAppInfo): boolean { let isPendingPermission: boolean = false; if (callerAppInfo.reqPerms.includes(permission)) { isPendingPermission = true; } return isPendingPermission; }
https://gitee.com/openharmony/applications_permission_manager.git
fbccdef662ec638049f38d32adc81efcb2c65379
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/AsyncLinkedConcurrentQueue.ets
arkts
resumePopQueue
Wakes one coroutine waiting to remove an element from the queue. Performs the notification while holding the pop-side mutex. @returns { void } No return value. @syscap SystemCapability.Utils.Lang @FaAndStageModel
private resumePopQueue(): void { ConcurrencyHelpers.mutexLock(this.popMutex); this.popCondVar.notifyOne(); ConcurrencyHelpers.mutexUnlock(this.popMutex); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left resumePopQueue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expr...
private resumePopQueue(): void { ConcurrencyHelpers.mutexLock(this.popMutex); this.popCondVar.notifyOne(); ConcurrencyHelpers.mutexUnlock(this.popMutex); }
https://gitcode.com/iop123123/arkts-static-skills
f41efaa9961b5c79df1174148ca2f70644da699c
gitcode
HarmonyCandies/image_cropper
image_cropper/src/main/ets/model/Geometry.ets
arkts
only
静态方法:指定方向的边距
public static only(left: number = 0, top: number = 0, right: number = 0, bottom: number = 0): EdgeInsets { return new EdgeInsets(left, top, right, bottom); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left only AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left left AST#id...
public static only(left: number = 0, top: number = 0, right: number = 0, bottom: number = 0): EdgeInsets { return new EdgeInsets(left, top, right, bottom); }
https://github.com/HarmonyCandies/image_cropper/blob/dd3664946b413166307b736a5763f998084364e1/image_cropper/src/main/ets/model/Geometry.ets#L531-L533
87a02f37f52fe275fe7385a8b4e7e0658a733b53
github
CLMC2025/Vignette
entry/src/main/ets/sync/DataSyncManager.ets
arkts
importIncremental
增量导入数据(合并策略:按数据类型智能处理)
async importIncremental(jsonData: string): Promise<SyncResult> { try { const importResult = this.exportImport.importFromJSON(jsonData, this.versionControl); const data: ExportData = importResult.data; const result: SyncResult = importResult.result; if (result.hasErrors()) { this.s...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left importIncremental AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left jsonData AST#identifier#Right AST#type_annotation#Left AST#:#...
async importIncremental(jsonData: string): Promise<SyncResult> { try { const importResult = this.exportImport.importFromJSON(jsonData, this.versionControl); const data: ExportData = importResult.data; const result: SyncResult = importResult.result; if (result.hasErrors()) { this.s...
https://github.com/CLMC2025/Vignette
c74fabdc42b85bf2fda4edbcaba084e853df81c6
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test26_original_index.ets
arkts
testTypedArrays
=== Round 26: ArrayBuffer TypedArrays (Int32Array, Float64Array), Uint8Array buffer manipulation, TypedArray.slice/set/subarray, Array.from with mapping, Map constructor from entries, Set constructor from array, Object.freeze emulation, String.fromCharCode chain, Number.EPSILON comparison === --- Int32Array and Float64...
function testTypedArrays(): string { let i32: Int32Array = new Int32Array(4); i32[0] = 10; i32[1] = 20; i32[2] = 30; i32[3] = 40; let sum: number = i32[0] + i32[1] + i32[2] + i32[3]; return String(sum); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testTypedArrays 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_...
function testTypedArrays(): string { let i32: Int32Array = new Int32Array(4); i32[0] = 10; i32[1] = 20; i32[2] = 30; i32[3] = 40; let sum: number = i32[0] + i32[1] + i32[2] + i32[3]; return String(sum); }
https://github.com/miaochiahao/ark-ghidra
f9d9dc1d85d21e2a3e2beeec92c1ca3a525fdbdf
github
openharmony-sig/applications_calculator
feature/calculation/src/main/ets/calculator/Evaluator.ets
arkts
getPreference
get share prefernce
async getPreference(): Promise<void> { if (this.sharePreference !== null) { return; } try { this.sharePreference = await dataPreferences.getPreferences(this.context, SHARE_MEMORY); } catch (err) { LogUtil.error(TAG, 'getPreference Failed to get preferences', err?.message); } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getPreference AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left A...
async getPreference(): Promise<void> { if (this.sharePreference !== null) { return; } try { this.sharePreference = await dataPreferences.getPreferences(this.context, SHARE_MEMORY); } catch (err) { LogUtil.error(TAG, 'getPreference Failed to get preferences', err?.message); } }
https://gitee.com/openharmony-sig/applications_calculator.git
b42c72621a35f09a1e1afc664ef9419eb0ffa1ee
gitee
Goway-Hui/harmonyos-next-dev
harmonyos-next-dev/assets/database-crud-template.ets
arkts
parseResultSet
==================== TOOLS ====================
private parseResultSet<T>(resultSet: relationalStore.ResultSet): T[] { let results: T[] = []; while (resultSet.goToNextRow()) { let row: Record<string, object | number | string | boolean> = {}; for (let i = 0; i < resultSet.columnCount; i++) { let colName = resultSet.getColumnName(i); ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#ERROR#Right AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#identifier#Left parseResultSet AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression...
private parseResultSet<T>(resultSet: relationalStore.ResultSet): T[] { let results: T[] = []; while (resultSet.goToNextRow()) { let row: Record<string, object | number | string | boolean> = {}; for (let i = 0; i < resultSet.columnCount; i++) { let colName = resultSet.getColumnName(i); ...
https://github.com/Goway-Hui/harmonyos-next-dev
13ea55931a42977ba002cfa5360d0d53a993e033
github
LambdaYH/ScrcpyForHarmonyOS
app/src/main/ets/client/tools/ControlPacket.ets
arkts
createRotateDevice
============ TYPE_ROTATE_DEVICE (11) ============ 格式: type(1) = 1 byte
static createRotateDevice(): ArrayBuffer { const buf = new ArrayBuffer(1); const view = new DataView(buf); view.setUint8(0, ControlMessageType.TYPE_ROTATE_DEVICE); return buf; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createRotateDevice 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 Arr...
static createRotateDevice(): ArrayBuffer { const buf = new ArrayBuffer(1); const view = new DataView(buf); view.setUint8(0, ControlMessageType.TYPE_ROTATE_DEVICE); return buf; }
https://github.com/LambdaYH/ScrcpyForHarmonyOS
008eae47c916fda3c3729d9545a5ab8b1c64cfe1
github
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/hosts/system/windows/classes/meowUiHost.ets
arkts
setOrientation
Sets the display orientation of the window.
async setOrientation(orientation: window.Orientation) { return this.windowObj?.setPreferredOrientation(orientation) .then((data) => { meow(`this.windowObj?.setPreferredOrientation(orientation) Set ${orientation}, Returned: ${JSON.stringify(data)}`, `meowUiHost][${this.windowId}][setOrientation`); ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left setOrientation AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left orientation AST#identifier#Right AST#type_annotation#Left AST#:#...
async setOrientation(orientation: window.Orientation) { return this.windowObj?.setPreferredOrientation(orientation) .then((data) => { meow(`this.windowObj?.setPreferredOrientation(orientation) Set ${orientation}, Returned: ${JSON.stringify(data)}`, `meowUiHost][${this.windowId}][setOrientation`); ...
https://github.com/awaLiny2333/LinysBrowser_NEXT
753598b2d1528682714d50a8d33583eb85361a6b
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/SharedLedgerDAO.ets
arkts
mapRowToLedger
映射数据库行到SharedLedger对象
private static mapRowToLedger(resultSet: relationalStore.ResultSet): SharedLedger { return new SharedLedger( DAOHelper.getLong(resultSet, 'ledger_id'), DAOHelper.getString(resultSet, 'name'), DAOHelper.getString(resultSet, 'description'), DAOHelper.getString(resultSet, 'type'), DAOHe...
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 mapRowToLedger AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resultSet AST#identifier#Right AST#:#...
private static mapRowToLedger(resultSet: relationalStore.ResultSet): SharedLedger { return new SharedLedger( DAOHelper.getLong(resultSet, 'ledger_id'), DAOHelper.getString(resultSet, 'name'), DAOHelper.getString(resultSet, 'description'), DAOHelper.getString(resultSet, 'type'), DAOHe...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
b8b6f54528b523eaa1ec542ac67479b1545209cf
github
LongLiveY96/chatcube
entry/src/main/ets/viewmodels/OnboardingViewModel.ets
arkts
applyProvider
把用户填的 API Key 写入预设服务商,获取模型列表,并自动设置默认聊天模型。 返回:成功 true,失败 false(失败信息写入 lastError)
async applyProvider(): Promise<boolean> { const providerId = this.selectedPresetProviderId const apiKey = this.apiKeyInput.trim() if (providerId === '' || apiKey === '') { this.lastError = '请选择服务商并填写 API Key' return false } const preset = getPresetProviderById(providerId) if (prese...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left applyProvider AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generi...
async applyProvider(): Promise<boolean> { const providerId = this.selectedPresetProviderId const apiKey = this.apiKeyInput.trim() if (providerId === '' || apiKey === '') { this.lastError = '请选择服务商并填写 API Key' return false } const preset = getPresetProviderById(providerId) if (prese...
https://github.com/LongLiveY96/chatcube
a0759e587c1d70fb39a0337ecbe8c30cce26eeb0
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/ConcurrentHashMap.ets
arkts
replace
Puts a pair of key and value into the Map @param { K } key the key to find in the Map @param { V } newValue the value to replace into the Map @returns { boolean } true if the delete Operation is success, otherwise false.
public replace(key: K, newValue: V): boolean { const buck = this.getBucket(key); if (buck !== undefined) { const buckSize = buck.length; ConcurrencyHelpers.mutexLock(this.bucketsMutex); const buckIndex = this.getBucketIndex(key); ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left replace 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 AS...
public replace(key: K, newValue: V): boolean { const buck = this.getBucket(key); if (buck !== undefined) { const buckSize = buck.length; ConcurrencyHelpers.mutexLock(this.bucketsMutex); const buckIndex = this.getBucketIndex(key); ...
https://gitcode.com/iop123123/arkts-static-skills
4d162ecb644dd5d0818bbf5ee9c5d4cccbb56626
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Preload/ChapterPreloadManager.ets
arkts
startPreload
开始预加载章节列表 @param mangaId 漫画ID @param externalMangaId 外部漫画ID @param sourceId 图源ID @param sourceName 图源名称(【关键】用于确保图源正确) @param chapters 要预加载的章节列表(按顺序)
public async startPreload( mangaId: string, externalMangaId: string, sourceId: number, sourceName: string, chapters: ChapterInfo[] ): Promise<void> { if (!this.config.enabled) { logger.info(TAG, '预加载已禁用'); return; } this.currentMangaId = mangaId; this.currentSour...
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 startPreload AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left mangaId AST#identifier#Right AST#ERROR#Left AST#:#Left : A...
public async startPreload( mangaId: string, externalMangaId: string, sourceId: number, sourceName: string, chapters: ChapterInfo[] ): Promise<void> { if (!this.config.enabled) { logger.info(TAG, '预加载已禁用'); return; } this.currentMangaId = mangaId; this.currentSour...
https://github.com/DaLongZhuaZi/manxia
4d5d88a874ea8cff8d1db48709f3de2ebfabaad1
github
ZestBox-18/kitebook-frontend
commons/data_core/src/main/ets/services/BudgetManager.ets
arkts
saveBudget
保存某个分类的预算,存在则更新,不存在则新增;传入 0 或负数时删除预算。
static async saveBudget(category: string, amount: number, month: string): Promise<void> { const existingBudget: BudgetBean | null = await BudgetManager.getBudgetByCategory(month, category); if (amount <= 0) { if (existingBudget !== null) { await BudgetManager.deleteBudget(existingBudget.id); ...
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 saveBudget AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left category AST#identifier#Right AST#ERROR#Left AST#:#Left : AS...
static async saveBudget(category: string, amount: number, month: string): Promise<void> { const existingBudget: BudgetBean | null = await BudgetManager.getBudgetByCategory(month, category); if (amount <= 0) { if (existingBudget !== null) { await BudgetManager.deleteBudget(existingBudget.id); ...
https://github.com/ZestBox-18/kitebook-frontend
968db9e7ee3740cfa207e5c7d0b7147cd24a9ba2
github