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
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/KeyboardTranslator.ets
arkts
translate
将 HarmonyOS 按键码翻译为 Windows 虚拟键码 @param keyCode HarmonyOS KeyCode @returns Windows VK code,未知按键返回 0
static translate(keyCode: number): number { // ── 范围映射 ── // 数字 0-9 → VK_0(0x30) ~ VK_9(0x39) if (keyCode >= OH_KEYCODE_0 && keyCode <= OH_KEYCODE_9) { return (keyCode - OH_KEYCODE_0) + VK_0; } // 字母 A-Z → VK_A(0x41) ~ VK_Z(0x5A) if (keyCode >= OH_KEYCODE_A && keyCode <= OH_KEYCODE_Z) ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left translate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left keyCode AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right...
static translate(keyCode: number): number { // ── 范围映射 ── // 数字 0-9 → VK_0(0x30) ~ VK_9(0x39) if (keyCode >= OH_KEYCODE_0 && keyCode <= OH_KEYCODE_9) { return (keyCode - OH_KEYCODE_0) + VK_0; } // 字母 A-Z → VK_A(0x41) ~ VK_Z(0x5A) if (keyCode >= OH_KEYCODE_A && keyCode <= OH_KEYCODE_Z) ...
https://github.com/AlkaidLab/moonlight-harmony
cd56ecf65167ddae43b79d80a9588ac4f82f55a3
github
HarmonyOS_Samples/MusicHome
common/musicbasic/src/main/ets/util/WindowUtil.ets
arkts
applyPcFreeWindowTitleImmersive
PC/2in1: hide the title bar in free window but keep the three system buttons. Call from PC ability only; phone default entry should not use this. @param enabled True to enable immersive title chrome; false to show standard title and unregister listeners. @param decorHeightVp Title decor height in vp when enabling; omit...
applyPcFreeWindowTitleImmersive(enabled: boolean, decorHeightVp?: number, decorButtonIconSizeVp?: number): void { if (this.mainWindow === undefined) { Logger.error('applyPcFreeWindowTitleImmersive: mainWindow is undefined'); return; } const win = this.mainWindow; if (enabled) { const...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left applyPcFreeWindowTitleImmersive AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifie...
applyPcFreeWindowTitleImmersive(enabled: boolean, decorHeightVp?: number, decorButtonIconSizeVp?: number): void { if (this.mainWindow === undefined) { Logger.error('applyPcFreeWindowTitleImmersive: mainWindow is undefined'); return; } const win = this.mainWindow; if (enabled) { const...
https://gitcode.com/HarmonyOS_Samples/MusicHome
0dde7eb1bcb5e570d63866f5e31a35d72b926273
gitcode
openharmony/applications_settings
product/phone/src/main/ets/pages/searchPage.ets
arkts
makeViewData
make data for view @param result Search result @return Data for show to view
makeViewData(result: SearchData[]): SearchData[][] { let list: SearchData[][] = []; let group: SearchData[] = []; let lastUri: string = ''; for (let i = 0; i < result.length; i++) { let data = result[i]; if (data.uri !== lastUri) { if (group) { let g = group; ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left makeViewData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left result AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#L...
makeViewData(result: SearchData[]): SearchData[][] { let list: SearchData[][] = []; let group: SearchData[] = []; let lastUri: string = ''; for (let i = 0; i < result.length; i++) { let data = result[i]; if (data.uri !== lastUri) { if (group) { let g = group; ...
https://gitee.com/openharmony/applications_settings.git
6ae53e30569195ddc0cef3f13bce98db3b83e936
gitee
openharmony/codelabs
ETSUI/MemoTime/entry/src/main/ets/pages/Index.ets
arkts
handleDateSelect
处理日期选择
handleDateSelect(date: Date): void { this.selectedDate = date this.currentYear = date.getFullYear() this.currentMonth = date.getMonth() this.updateSelectedDateSchedules() }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left handleDateSelect AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left date AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Date AST#identifier#Right AST#)#Left ) ...
handleDateSelect(date: Date): void { this.selectedDate = date this.currentYear = date.getFullYear() this.currentMonth = date.getMonth() this.updateSelectedDateSchedules() }
https://gitcode.com/openharmony/codelabs
218b5bd3bbcbcd4ed587a7b473f2a088f30a052f
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/EnhancedBackupManager.ets
arkts
getBackupMetadata
获取备份元数据
async getBackupMetadata(filePath: string): Promise<BackupMetadata> { try { const tempDir = await this.createTempRestoreDir(); try { await this.tarPackager.extractTarArchive(filePath, tempDir); const jsonPath = `${tempDir}/backup.json`; const backupData: BackupDa...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getBackupMetadata 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#:#...
async getBackupMetadata(filePath: string): Promise<BackupMetadata> { try { const tempDir = await this.createTempRestoreDir(); try { await this.tarPackager.extractTarArchive(filePath, tempDir); const jsonPath = `${tempDir}/backup.json`; const backupData: BackupDa...
https://github.com/DaLongZhuaZi/manxia
a1583f21b074e9a20f21a808489d46ed9b109695
github
Yebingiscn/SweetVideo
entry/src/main/ets/utils/BaseEventUtil.ets
arkts
hasListeners
检查是否有事件监听器 @param eventName 事件名称 @returns 是否存在监听器
hasListeners(eventName: string): boolean { const dataListeners = this.dataEvents.get(eventName) // const voidListeners = this.voidEvents.get(eventName) const hasDataListeners = dataListeners ? dataListeners.length > 0 : false // const hasVoidListeners = voidListeners ? voidListeners.length > 0 : fals...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasListeners 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#Right AST#)#Left ) AST#)...
hasListeners(eventName: string): boolean { const dataListeners = this.dataEvents.get(eventName) // const voidListeners = this.voidEvents.get(eventName) const hasDataListeners = dataListeners ? dataListeners.length > 0 : false // const hasVoidListeners = voidListeners ? voidListeners.length > 0 : fals...
https://github.com/Yebingiscn/SweetVideo
add5d22f58a0b7bfdd82e26efacf6a34d7e51a65
github
openharmony-sig/ohos_video_trimmer
entry/src/main/ets/pages/FileUtils.ets
arkts
createFile
新建文件 @param path 文件绝对路径及文件名 @return number 文件句柄id
createFile(path: string): number { return fs.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE).fd }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left createFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#...
createFile(path: string): number { return fs.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE).fd }
https://gitee.com/openharmony-sig/ohos_video_trimmer.git
3d19f6fc7eccfe112cbd050726236ceba0759014
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Map.ets
arkts
constructor
Constructs an empty Map
constructor() { this.tree = newEmpty<K, V>(); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A...
constructor() { this.tree = newEmpty<K, V>(); }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
5a2b7c738a06be477fa1bc54c130717accbf9891
gitee
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ets
arkts
isDate
Check whether the entered value is of type date. @param { Object } value - A Date value @returns { boolean } Returns true if the value is a built-in Date instance.
isDate(value: Object): boolean { return value instanceof Date; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isDate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Object AST#identifier#Right AST#)#Left ) AST#)#R...
isDate(value: Object): boolean { return value instanceof Date; }
https://gitcode.com/iop123123/arkts-static-skills
595c4c402d911e0061a840171449b2a3ce0751cb
gitcode
openharmony/applications_app_samples
code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/videotrimmer/VideoTrimmerView.ets
arkts
initRangeSeekBarView
初始视频选择区域范围
initRangeSeekBarView() { this.mRangSeekBarOption = { mLeftProgressPos: 0, mRightProgressPos: this.mDuration, // 最小时间 比如一屏幕10张图 间隔10s, 现在最小时间是3s,那么leftThumb和rightThumb的最小间隔是3张图宽度 mMinShootTime: this.videoMinTime, // 最大时间 约束了右侧thumb和左侧thumb的距离 mMaxShootTime: this.videoMaxTime, ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left initRangeSeekBarView AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_blo...
initRangeSeekBarView() { this.mRangSeekBarOption = { mLeftProgressPos: 0, mRightProgressPos: this.mDuration, // 最小时间 比如一屏幕10张图 间隔10s, 现在最小时间是3s,那么leftThumb和rightThumb的最小间隔是3张图宽度 mMinShootTime: this.videoMinTime, // 最大时间 约束了右侧thumb和左侧thumb的距离 mMaxShootTime: this.videoMaxTime, ...
https://github.com/openharmony/applications_app_samples
451acd90543332b85fde537050f6e93e0ca19865
github
silence17/harmonydemo
entry/src/main/ets/view/refresh/preferencesStrong.ets
arkts
getPreference
Get preference data.
async getPreference(key: string) { if (!key) { return } let value: number | string | boolean | Array<number> | Array<string> | Array<boolean>; if (!preference) { await this.getPreferences(); } try { value = await preference.get(key, '') } catch (err) { console.erro...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getPreference AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left key AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS...
async getPreference(key: string) { if (!key) { return } let value: number | string | boolean | Array<number> | Array<string> | Array<boolean>; if (!preference) { await this.getPreferences(); } try { value = await preference.get(key, '') } catch (err) { console.erro...
https://github.com/silence17/harmonydemo
a8cfb6602e9421ffa8529262dc225c58ae2ba99f
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/remainder/remainder_ulong.ets
arkts
main
--- desc: check remainder of division operation for two unsigned long integer operands ---
function main(): void { const a: ulong = {{v.left}} const b: ulong = {{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: ulong = {{v.left}} const b: ulong = {{v.right}} assert (a % b) == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
c0023f48ac11ca28e836ebc44b578943caad0b9a
gitee
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/usbdriver/DdkUsbPoller.ets
arkts
init
全局初始化 DDK (只需调用一次) @returns 初始化结果
static init(): DdkInitResult { if (!DdkUsbPoller.isAvailable()) { return { code: -1, error: 'DDK native module not available' }; } if (ddkInitialized) { return { code: 0, status: 'already initialized' }; } try { const result = ddkNative!.init(); if (result.code === 0) { ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Righ...
static init(): DdkInitResult { if (!DdkUsbPoller.isAvailable()) { return { code: -1, error: 'DDK native module not available' }; } if (ddkInitialized) { return { code: 0, status: 'already initialized' }; } try { const result = ddkNative!.init(); if (result.code === 0) { ...
https://github.com/AlkaidLab/moonlight-harmony
2ed8a4218940a8c4d52ad86e8dbffc12340497e6
github
HarmonyOS_Samples/MusicHome
features/recommendation/src/main/ets/view/PanelMusicHomePage.ets
arkts
pageTransition
Page enter/exit transitions for this panel route.
pageTransition() { PageTransitionEnter({ duration: SongConstants.TRANSITION_DURATION, curve: Curve.Smooth, type: RouteType.Pop }) PageTransitionExit({ duration: SongConstants.TRANSITION_DURATION, curve: Curve.Smooth, type: RouteType.Push }) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left pageTransition AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Lef...
pageTransition() { PageTransitionEnter({ duration: SongConstants.TRANSITION_DURATION, curve: Curve.Smooth, type: RouteType.Pop }) PageTransitionExit({ duration: SongConstants.TRANSITION_DURATION, curve: Curve.Smooth, type: RouteType.Push }) }
https://gitcode.com/HarmonyOS_Samples/MusicHome
ab3c18c40825eee421e7fa91a1c42d3686999c15
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
byteOffset
Byte offset within the underlying Buffer @returns { int } @syscap SystemCapability.Utils.Lang @FaAndStageModel
public get byteOffset(): int { return this.byteOffsetInt }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left get AST#identifier#Right AST#call_expression#Left AST#identifier#Left byteOffset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left ...
public get byteOffset(): int { return this.byteOffsetInt }
https://gitcode.com/iop123123/arkts-static-skills
f4996d23336d23e239ab4ad89514ca62a33697e4
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/RhinoWasmExecutor.ets
arkts
getSandboxHtml
获取内联的沙箱HTML(备用方法) 包含所有必要的JS代码,避免外部文件加载问题
private getSandboxHtml(): string { return `<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Rhino Sandbox</title> </head> <body> <script> // ========== 沙箱状态 ========== window.rhinoSandbox = { ready: false, mode: 'offline', error: null, pendingTasks: [], results: {} }; // ========== Jsoup...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getSandboxHtml 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 A...
private getSandboxHtml(): string { return `<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Rhino Sandbox</title> </head> <body> <script> // ========== 沙箱状态 ========== window.rhinoSandbox = { ready: false, mode: 'offline', error: null, pendingTasks: [], results: {} }; // ========== Jsoup...
https://github.com/DaLongZhuaZi/manxia
1b68c7ae7446c0e382381837a1bd44bf7978ba89
github
Dabing-0x19d/berverage_HarmonyOS6.0
entry/src/main/ets/common/utils/PreferencesUtil.ets
arkts
getMonthFormIds
静态方法:异步获取月数据卡片的所有formId
static async getMonthFormIds(): Promise<string[]> { hilog.info(0x0000, TAG, `[PreferencesUtil] getMonthFormIds: 开始获取`); if (!globalContext) { hilog.error(0x0000, TAG, `[PreferencesUtil] getMonthFormIds: globalContext is null`); return []; } try { // 重要:先清除缓存,确保获取最新数据 hilog.info...
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 getMonthFormIds AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#...
static async getMonthFormIds(): Promise<string[]> { hilog.info(0x0000, TAG, `[PreferencesUtil] getMonthFormIds: 开始获取`); if (!globalContext) { hilog.error(0x0000, TAG, `[PreferencesUtil] getMonthFormIds: globalContext is null`); return []; } try { // 重要:先清除缓存,确保获取最新数据 hilog.info...
https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0
c2973e09318f2c38587ffd4f1212fab1b568bd70
github
Dige945/EmoCollector
entry/src/main/ets/model/DBManager.ets
arkts
checkAndUpgradeTable
检查并升级表结构(添加 photo_path 列)
private async checkAndUpgradeTable(): Promise<void> { if (!this.rdbStore) { return; } try { // 尝试直接添加 photo_path 列 // 如果列已存在,ALTER TABLE 会失败但不影响使用 const alterTableSql = `ALTER TABLE ${this.TABLE_NAME} ADD COLUMN ${this.COLUMN_PHOTO_PATH} TEXT`; await this.rdbStore.executeSql...
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 checkAndUpgradeTable AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Ri...
private async checkAndUpgradeTable(): Promise<void> { if (!this.rdbStore) { return; } try { // 尝试直接添加 photo_path 列 // 如果列已存在,ALTER TABLE 会失败但不影响使用 const alterTableSql = `ALTER TABLE ${this.TABLE_NAME} ADD COLUMN ${this.COLUMN_PHOTO_PATH} TEXT`; await this.rdbStore.executeSql...
https://github.com/Dige945/EmoCollector
ac93e3bcc8f08b9b0bcb37c098ff038847484e6a
github
Explore-In-HMOS-Wearable/stack-game-with-unity-tuanjie
StackGameWithUnityDevEcoExport/tuanjieLib/src/main/ets/utils/TuanjieNative.ets
arkts
TuanjieSendMessage
Calls the method named methodName on every MonoBehaviour in this game object. @param methodName - Name of the method to call. @param value - Optional parameter for the method. @param options - Should an error be raised if the target object doesn't implement the method for the message?
public static TuanjieSendMessage(methodName: string, value: ESObject, options: ESObject): void { tuanjie.TuanjieSendMessage(methodName, value, options); }
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 TuanjieSendMessage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left methodName AST#identifier#Right AST#ERROR#Left AST#...
public static TuanjieSendMessage(methodName: string, value: ESObject, options: ESObject): void { tuanjie.TuanjieSendMessage(methodName, value, options); }
https://github.com/Explore-In-HMOS-Wearable/stack-game-with-unity-tuanjie
8c00a047646030f240e8958a694dec52a897f8c4
github
Harrisonls2004/WaterFlow
entry/src/main/ets/common/utils/FootprintManager.ets
arkts
saveAllFootprints
Save all footprints
private static async saveAllFootprints(footprints: IFootprint[]): Promise<void> { try { if (!FootprintManager.preferencesInstance) { console.error('FootprintManager: Preferences not initialized'); return; } await FootprintManager.preferencesInstance.put(FootprintManager.FOOTPRIN...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left saveAllFootprints AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Le...
private static async saveAllFootprints(footprints: IFootprint[]): Promise<void> { try { if (!FootprintManager.preferencesInstance) { console.error('FootprintManager: Preferences not initialized'); return; } await FootprintManager.preferencesInstance.put(FootprintManager.FOOTPRIN...
https://github.com/Harrisonls2004/WaterFlow
f67472babfdf2613569c3ab435221a674d6545d5
github
751496032/ZRouter
RouterApi/src/main/ets/api/RouterMgr.ets
arkts
popWithResult
带结果的关闭页面 pushForResult - popWithResult 场景 A->B, B->A ,A监听B的返回结果 @see {pushForResult} @param result @param animated @returns boolean true: 表示成功关闭页面
public popWithResult(result?: Object, animated: boolean = true) { if (ObjectUtil.isNull(result)) { result = new Object() } return this.popInternal(result, animated) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left popWithResult AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left result AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#R...
public popWithResult(result?: Object, animated: boolean = true) { if (ObjectUtil.isNull(result)) { result = new Object() } return this.popInternal(result, animated) }
https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/api/RouterMgr.ets#L463-L468
f6d09b47a8f06f2f9345dbb0a3a16b63041c340b
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test22_original_index.ets
arkts
testBoolNegation
--- Boolean negation chains ---
function testBoolNegation(): string { let a: boolean = true; let b: boolean = !a; let c: boolean = !b; let d: boolean = !!a; return String(a) + ',' + String(b) + ',' + String(c) + ',' + String(d); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testBoolNegation 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 testBoolNegation(): string { let a: boolean = true; let b: boolean = !a; let c: boolean = !b; let d: boolean = !!a; return String(a) + ',' + String(b) + ',' + String(c) + ',' + String(d); }
https://github.com/miaochiahao/ark-ghidra
1516870a82e941f26b07644b67bdb5ee0424a2dd
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.xml.ets
arkts
writeEscaped
Escapes special characters in the given string and appends the result to the provided StringBuilder. @param {StringBuilder} stringBuilder - The StringBuilder to which the escaped string will be appended. @param {string} s - The input string to be escaped.
private writeEscaped(stringBuilder: StringBuilder, s: string): void { s = s.replaceAll('&', '&amp;'); s = s.replaceAll('\'', '&apos;'); s = s.replaceAll('\"', '&quot;'); s = s.replaceAll('>', '&gt;'); s = s.replaceAll('<', '&lt;'); stringBu...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left writeEscaped AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left stringBuilder AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif...
private writeEscaped(stringBuilder: StringBuilder, s: string): void { s = s.replaceAll('&', '&amp;'); s = s.replaceAll('\'', '&apos;'); s = s.replaceAll('\"', '&quot;'); s = s.replaceAll('>', '&gt;'); s = s.replaceAll('<', '&lt;'); stringBu...
https://gitcode.com/iop123123/arkts-static-skills
1983d896caa4ea50938129da4805c7effa9ecbcd
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/pages/MainMenuPage.ets
arkts
handleScrollForBottomBar
处理滚动事件,实现底栏跟手滑动隐藏/显示 @param deltaY Y轴滚动偏移量变化值(正值=向下滚动,负值=向上滚动)
private handleScrollForBottomBar(deltaY: number): void { if (!this.mainPageBottomBarAnimationEnabled || this.useTopTabsNavigation || this.isOverlayBottomNavTab(this.currentTabIndex)) { return; } this.clearBottomBarSettleTimer(); if (Math.abs(deltaY) <= 0.01) { return; } this.bott...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleScrollForBottomBar AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left deltaY AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#id...
private handleScrollForBottomBar(deltaY: number): void { if (!this.mainPageBottomBarAnimationEnabled || this.useTopTabsNavigation || this.isOverlayBottomNavTab(this.currentTabIndex)) { return; } this.clearBottomBarSettleTimer(); if (Math.abs(deltaY) <= 0.01) { return; } this.bott...
https://github.com/DaLongZhuaZi/manxia
7b4bbf878ad461e7cbc66777ce6e744e43f84649
github
HarmonyOS_Samples/MusicHome
common/musicbasic/src/main/ets/model/SongDataSource.ets
arkts
notifyDataAdd
Notifies listeners that one row was inserted. @param index Index of the new row.
public notifyDataAdd(index: number): void { this.listeners.forEach(listener => { listener.onDataAdd(index); }); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left notifyDataAdd AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left n...
public notifyDataAdd(index: number): void { this.listeners.forEach(listener => { listener.onDataAdd(index); }); }
https://gitcode.com/HarmonyOS_Samples/MusicHome
ee95d6d0a33249424086deb3e9873f176141dbb0
gitcode
CPF-ApplicationTPC/openharmony_tpc_samples
SwipeMenuListView/library/src/main/ets/utils/SwipeMenuListUtils.ets
arkts
getString
获取字符串资源 @param context 上下文对象 @param resId 资源ID @returns Promise<string> 字符串资源内容
public static async getString(context: common.UIAbilityContext, resId: number): Promise<string> { try { return await context.resourceManager.getStringValue(resId); } catch (error) { logger.warn(`Failed to get string resource ${resId}:`, error); return ''; } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left getString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context ...
public static async getString(context: common.UIAbilityContext, resId: number): Promise<string> { try { return await context.resourceManager.getStringValue(resId); } catch (error) { logger.warn(`Failed to get string resource ${resId}:`, error); return ''; } }
https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples
2f509ce0c87fea58e4df5615ae8958d7ed8f5d68
gitcode
XJTUWYD/ArkDiff
entry/src/main/ets/utils/ThemeColors.ets
arkts
diffAddedBackground
========== 便捷属性(直接代理到当前主题) ==========
get diffAddedBackground(): string { return this.colors.diffAddedBackground; }
AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left diffAddedBackground 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...
get diffAddedBackground(): string { return this.colors.diffAddedBackground; }
https://github.com/XJTUWYD/ArkDiff
510bf4a2570819117ed279724afe7d725b772ae0
github
HarmonyOS_Codelabs/arkts-basic-syntax-demo
entry/src/main/ets/pages/BasicPage.ets
arkts
checkAge
throw语句
function checkAge(age: number) { if (age < 0) { throw new Error('Age cannot be negative'); } }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left checkAge AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left age AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AS...
function checkAge(age: number) { if (age < 0) { throw new Error('Age cannot be negative'); } }
https://gitcode.com/HarmonyOS_Codelabs/arkts-basic-syntax-demo
183478d40cb357d152ac37255b956f01e1435773
gitcode
HarmonyOS_Samples/BestPracticeSnippets
AppColdStart/entry/src/main/ets/pages/ScenariosExample.ets
arkts
transcodePixelMap
Use createPixelMap to replace pictures of ArrayBuffer type with PixelMap type @param data:Resources obtained from the network
transcodePixelMap(data: http.HttpResponse): void { if (http.ResponseCode.OK === data.responseCode) { const imageData: ArrayBuffer = data.result as ArrayBuffer; // Create a picture source instance through ArrayBuffer const imageSource: image.ImageSource = image.createImageSource(imageData); ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left transcodePixelMap 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#member_expression#Left AST#identifier#Left http AST#id...
transcodePixelMap(data: http.HttpResponse): void { if (http.ResponseCode.OK === data.responseCode) { const imageData: ArrayBuffer = data.result as ArrayBuffer; // Create a picture source instance through ArrayBuffer const imageSource: image.ImageSource = image.createImageSource(imageData); ...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
0a83e228b117cddeff8b2fe170e45314f5c94bd1
gitcode
xiebyapps/ClipLink
entry/src/main/ets/services/HttpClient.ets
arkts
setBaseUrl
Set base URL
setBaseUrl(url: string): void { this.baseUrl = url.endsWith('/') ? url.slice(0, -1) : url; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setBaseUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)...
setBaseUrl(url: string): void { this.baseUrl = url.endsWith('/') ? url.slice(0, -1) : url; }
https://github.com/xiebyapps/ClipLink
fc7e78b149626b40aac1117a9adaed870e5287b1
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Double.ets
arkts
parseInt
parseInt(String, double) parses from String an integer of specified radix If args ('10', 1) -> thrown ArgumentOutOfRangeError, ('10', 37) -> thrown ArgumentOutOfRangeError If args ('10', 2) -> 2 If args ('10', 10) -> 10, ('10', 0) -> 10 If args ('ff', 16) -> 255 etc. @param { String } s the string to convert @param { d...
public static parseInt(s: String, r: double): double { if (!Double.isFinite(r)) { r = 0.0; } if ((r < 2.0 || r > 36.0) && r != 0.0) { return NaN; } else { return Double.parseIntCore(s.trim(), Double.toInt(r)); } }
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 parseInt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left s AST#identifier#Right AST#:#Left : AST#:#Righ...
public static parseInt(s: String, r: double): double { if (!Double.isFinite(r)) { r = 0.0; } if ((r < 2.0 || r > 36.0) && r != 0.0) { return NaN; } else { return Double.parseIntCore(s.trim(), Double.toInt(r)); } }
https://gitcode.com/iop123123/arkts-static-skills
1b8e9ee9f313053d0c9c1c601b025bcdf3a450c1
gitcode
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/EventSourcingService.ets
arkts
executeCommand
==================== 命令处理 ==================== 执行命令 @param commandType 命令类型 @param aggregateType 聚合类型 @param aggregateId 聚合ID @param userId 用户ID @param payload 命令负载 @returns 执行结果
static async executeCommand( commandType: string, aggregateType: string, aggregateId: number, userId: number, payload: Record<string, Object> ): Promise<CommandExecutionResult> { try { // 创建命令记录 const command = new Command(); command.commandId = EventSourcingService.generat...
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 executeCommand AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left commandType AST#identifier#Right AST#ERROR#Left AST#:#Le...
static async executeCommand( commandType: string, aggregateType: string, aggregateId: number, userId: number, payload: Record<string, Object> ): Promise<CommandExecutionResult> { try { // 创建命令记录 const command = new Command(); command.commandId = EventSourcingService.generat...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
6dd396df27f3903ad05a9d252cc5ca0efa62dd54
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Parsers/PdfToMangaImporter.ets
arkts
writePixelMapToFile
将 PixelMap 直接打包写入文件,避免先创建整块 ArrayBuffer 再复制到文件,降低峰值内存占用。
private async writePixelMapToFile( pixelMap: image.PixelMap, outputPath: string, format: string = 'image/jpeg', quality: number = 90 ): Promise<void> { const packOpts: image.PackingOption = { format: format, quality: quality }; const imagePackerApi = image.createImagePacker()...
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 writePixelMapToFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left pixelMap AST#identifi...
private async writePixelMapToFile( pixelMap: image.PixelMap, outputPath: string, format: string = 'image/jpeg', quality: number = 90 ): Promise<void> { const packOpts: image.PackingOption = { format: format, quality: quality }; const imagePackerApi = image.createImagePacker()...
https://github.com/DaLongZhuaZi/manxia
5445e8d5d53508450b8a0302e617ca53f581c53c
github
jjjjjjava/ffmpeg_tools
src/main/ets/ffmpeg/FFmpegCommandBuilder.ets
arkts
output
设置输出文件
public output(path: string): FFmpegCommandBuilder { this.outputPath = path; return this; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left output AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AS...
public output(path: string): FFmpegCommandBuilder { this.outputPath = path; return this; }
https://github.com/jjjjjjava/ffmpeg_tools
bd1e52610cb5e9c76a8ed1bf168ccc6dfed03bef
github
Joker-x-dev/CoolMallArkTS
feature/goods/src/main/ets/viewmodel/GoodsSearchViewModel.ets
arkts
onSearch
执行搜索 @param {string} keyword - 搜索关键词 @returns {Promise<void>} Promise<void>
async onSearch(keyword: string): Promise<void> { const trimmed: string = keyword.trim(); if (!trimmed) { return; } this.searchValue = trimmed; await this.searchHistoryRepository.addSearchHistory(trimmed); await this.loadSearchHistory(); const params: GoodsCategoryParam = { fea...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left onSearch AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left keyword AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST...
async onSearch(keyword: string): Promise<void> { const trimmed: string = keyword.trim(); if (!trimmed) { return; } this.searchValue = trimmed; await this.searchHistoryRepository.addSearchHistory(trimmed); await this.loadSearchHistory(); const params: GoodsCategoryParam = { fea...
https://github.com/Joker-x-dev/CoolMallArkTS
f76d468284330c469a47c0c4ab198cff9fcbbffb
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets
arkts
convertObject
Converts object to this array type @param {Any} obj Object to convert @returns {Any} Converted object @throws {Error} If conversion is invalid @syscap SystemCapability.Utils.Lang @FaAndStageModel
public override convertObject(obj: Any): Any { const objType = Type.of(obj) if (this.equals(objType)) { return obj } if (!this.assignableFrom(objType)) { throw new Error("invalid conversion") } return obj }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left convertObject AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#:#Left : A...
public override convertObject(obj: Any): Any { const objType = Type.of(obj) if (this.equals(objType)) { return obj } if (!this.assignableFrom(objType)) { throw new Error("invalid conversion") } return obj }
https://gitcode.com/iop123123/arkts-static-skills
906f9b4c306f8af988f77579e61328638949abd3
gitcode
zmuxuny/ai-guardian-star
entry/src/main/ets/database/DatabaseHelper.ets
arkts
markEventHandled
标记事件为已处理
public async markEventHandled(eventId: number): Promise<void> { const predicates = new relationalStore.RdbPredicates("t_health_event"); predicates.equalTo("id", eventId); try { await this.getStore().update({ is_handled: 1 }, predicates); hilog.info(DOMAIN, TAG, `markEventHandled 成功 id=${eventI...
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 markEventHandled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left eventId AST#identifier#Right AST#ERROR#Left AST#:#Left...
public async markEventHandled(eventId: number): Promise<void> { const predicates = new relationalStore.RdbPredicates("t_health_event"); predicates.equalTo("id", eventId); try { await this.getStore().update({ is_handled: 1 }, predicates); hilog.info(DOMAIN, TAG, `markEventHandled 成功 id=${eventI...
https://github.com/zmuxuny/ai-guardian-star/blob/87ab023d8b9aab4303a9fc1e97508e1f8ee01e07/entry/src/main/ets/database/DatabaseHelper.ets#L567-L578
269d8b1ac5d1c3c05b0277c42c031e262ca46dd1
github
FinalScave/SweetLine
platform/OHOS/sweetline/src/main/ets/Index.ets
arkts
charIndexOfLine
Calculate the start character index of a specific line in the full text
public charIndexOfLine(line: number): number { return lib.Document_CharIndexOfLine(this.nativeHandle, line); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left charIndexOfLine AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left line AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ...
public charIndexOfLine(line: number): number { return lib.Document_CharIndexOfLine(this.nativeHandle, line); }
https://github.com/FinalScave/SweetLine
cfa0d23aadf70259bd5f6db84db448d9e9119d48
github
ZestBox-18/kitebook-frontend
commons/kite_utils/src/main/ets/utils/clog/Clog.ets
arkts
writeLog
根据开关与级别将日志写入对应文件及汇总文件 当 `disableSave()` 已启用时,仅 `error` 级别会落盘
private static writeLog(level: 'info' | 'warn' | 'error', tag: string, message: string): void { if (Clog.DISABLE_NON_ERROR_SAVE && level !== 'error') { return; } const filePath = Clog.getFilePath(level); if (!filePath) { return; } const entry: LogEntry = { level, tag, message, time...
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 writeLog AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left level AST#identifier#Right AST#:#Left : AST...
private static writeLog(level: 'info' | 'warn' | 'error', tag: string, message: string): void { if (Clog.DISABLE_NON_ERROR_SAVE && level !== 'error') { return; } const filePath = Clog.getFilePath(level); if (!filePath) { return; } const entry: LogEntry = { level, tag, message, time...
https://github.com/ZestBox-18/kitebook-frontend
228c9a22373d20322a125889b5cfdb97f1df5d83
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelSourceValidator.ets
arkts
addErrorGroup
添加错误分组
private addErrorGroup(result: SourceValidationResult, errorType: ValidationErrorType): void { const groupName = ERROR_GROUP_NAMES[errorType]; if (!result.errorGroups.includes(groupName)) { result.errorGroups.push(groupName); } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left addErrorGroup AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left result AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le...
private addErrorGroup(result: SourceValidationResult, errorType: ValidationErrorType): void { const groupName = ERROR_GROUP_NAMES[errorType]; if (!result.errorGroups.includes(groupName)) { result.errorGroups.push(groupName); } }
https://github.com/DaLongZhuaZi/manxia
1c3e5f0f842a08b6c891027ac2c27b5f82ab2790
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
forEach
Applies a function over all elements of Int32Array @param fn function to apply @returns undefined
public forEach(fn: (val: int) => int): void { let newF: (val: int, index: int, array: Int32Array) => int = (val: int, index: int, array: Int32Array): int => { return fn(val) } this.forEach(newF) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left forEach AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#...
public forEach(fn: (val: int) => int): void { let newF: (val: int, index: int, array: Int32Array) => int = (val: int, index: int, array: Int32Array): int => { return fn(val) } this.forEach(newF) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
cd2409badaf6854ba31b9c41d64274cb581ee25a
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
with
Creates a copy with replaced value on index @param index @param value @returns an Uint32Array with replaced value on index
public with(index: number, value: number): Uint32Array { return this.with(index as int, value as number) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#ERROR#Right AST#with_statement#Left AST#with#Left with AST#with#Right AST#parenthesized_expression#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST...
public with(index: number, value: number): Uint32Array { return this.with(index as int, value as number) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
bfed453a9b007b680cd18ded6fda5cf104ed9912
gitee
openharmony-tpc/openharmony_tpc_samples
SmartRefreshLayout/library/src/main/ets/components/bottomRefresh/BezierCircleBottomRefresh.ets
arkts
spin
Puts the view on spin mode
spin(): void { this.lastTimeAnimated = new Date().getTime() this.isSpinning = true; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left spin AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left AS...
spin(): void { this.lastTimeAnimated = new Date().getTime() this.isSpinning = true; }
https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git
4e561c7fb6c76d09f482449999b2513f09d5fa2c
gitee
webabcd/HarmonyDemo
entry/src/main/ets/pages/basic/LifecycleDemo.ets
arkts
onBackPress
只有被 @Entry 装饰的组件的生命周期才有 onBackPress
onBackPress() { MyLog.d('onBackPress 用户点击返回按钮时触发'); // 返回 false 则使用默认的返回逻辑 // 返回 true 则需要自己处理返回逻辑 return false }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onBackPress 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 A...
onBackPress() { MyLog.d('onBackPress 用户点击返回按钮时触发'); // 返回 false 则使用默认的返回逻辑 // 返回 true 则需要自己处理返回逻辑 return false }
https://github.com/webabcd/HarmonyDemo
c82c62c289367eb53332aa0dda8db904d9760069
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelChapterCacheManager.ets
arkts
getAllDownloadTasks
获取所有下载任务
getAllDownloadTasks(): NovelDownloadTask[] { return Array.from(this.downloadTasks.values()); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getAllDownloadTasks AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:...
getAllDownloadTasks(): NovelDownloadTask[] { return Array.from(this.downloadTasks.values()); }
https://github.com/DaLongZhuaZi/manxia
5ef8f466efee5e0cf3b20cc97ac6b867aed5d72a
github
HarmonyOS_Samples/MusicHome
products/tv/src/main/ets/tvbackupability/TvBackupAbility.ets
arkts
onBackup
Invoked when backup runs; logs a placeholder success message.
async onBackup() { Logger.info('TvBackupAbility: onBackup ok'); await Promise.resolve(); }
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left onBackup AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#{#Left { AST#{#Right AST#ERROR#Right AST#expression_...
async onBackup() { Logger.info('TvBackupAbility: onBackup ok'); await Promise.resolve(); }
https://gitcode.com/HarmonyOS_Samples/MusicHome
0ac8564d2b52ac282d0e56a19ad660e67a6cfc81
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelCoverGenerator.ets
arkts
getCoverDir
获取封面存储目录
getCoverDir(): string { return this.coverDir; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCoverDir AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement_...
getCoverDir(): string { return this.coverDir; }
https://github.com/DaLongZhuaZi/manxia
3fc0cb87d39ee009a900a051d022cfc3c0e7c572
github
openharmony/codelabs
ETSUI/LifeBalance/entry/src/main/ets/common/database/DietRecordDao.ets
arkts
getWeeklyStats
--- 获取过去7天的每日总热量 ---
async getWeeklyStats(): Promise<GeneratedTypeLiteralInterface_1[]> { const store = RdbManager.getInstance().getRdbStore(); if (!store) { return []; } const result: GeneratedTypeLiteralInterface_2[] = []; // 循环获取过去 7 天的日期字符串 for (let i = 6; i >= 0; i--) { const d = new Date(); ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getWeeklyStats AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#gener...
async getWeeklyStats(): Promise<GeneratedTypeLiteralInterface_1[]> { const store = RdbManager.getInstance().getRdbStore(); if (!store) { return []; } const result: GeneratedTypeLiteralInterface_2[] = []; // 循环获取过去 7 天的日期字符串 for (let i = 6; i >= 0; i--) { const d = new Date(); ...
https://gitcode.com/openharmony/codelabs
38a9d97b6f6466548f5e2fc7b14a5005f8aba639
gitcode
openharmony/codelabs
Data/PersonalAssistantPro/entry/src/main/ets/services/DataExportService.ets
arkts
mockCloudUpload
========================================== 1. JSON 生成器
static async mockCloudUpload(fileContent: string): Promise<boolean> { DataExportService.logger.info('Initiating mock cloud upload...'); const totalChunks = 5; for (let i = 1; i <= totalChunks; i++) { await DataExportService.simulateDelay(300); DataExportService.logger.info(`Uploading chunk ${...
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 mockCloudUpload AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left fileContent AST#identifier#Right AST#ERROR#Left AST#:#L...
static async mockCloudUpload(fileContent: string): Promise<boolean> { DataExportService.logger.info('Initiating mock cloud upload...'); const totalChunks = 5; for (let i = 1; i <= totalChunks; i++) { await DataExportService.simulateDelay(300); DataExportService.logger.info(`Uploading chunk ${...
https://gitcode.com/openharmony/codelabs
e041bb338fd23ffcc4fe8d64b5e828f7e0749388
gitcode
openharmony-sig/knowledge_demo_entainment
FA/notebook/entry/src/main/ets/common/database/NoteInfoTable.ets
arkts
queryAll
查询全部笔记 @param callback 查询成功的回调函数
queryAll(callback) { try { // 获取RdbStore this.getRdbStore(() => { // 获取RdbPredicates let predicates = new data_rdb.RdbPredicates(NOTE_INFO.tableName) // 按照date字段降序排序 predicates.orderByDesc('date'); // 查询数据 this.rdbStore.query(predicates, NOTE_INFO.column...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left queryAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left callback AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expres...
queryAll(callback) { try { // 获取RdbStore this.getRdbStore(() => { // 获取RdbPredicates let predicates = new data_rdb.RdbPredicates(NOTE_INFO.tableName) // 按照date字段降序排序 predicates.orderByDesc('date'); // 查询数据 this.rdbStore.query(predicates, NOTE_INFO.column...
https://gitee.com/openharmony-sig/knowledge_demo_entainment.git
d6970d1fdcf69c4b48e0a2f085d93ea960dba093
gitee
HarmonyOS_Samples/sample_in_harmonyos
common/src/main/ets/trackmanager/TrackManager.ets
arkts
initTrackCommonData
Get the common track data.
private initTrackCommonData(): Promise<void> { return Promise.resolve().then(() => { const bundleInfo: BundleInfoData | undefined = AppStorage.get(StorageKey.BUNDLE_INFO); const trackCommonData: TrackCommonData = { bundleName: bundleInfo?.bundleName ?? null, version: bundleInfo?.versio...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left initTrackCommonData 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#instantiation_e...
private initTrackCommonData(): Promise<void> { return Promise.resolve().then(() => { const bundleInfo: BundleInfoData | undefined = AppStorage.get(StorageKey.BUNDLE_INFO); const trackCommonData: TrackCommonData = { bundleName: bundleInfo?.bundleName ?? null, version: bundleInfo?.versio...
https://gitcode.com/HarmonyOS_Samples/sample_in_harmonyos
21241e31705800ed4abff771d6bca74809816524
gitcode
tdcare/tdwebrtc
src/main/ets/utils/StrUtil.ets
arkts
strToBuffer
字符串转ArrayBuffer @param str @returns
static strToBuffer(src: string, encoding: buffer.BufferEncoding = 'utf-8'): ArrayBuffer { const buf = buffer.from(src, encoding); return buf.buffer; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left strToBuffer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left src AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left strin...
static strToBuffer(src: string, encoding: buffer.BufferEncoding = 'utf-8'): ArrayBuffer { const buf = buffer.from(src, encoding); return buf.buffer; }
https://github.com/tdcare/tdwebrtc
43f07a46812be69d7747ae4404face3db204db7d
github
wodekouwei/qlog
qloglib/src/main/ets/qlog/xlog/CommonUtils.ets
arkts
zipFile
压缩文件到outFile @param inFile 源文件 @param outFile 压缩后文件
public static zipFile(inFile: string, outFile: string): Promise<void> { if (CommonUtils.isNullOrBlank(inFile) || CommonUtils.isNullOrBlank(outFile)) { return Promise.reject(-1) } return CommonUtils.zipFileByOption(inFile, outFile, { level: zip.CompressLevel.COMPRESS_LEVEL_DEFAULT_COMPRESSION, ...
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 zipFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left inFile AST#identifier#Right AST#:#Left : AST#:#...
public static zipFile(inFile: string, outFile: string): Promise<void> { if (CommonUtils.isNullOrBlank(inFile) || CommonUtils.isNullOrBlank(outFile)) { return Promise.reject(-1) } return CommonUtils.zipFileByOption(inFile, outFile, { level: zip.CompressLevel.COMPRESS_LEVEL_DEFAULT_COMPRESSION, ...
https://gitcode.com/wodekouwei/qlog
3d1cf98e2c91e5318d8557bf39449ddfbd11229a
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Scraper/ScraperManager.ets
arkts
getEnabledSources
获取所有启用的刮削源
public getEnabledSources(): ScraperSource[] { return Array.from(this.enabledSources); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getEnabledSources 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 Scra...
public getEnabledSources(): ScraperSource[] { return Array.from(this.enabledSources); }
https://github.com/DaLongZhuaZi/manxia
a1a68327653c56ed3bc9647e312a4a67a7632902
github
youyeyejie/ZhiXing_ActHub
entry/src/main/ets/app/AppShell.ets
arkts
buildDestination
根据 route 名渲染对应 overlay 目的页。
private buildDestination(name: string) { if (name === AppRoute.FOCUS) { FocusOverlayDestination(); } else if (name === AppOverlayRoute.SEARCH) { SearchOverlayDestination({ routeParam: this.resolveSearchRouteParam() }); } else if (name === AppOverlayRoute.ACTION_SHEET) { ActionSheetOverla...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildDestination AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
private buildDestination(name: string) { if (name === AppRoute.FOCUS) { FocusOverlayDestination(); } else if (name === AppOverlayRoute.SEARCH) { SearchOverlayDestination({ routeParam: this.resolveSearchRouteParam() }); } else if (name === AppOverlayRoute.ACTION_SHEET) { ActionSheetOverla...
https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/app/AppShell.ets#L106-L124
a62aeb7301c3c2bba6fd18c8d0be995f5f100d25
github
ASweetBite/HarmonyPulse
entry/src/main/ets/utils/services/MusicImportService.ets
arkts
deleteSongs
删除指定的歌曲,包括清理文件、数据库和本地缓存。 @param context UIAbilityContext,用于文件操作和首选项。 @param globalMusic 全局音乐数据管理实例。 @param songToDelete 要删除的歌曲对象。
public static async deleteSongs( context: common.UIAbilityContext, songToDelete: SongItemType ): Promise<void> { console.info(`开始删除歌曲: ${songToDelete.name} (ID: ${songToDelete.id})`) // 1. 清理本地文件 try { // 清理音频文件 const audioFilePath = `${context.filesDir}/${songToDelete.filePath}` ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left deleteSongs AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left contex...
public static async deleteSongs( context: common.UIAbilityContext, songToDelete: SongItemType ): Promise<void> { console.info(`开始删除歌曲: ${songToDelete.name} (ID: ${songToDelete.id})`) // 1. 清理本地文件 try { // 清理音频文件 const audioFilePath = `${context.filesDir}/${songToDelete.filePath}` ...
https://github.com/ASweetBite/HarmonyPulse/blob/a7fcf153a20bafa29ac1fb8c25743dd5350dc54c/entry/src/main/ets/utils/services/MusicImportService.ets#L233-L268
d1d611cee680b4ef82f5c4f5eb92ee529bf28ff9
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.LightWeightSet.ets
arkts
remove
Removes a value from the LightWeightSet @param key the value to remove from the LightWeightSet @returns the removed value if it was present, undefined otherwise
remove(key: T): T | undefined { return this.buckets.remove(key); }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left remove 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 T AST#identifier#Right A...
remove(key: T): T | undefined { return this.buckets.remove(key); }
https://gitcode.com/iop123123/arkts-static-skills
8467d056126e508d09035dfa5f0aaf051829b4d0
gitcode
openharmony/codelabs
ETSUI/PassNote/entry/src/main/ets/pages/SchedulePage.ets
arkts
aboutToAppear
-------------------------------------------------------------------------- 生命周期方法 -------------------------------------------------------------------------- 页面即将显示时触发 初始化管理器并加载数据
aboutToAppear() { this.initializeData(); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left...
aboutToAppear() { this.initializeData(); }
https://gitcode.com/openharmony/codelabs
2582028dcda90a7b86d78d7db690a0c47cf03a07
gitcode
Explore-In-HMOS-Wearable/how-to-use-uiability-lifecycle
entry/src/main/ets/entryability/EntryAbility.ets
arkts
onBackground
Called when the app goes to the background
onBackground() { LifeCycleLog.add('🟥 onBackground: App sent to background.'); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onBackground AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left ...
onBackground() { LifeCycleLog.add('🟥 onBackground: App sent to background.'); }
https://github.com/Explore-In-HMOS-Wearable/how-to-use-uiability-lifecycle
e230fd40851966d956c5ef146df1956e883ec7fc
github
tdcare/tdwebrtc
example/SignalingClientExample.ets
arkts
joinRoom
============================================================ 房间管理 ============================================================ 加入房间
public joinRoom(roomId: string): void { if (!this.signaling) { console.error('[SignalingExample] 未连接'); return; } this.currentRoomId = roomId; this.signaling.sendJoinRoom(roomId); console.log(`[SignalingExample] 加入房间: ${roomId}`); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left joinRoom AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left roomId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left strin...
public joinRoom(roomId: string): void { if (!this.signaling) { console.error('[SignalingExample] 未连接'); return; } this.currentRoomId = roomId; this.signaling.sendJoinRoom(roomId); console.log(`[SignalingExample] 加入房间: ${roomId}`); }
https://github.com/tdcare/tdwebrtc
a1dfbd20ec9ba425bfb7bcaf818dfdf69bd59536
github
openharmony-sig/applications_calculator
feature/calculation/src/main/ets/model/ExpressionsDataSource.ets
arkts
buildExpList
handle expLists, add property isVisible. @param expLists
private buildExpList(expLists: Array<LooseObject>): void { let preDateId: string = this.dateUtil.today; for (let i = 0; i < expLists.length; i++) { let curItemData: LooseObject = expLists[i]; curItemData.id = curItemData.dbId + this.dateUtil.localStr; this.convertTimeStampToDate(curItemData,...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildExpList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left expLists AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Righ...
private buildExpList(expLists: Array<LooseObject>): void { let preDateId: string = this.dateUtil.today; for (let i = 0; i < expLists.length; i++) { let curItemData: LooseObject = expLists[i]; curItemData.id = curItemData.dbId + this.dateUtil.localStr; this.convertTimeStampToDate(curItemData,...
https://gitee.com/openharmony-sig/applications_calculator.git
e3aea8b643ff68921e5ff07143f4a8cd394a258c
gitee
openharmony/codelabs
Distributed/DistributeDraw/entry/src/main/ets/common/utils/RemoteDeviceUtil.ets
arkts
authenticateDevice
Device connection verification. @param context Ability context. @param device Device information. @param positionList Position List.
authenticateDevice( context: common.UIAbilityContext, device: deviceManager.DeviceInfo, positionList: Position[] ): void { let tmpList = this.trustedDeviceList.filter((item: deviceManager.DeviceInfo) => device.deviceId === item.deviceId); if (tmpList.length > 0) { this.startAbility(context...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left authenticateDevice AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Left common ...
authenticateDevice( context: common.UIAbilityContext, device: deviceManager.DeviceInfo, positionList: Position[] ): void { let tmpList = this.trustedDeviceList.filter((item: deviceManager.DeviceInfo) => device.deviceId === item.deviceId); if (tmpList.length > 0) { this.startAbility(context...
https://gitee.com/openharmony/codelabs.git
9ec98a68d89366dfc393569e2bd62ebd0e2e701e
gitee
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/PieChartModel.ets
arkts
setDrawSlicesUnderHole
Enable or disable the visibility of the inner tips of the slices behind the hole
public setDrawSlicesUnderHole(enable: boolean): void { this.mDrawSlicesUnderHole = enable; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setDrawSlicesUnderHole AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enable AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif...
public setDrawSlicesUnderHole(enable: boolean): void { this.mDrawSlicesUnderHole = enable; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
02ea79f1622397630dd5a4c4d24f28cbb7374907
gitee
openharmony/applications_permission_manager
permissionmanager/src/main/ets/ServiceExtAbility/GrantDialogModel.ets
arkts
needHandlePermission
判断权限是否为当前设备所支持权限 且状态为待授权 @param permission 权限 @param state 权限初始状态 return
private needHandlePermission(permission: Permission, state: number): boolean { let supportPermissions = supportPermission(); if (supportPermissions.includes(permission) && state === Constants.DYNAMIC_OPER) { return true; } else { return false; } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left needHandlePermission 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#id...
private needHandlePermission(permission: Permission, state: number): boolean { let supportPermissions = supportPermission(); if (supportPermissions.includes(permission) && state === Constants.DYNAMIC_OPER) { return true; } else { return false; } }
https://gitee.com/openharmony/applications_permission_manager.git
3b3da121286b3f83d71ed7a24350a76b9f7b5d67
gitee
HarmonyOS_Codelabs/arkts-intermediate-syntax
entry/src/main/ets/model/Device.ets
arkts
getInfo
具体方法:所有设备共享的共性逻辑 作用:返回设备的详细描述信息,无需子类重复实现
getInfo(): string { return `${this.name}(${Location[this.location]} 位置的 ${DeviceType[this.type]} 设备)`; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement_bloc...
getInfo(): string { return `${this.name}(${Location[this.location]} 位置的 ${DeviceType[this.type]} 设备)`; }
https://gitcode.com/HarmonyOS_Codelabs/arkts-intermediate-syntax
944fbf7ecf560bb8387b1d06ab3cc0f8c53cda35
gitcode
LZZLHY/hlib
entry/src/main/ets/utils/Layout.ets
arkts
dialogMaxWidth
Dialog 最大宽度(vp)。
static dialogMaxWidth(bp: Breakpoint): number { if (bp === 'sm') return 360; if (bp === 'md') return 420; if (bp === 'lg') return 480; return 520; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left dialogMaxWidth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bp AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Bre...
static dialogMaxWidth(bp: Breakpoint): number { if (bp === 'sm') return 360; if (bp === 'md') return 420; if (bp === 'lg') return 480; return 520; }
https://github.com/LZZLHY/hlib
9927a0671c05f5febf74410d0cfefcc1695f1e7e
github
Joker-x-dev/CoolMallArkTS
core/network/src/main/ets/datasource/goods/GoodsNetworkDataSourceImpl.ets
arkts
getGoodsCommentPage
分页查询商品评论 @param params 评论分页请求参数 @returns 评论分页数据响应
async getGoodsCommentPage(params: GoodsCommentPageRequest): Promise<NetworkResponse<NetworkPageData<Comment>>> { const resp: AxiosResponse<NetworkResponse<NetworkPageData<Comment>>> = await NetworkClient.http.post("goods/comment/page", params); return resp.data; }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getGoodsCommentPage 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#:#...
async getGoodsCommentPage(params: GoodsCommentPageRequest): Promise<NetworkResponse<NetworkPageData<Comment>>> { const resp: AxiosResponse<NetworkResponse<NetworkPageData<Comment>>> = await NetworkClient.http.post("goods/comment/page", params); return resp.data; }
https://github.com/Joker-x-dev/CoolMallArkTS
63abdc4de62fdeb1a38c46e2f3dbde7d043bf091
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/Boolean.ets
arkts
negate
Inverts this instance value @returns true if value was false and vice versa
public negate(): Boolean { return Boolean.valueOf(!this.value) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left negate 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 Boolean AST#ide...
public negate(): Boolean { return Boolean.valueOf(!this.value) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
71f9a29e73c190c931fc0cdfc8ea54f5dde04f05
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Errors.ets
arkts
constructor
Constructs a new RangeError instance with provided message and error specific information @param { String | undefined } message - Error text @param { ErrorOptions | undefined } options - Error options @syscap SystemCapability.Utils.Lang
constructor(message?: String, options?: ErrorOptions) { super("RangeError", 401, message, options) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left message AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#identifier#Left String AST#identi...
constructor(message?: String, options?: ErrorOptions) { super("RangeError", 401, message, options) }
https://gitcode.com/iop123123/arkts-static-skills
ca9648b508853b443c061e669795536918dde5e4
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelSourceManager.ets
arkts
getAllSources
获取所有书源 排序规则:启用的书源按 customOrder 排序,未启用的书源放在末尾
getAllSources(): NovelSourceInfo[] { const infos: NovelSourceInfo[] = []; this.sources.forEach((source, url) => { infos.push({ id: url, name: source.bookSourceName, url: url, group: source.bookSourceGroup, bookSourceType: source.bookSourceType, enable...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getAllSources 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 NovelSourceInfo AST#identifier#Right AST#[#Left ...
getAllSources(): NovelSourceInfo[] { const infos: NovelSourceInfo[] = []; this.sources.forEach((source, url) => { infos.push({ id: url, name: source.bookSourceName, url: url, group: source.bookSourceGroup, bookSourceType: source.bookSourceType, enable...
https://github.com/DaLongZhuaZi/manxia
573b4e7e0bf8e874c054fbca2c53f2ba203fea4a
github
arkui-x/samples
CodeLab/Cases/feature/customscan/src/main/ets/components/CustomScanCameraComp.ets
arkts
onBackgroundUpdate
应用前后台切换回调,进后台时需要释放扫码资源,进前台时需要重启扫码功能 @returns {void}
onBackgroundUpdate(): void { if (this.isBackground) { this.customScanVM.releaseCustomScan(); } else { this.customScanVM.restartCustomScan(); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onBackgroundUpdate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_express...
onBackgroundUpdate(): void { if (this.isBackground) { this.customScanVM.releaseCustomScan(); } else { this.customScanVM.restartCustomScan(); } }
https://gitcode.com/arkui-x/samples
b183a1e76a451be2c6770f3adb2b870029dbe644
gitcode
Mydstiny/RemoteDeskHarmonyOS
entry/src/main/ets/services/AccountKitService.ets
arkts
getAuthHeaders
生成服务端 API 请求头 优先使用 Access Token (通过 exchangeAuthCode 换取); 如果尚未换取, 使用 ID Token (JWT) 作为 Bearer Token。 ⚠️ Authorization Code 是一次性临时凭证,不能直接作为 Bearer Token 必须通过 OAuth 2.0 Token Endpoint 换取 Access Token 后才可使用
getAuthHeaders(): Record<string, string> { // 优先使用已换取的 Access Token const bearer = this.getAccessToken() || this.getIdToken(); if (!bearer) { hilog.warn(DOMAIN, TAG, '[getAuthHeaders] 无可用的 Bearer Token, 请先调用 exchangeAuthCode'); } return { 'Authorization': "Bearer " + bearer, 'X-U...
AST#program#Left AST#expression_statement#Left AST#sequence_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getAuthHeaders AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#...
getAuthHeaders(): Record<string, string> { // 优先使用已换取的 Access Token const bearer = this.getAccessToken() || this.getIdToken(); if (!bearer) { hilog.warn(DOMAIN, TAG, '[getAuthHeaders] 无可用的 Bearer Token, 请先调用 exchangeAuthCode'); } return { 'Authorization': "Bearer " + bearer, 'X-U...
https://github.com/Mydstiny/RemoteDeskHarmonyOS
03e199096fc5f84f1e6047bfb203dfa234d472ab
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets
arkts
random
Returns a new Decimal with a random value equal to or greater than 0 and less than 1, and with `significantDigits` significant digits (or less if trailing zeros are produced). @param { double } significantDigits Significant digits. Integer, 0 to MAX_DIGITS inclusive. @returns { Decimal } the Decimal type @throws { Busi...
static random(significantDigits: double): Decimal { return Utils.random(significantDigits); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left random AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left significantDigits AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left double AST#i...
static random(significantDigits: double): Decimal { return Utils.random(significantDigits); }
https://gitcode.com/iop123123/arkts-static-skills
7bba7e0435e5f15978abe0721505e38155aaef94
gitcode
qiuhaotc/HarmonyOSPlayground
entry/src/main/ets/utils/BillStatisticsUtil.ets
arkts
calculateStatistics
统计账单数据
static calculateStatistics(bills: BillModel[]): BillStatistics { const stats = new BillStatistics(); bills.forEach((bill) => { if (bill.type === BillType.INCOME) { stats.totalIncome += bill.amount; } else { stats.totalExpense += bill.amount; ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left calculateStatistics AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bills AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_e...
static calculateStatistics(bills: BillModel[]): BillStatistics { const stats = new BillStatistics(); bills.forEach((bill) => { if (bill.type === BillType.INCOME) { stats.totalIncome += bill.amount; } else { stats.totalExpense += bill.amount; ...
https://github.com/qiuhaotc/HarmonyOSPlayground
4fcd038a2b65a493cb73b0b754f291c8e60a0dcd
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/EnhancedBackupManager.ets
arkts
exportNovelTxtTocRules
导出TXT目录识别规则
private async exportNovelTxtTocRules(): Promise<NovelTxtTocRuleBackup[]> { try { const sql = 'SELECT * FROM novel_txt_toc_rule ORDER BY serialNumber ASC'; const results = await this.dbManager.querySql(sql); const items: NovelTxtTocRuleBackup[] = []; for (const record of results) { ...
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 exportNovelTxtTocRules AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#...
private async exportNovelTxtTocRules(): Promise<NovelTxtTocRuleBackup[]> { try { const sql = 'SELECT * FROM novel_txt_toc_rule ORDER BY serialNumber ASC'; const results = await this.dbManager.querySql(sql); const items: NovelTxtTocRuleBackup[] = []; for (const record of results) { ...
https://github.com/DaLongZhuaZi/manxia
12c733f5cd36bf621ac98760a9d5860a26003512
github
Octo-o-o-o/harmonyos-ai-workspace
samples/templates/error-event-builder/ErrorEventBuilder.ets
arkts
failAndUnregister
Same as `reportError` but ALSO removes the entry from the active map. Use AFTER the upload has been registered (so an `active.delete` is needed for cleanup). Naming the helper after the side-effect — not generalising — keeps the intent clear at call sites.
private failAndUnregister( corrId: string, code: string, message: string, retryable: boolean, ): void { this.reportError(corrId, code, message, retryable) this.active.delete(corrId) }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left failAndUnregister AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left corrId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie...
private failAndUnregister( corrId: string, code: string, message: string, retryable: boolean, ): void { this.reportError(corrId, code, message, retryable) this.active.delete(corrId) }
https://github.com/Octo-o-o-o/harmonyos-ai-workspace
f79e9f62f81ae3a084eac4e75286a3f1725e4554
github
cheinlu/HarmonyOS-groundhog-charging-system
TbsChargeHarmonyOs/feature/charge/src/main/ets/view/ChargeListView.ets
arkts
clickPileItem
单个桩点击处理
clickPileItem(item: PileType) { if (item.state === 0) { this.chargeItemController?.close() router.pushNamedRoute({ name: 'ChargingPage', params: { "pileId":item.id, "pileCode":item.code, "stationName":item.stationName } }) } else if (item...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left clickPileItem AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left item AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left PileType AST#identifier#Rig...
clickPileItem(item: PileType) { if (item.state === 0) { this.chargeItemController?.close() router.pushNamedRoute({ name: 'ChargingPage', params: { "pileId":item.id, "pileCode":item.code, "stationName":item.stationName } }) } else if (item...
https://github.com/cheinlu/HarmonyOS-groundhog-charging-system
f24f61e7336b1b5cdaa35456aca39c2e86391e0e
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/TrackpadGestureHandler.ets
arkts
onUp
==================== Up ====================
private onUp(touches: TouchObject[], changed: TouchObject[]): void { const now = Date.now(); const remaining = Math.max(0, this.activeCount - changed.length); // 双击待定态抬起 → 发送双击 if (this.isPotentialDoubleClick && remaining === 0) { this.cancelDoubleTapHoldTimer(); this.isPotentialDoubleCli...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left private AST#identifier#Right AST#ERROR#Left AST#identifier#Left onUp AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left touches AST#identifier#Right AST#:#Left : AST#:#Right AST#...
private onUp(touches: TouchObject[], changed: TouchObject[]): void { const now = Date.now(); const remaining = Math.max(0, this.activeCount - changed.length); // 双击待定态抬起 → 发送双击 if (this.isPotentialDoubleClick && remaining === 0) { this.cancelDoubleTapHoldTimer(); this.isPotentialDoubleCli...
https://github.com/AlkaidLab/moonlight-harmony
b16ca747b073c0bc8822770ddd14cb4c66c61cd5
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/entryability/EntryAbility.ets
arkts
unregisterAppStateCallback
取消应用状态监听
private unregisterAppStateCallback(): void { if (this.appStateCallback) { try { const applicationContext = this.context.getApplicationContext(); applicationContext.off('applicationStateChange', this.appStateCallback); hilog.info(DOMAIN, TAG, '%{public}s', 'App state callback unregist...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left unregisterAppStateCallback 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#Ri...
private unregisterAppStateCallback(): void { if (this.appStateCallback) { try { const applicationContext = this.context.getApplicationContext(); applicationContext.off('applicationStateChange', this.appStateCallback); hilog.info(DOMAIN, TAG, '%{public}s', 'App state callback unregist...
https://github.com/AlkaidLab/moonlight-harmony
5b0045b5b29eb820800489b57a90877a2d0ba9d1
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets
arkts
constructor
Creates a new Blob object containing a concatenation of the given sources. <ArrayBuffer>, <TypedArray>, <DataView>, and <Buffer> sources are copied into the 'Blob' and can therefore be safely modified after the 'Blob' is created. String sources are encoded as UTF-8 byte sequences and copied into the Blob. Unmatched sur...
constructor(sources: ArrayUnionType, options?: BlobOptions) { this.arrBuffer = this.flattenData(sources); this.blobSize = this.arrBuffer.byteLength; if (options != undefined) { this.blobType = options!.type ? options!.type! : '' } else { ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left sources AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ArrayUnionType AST#identif...
constructor(sources: ArrayUnionType, options?: BlobOptions) { this.arrBuffer = this.flattenData(sources); this.blobSize = this.arrBuffer.byteLength; if (options != undefined) { this.blobType = options!.type ? options!.type! : '' } else { ...
https://gitcode.com/iop123123/arkts-static-skills
e3b2732f4c4875bdda431dc5bf1d6e9528ceb717
gitcode
openharmony-sig/ohos_easyui
easyui/src/main/ets/common/components/TextInput.ets
arkts
build
输入框类型
build(){ Column(){ Row(){ Row(){ Stack(){ Image($rawfile(this.iconUrl)) .height(30) .margin({top: 5, left: 5}) } .width("15%") Stack(){ TextInput({ placeholder: this.placeholder}) .placeholderC...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#object#Left AST#{#Left { AST#{#Right AST#method_def...
build(){ Column(){ Row(){ Row(){ Stack(){ Image($rawfile(this.iconUrl)) .height(30) .margin({top: 5, left: 5}) } .width("15%") Stack(){ TextInput({ placeholder: this.placeholder}) .placeholderC...
https://gitee.com/openharmony-sig/ohos_easyui.git
01e7fdab1e8f5db2b89e4ba4b71918ea9be81302
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Compress/ComicArchiveManager.ets
arkts
readMetadata
读取元数据
private async readMetadata(dir: string): Promise<ArchiveMetadata | null> { try { // 尝试读取JSON元数据 const jsonPath = `${dir}/metadata.json`; if (await this.sandboxManager.exists(jsonPath)) { const content = await this.sandboxManager.readTextFile(jsonPath); return SafeUtils.parseObj(c...
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 readMetadata AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dir AST#identifier#Right AST#:#Left : AS...
private async readMetadata(dir: string): Promise<ArchiveMetadata | null> { try { // 尝试读取JSON元数据 const jsonPath = `${dir}/metadata.json`; if (await this.sandboxManager.exists(jsonPath)) { const content = await this.sandboxManager.readTextFile(jsonPath); return SafeUtils.parseObj(c...
https://github.com/DaLongZhuaZi/manxia
5d02bcddf6b4a6c628103757843bc61366f9abd2
github
Mydstiny/RemoteDeskHarmonyOS
entry/src/main/ets/services/CloudStore.ets
arkts
pushTable
手动触发推送
pushTable(table: string): void { if (!this.store) { return; } this.store.cloudSync(relationalStore.SyncMode.SYNC_MODE_TIME_FIRST, [table], (p: Object) => { const pd = p as Record<string, Object>; hilog.info(0x0001, 'CloudSync', "pushTable 进度 " + table + ": status=" + pd['status...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left pushTable AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left table AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#...
pushTable(table: string): void { if (!this.store) { return; } this.store.cloudSync(relationalStore.SyncMode.SYNC_MODE_TIME_FIRST, [table], (p: Object) => { const pd = p as Record<string, Object>; hilog.info(0x0001, 'CloudSync', "pushTable 进度 " + table + ": status=" + pd['status...
https://github.com/Mydstiny/RemoteDeskHarmonyOS
afc5a93b083d27073ae2a90947c627596d03a46a
github
huaiminqin/TankWar-Master-with-Many-Tasks
util/src/main/ets/services/GameService.ets
arkts
getMissionStatusColor
获取任务状态颜色
static getMissionStatusColor(status: MissionStatus): string { switch (status) { case MissionStatus.COMPLETED: return '#4CAF50'; case MissionStatus.FAILED: return '#F44336'; case MissionStatus.IN_PROGRESS: return '#2196F3'; default: return '#9E9E9E'; } }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getMissionStatusColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left status AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi...
static getMissionStatusColor(status: MissionStatus): string { switch (status) { case MissionStatus.COMPLETED: return '#4CAF50'; case MissionStatus.FAILED: return '#F44336'; case MissionStatus.IN_PROGRESS: return '#2196F3'; default: return '#9E9E9E'; } }
https://github.com/huaiminqin/TankWar-Master-with-Many-Tasks
98bf951f1144acbfa933095a1f0ebf18433f8b3e
github
openharmony/web_webview
interfaces/kits/ani/webview/ets/@ohos.web.webview.ets
arkts
getUrl
Returns the proxy URL. @returns { string } The proxy URL. @syscap SystemCapability.Web.Webview.Core @since 20
getUrl(): string { return this.url; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement_block...
getUrl(): string { return this.url; }
https://gitee.com/openharmony/web_webview.git
2557f125f83c8dee91f3bbd4c9201deac6bddabe
gitee
YANGZX22/Voot
entry/src/main/ets/services/SherpaWhisperMicService.ets
arkts
start
Start mic capture and buffer PCM. Decodes: - partial results every ~1.2s (isFinal=false) - one final result when stop() is called (isFinal=true)
start(onResult: AsrResultCallback, onError: AsrErrorCallback): void { this.onResult = onResult; this.onError = onError; if (!this.recognizer) { const msg = 'start: recognizer not initialized. Call init() first.'; console.error(msg); if (this.onError) { this.onError(msg); }...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left start AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left onResult AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left AsrResultCallback AST#identifier#Right AST#,#L...
start(onResult: AsrResultCallback, onError: AsrErrorCallback): void { this.onResult = onResult; this.onError = onError; if (!this.recognizer) { const msg = 'start: recognizer not initialized. Call init() first.'; console.error(msg); if (this.onError) { this.onError(msg); }...
https://github.com/YANGZX22/Voot
3d0ff76e6366f3a76a7d6874243697188d9cf3e5
github
yang-kun-long/HarmonyAccounting
entry/src/main/ets/pages/MainPage.ets
arkts
aboutToAppear
在组件即将出现时执行的操作。 此方法用于在组件出现之前获取并设置账户数据。
aboutToAppear() { // 获取RDB存储,回调函数中将执行对数据库的操作 this.AccountTable.getRdbStore(() => { // 查询账户数据,从0开始,返回所有匹配的结果 this.AccountTable.query(0, (result: AccountData[]) => { // 将查询结果赋值给accounts属性 this.accounts = result; }, true); }); }
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() { // 获取RDB存储,回调函数中将执行对数据库的操作 this.AccountTable.getRdbStore(() => { // 查询账户数据,从0开始,返回所有匹配的结果 this.AccountTable.query(0, (result: AccountData[]) => { // 将查询结果赋值给accounts属性 this.accounts = result; }, true); }); }
https://github.com/yang-kun-long/HarmonyAccounting
22ca6168ead60c0bb9ac09f6a0807bb4706da424
github
YANGZX22/Voot
entry/src/main/ets/entryformability/EntryFormAbility.ets
arkts
removeFormId
Helper to remove formId from persistent storage
private async removeFormId(formId: string): Promise<void> { try { const pref = await preferences.getPreferences(this.context, PREF_FILE); const idsStr = await pref.get(FORM_IDS_KEY, '[]') as string; let ids: string[] = JSON.parse(idsStr); ids = ids.filter((id: string) => id !== formId); ...
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 removeFormId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left formId AST#identifier#Right AST#:#Left :...
private async removeFormId(formId: string): Promise<void> { try { const pref = await preferences.getPreferences(this.context, PREF_FILE); const idsStr = await pref.get(FORM_IDS_KEY, '[]') as string; let ids: string[] = JSON.parse(idsStr); ids = ids.filter((id: string) => id !== formId); ...
https://github.com/YANGZX22/Voot
64f8cad13a5762c6afbf05ce57296b616250769e
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Atomics.ets
arkts
isLockFree
isLockFree(n) returns true if Atomic operations for typed arrays where "BYTER_PER_ELEMENT == n" use hardware atomics instructions instead of locks. Warning: currently, all Atomic operations use locks, but isLockFree(4) following the ECMA specification returns true.
public isLockFree(byteSize: int): boolean { return byteSize == 4 }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isLockFree AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left byteSize AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifie...
public isLockFree(byteSize: int): boolean { return byteSize == 4 }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
69fdfacc449b1211009ecdc2db22b03e9b203454
gitee
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/hosts/system/windows/classes/meowUiHost.ets
arkts
setWindowAlias
Sets the alias of the window.
async setWindowAlias(newAlias: string) { this.windowAlias = newAlias; await this.updateWindowTitle(); // Zones names if (this.isZone) { // Replace the last part of current workingDir to the newAlias const oldDir = this.workingDir; this.workingDir = this.workingDir.replace(/\/[^/]+$/...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left setWindowAlias AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left newAlias AST#identifier#Right AST#type_annotation#Left AST#:#Lef...
async setWindowAlias(newAlias: string) { this.windowAlias = newAlias; await this.updateWindowTitle(); // Zones names if (this.isZone) { // Replace the last part of current workingDir to the newAlias const oldDir = this.workingDir; this.workingDir = this.workingDir.replace(/\/[^/]+$/...
https://github.com/awaLiny2333/LinysBrowser_NEXT
d0e4130d4c5548218d50ecb3614550c75ed7ae2f
github
Nekofox-POT/LinMusic
entry/src/main/ets/pages/setting/setting_index.ets
arkts
trigger_press
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 扩展函数 // ////////// 按压回弹 //
trigger_press(idx: number) { this.press_idx = idx setTimeout(() => { this.press_idx = -1 }, 150) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left trigger_press AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left idx AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right ...
trigger_press(idx: number) { this.press_idx = idx setTimeout(() => { this.press_idx = -1 }, 150) }
https://github.com/Nekofox-POT/LinMusic
da95da1809e6e578c00fa9234b7f2764b438875d
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets
arkts
asinh
Return a new Decimal whose value is the inverse of the hyperbolic sine of `n`, rounded to `precision` significant digits using rounding mode `rounding`. @param { Value } n {double | string | Decimal} A value in radians. @returns { Decimal } the Decimal type @throws { BusinessError } 10200060 - Precision limit exceeded.
static asinh(n: Value): Decimal { return new Decimal(n).asinh(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left asinh AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left n AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#...
static asinh(n: Value): Decimal { return new Decimal(n).asinh(); }
https://gitcode.com/iop123123/arkts-static-skills
ae553b67d5b76c94dcd40dc1fb510fa7f2e86fd7
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/MangaSourceConfigParser.ets
arkts
hasWorkflow
检查图源是否支持指定工作流 @param config 图源配置 @param workflowName 工作流名称 @returns 是否支持
hasWorkflow(config: MangaSourceConfig, workflowName: string): boolean { return this.getWorkflow(config, workflowName) !== undefined; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasWorkflow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left MangaSourceConfig AST#identifier#Right AST...
hasWorkflow(config: MangaSourceConfig, workflowName: string): boolean { return this.getWorkflow(config, workflowName) !== undefined; }
https://github.com/DaLongZhuaZi/manxia
5c38196c183c0e5f83b66ab37a282457d286f79c
github
openharmony/applications_launcher
feature/recents/src/main/ets/default/common/uicomponents/RecentMissionAppName.ets
arkts
updateName
Update the app name of recent missions.
updateName(): void { if (this.bundleName && this.bundleName.length > 0 && this.mResourceManager) { this.mResourceManager.getAppNameWithCache(this.labelId, this.bundleName, this.moduleName, this.appName, this.appNameLoadCallback); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left...
updateName(): void { if (this.bundleName && this.bundleName.length > 0 && this.mResourceManager) { this.mResourceManager.getAppNameWithCache(this.labelId, this.bundleName, this.moduleName, this.appName, this.appNameLoadCallback); } }
https://gitee.com/openharmony/applications_launcher.git
8e27080106aca80134d0624e045dfce94e0e5a10
gitee
arkui-x/samples
CodeLab/Cases/feature/fadingedge/src/main/ets/mainpage/MainPage.ets
arkts
promptToast
示例提示toast窗口
promptToast() { promptAction.showToast({ message: $r('app.string.fadingedge_prompt_message'), duration: Const.PROMPT_TOAST_DURATION }) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left promptToast 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 A...
promptToast() { promptAction.showToast({ message: $r('app.string.fadingedge_prompt_message'), duration: Const.PROMPT_TOAST_DURATION }) }
https://gitcode.com/arkui-x/samples
25d1bee38dbf05a37104eb75b3b96bbcb025e62b
gitcode
qiuhaotc/Sunshine_HarmonyOS
entry/src/main/ets/calculator/AdvancedSunshineCalculator.ets
arkts
getSolarPosition
计算太阳位置
private getSolarPosition( latitude: number, longitude: number, dayOfYear: number, minutes: number, timeZone: number ): SunPosition { // 简化的太阳位置计算 const localHour = minutes / 60; // 当地时间(小时) // 时间方程校正 const eqTime = this.getEquationOfTime(dayOfYear); // 标准经线 cons...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getSolarPosition AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left latitude AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#n...
private getSolarPosition( latitude: number, longitude: number, dayOfYear: number, minutes: number, timeZone: number ): SunPosition { // 简化的太阳位置计算 const localHour = minutes / 60; // 当地时间(小时) // 时间方程校正 const eqTime = this.getEquationOfTime(dayOfYear); // 标准经线 cons...
https://github.com/qiuhaotc/Sunshine_HarmonyOS
694d25413c50aa11b67e0a25c22441e97e5641ac
github
somnio-software/my-bot-pal
entry/src/main/ets/utils/LocationService.ets
arkts
formatLocationData
Formats the location data from the geoLocationManager to a simpler object @param location The location from geoLocationManager @returns LocationData object with formatted coordinates
private formatLocationData(location: geoLocationManager.Location): LocationData { return { latitude: location.latitude, longitude: location.longitude, accuracy: location.accuracy, altitude: location.altitude, direction: location.direction, speed: location.speed, timeStamp...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left formatLocationData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left location AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member...
private formatLocationData(location: geoLocationManager.Location): LocationData { return { latitude: location.latitude, longitude: location.longitude, accuracy: location.accuracy, altitude: location.altitude, direction: location.direction, speed: location.speed, timeStamp...
https://github.com/somnio-software/my-bot-pal
ca389914350a039c0425f7099c6a6d8b10c99ede
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test5_original_index.ets
arkts
testStringSearch
=== String search and manipulation ===
function testStringSearch(): number { let text: string = 'The quick brown fox jumps over the lazy dog'; let foxIdx: number = text.indexOf('fox'); let dogIdx: number = text.lastIndexOf('dog'); let substr: string = text.substring(foxIdx, foxIdx + 3); let upper: string = substr.toUpperCase(); return foxIdx + d...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testStringSearch 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 testStringSearch(): number { let text: string = 'The quick brown fox jumps over the lazy dog'; let foxIdx: number = text.indexOf('fox'); let dogIdx: number = text.lastIndexOf('dog'); let substr: string = text.substring(foxIdx, foxIdx + 3); let upper: string = substr.toUpperCase(); return foxIdx + d...
https://github.com/miaochiahao/ark-ghidra
8e71ebd473071d366fe220b1c5da03b5afd4c4da
github
Your-USTC/DailyNic_HMOS
entry/src/main/ets/utils/tools.ets
arkts
getFileExtension
提取文件路径的扩展名(不含分隔符`.`) @param filePath 字符串格式的文件路径 @returns 扩展名(无扩展名返回空字符串)
function getFileExtension(filePath: string): string { // 处理空字符串、纯空格等无效路径 if (!filePath || filePath.trim() === '') { return ''; } // 统一处理路径分隔符(兼容 Windows\ 和 Unix/),转为小写便于统一判断 const normalizedPath = filePath.trim().toLowerCase(); // 定位最后一个`.`的位置(扩展名的分隔符) const lastDotIndex = normalizedPath.lastIndexOf...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getFileExtension AST#identifier#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 : A...
function getFileExtension(filePath: string): string { // 处理空字符串、纯空格等无效路径 if (!filePath || filePath.trim() === '') { return ''; } // 统一处理路径分隔符(兼容 Windows\ 和 Unix/),转为小写便于统一判断 const normalizedPath = filePath.trim().toLowerCase(); // 定位最后一个`.`的位置(扩展名的分隔符) const lastDotIndex = normalizedPath.lastIndexOf...
https://github.com/Your-USTC/DailyNic_HMOS
2082579c62f75dcecc3ee03fb5fdd9196d618dcd
github
openharmony-sig/flutter_sqflite
sqflite/ohos/src/main/ets/io/flutter/plugins/sqflite/SqflitePlugin.ets
arkts
handleGetPlatformVersionCall
/获取设备信息
async handleGetPlatformVersionCall(call: MethodCall, result: MethodResult): Promise<void> { DatabaseHelper.getPlatformVersion(call, result); }
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left handleGetPlatformVersionCall AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left call AST#identifier#Right AST#type_annota...
async handleGetPlatformVersionCall(call: MethodCall, result: MethodResult): Promise<void> { DatabaseHelper.getPlatformVersion(call, result); }
https://gitee.com/openharmony-sig/flutter_sqflite.git
a1f39620ad9078153853b2d34fb7e411a64b2739
gitee