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
Cool_foolisher1/ArkTSRepository
GuardianAssistant/entry/src/main/ets/pages/Tabs/MyTabsComp.ets
arkts
getDeviceInfo
获取设备产品名称
getDeviceInfo() { // 模拟器 emulator this.deviceName = deviceInfo.marketName }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getDeviceInfo 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...
getDeviceInfo() { // 模拟器 emulator this.deviceName = deviceInfo.marketName }
https://gitcode.com/Cool_foolisher1/ArkTSRepository
31ae26b8ef1ad12eaaf5cdb63f7c3841ee1f4aa5
gitcode
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ets
arkts
isAsyncFunction
Check whether the entered value is of type asyncfunction. @param { Object } value - A AsyncFunction value @returns { boolean } Returns true if the value is a built-in AsyncFunction instance. Since the current interface cannot be correctly determined, it returns false by default
isAsyncFunction(value: Object): boolean { if (value instanceof Function) { return reflect.isFuncObjAsync(value); } return false; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isAsyncFunction 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 ...
isAsyncFunction(value: Object): boolean { if (value instanceof Function) { return reflect.isFuncObjAsync(value); } return false; }
https://gitcode.com/iop123123/arkts-static-skills
2c85a8a2a8f2fd2298c32ebd90884c2fd8b9abb8
gitcode
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnSliderViewModel.ets
arkts
setSliderValue1
设置滑块组件1的当前值 @param value 新的滑块值
setSliderValue1(value: number): void { this.sliderValue1 = value; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setSliderValue1 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ...
setSliderValue1(value: number): void { this.sliderValue1 = value; }
https://github.com/codelably/tuniao-ui
20d8da48b71aacbfb3600b2bb2dbaf252a899123
github
arkui-x/samples
CodeLab/Cases/feature/customscan/src/main/ets/components/CommonCodeLayout.ets
arkts
getOffset
计算水平或者竖直的偏移量
getOffset(coordinateAxis: string, location: Array<number>): number { if (coordinateAxis === 'x') { return this.setOffsetXByOrientation(location); } return this.setOffsetYByOrientation(location); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getOffset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left coordinateAxis AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , AST...
getOffset(coordinateAxis: string, location: Array<number>): number { if (coordinateAxis === 'x') { return this.setOffsetXByOrientation(location); } return this.setOffsetYByOrientation(location); }
https://gitcode.com/arkui-x/samples
0f733e79a90aaae3c00f30519f7b7a7b2dc33a9a
gitcode
Countly/countly-sdk-hos
library/src/main/ets/internal/ModuleBase.ets
arkts
onInit
Called once after all modules have been constructed and config is frozen.
public onInit(): Promise<void> { return Promise.resolve(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left onInit 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_expression#Left A...
public onInit(): Promise<void> { return Promise.resolve(); }
https://github.com/Countly/countly-sdk-hos
ed10590423269cc8390fe068825583fa889def14
github
Yebingiscn/SweetVideo
entry/src/main/ets/component/VideoItemComponent/VideoItemComponent.ets
arkts
isSearchEmpty
检查是否是搜索无结果状态
isSearchEmpty(searchValue: string): boolean { // 有搜索值且结果为空 return searchValue.length > 0 && this.videoDataSource.totalCount() == 0 }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isSearchEmpty AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left searchValue AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AS...
isSearchEmpty(searchValue: string): boolean { // 有搜索值且结果为空 return searchValue.length > 0 && this.videoDataSource.totalCount() == 0 }
https://github.com/Yebingiscn/SweetVideo
571a6bdbe405ed8dd89d5b5aa205e2fd320f2f37
github
openharmony/codelabs
ETSUI/RoundThreadScheduler/entry/src/main/ets/scheduler/RoundThreadScheduler.ets
arkts
getResult
获取最终执行结果
getResult(): number { return this.finalResult; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getResult AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statement_bl...
getResult(): number { return this.finalResult; }
https://gitcode.com/openharmony/codelabs
043e0342055b4169574488caecba8c8cc91d2eb6
gitcode
webabcd/HarmonyDemo
entry/src/main/ets/pages/animation/AnimatableExtendDemo.ets
arkts
animatableEndPoint
@AnimatableExtend - 用于为指定的组件自定义可动画的属性方法 仅支持在全局定义 函数的参数类型仅支持 number 或 AnimatableArithmetic<T> 对象 为 Line 组件定义一个名为 animatableEndPoint() 的属性方法,此属性方法是可动画的,即可以通过 animation() 实现属性动画 animatableEndPoint() 接收一个 Point 类型(其实现了 AnimatableArithmetic<T> 接口)的参数,且函数体内只能调用 Line 的属性方法
@AnimatableExtend(Line) function animatableEndPoint(point: Point) { .endPoint([point.x, point.y]) }
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#call_expression#Left AST#identifier#Left AnimatableExtend AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left Line AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_ex...
@AnimatableExtend(Line) function animatableEndPoint(point: Point) { .endPoint([point.x, point.y]) }
https://github.com/webabcd/HarmonyDemo
6861a91edd0381326c905bc509fc7647384e808c
github
Vincent-Leon/zotero-harmony
entry/src/main/ets/api/ZoteroClient.ets
arkts
getUserId
The cached userID, or undefined if verifyKey() hasn't run yet.
getUserId(): number | undefined { return this.userId; }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getUserId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left...
getUserId(): number | undefined { return this.userId; }
https://github.com/Vincent-Leon/zotero-harmony
a820830758f383e5d9a263e317dd74a406471b65
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/CoverCacheManager.ets
arkts
saveTempManga
保存临时漫画信息(使用UPSERT减少查询)
async saveTempManga( sourceId: number, externalId: string, title: string, coverUrl: string ): Promise<void> { try { const id = `${sourceId}_${externalId}`; const now = Date.now(); // 使用INSERT OR REPLACE减少一次查询 const sql = `INSERT INTO temp_manga_info (id, sourceId, ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left saveTempManga AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceId AST#identifier#Right AST#type_annotation#Left AST#:#Left...
async saveTempManga( sourceId: number, externalId: string, title: string, coverUrl: string ): Promise<void> { try { const id = `${sourceId}_${externalId}`; const now = Date.now(); // 使用INSERT OR REPLACE减少一次查询 const sql = `INSERT INTO temp_manga_info (id, sourceId, ...
https://github.com/DaLongZhuaZi/manxia
7675091bf65b27f0e9950d6de2860f456f9eda47
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Boolean.ets
arkts
toString
Converts the primitive to a string @param { boolean } v value to be converted @returns { string } The string representation of the boolean value @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static toString(v: boolean): string { if (v) { return 'true'; } return 'false'; }
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 toString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left v AST#identifier#Right AST#:#Left : AST#:#Righ...
public static toString(v: boolean): string { if (v) { return 'true'; } return 'false'; }
https://gitcode.com/iop123123/arkts-static-skills
fb7fbd34191eb5c782c9ab368ecdee8849e473a2
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Storage/SandboxManager.ets
arkts
readTextFile
读取文本文件
public async readTextFile(path: string, encoding: string = 'utf-8'): Promise<string> { try { const buffer = await this.readFile(path); const decoder = new util.TextDecoder(encoding); return decoder.decodeToString(new Uint8Array(buffer)); } catch (error) { logger.error(TAG, `读取文本文件失败: $...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left readTextFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#...
public async readTextFile(path: string, encoding: string = 'utf-8'): Promise<string> { try { const buffer = await this.readFile(path); const decoder = new util.TextDecoder(encoding); return decoder.decodeToString(new Uint8Array(buffer)); } catch (error) { logger.error(TAG, `读取文本文件失败: $...
https://github.com/DaLongZhuaZi/manxia
efbbfe410b9b0988c462617484b5df48208466a4
github
offlinecat-dev/OCNetORM
src/main/ets/mapping/TypedEntityData.ets
arkts
clear
清空所有属性
clear(): void { this.data.clear() this.relatedData.clear() }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clear 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 A...
clear(): void { this.data.clear() this.relatedData.clear() }
https://github.com/offlinecat-dev/OCNetORM
43c23d38c425e56accd991327f0206bb5a3318f0
github
aimilin6688/KeePassHO
entry/src/main/ets/services/CrashLogService.ets
arkts
processCrashEventInfo
处理崩溃事件信息
private processCrashEventInfo(eventInfo: hiAppEvent.AppEventInfo): void { hilog.info(DOMAIN, TAG, 'HiAppEvent eventInfo.domain=%{public}s', eventInfo.domain); hilog.info(DOMAIN, TAG, 'HiAppEvent eventInfo.name=%{public}s', eventInfo.name); hilog.info(DOMAIN, TAG, 'HiAppEvent eventInfo.eventType=%{public}d...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left processCrashEventInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left eventInfo AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#me...
private processCrashEventInfo(eventInfo: hiAppEvent.AppEventInfo): void { hilog.info(DOMAIN, TAG, 'HiAppEvent eventInfo.domain=%{public}s', eventInfo.domain); hilog.info(DOMAIN, TAG, 'HiAppEvent eventInfo.name=%{public}s', eventInfo.name); hilog.info(DOMAIN, TAG, 'HiAppEvent eventInfo.eventType=%{public}d...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/CrashLogService.ets#L177-L229
2cea8c9e517ce99b937155e1b273014a1b8e3c96
github
openharmony/codelabs
ETSUI/LifeTrack/entry/src/main/ets/dao/ContactDao.ets
arkts
getAllContacts
查询所有联系人(按首字母排序)
public async getAllContacts(): Promise<ContactsItem[]> { try { const rdbStore = await this.ensureDBInitialized(); // 创建查询条件,按首字母和姓名排序 const predicates = new relationalStore.RdbPredicates('contacts'); predicates.orderByAsc('initial') .orderByAsc('name'); // 查询数据 const ...
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 getAllContacts AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:...
public async getAllContacts(): Promise<ContactsItem[]> { try { const rdbStore = await this.ensureDBInitialized(); // 创建查询条件,按首字母和姓名排序 const predicates = new relationalStore.RdbPredicates('contacts'); predicates.orderByAsc('initial') .orderByAsc('name'); // 查询数据 const ...
https://gitcode.com/openharmony/codelabs
0b588a695948c24487c48a19872d05f52d83316c
gitcode
openharmony/applications_mms
entry/src/main/ets/pages/conversation/conversationController.ets
arkts
dealSessionDraft
When the draft logic is set, the text content is empty and the page is not created, the session list data needs to be updated.
dealSessionDraft(source) { let valueBucket: LooseObject = { 'content': common.string.EMPTY_STR, 'has_draft': common.has_draft.NO, 'time': new Date().getTime(), 'has_mms': common.has_mms.NO, 'has_attachment': common.has_attachment.NO } // Query the last content in the list ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left dealSessionDraft AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left source AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#...
dealSessionDraft(source) { let valueBucket: LooseObject = { 'content': common.string.EMPTY_STR, 'has_draft': common.has_draft.NO, 'time': new Date().getTime(), 'has_mms': common.has_mms.NO, 'has_attachment': common.has_attachment.NO } // Query the last content in the list ...
https://gitee.com/openharmony/applications_mms.git
83da8124432fcddf6813705a7799dd041f6bf0c2
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
of
Returns a new array from a set of elements. @returns { Int32Array } - a new Int32Array @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static of(): Int32Array { return new Int32Array(0) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#of#Left of AST#of#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression...
public static of(): Int32Array { return new Int32Array(0) }
https://gitcode.com/iop123123/arkts-static-skills
102ac65ff7cea27466ca7bae364e333c76254b7d
gitcode
LJ666-ui/harmony-health-care
entry/src/main/ets/common/utils/TokenManager.ets
arkts
getFamilyToken
获取家属Token
static getFamilyToken(): string | null { return SettingsUtil.get('familyToken'); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getFamilyToken AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left ...
static getFamilyToken(): string | null { return SettingsUtil.get('familyToken'); }
https://github.com/LJ666-ui/harmony-health-care
5c77f60be6a138b097f4a61fa819df7b0d3bc079
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets
arkts
setMonth
Sets the month for a specified date according to the currently set year. @param { int } month new month @param { int } date @returns { long } get new date value @syscap SystemCapability.Utils.Lang @FaAndStageModel
public setMonth(month: int, date: int): long { this.setMonth(month); this.setDate(date); return this.ms; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setMonth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left month AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#Rig...
public setMonth(month: int, date: int): long { this.setMonth(month); this.setDate(date); return this.ms; }
https://gitcode.com/iop123123/arkts-static-skills
6fa998cd601e60e58ae317f4065b9dcd3e2932c6
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Console.ets
arkts
render
Renders the DataFrame as an array of strings @returns {Array<String>} Array of formatted table rows
public render(): Array<String> { if (this.tableModel.size == 0) { return new Array<string>(); } // row1 const topBorder = this.buildBorderRow('─', '┬', '┌', '┐'); // row2 const separator = this.buildBorderRow('─', '┼', '├', '┤'); // row3 c...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left render AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left AST#iden...
public render(): Array<String> { if (this.tableModel.size == 0) { return new Array<string>(); } // row1 const topBorder = this.buildBorderRow('─', '┬', '┌', '┐'); // row2 const separator = this.buildBorderRow('─', '┼', '├', '┤'); // row3 c...
https://gitcode.com/iop123123/arkts-static-skills
43a76de4668be4393d4143febce5fb4d91e41c82
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/ReadingAnalyticsManager.ets
arkts
isLongTermView
==================== 视图模式管理 ==================== 获取视图模式
public isLongTermView(): boolean { return this.settings.isLongTermView; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isLongTermView AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AS...
public isLongTermView(): boolean { return this.settings.isLongTermView; }
https://github.com/DaLongZhuaZi/manxia
e56d9279d16d6a5038b1e58e9ddf798ebca2e323
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/AutoPageTurnController.ets
arkts
pause
暂停自动翻页
public pause(): void { if (this.state !== AutoPageTurnState.RUNNING) { return; } this.state = AutoPageTurnState.PAUSED; this.clearTimer(); logger.info(TAG, '自动翻页已暂停'); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left pause AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Rig...
public pause(): void { if (this.state !== AutoPageTurnState.RUNNING) { return; } this.state = AutoPageTurnState.PAUSED; this.clearTimer(); logger.info(TAG, '自动翻页已暂停'); }
https://github.com/DaLongZhuaZi/manxia
bbb814cec7e06eabef82a24d5edbf84a259bf707
github
qiuhaotc/HarmonyOSPlayground
entry/src/main/ets/pages/AddBillPage.ets
arkts
showDatePickerDialog
显示日期选择器
showDatePickerDialog() { const dateArray = this.selectedDate.split('-'); const selectedYear = parseInt(dateArray[0]); const selectedMonth = parseInt(dateArray[1]); const selectedDay = parseInt(dateArray[2]); // 允许选择任意日期,包括历史日期 const startDate = new Date('2000...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left showDatePickerDialog AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_blo...
showDatePickerDialog() { const dateArray = this.selectedDate.split('-'); const selectedYear = parseInt(dateArray[0]); const selectedMonth = parseInt(dateArray[1]); const selectedDay = parseInt(dateArray[2]); // 允许选择任意日期,包括历史日期 const startDate = new Date('2000...
https://github.com/qiuhaotc/HarmonyOSPlayground
aeb2a01e2ac5bd1583f620474e7561ab9ef85185
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/StreamWindowManager.ets
arkts
notifyWindowSizeChanged
防抖通知布局重算。窗口 recover/maximize、用户拖拽和系统布局 settle 都从这里汇总,避免页面层用固定延时猜窗口何时稳定。
private notifyWindowSizeChanged(): void { if (this.windowSizeDebounceTimer !== -1) { clearTimeout(this.windowSizeDebounceTimer); } this.windowSizeDebounceTimer = Number(setTimeout(() => { this.windowSizeDebounceTimer = -1; this.onWindowSizeChanged?.(); }, 120)); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left notifyWindowSizeChanged 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...
private notifyWindowSizeChanged(): void { if (this.windowSizeDebounceTimer !== -1) { clearTimeout(this.windowSizeDebounceTimer); } this.windowSizeDebounceTimer = Number(setTimeout(() => { this.windowSizeDebounceTimer = -1; this.onWindowSizeChanged?.(); }, 120)); }
https://github.com/AlkaidLab/moonlight-harmony
3aa3325f69675f7e61507e7af1b3460e45f69e45
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/customkey/CustomKeyStore.ets
arkts
setGameProfile
保存游戏→配置关联
static async setGameProfile(appId: number, profileName: string): Promise<void> { await CustomKeyStore.ensureInit(); if (!CustomKeyStore.gameProfiles) { CustomKeyStore.gameProfiles = {}; } CustomKeyStore.gameProfiles[String(appId)] = profileName; await PreferencesUtil.put(STORAGE_KEY_GAME_PRO...
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 setGameProfile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left appId AST#identifier#Right AST#:#Left : A...
static async setGameProfile(appId: number, profileName: string): Promise<void> { await CustomKeyStore.ensureInit(); if (!CustomKeyStore.gameProfiles) { CustomKeyStore.gameProfiles = {}; } CustomKeyStore.gameProfiles[String(appId)] = profileName; await PreferencesUtil.put(STORAGE_KEY_GAME_PRO...
https://github.com/AlkaidLab/moonlight-harmony
219e09b2c944ae96aaccf5af70d1a526960a3891
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoJsExtensions.ets
arkts
t2s
==================== 繁简转换 ==================== 繁体转简体 使用简化的映射表
t2s(text: string): string { return this.convertChinese(text, T2S_MAP); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left t2s AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)#Right...
t2s(text: string): string { return this.convertChinese(text, T2S_MAP); }
https://github.com/DaLongZhuaZi/manxia
f33ea1b3cc29f4e97b576e1da92b0c4926ba5f09
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/viewmodel/ComputerMenuHelper.ets
arkts
generateMenu
生成电脑操作菜单
static generateMenu(computer: ObservableComputer, callbacks: ComputerMenuCallbacks): ComputerMenuResult { const options: OptionItem[] = []; const actionMap = new Map<string, () => void>(); let actionIndex = 0; // 离线状态 - 显示唤醒选项 if (!computer.isOnline) { const key = `action_${actionIndex+...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left generateMenu AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left computer AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left...
static generateMenu(computer: ObservableComputer, callbacks: ComputerMenuCallbacks): ComputerMenuResult { const options: OptionItem[] = []; const actionMap = new Map<string, () => void>(); let actionIndex = 0; // 离线状态 - 显示唤醒选项 if (!computer.isOnline) { const key = `action_${actionIndex+...
https://github.com/AlkaidLab/moonlight-harmony
0ab755287c0e6457a5bedba2aa145e5f8c2ff8a1
github
XHXYT/Pixark
entry/src/main/ets/common/utils/database/impl/DownloadRecordTable.ets
arkts
updateStatus
更新下载状态
async updateStatus(task_id: string, status: number): Promise<number> { const record = await this.queryByTaskId(task_id); if (record) { record.status = status; return this.update(record); } return -1; }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left updateStatus AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left task_id AST#identifier#Right AST#type_annotation#Left AST#:#Left :...
async updateStatus(task_id: string, status: number): Promise<number> { const record = await this.queryByTaskId(task_id); if (record) { record.status = status; return this.update(record); } return -1; }
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/common/utils/database/impl/DownloadRecordTable.ets#L55-L62
bb11b3610f9ca78b26be50a17a4813f0108d8190
github
Countly/countly-sdk-hos
library/src/main/ets/internal/modules/ModuleConsent.ets
arkts
applyRevokeFromUnknownMode_phase2
Phase 3 of UCM revoke (see `applyRevokeFromUnknownMode_phase1`). Caller must have run phase 1 + queue.clear() first. Cancels the 1s coalesce timer that phase1's `setConsentInternal` scheduled (we don't want to wait, and we don't want a second snapshot to fire later) and ships the all-false consent snapshot synchronousl...
public async applyRevokeFromUnknownMode_phase2(): Promise<void> { if (this.pendingCoalesceTimer !== null) { clearTimeout(this.pendingCoalesceTimer); this.pendingCoalesceTimer = null; } await this.sendSnapshot(); }
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 applyRevokeFromUnknownMode_phase2 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_exp...
public async applyRevokeFromUnknownMode_phase2(): Promise<void> { if (this.pendingCoalesceTimer !== null) { clearTimeout(this.pendingCoalesceTimer); this.pendingCoalesceTimer = null; } await this.sendSnapshot(); }
https://github.com/Countly/countly-sdk-hos
6bd08659b29bd95444f9deac42f28e777cfa2bb2
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Runtime.ets
arkts
toStringStub
Converts Any object to a string @param object to conversion to a string @returns result of the conversion
static toStringStub(a: Any): String { if (a instanceof Object) { return a.toString(); } if (a === undefined) { return "undefined"; } if (a === null) { return "null"; } return Runtime.anyToString(a); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left toStringStub AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left a AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Any AS...
static toStringStub(a: Any): String { if (a instanceof Object) { return a.toString(); } if (a === undefined) { return "undefined"; } if (a === null) { return "null"; } return Runtime.anyToString(a); }
https://gitcode.com/iop123123/arkts-static-skills
2bf7b87f1f7fed905a609bb6d579040d326dfe96
gitcode
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test3_original_index.ets
arkts
testHigherOrder
=== Higher-Order Functions ===
function testHigherOrder(): number { let multiplier = (factor: number): ((n: number) => number) => { return (n: number): number => n * factor; }; let triple = multiplier(3); return triple(7); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testHigherOrder 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 testHigherOrder(): number { let multiplier = (factor: number): ((n: number) => number) => { return (n: number): number => n * factor; }; let triple = multiplier(3); return triple(7); }
https://github.com/miaochiahao/ark-ghidra
e97e0daff7aedc4790b1fc59ccc003b5ed3b1918
github
offlinecat-dev/OCNetORM
src/main/ets/query/QueryBuilder.ets
arkts
isIncludeDeleted
检查是否包含已删除的数据 @returns 是否包含已删除的数据
isIncludeDeleted(): boolean { return this.includeDeleted }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isIncludeDeleted AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#st...
isIncludeDeleted(): boolean { return this.includeDeleted }
https://github.com/offlinecat-dev/OCNetORM
9224a26393f921cc86a30dee4890ef0c2075b337
github
honjow/Next2V
feature/settings/src/main/ets/model/BackupFilePickerCoordinator.ets
arkts
decryptSelected
Decrypt a previously-selected encrypted backup with the user's password. The raw bytes were already read by selectImport(); the password is passed straight through and never retained.
static async decryptSelected(raw: string, password: string): Promise<BackupParseResult> { return await BackupService.decryptAndPreview(raw, password) }
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 decryptSelected AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left raw AST#identifier#Right AST#:#Left : AS...
static async decryptSelected(raw: string, password: string): Promise<BackupParseResult> { return await BackupService.decryptAndPreview(raw, password) }
https://github.com/honjow/Next2V
c7808747964055bf0dafc9d13add1751b58d04bf
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
copyWithin
Makes a copy of internal elements to insertPos from begin to end of Int8Array. See rules of parameters normalization: {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/copyWithin}
public copyWithin(insertPos: number): void { this.copyWithin(insertPos as int) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left copyWithin AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left insertPos AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Ri...
public copyWithin(insertPos: number): void { this.copyWithin(insertPos as int) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
06c69ead4d99dc311e82e7b85364677e892f2946
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Source/SuwayomiCacheManager.ets
arkts
deleteChapterCache
删除章节缓存
public deleteChapterCache(mangaTitle: string, chapterTitle: string): boolean { try { const chapterPath = this.getChapterCachePath(mangaTitle, chapterTitle); SafeFileUtils.rmdirSync(chapterPath); logger.info(TAG, `章节缓存已删除: ${chapterPath}`); return true; } catch (error) { logger.er...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left deleteChapterCache AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left mangaTitle AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#...
public deleteChapterCache(mangaTitle: string, chapterTitle: string): boolean { try { const chapterPath = this.getChapterCachePath(mangaTitle, chapterTitle); SafeFileUtils.rmdirSync(chapterPath); logger.info(TAG, `章节缓存已删除: ${chapterPath}`); return true; } catch (error) { logger.er...
https://github.com/DaLongZhuaZi/manxia
20b13d935cfcea44efcffdddb8695dc0fc032900
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/GameManager.ets
arkts
scanDirectory
扫描目录获取游戏列表
public async scanDirectory(dirPath: string): Promise<GameInfo[]> { const games: GameInfo[] = []; try { const files = fileIo.listFileSync(dirPath); for (const fileName of files) { if (this.isSupportedRom(fileName)) { const filePath = `${dirPath}/${fileName}`; const nam...
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 scanDirectory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left dirPath AST#identifier#Right AST#ERROR#Left AST#:#Left : ...
public async scanDirectory(dirPath: string): Promise<GameInfo[]> { const games: GameInfo[] = []; try { const files = fileIo.listFileSync(dirPath); for (const fileName of files) { if (this.isSupportedRom(fileName)) { const filePath = `${dirPath}/${fileName}`; const nam...
https://github.com/richshaw2015/nds
39b226cfc0e471a71b0ddf487f783175e6cf350a
github
Joker-x-dev/CoolMallArkTS
core/data/src/main/ets/repository/AuthRepository.ets
arkts
register
用户注册 @param {Record<string, string>} params - 注册参数 @returns {Promise<NetworkResponse<Auth>>} 注册结果
async register(params: Record<string, string>): Promise<NetworkResponse<Auth>> { return this.networkDataSource.register(params); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left register AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left params AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#...
async register(params: Record<string, string>): Promise<NetworkResponse<Auth>> { return this.networkDataSource.register(params); }
https://github.com/Joker-x-dev/CoolMallArkTS
47eafcaba57798c1ab07906117875082de8c7d36
github
openharmony-sig/applications_filemanager
entry/src/main/ets/pages/USBShowList.ets
arkts
build
dialogController: CustomDialogController = new CustomDialogController ({ builder: CustomInputDialogExample({ cancel: ()=>{}, confirm: (text)=>{ this.mkdir(text) } }), cancel: ()=>{}, autoCancel: true })
build() { Stack({ alignContent: Alignment.BottomStart }) { Column() { List({ space: 20, initialIndex: 0 }) { ForEach(this.arr, (item) => { ListItem() { Column() { Row(){ Image(this.getIcon(item)).width(25).height(25) ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST...
build() { Stack({ alignContent: Alignment.BottomStart }) { Column() { List({ space: 20, initialIndex: 0 }) { ForEach(this.arr, (item) => { ListItem() { Column() { Row(){ Image(this.getIcon(item)).width(25).height(25) ...
https://gitee.com/openharmony-sig/applications_filemanager.git
56d9b6d861092c13877f1eafede6f8adf7162cad
gitee
openharmony-sig/flutter_image_gallery_saver
ohos/src/main/ets/components/plugin/ImageGallerySaverPlugin.ets
arkts
saveCacheDir
将图片暂存到缓存压缩图片
async saveCacheDir(bmp: Uint8Array, quality: number) { let filePath: string = this.applicationContext?.cacheDir + '/image_source.jpg'; let outputFile = fs.openSync(filePath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE) await fs.write(outputFile.fd, bmp.buffer); let imageBuffer: ArrayBuffer | null = n...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left saveCacheDir AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left bmp AST#identifier#Right AST#type_annotation#Left AST#:#L...
async saveCacheDir(bmp: Uint8Array, quality: number) { let filePath: string = this.applicationContext?.cacheDir + '/image_source.jpg'; let outputFile = fs.openSync(filePath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE) await fs.write(outputFile.fd, bmp.buffer); let imageBuffer: ArrayBuffer | null = n...
https://gitee.com/openharmony-sig/flutter_image_gallery_saver.git
47310a6857cd03df9db77bc735a2be0a352f4bce
gitee
JackJiang2011/harmonychat
entry/src/main/ets/pages/LoginPage.ets
arkts
startLoginTimer
开启登录超时计时器。
startLoginTimer() { // 先确保清除之前的计时器 this.stopLoginTimer(); // 登陆超时计时器 this.loginingTimerId = setTimeout(() => { this.onLoginTimeout(); }, this.RETRY_DELAY); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left startLoginTimer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Le...
startLoginTimer() { // 先确保清除之前的计时器 this.stopLoginTimer(); // 登陆超时计时器 this.loginingTimerId = setTimeout(() => { this.onLoginTimeout(); }, this.RETRY_DELAY); }
https://github.com/JackJiang2011/harmonychat
4c958812c98d3006770cacd2416c5f45940e47db
github
picklerick422/zju-learning-assistant-OH
entry/src/main/ets/services/DownloadHistoryService.ets
arkts
clear
清空历史记录。
static async clear(): Promise<void> { if (!DownloadHistoryService.pref) { return; } DownloadHistoryService.pref.putSync(KEY, ''); await DownloadHistoryService.pref.flush(); }
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 clear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : A...
static async clear(): Promise<void> { if (!DownloadHistoryService.pref) { return; } DownloadHistoryService.pref.putSync(KEY, ''); await DownloadHistoryService.pref.flush(); }
https://github.com/picklerick422/zju-learning-assistant-OH
8d87aa94ffe8bb9a0512c85b594ef397fabc86be
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/UnifiedOperationInterface.ets
arkts
executeSecurityOperation
执行安全操作
private async executeSecurityOperation(action: string, data?: OperationBusinessData): Promise<ExecuteOperationResult> { if (action === 'validate') { if (data && Object.keys(data).includes('url') && Object.keys(data).includes('policy')) { const securityData = data as SecurityOperationData; co...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left executeSecurityOperation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left action AST#identifier#Right ...
private async executeSecurityOperation(action: string, data?: OperationBusinessData): Promise<ExecuteOperationResult> { if (action === 'validate') { if (data && Object.keys(data).includes('url') && Object.keys(data).includes('policy')) { const securityData = data as SecurityOperationData; co...
https://github.com/DaLongZhuaZi/manxia
a80f2d52372e849a63503e0364d82f380f2ca75d
github
Joker-x-dev/HarmonyKit
feature/demo/src/main/ets/view/NavigationResultPage.ets
arkts
build
构建结果回传示例页 @returns {void} 无返回值
build() { AppNavDestination({ title: $r("app.string.demo_navigation_result_title"), viewModel: this.vm }) { this.NavigationResultContent(); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c...
build() { AppNavDestination({ title: $r("app.string.demo_navigation_result_title"), viewModel: this.vm }) { this.NavigationResultContent(); } }
https://github.com/Joker-x-dev/HarmonyKit
3bab4c53065b6b00749633eb02b0a1ea83edfc77
github
ASweetBite/HarmonyPulse
entry/src/main/ets/utils/managers/LyricManager.ets
arkts
saveLyricFile
保存歌词内容
saveLyricFile(path: string, content: string): void { try { const file = fs.openSync(path, fs.OpenMode.WRITE_ONLY | fs.OpenMode.TRUNC); fs.writeSync(file.fd, content); fs.closeSync(file); } catch (e) { console.error(`Save lyric failed: ${JSON.stringify(e)}`); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left saveLyricFile 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 , A...
saveLyricFile(path: string, content: string): void { try { const file = fs.openSync(path, fs.OpenMode.WRITE_ONLY | fs.OpenMode.TRUNC); fs.writeSync(file.fd, content); fs.closeSync(file); } catch (e) { console.error(`Save lyric failed: ${JSON.stringify(e)}`); } }
https://github.com/ASweetBite/HarmonyPulse/blob/a7fcf153a20bafa29ac1fb8c25743dd5350dc54c/entry/src/main/ets/utils/managers/LyricManager.ets#L111-L119
6f1a5c9bc546247b23ff2f2a4b17d3279c5fe546
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/MangaSourceActionEngine.ets
arkts
executeAction
执行单个操作
async executeAction(action: Action, context: ActionContext): Promise<ActionResult> { const currentOwnerToken = context.variables[ACTION_QUEUE_OWNER_KEY] || ''; if (currentOwnerToken !== '' && currentOwnerToken === this.activeActionOwnerToken) { return await this.executeActionInternal(action, context); ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left executeAction AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left action AST#identifier#Right AST#type_annotation#Left AST#:#Left :...
async executeAction(action: Action, context: ActionContext): Promise<ActionResult> { const currentOwnerToken = context.variables[ACTION_QUEUE_OWNER_KEY] || ''; if (currentOwnerToken !== '' && currentOwnerToken === this.activeActionOwnerToken) { return await this.executeActionInternal(action, context); ...
https://github.com/DaLongZhuaZi/manxia
0769f527f7456a5f08624ac1e9431cafb822f39e
github
yongoe1024/RdbPlus
entry/src/main/ets/rdb/EmpMapper.ets
arkts
createTable
创建表 修改表结构需要控制版本 修改后数据库版本增加,且无法降低版本
static async createTable() { let db: Connection | undefined = undefined try { db = await EmpMapper.getInstance().getConnection() console.log('createTable 首次打开 版本 0'); // 初始默认 0 if (db.version === 0) { await db.execDML( `create table if not exists "t_emp" ( ...
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 createTable AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERRO...
static async createTable() { let db: Connection | undefined = undefined try { db = await EmpMapper.getInstance().getConnection() console.log('createTable 首次打开 版本 0'); // 初始默认 0 if (db.version === 0) { await db.execDML( `create table if not exists "t_emp" ( ...
https://github.com/yongoe1024/RdbPlus/blob/83f7347b7ac692941729d3464923155948e876bb/entry/src/main/ets/rdb/EmpMapper.ets#L27-L57
fb4081812a6562f987eed06893b12a8612a77154
github
openharmony/codelabs
ETSUI/LifeHub/entry/src/main/ets/model/LifeHubData.ets
arkts
addDiary
==================== 日记模块方法 ====================
async addDiary(diary: Diary): Promise<number> { await this.ensureDatabaseReady(); if (!this.rdbStore) { throw new Error('数据库未初始化'); } const valuesBucket: relationalStore.ValuesBucket = { date: diary.date || this.getTodayString(), title: diary.title || '', content: diary.conten...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left addDiary AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left diary AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:...
async addDiary(diary: Diary): Promise<number> { await this.ensureDatabaseReady(); if (!this.rdbStore) { throw new Error('数据库未初始化'); } const valuesBucket: relationalStore.ValuesBucket = { date: diary.date || this.getTodayString(), title: diary.title || '', content: diary.conten...
https://gitcode.com/openharmony/codelabs
cea335c8f6ff12be0d98829188d07d15fffe9125
gitcode
openharmony/codelabs
Security/StringCipherArkTS/entry/src/main/ets/common/utils/AesUtil.ets
arkts
genGcmParamsSpec
Obtaining parameters required for GCM encryption and decryption. @returns Parameters required for encryption and decryption.
async genGcmParamsSpec(): Promise<cryptoFramework.GcmParamsSpec> { let ivBlob: cryptoFramework.DataBlob = this.genKeyMaterialBlob(CommonConstants.GCM_IV_DATA); let aadBlob: cryptoFramework.DataBlob = this.genKeyMaterialBlob(CommonConstants.GCM_AAD_DATA); let tagBlob: cryptoFramework.DataBlob = this.genKey...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left genGcmParamsSpec 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#:#Righ...
async genGcmParamsSpec(): Promise<cryptoFramework.GcmParamsSpec> { let ivBlob: cryptoFramework.DataBlob = this.genKeyMaterialBlob(CommonConstants.GCM_IV_DATA); let aadBlob: cryptoFramework.DataBlob = this.genKeyMaterialBlob(CommonConstants.GCM_AAD_DATA); let tagBlob: cryptoFramework.DataBlob = this.genKey...
https://gitee.com/openharmony/codelabs.git
b2ff260d5fa7df95a95a8894e1855730392d4ca3
gitee
harmonyos/codelabs
DownloadNotification/entry/src/main/ets/pages/MainPage.ets
arkts
open
Open file
open() { promptAction.showToast({ message: $r('app.string.invalid_button_toast') }) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left open AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#ca...
open() { promptAction.showToast({ message: $r('app.string.invalid_button_toast') }) }
https://gitee.com/harmonyos/codelabs.git
79f6cb02e4738e8113b317879574d8b12c430398
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoJsExtensions.ets
arkts
strToBytes
字符串转字节数组
strToBytes(str: string, charset?: string): number[] { const bytes: number[] = []; for (let i = 0; i < str.length; i++) { bytes.push(str.charCodeAt(i) & 0xFF); } return bytes; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left strToBytes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST...
strToBytes(str: string, charset?: string): number[] { const bytes: number[] = []; for (let i = 0; i < str.length; i++) { bytes.push(str.charCodeAt(i) & 0xFF); } return bytes; }
https://github.com/DaLongZhuaZi/manxia
64cf804e88e366bcbcb6e48d0fb8bf7b016bd446
github
Eklps/harmony-mall-perf
entry/src/main/ets/pages/ListIndex.ets
arkts
onTouchMove
统计触摸次数 触摸移动:计算滑动频率,添加去抖优化
onTouchMove() { if (!this.isScrolling) { return; } const now = Date.now(); if (now - this.lastMoveTime > 4) { this.scrollCount += 1; this.lastMoveTime = now; } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onTouchMove 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...
onTouchMove() { if (!this.isScrolling) { return; } const now = Date.now(); if (now - this.lastMoveTime > 4) { this.scrollCount += 1; this.lastMoveTime = now; } }
https://github.com/Eklps/harmony-mall-perf
9b4cbf70bbbc9c1c5be53d52ec4817f7bb6d3db2
github
openharmony-sig/online_event
solution_student_challenge/基于OpenHarmony的OpenGit_潘骏翔/OpenGit/entry/src/main/ets/MainAbility/pages/main/main.ets
arkts
build
当前侧边栏的显隐
build() { //侧边栏组件 SideBarContainer(SideBarContainerType.Overlay) { //侧边栏组件内的第一个组件为侧边栏内的内容 //侧边栏组件,传入viewModel对象 SideBarComponent({ viewModel: $mainViewModel }) //后续的组件为页面的内容 //在Stack容器内有一个满屏幕的半透明组件,用于在侧边栏开启时形成阴影效果 Stack() { Column() { //顶部工具栏 T...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST...
build() { //侧边栏组件 SideBarContainer(SideBarContainerType.Overlay) { //侧边栏组件内的第一个组件为侧边栏内的内容 //侧边栏组件,传入viewModel对象 SideBarComponent({ viewModel: $mainViewModel }) //后续的组件为页面的内容 //在Stack容器内有一个满屏幕的半透明组件,用于在侧边栏开启时形成阴影效果 Stack() { Column() { //顶部工具栏 T...
https://gitee.com/openharmony-sig/online_event.git
099bf347662de5c5d2abc7705a249695ef15e7ed
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Services/DataService.ets
arkts
getRecord
获取测试记录
public async getRecord(id: string): Promise<Record<string, string | number | boolean | string[] | number[]> | null> { try { if (!this.testRecords) { return null; } const record = this.testRecords.get(id) || null; logger.debug(TAG, `获取测试记录: ${id}, 存在: ${record !== null}`); ret...
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 getRecord AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:#Rig...
public async getRecord(id: string): Promise<Record<string, string | number | boolean | string[] | number[]> | null> { try { if (!this.testRecords) { return null; } const record = this.testRecords.get(id) || null; logger.debug(TAG, `获取测试记录: ${id}, 存在: ${record !== null}`); ret...
https://github.com/DaLongZhuaZi/manxia
6d0b0c15e0af88c6a54f3ae9f5d5e5fde550a85e
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/components/StreamMenuManager.ets
arkts
getStreamMenuConfig
获取主串流菜单配置
getStreamMenuConfig(): OptionPickerDialogConfig { const options: OptionItem[] = [ { title: '🎮 继续游戏', subtitle: '关闭此菜单,继续串流', value: 'resume' }, { title: '⎋ 发送 ESC', subtitle: '向远程发送 ESC 键', value: 'send_esc' }, { title: '⊞ 发送 W...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getStreamMenuConfig 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 OptionPickerDialogConfig AST#identifier#Ri...
getStreamMenuConfig(): OptionPickerDialogConfig { const options: OptionItem[] = [ { title: '🎮 继续游戏', subtitle: '关闭此菜单,继续串流', value: 'resume' }, { title: '⎋ 发送 ESC', subtitle: '向远程发送 ESC 键', value: 'send_esc' }, { title: '⊞ 发送 W...
https://github.com/AlkaidLab/moonlight-harmony
c04c87c6d5941e9cc20c3709b5e36c36e454f13b
github
openharmony/codelabs
ETSUI/LifeTrack/entry/src/main/ets/pages/CalendarPage.ets
arkts
getEventIndicators
获取事件指示点颜色
getEventIndicators(date: Date): string[] { const dateStr = date.toDateString(); const indicators: string[] = []; // 1. 收集直接事件的指示点 const directEvents = this.events.filter(event => { const eventDate = CalendarUtils.timestampToDate(event.startTime); return eventDate.toDateString() === dateSt...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getEventIndicators 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#Ri...
getEventIndicators(date: Date): string[] { const dateStr = date.toDateString(); const indicators: string[] = []; // 1. 收集直接事件的指示点 const directEvents = this.events.filter(event => { const eventDate = CalendarUtils.timestampToDate(event.startTime); return eventDate.toDateString() === dateSt...
https://gitcode.com/openharmony/codelabs
8a31a0e9ef8ea65ca0bcd0256f2516a06cab3af6
gitcode
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnThemeViewModel.ets
arkts
restoreDefaultTheme
恢复默认主题
restoreDefaultTheme(): void { this.isCustomTheme = false; this.customColor = ""; TnUISetUIBaseStyle(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left restoreDefaultTheme 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#statemen...
restoreDefaultTheme(): void { this.isCustomTheme = false; this.customColor = ""; TnUISetUIBaseStyle(); }
https://github.com/codelably/tuniao-ui
9fd013d1ffb92f8f2c4fa3a5f0eb3f63c11b0b0d
github
David8Idira/AI-OA
packages/harmonyos/commons/src/main/ets/data/api/ApiClient.ets
arkts
getApprovals
============ 审批模块 API ============ 获取审批列表
async getApprovals(params?: { status?: string; type?: string; page?: number; pageSize?: number; keyword?: string; }): Promise<ApiResponse<any>> { return this.get<any>('/api/approval/approvals', params) }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getApprovals AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#optional_parameter#Left AST#identifier#Left params AST#identifier#Right AST#?#Left ? AST#?#Right AST#type_anno...
async getApprovals(params?: { status?: string; type?: string; page?: number; pageSize?: number; keyword?: string; }): Promise<ApiResponse<any>> { return this.get<any>('/api/approval/approvals', params) }
https://github.com/David8Idira/AI-OA
86627c5d3ac1795eefd804c603008d82c47cdfbc
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/ChartModel.ets
arkts
getAnimator
CODE BELOW THIS RELATED TO ANIMATION Returns the animator responsible for animating chart values. @return
public getAnimator(): ChartAnimator | null { return this.mAnimator; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getAnimator AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left AST...
public getAnimator(): ChartAnimator | null { return this.mAnimator; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
6ff5b082f1c4f317946a724803ec70b8add2b928
gitee
openharmony-sig/flutter_packages
packages/local_auth/local_auth_ohos/ohos/src/main/ets/io/flutter/plugins/localauth/LocalAuthPlugin.ets
arkts
authenticate
Attempts to authenticate the user with the provided [options], and using [strings] for any UI.
async authenticate(call: MethodCall, result: MethodResult): Promise<void> { if (authInProgress) { result.error("auth_in_progress", "Authentication in progress", null); return; } if (this.abilityPluginBinding?.getAbility() == null) { result.error("no_ability", "local_auth plugin requires...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left authenticate AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left call AST#identifier#Right AST#ty...
async authenticate(call: MethodCall, result: MethodResult): Promise<void> { if (authInProgress) { result.error("auth_in_progress", "Authentication in progress", null); return; } if (this.abilityPluginBinding?.getAbility() == null) { result.error("no_ability", "local_auth plugin requires...
https://gitee.com/openharmony-sig/flutter_packages.git
7ac6a6e441ebefdb349cac72c10325c235bf545e
gitee
Joker-x-dev/CoolMallArkTS
core/navigation/src/main/ets/cs/CsNavigator.ets
arkts
toChat
跳转到客服聊天 @returns {void} 无返回值
static toChat(): void { navigateTo(CsRoutes.Chat); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left toChat 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_stat...
static toChat(): void { navigateTo(CsRoutes.Chat); }
https://github.com/Joker-x-dev/CoolMallArkTS
6972ee4085b5f06936ec77d42167f381a15c7bd3
github
codelably/HCompass
packages/auth/src/main/ets/AuthModule.ets
arkts
registerGuards
注册路由守卫 @param navigationService 导航服务
registerGuards(navigationService: NavigationService): void { // 注册认证守卫(保护需要登录的页面) navigationService.registerGuard(new AuthGuard()); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left registerGuards AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left navigationService AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left NavigationService AST#identi...
registerGuards(navigationService: NavigationService): void { // 注册认证守卫(保护需要登录的页面) navigationService.registerGuard(new AuthGuard()); }
https://github.com/codelably/HCompass
efbfe913290061a6403968961d5e57daca217f77
github
openharmony/applications_photos
common/src/main/ets/default/view/browserOperation/MoveOrCopyBroadCastProp.ets
arkts
sendMoveOrAddBroadCast
sendMoveOrCopyBroadCast @param broadCast broadCast
public sendMoveOrAddBroadCast(broadCast: BroadCast): void { if (broadCast === null || broadCast === undefined) { Log.error(TAG, 'sendMoveOrAddBroadCast error: null or undefined broadcast'); return; } this.setBroadCast(broadCast); /// 如果是系统相册,或者是新建相册从PickerPage界面添加图片的场景,直接添加到,而不是弹窗选择添加还是移动...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left sendMoveOrAddBroadCast AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left broadCast AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#iden...
public sendMoveOrAddBroadCast(broadCast: BroadCast): void { if (broadCast === null || broadCast === undefined) { Log.error(TAG, 'sendMoveOrAddBroadCast error: null or undefined broadcast'); return; } this.setBroadCast(broadCast); /// 如果是系统相册,或者是新建相册从PickerPage界面添加图片的场景,直接添加到,而不是弹窗选择添加还是移动...
https://gitee.com/openharmony/applications_photos.git
e4edc11bd3a78765162289919dfa7f3c580fd67a
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Jsonx.ets
arkts
createUndefined
Creates a new JSON element containing an undefined value. @returns {JsonElement} A new JsonElement containing undefined
static createUndefined(): JsonElement { const element = new JsonElement() return element }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createUndefined 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 JsonEl...
static createUndefined(): JsonElement { const element = new JsonElement() return element }
https://gitcode.com/iop123123/arkts-static-skills
6a59b269986969ef6d1fe87b93d6c94ffb903d5f
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/TarPackager.ets
arkts
parseTarHeader
解析 tar 文件头
private parseTarHeader(buffer: ArrayBuffer): TarHeader { const view = new Uint8Array(buffer); return { name: this.readString(view, 0, 100), mode: this.readString(view, 100, 8), uid: this.readString(view, 108, 8), gid: this.readString(view, 116, 8), size: this.readString(view...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseTarHeader AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left buffer AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
private parseTarHeader(buffer: ArrayBuffer): TarHeader { const view = new Uint8Array(buffer); return { name: this.readString(view, 0, 100), mode: this.readString(view, 100, 8), uid: this.readString(view, 108, 8), gid: this.readString(view, 116, 8), size: this.readString(view...
https://github.com/DaLongZhuaZi/manxia
43d618ab18c6d099be9d706752bb474a5e58d431
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/database/DatabaseManager.ets
arkts
toError
统一错误处理
private static toError(message: string, err: Error | string | object): Error { let details = ''; try { details = typeof err === 'string' ? err : JSON.stringify(err); } catch (_) { details = String(err); } return new Error(`${message}${details ? ' -> ' + details : ''}`); }
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 toError AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left message AST#identifier#Right AST#ERROR#Left AST#:#Left : AS...
private static toError(message: string, err: Error | string | object): Error { let details = ''; try { details = typeof err === 'string' ? err : JSON.stringify(err); } catch (_) { details = String(err); } return new Error(`${message}${details ? ' -> ' + details : ''}`); }
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
c09802d9303b360324d6028ef6621fb976fc3ea6
github
Gramony/Gramony
features/home/src/main/ets/viewmodel/Message/MessageDataSource.ets
arkts
get
to make names consistent
public get(index: number): Message { return this.sortedMessages.getValueAt(index) || nullMessage; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left get AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERRO...
public get(index: number): Message { return this.sortedMessages.getValueAt(index) || nullMessage; }
https://github.com/Gramony/Gramony
27667d6d13c53dff928aab9189982cb2516803eb
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/BarDataSet.ets
arkts
setHighLightAlpha
Set the alpha value (transparency) that is used for drawing the highlight indicator bar. min = 0 (fully transparent), max = 255 (fully opaque) @param alpha
public setHighLightAlpha(alpha: number): void { this.mHighLightAlpha = alpha; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setHighLightAlpha AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left alpha AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le...
public setHighLightAlpha(alpha: number): void { this.mHighLightAlpha = alpha; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
091c9f0ae09337c4a4ea30749b0035fe3da45bed
gitee
zmuxuny/ai-guardian-star
entry/src/main/ets/common/ThemeManager.ets
arkts
getSystemTheme
获取系统主题
private async getSystemTheme(): Promise<boolean> { if (!this.context) return false; try { const appContext = this.context.getApplicationContext(); const resourceManager = appContext.resourceManager; const config = await resourceManager.getConfiguration(); if (config && config.col...
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 getSystemTheme AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS...
private async getSystemTheme(): Promise<boolean> { if (!this.context) return false; try { const appContext = this.context.getApplicationContext(); const resourceManager = appContext.resourceManager; const config = await resourceManager.getConfiguration(); if (config && config.col...
https://github.com/zmuxuny/ai-guardian-star/blob/87ab023d8b9aab4303a9fc1e97508e1f8ee01e07/entry/src/main/ets/common/ThemeManager.ets#L117-L136
fd14531fac923ada17cf20aa0e339c8ed1551225
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/utils/ViewPortHandler.ets
arkts
setMinimumScaleY
Sets the minimum scale factor for the y-axis @param yScale
public setMinimumScaleY(yScale: number) { if (yScale < 1) yScale = 1; this.mMinScaleY = yScale; this.limitTransAndScale(this.mMatrixTouch, this.mContentRect); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setMinimumScaleY AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left yScale AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le...
public setMinimumScaleY(yScale: number) { if (yScale < 1) yScale = 1; this.mMinScaleY = yScale; this.limitTransAndScale(this.mMatrixTouch, this.mContentRect); }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
f285df82d77b3ea1349fa8840677b958a79f1abf
gitee
HarmonyOS_Samples/BestPracticeSnippets
VideoProcessBaseWeb/entry/src/main/ets/pages/Index.ets
arkts
onBackPress
[StartExclude index] [Start on_back_press]
onBackPress(): boolean | void { if (this.isFullScreen && this.handler) { this.handler.exitFullScreen(); return true; } return false; }
AST#program#Left AST#expression_statement#Left AST#binary_expression#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#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#L...
onBackPress(): boolean | void { if (this.isFullScreen && this.handler) { this.handler.exitFullScreen(); return true; } return false; }
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
2bd3adfd563e144e815341a8946a453850d568c2
gitcode
openharmony-sig/commons-cli
library/src/main/ets/components/cli/Options.ets
arkts
getOption
Gets the {@link Option} matching the long or short name specified. <p> The leading hyphens in the name are ignored (up to 2). </p> @param opt short or long name of the {@link Option} @return the option represented by opt
public getOption(opt: string): CliOption{ opt = Util.stripLeadingHyphens(opt); if (this.shortOpts.containsKey(opt)) { return this.shortOpts.get(opt) == null ? new CliOption(null) : this.shortOpts.get(opt) as CliOption; } return this.longOpts.get(opt) == null ? new CliOption(null) : this.longOp...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getOption AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left opt AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string ...
public getOption(opt: string): CliOption{ opt = Util.stripLeadingHyphens(opt); if (this.shortOpts.containsKey(opt)) { return this.shortOpts.get(opt) == null ? new CliOption(null) : this.shortOpts.get(opt) as CliOption; } return this.longOpts.get(opt) == null ? new CliOption(null) : this.longOp...
https://gitee.com/openharmony-sig/commons-cli.git
8f818f2328036bb70d573a7f3fce7d5f3cebdbd1
gitee
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/network/MdnsDiscovery.ets
arkts
startDiscovery
开始发现局域网内的主机
async startDiscovery(): Promise<void> { if (this.isDiscovering) { console.info('MdnsDiscovery: 已经在发现中'); return; } this.isDiscovering = true; this.disposed = false; this.discoveredComputers.clear(); console.info(`MdnsDiscovery: 开始发现服务类型 ${MdnsDiscovery.SERVICE_TYPE}`); try {...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left startDiscovery AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left ...
async startDiscovery(): Promise<void> { if (this.isDiscovering) { console.info('MdnsDiscovery: 已经在发现中'); return; } this.isDiscovering = true; this.disposed = false; this.discoveredComputers.clear(); console.info(`MdnsDiscovery: 开始发现服务类型 ${MdnsDiscovery.SERVICE_TYPE}`); try {...
https://github.com/AlkaidLab/moonlight-harmony
ba06496427e24cebef2d24d707b114c11d504954
github
LiHuaJZOAQ/GuardSysAPP
entry/src/main/ets/pages/TCPClient.ets
arkts
connectServer
连接服务器(支持域名或IP)
async connectServer(remoteHost: string, remotePort: number): Promise<void> { if (this.isConnecting) { if (this.onErrorCallback) { this.onErrorCallback('正在连接中,请勿重复点击(目标 ' + remoteHost + ':' + remotePort + ')'); } return; } if (!remoteHost || remoteHost.trim() === '') { if (...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left connectServer AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left remoteHost AST#identifier#Right...
async connectServer(remoteHost: string, remotePort: number): Promise<void> { if (this.isConnecting) { if (this.onErrorCallback) { this.onErrorCallback('正在连接中,请勿重复点击(目标 ' + remoteHost + ':' + remotePort + ')'); } return; } if (!remoteHost || remoteHost.trim() === '') { if (...
https://github.com/LiHuaJZOAQ/GuardSysAPP
7855659f738e0c9dfbfbdf6c0b2537c5e75f2cb0
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/SettingsManager.ets
arkts
set
============================================================================ 设置写入 ============================================================================ 设置单个值 Requirements: 12.2, 12.4 @param key 设置键名 @param value 设置值 @returns 操作结果
public async set(key: string, value: SettingValue): Promise<SettingsResult<void>> { // 验证设置键是否存在 const definition = getSettingDefinition(key); if (!definition) { console.warn(`${TAG} Unknown setting key: ${key}`); return createErrorResult(SettingsErrorCode.ERR_UNKNOWN_SETTING_KEY, key, value);...
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 set AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AS...
public async set(key: string, value: SettingValue): Promise<SettingsResult<void>> { // 验证设置键是否存在 const definition = getSettingDefinition(key); if (!definition) { console.warn(`${TAG} Unknown setting key: ${key}`); return createErrorResult(SettingsErrorCode.ERR_UNKNOWN_SETTING_KEY, key, value);...
https://github.com/richshaw2015/nds
29ce38fcb53af2e5b21d3dac9a9538d022792fc0
github
openharmony-sig/ohos_easyui
easyui/src/main/ets/common/components/AddressEdit.ets
arkts
handleResult
处理点击确定事件
handleResult() { let arr = [] arr = this.result.split("/") if (arr.includes("请选择") || arr.includes("")) { this.showTips("请选择地区") console.log("error") } else { this.showResult = this.result console.log("success") this.closeAreaSelect() } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left handleResult 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 ...
handleResult() { let arr = [] arr = this.result.split("/") if (arr.includes("请选择") || arr.includes("")) { this.showTips("请选择地区") console.log("error") } else { this.showResult = this.result console.log("success") this.closeAreaSelect() } }
https://gitee.com/openharmony-sig/ohos_easyui.git
5c0a1f1f820d9a804fae656b0caeb3a024f97cb7
gitee
HunZiLei/ArkTS_PokePomodoro
entry/src/main/ets/components/IndexTabPages/DDLState.ets
arkts
build
组件生命周期 结束 UI
build() { Column() { Stack({alignContent: Alignment.Bottom}) { Navigation() { // UI 标题栏 // UI 搜索 if (!this.isEditing) Search() // .onClick(() => { this.isOnSearch = true}) .onSubmit((value: string) => { this.querySearchTask(v...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST...
build() { Column() { Stack({alignContent: Alignment.Bottom}) { Navigation() { // UI 标题栏 // UI 搜索 if (!this.isEditing) Search() // .onClick(() => { this.isOnSearch = true}) .onSubmit((value: string) => { this.querySearchTask(v...
https://github.com/HunZiLei/ArkTS_PokePomodoro
3a2dcffad9a9cb622a197d2ae7f771fe6eec9d57
github
openharmony/applications_contacts
feature/call/src/main/ets/missedcall/MissedCallService.ets
arkts
getInstance
getInstance for MissedCallService
public static getInstance() { if (!MissedCallService.sInstance || MissedCallService.sInstance == undefined) { MissedCallService.sInstance = new MissedCallService(); } return MissedCallService.sInstance; }
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 getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERR...
public static getInstance() { if (!MissedCallService.sInstance || MissedCallService.sInstance == undefined) { MissedCallService.sInstance = new MissedCallService(); } return MissedCallService.sInstance; }
https://gitee.com/openharmony/applications_contacts.git
5297f7f08064e224ec1c605d6978e90ed86cb3eb
gitee
OHPG/FinSdk
emby/src/main/ets/api/UserApi.ets
arkts
getUsers
getUsers @summary Gets a list of users. @param {UserApiGetUsersRequest} requestParameters Request parameters. @throws {RequiredError} @memberof UserApi
public async getUsers(requestParameters: UserApiGetUsersRequest = {}): Promise<Array<UserDto>> { return this.apiClient.get({ path: "/Users", parameters: requestParameters }) }
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 getUsers AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right AST#:#Le...
public async getUsers(requestParameters: UserApiGetUsersRequest = {}): Promise<Array<UserDto>> { return this.apiClient.get({ path: "/Users", parameters: requestParameters }) }
https://github.com/OHPG/FinSdk
1f40745c87a8db99098242ee4b0d120cba4144d5
github
AGenUI/AGenUI
platforms/harmony/agenui/src/main/ets/agenui/logger/AGenUILogger.ets
arkts
setCustomLogger
Set the custom logger that will receive log callbacks @param customLogger Custom logger implementation
public setCustomLogger(customLogger: IAGenUILogger): void { this.customLogger = customLogger; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setCustomLogger AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left customLogger AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi...
public setCustomLogger(customLogger: IAGenUILogger): void { this.customLogger = customLogger; }
https://github.com/AGenUI/AGenUI
a188ec17cced19aa1bd4bdc93618b819c1250928
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/left_shift/left_shift_ushort.ets
arkts
main
--- desc: check left shift operation for unsigned short integer ---
function main(): void { const a: ushort = {{v.left}} const b: int = {{v.right}} assert (a << b) == {{v.result}}
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A...
function main(): void { const a: ushort = {{v.left}} const b: int = {{v.right}} assert (a << b) == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
7b27ce0b1e878f008de9dff8a8084c6ef93e1614
gitee
HarmonyOS_Codelabs/readerkit_codelab_arkts
entry/src/main/ets/common/LocalBookImporter.ets
arkts
importLocalBookToCache
Import book file to the specified location @param filePath - Book file path @param workPath - save path @return {BookParserInfo}
public async importLocalBookToCache(filePath: string, workPath: string): Promise<BookParserInfo> { hilog.info(0x0000, TAG, "importLocalBookToCache start", filePath); try { if (!fs.accessSync(workPath)) { fs.mkdirSync(workPath); } let path = BookUtils.getBookFileLocalBookPath(workPath...
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 importLocalBookToCache AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath AST#identifier#Right AST#ERROR#Left AST...
public async importLocalBookToCache(filePath: string, workPath: string): Promise<BookParserInfo> { hilog.info(0x0000, TAG, "importLocalBookToCache start", filePath); try { if (!fs.accessSync(workPath)) { fs.mkdirSync(workPath); } let path = BookUtils.getBookFileLocalBookPath(workPath...
https://gitcode.com/HarmonyOS_Codelabs/readerkit_codelab_arkts
69241c4dd2b153b094dd54b050a5379082ed26d9
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
subarray
Creates a Int8Array with the same ArrayBuffer @returns new Int8Array with the same ArrayBuffer
public subarray(): Int8Array { return this.subarray(0, this.length) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left subarray 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 Int8Array AST...
public subarray(): Int8Array { return this.subarray(0, this.length) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
21f54f6ebdecb4d721cf2ada55ec630899f62f3d
gitee
zmuxuny/ai-guardian-star
entry/src/main/ets/common/ThemeManager.ets
arkts
applyThemeMode
应用主题模式
public async applyThemeMode() { let shouldBeDark = false; if (this.themeMode === ThemeMode.FOLLOW_SYSTEM) { // 跟随系统 shouldBeDark = await this.getSystemTheme(); } else if (this.themeMode === ThemeMode.DARK) { // 强制深色 shouldBeDark = true; } else { // 强制浅色 shouldB...
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 applyThemeMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#E...
public async applyThemeMode() { let shouldBeDark = false; if (this.themeMode === ThemeMode.FOLLOW_SYSTEM) { // 跟随系统 shouldBeDark = await this.getSystemTheme(); } else if (this.themeMode === ThemeMode.DARK) { // 强制深色 shouldBeDark = true; } else { // 强制浅色 shouldB...
https://github.com/zmuxuny/ai-guardian-star/blob/87ab023d8b9aab4303a9fc1e97508e1f8ee01e07/entry/src/main/ets/common/ThemeManager.ets#L96-L114
e544e81793812f98e033b1853aa7017ef821bc46
github
zmuxuny/ai-guardian-star
entry/src/main/ets/database/DatabaseHelper.ets
arkts
backup
════════════════════════════════════════════════════════════ 数据库维护 ════════════════════════════════════════════════════════════ 手动备份数据库到同沙箱路径下的 GuardianStar_backup.db
public async backup(): Promise<void> { try { await (this.getStore() as relationalStore.RdbStore).backup("GuardianStar_backup.db"); hilog.info(DOMAIN, TAG, "数据库备份成功"); } catch (e) { const err = e as BusinessError; hilog.error(DOMAIN, TAG, `backup 失败 ${err.code} ${err.message}`); t...
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 backup AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : ...
public async backup(): Promise<void> { try { await (this.getStore() as relationalStore.RdbStore).backup("GuardianStar_backup.db"); hilog.info(DOMAIN, TAG, "数据库备份成功"); } catch (e) { const err = e as BusinessError; hilog.error(DOMAIN, TAG, `backup 失败 ${err.code} ${err.message}`); t...
https://github.com/zmuxuny/ai-guardian-star/blob/87ab023d8b9aab4303a9fc1e97508e1f8ee01e07/entry/src/main/ets/database/DatabaseHelper.ets#L789-L798
7e5b0f08d68b5fe448145a547a94545a6229fa2e
github
NissonCX/CQU-HarmonyOS-APP-Dev-Final
entry/src/main/ets/utils/DataManager.ets
arkts
getAllHealthGoals
获取所有健康目标
async getAllHealthGoals(): Promise<HealthGoal[]> { try { const data = await this.dataPreferences?.get(KEY_HEALTH_GOALS, '[]') as string; return JSON.parse(data) as HealthGoal[]; } catch (error) { console.error('获取健康目标失败:', JSON.stringify(error)); return []; } }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getAllHealthGoals AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#ge...
async getAllHealthGoals(): Promise<HealthGoal[]> { try { const data = await this.dataPreferences?.get(KEY_HEALTH_GOALS, '[]') as string; return JSON.parse(data) as HealthGoal[]; } catch (error) { console.error('获取健康目标失败:', JSON.stringify(error)); return []; } }
https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final
ca68c8edbf5527f83f07d02ec206afbe96db22af
github
openharmony-tpc/VCard
library/src/main/ets/components/utils/PhoneNumberUtils.ets
arkts
isNonSeparator
True if c is ISO-LATIN characters 0-9, *, # , +, WILD, WAIT, PAUSE
public static isNonSeparator(c:string) :boolean { return (c >= '0' && c <= '9') || c == '*' || c == '#' || c == '+' || c == PhoneNumberUtils.WILD || c == PhoneNumberUtils.WAIT || c == PhoneNumberUtils.PAUSE; }
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 isNonSeparator AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left c AST#identifier#Right AST#:#Left : AST#...
public static isNonSeparator(c:string) :boolean { return (c >= '0' && c <= '9') || c == '*' || c == '#' || c == '+' || c == PhoneNumberUtils.WILD || c == PhoneNumberUtils.WAIT || c == PhoneNumberUtils.PAUSE; }
https://gitee.com/openharmony-tpc/VCard.git
84bef59efbccdef744c1b7dbc4df3e9dc521bd96
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/ConcurrentHashMap.ets
arkts
constructor
Constructs a ConcurrentHashMap from ArrayLike @param { ArrayLike<[K, V]> } entries initial ArrayLike
constructor(entries: ArrayLike<[K, V]>) { const bucketsCount = this.getInitialBucketsCount(Double.toInt(entries.length)); this.buckets = new ConcurrentHashMapBucket < K, V > [bucketsCount](undefined); this.bucketMutex = new (Object | undefined)[bucketsCount](undefined); ...
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 entries AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identifi...
constructor(entries: ArrayLike<[K, V]>) { const bucketsCount = this.getInitialBucketsCount(Double.toInt(entries.length)); this.buckets = new ConcurrentHashMapBucket < K, V > [bucketsCount](undefined); this.bucketMutex = new (Object | undefined)[bucketsCount](undefined); ...
https://gitcode.com/iop123123/arkts-static-skills
235d54ce5bcbdb0d934a6fa2c845c6d43a7a34db
gitcode
openharmony-sig/amountinputtext
libamountinput/src/main/ets/widget/AmountInputText.ets
arkts
clear
清除金额内容
clear() { this.amountStr = this.defTips; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#a...
clear() { this.amountStr = this.defTips; }
https://gitee.com/openharmony-sig/amountinputtext.git
5b4ba7b931c03a6f92b81589118dba0464dfbc21
gitee
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test57_original_index.ets
arkts
curryAdd
--- Currying ---
function curryAdd(a: number): (b: number) => number { return (b: number): number => { return a + b; }; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left curryAdd AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left a AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#...
function curryAdd(a: number): (b: number) => number { return (b: number): number => { return a + b; }; }
https://github.com/miaochiahao/ark-ghidra
b5f2a65e07b31a7637d3ae29f6411b2442b79c4a
github
iop123123/arkts-static-skills
linter/linter/examples/types/any_banned.fail.ets
arkts
main
expect: fail expect-code: ESE115343 evidence: ERROR_ARKTS_NO_UNTYPED_OBJ_LITERALS — 'Object', 'object', 'any' types cannot be initialized with object literals.
function main(): void { let bag: Object = { id: 1, name: "a" }; console.log(bag); }
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 { let bag: Object = { id: 1, name: "a" }; console.log(bag); }
https://gitcode.com/iop123123/arkts-static-skills
0aa8bf0f55e3559e34d2b8347a97a12952c35f7b
gitcode
HarmonyOS_Samples/scankit-samplecode-clientdemo-arkts
common/sample_common/src/main/ets/model/CommonEventManager.ets
arkts
unsubscribe
Callback for common event unsubscription.
public unsubscribe(): void { try { Logger.info(TAG, `Start to unsubscribe.`); commonEventManager.unsubscribe(this.subscriber); } catch (error) { Logger.error(TAG, `Failed to unsubscribe. Code: ${error?.code}`); } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left unsubscribe AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression...
public unsubscribe(): void { try { Logger.info(TAG, `Start to unsubscribe.`); commonEventManager.unsubscribe(this.subscriber); } catch (error) { Logger.error(TAG, `Failed to unsubscribe. Code: ${error?.code}`); } }
https://gitcode.com/HarmonyOS_Samples/scankit-samplecode-clientdemo-arkts
290da7417901e6a2cb44163216b3f32ae7d429aa
gitcode
HarmonyOS_Samples/BestPracticeSnippets
PerformanceAnalysis/BptaDelayAnalysis/entry/src/main/ets/components/AudioPlayerService.ets
arkts
constructor
[StartExclude audio_player_service] [StartExclude audio_player_service1] private constructor
private constructor() { this.initAudioPlayer(); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left ...
private constructor() { this.initAudioPlayer(); }
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
70672be483dc1712af6f06c71dd309f4010576cc
gitcode
LongLiveY96/chatcube
entry/src/main/ets/services/IconDownloadCache.ets
arkts
hashUrl
简单字符串哈希,生成 hex 字符串作为文件名
private hashUrl(url: string): string { let hash: number = 0 for (let i = 0; i < url.length; i++) { const ch = url.charCodeAt(i) hash = ((hash << 5) - hash) + ch hash = hash & hash // 转为 32 位整数 } // 转为无符号 hex const unsigned = hash >>> 0 return unsigned.toString(16).padStart(8,...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left hashUrl 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...
private hashUrl(url: string): string { let hash: number = 0 for (let i = 0; i < url.length; i++) { const ch = url.charCodeAt(i) hash = ((hash << 5) - hash) + ch hash = hash & hash // 转为 32 位整数 } // 转为无符号 hex const unsigned = hash >>> 0 return unsigned.toString(16).padStart(8,...
https://github.com/LongLiveY96/chatcube
16f68d2a7bd79c4ef29f46dd00a98eb0ad1f7405
github
HarmonyOS_Samples/BestPracticeSnippets
ArkWebSecurity/arkwebsecurity/src/main/ets/pages/ErrorSamples/SetURLTrustList.ets
arkts
build
Any URL to be loaded.
build() { Column() { Web({ src: this.urlStr, controller: this.webviewController }) .javaScriptAccess(true) .onControllerAttached(() => { try { this.webviewController.setUrlTrustList(this.urlTrustList); } catch (error) { hilog.error(0x0000, 'ArkWebS...
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() { Web({ src: this.urlStr, controller: this.webviewController }) .javaScriptAccess(true) .onControllerAttached(() => { try { this.webviewController.setUrlTrustList(this.urlTrustList); } catch (error) { hilog.error(0x0000, 'ArkWebS...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
5293788c8e5c98128a08617d2e23cebb610677e0
gitcode
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/TagDAO.ets
arkts
exists
检查标签是否存在 @param tagId 标签ID @returns 是否存在
static async exists(tagId: number): Promise<boolean> { const sql = `SELECT 1 FROM tags WHERE tag_id = ? AND is_deleted = 0`; const store = DatabaseManager.getDatabase(); let rs: relationalStore.ResultSet | null = null; try { rs = await store.querySql(sql, [tagId]); return rs.goToNextRow();...
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 exists AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tagId AST#identifier#Right AST#:#Left : AST#:#Rig...
static async exists(tagId: number): Promise<boolean> { const sql = `SELECT 1 FROM tags WHERE tag_id = ? AND is_deleted = 0`; const store = DatabaseManager.getDatabase(); let rs: relationalStore.ResultSet | null = null; try { rs = await store.querySql(sql, [tagId]); return rs.goToNextRow();...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
b055b17d23b1cc37eaa2689be4b42524c0062fa1
github
openharmony/arkui_ace_engine
examples/Info/entry/src/main/ets/pages/qrcode/qrcodegen.ets
arkts
getBit
Returns true iff the i'th bit of x is set to 1.
function getBit(x: int, i: int): boolean { return ((x >>> i) & 1) != 0; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getBit AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left x AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#ty...
function getBit(x: int, i: int): boolean { return ((x >>> i) & 1) != 0; }
https://gitee.com/openharmony/arkui_ace_engine.git
8a30373eadb4be2fca4a187d4b1ac19b65a02e6a
gitee
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test13_original_index.ets
arkts
testStringStartsEnds
--- String.startsWith / endsWith ---
function testStringStartsEnds(): string { let s: string = 'Hello, World!'; let starts: boolean = s.startsWith('Hello'); let ends: boolean = s.endsWith('!'); let starts2: boolean = s.startsWith('World', 7); return String(starts) + ',' + String(ends) + ',' + String(starts2); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testStringStartsEnds 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#predef...
function testStringStartsEnds(): string { let s: string = 'Hello, World!'; let starts: boolean = s.startsWith('Hello'); let ends: boolean = s.endsWith('!'); let starts2: boolean = s.startsWith('World', 7); return String(starts) + ',' + String(ends) + ',' + String(starts2); }
https://github.com/miaochiahao/ark-ghidra
a07c89dd90055fdced07ccfce97aa6e860639cfc
github
OMGCA/sakipay
sakipay_hmos/main/src/main/ets/services/PreferencesStore.ets
arkts
voluntaryOvertimeTotalSeconds
Computes the total voluntary OT seconds at the current moment. Returns 0 if no session is active or if the stored date is stale (different day). If stale, also resets the stored state.
public async voluntaryOvertimeTotalSeconds(): Promise<number> { const active: boolean = await this.loadVoluntaryOTActive() if (!active) { return 0 } const storedDate: string = await this.loadVoluntaryOTDate() const today: string = this.dateStringToday() if (storedDate !== today) { // Stale ...
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 voluntaryOvertimeTotalSeconds AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_express...
public async voluntaryOvertimeTotalSeconds(): Promise<number> { const active: boolean = await this.loadVoluntaryOTActive() if (!active) { return 0 } const storedDate: string = await this.loadVoluntaryOTDate() const today: string = this.dateStringToday() if (storedDate !== today) { // Stale ...
https://github.com/OMGCA/sakipay
dc302ccc413a4881b07a9c987af3938502ba3de7
github
the-wwyang/kids-learning-app
src/main/ets/services/ScoreService.ets
arkts
calculateNextLevelExp
计算下一级所需经验值
public calculateNextLevelExp(currentLevel: number): number { return (currentLevel + 1) * LevelConfig.EXP_PER_LEVEL; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left calculateNextLevelExp AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left currentLevel AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number...
public calculateNextLevelExp(currentLevel: number): number { return (currentLevel + 1) * LevelConfig.EXP_PER_LEVEL; }
https://github.com/the-wwyang/kids-learning-app
9674395b884e6ee34f27adfdc7e189abcde2d2af
github
XJTUWYD/ArkDiff
entry/src/main/ets/viewmodel/DiffSessionViewModel.ets
arkts
syncToRight
==================== 双向同步 ====================
syncToRight(lineIndexA: number): void { if (!this.diffResult) return; const leftLines = this.diffResult.leftLines; if (lineIndexA < 0 || lineIndexA >= leftLines.length) return; const leftLine = leftLines[lineIndexA]; const content = leftLine.content; const linesB = this.textB.split('\n'); ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left syncToRight AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left lineIndexA AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) AST#)...
syncToRight(lineIndexA: number): void { if (!this.diffResult) return; const leftLines = this.diffResult.leftLines; if (lineIndexA < 0 || lineIndexA >= leftLines.length) return; const leftLine = leftLines[lineIndexA]; const content = leftLine.content; const linesB = this.textB.split('\n'); ...
https://github.com/XJTUWYD/ArkDiff
d4b2a66a7711db51116c362938e93714a268d315
github