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
HarmonyOS_Samples/HarmonyOSComponentUXExamples
products/phone/src/main/ets/components/navigation/bottomtabbar/SplitViewLayoutTabBar.ets
arkts
getNavBarWidthRatio
Calculates the navigation bar width as a percentage of the total screen width. The calculation includes both the tab bar width and a portion of the tab content area. @returns {string} The percentage value as a string with '%' suffix (e.g., '45.50%')
private getNavBarWidthRatio(): string { // Width of the tab bar in pixels const tabBarWidth: number = 276; // Current screen width in pixels const screenWidth: number = this.breakpointModel.windowInfo.windowSize.width; // Width of the tab content area in pixels (40% of remaining space after tab ba...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getNavBarWidthRatio AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left str...
private getNavBarWidthRatio(): string { // Width of the tab bar in pixels const tabBarWidth: number = 276; // Current screen width in pixels const screenWidth: number = this.breakpointModel.windowInfo.windowSize.width; // Width of the tab content area in pixels (40% of remaining space after tab ba...
https://gitcode.com/HarmonyOS_Samples/HarmonyOSComponentUXExamples
cca65933f210f6134d0d656643bc616e37902a99
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/pages/StreamPage.ets
arkts
showShortcutEditor
显示快捷键编辑器 @param editingShortcut 如果传入,则为编辑模式
showShortcutEditor(editingShortcut?: Shortcut): void { this.shortcutEditorController = new CustomDialogController({ builder: ShortcutEditorDialog({ editingShortcut: editingShortcut, callbacks: { onSave: async (data: ShortcutEditData) => { if (editingShortcut) { ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left showShortcutEditor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left editingShortcut AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#identifier#Left Shortcut AST#iden...
showShortcutEditor(editingShortcut?: Shortcut): void { this.shortcutEditorController = new CustomDialogController({ builder: ShortcutEditorDialog({ editingShortcut: editingShortcut, callbacks: { onSave: async (data: ShortcutEditData) => { if (editingShortcut) { ...
https://github.com/AlkaidLab/moonlight-harmony
d854177997b12a7ea0f73358889d5879ddcaf4a8
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Theme/AppColors.ets
arkts
primary
==================== 主色系 ====================
static get primary(): string { return getColorForCurrentTheme(ColorRole.PRIMARY); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left get AST#identifier#Right AST#call_expression#Left AST#identifier#Left primary 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 get primary(): string { return getColorForCurrentTheme(ColorRole.PRIMARY); }
https://github.com/DaLongZhuaZi/manxia
95783eafb2683b8ed53ed3dc75108a5be12f7b66
github
itrainhub/wu-ui
WuUI/wu_ui/src/main/ets/components/image/image-viewer.ets
arkts
loadResource
加载资源文件,返回 ArrayBuffer @param ctx @param url @returns
function loadResource(ctx: Context, url: Resource) { const res = ctx.resourceManager.getMediaContentSync(url) return res.buffer }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left loadResource AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left ctx AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Righ...
function loadResource(ctx: Context, url: Resource) { const res = ctx.resourceManager.getMediaContentSync(url) return res.buffer }
https://github.com/itrainhub/wu-ui
6b86919ecff92c0fc3ad619eccfe968e89ebd3bf
github
Nekofox-POT/LinMusic
entry/src/main/ets/package/audio_player/class_audio_player.ets
arkts
timing
定时器(自动线程) //
private async timing() { setInterval(() => { // 若有定时任务 // if (this.target_timed != 0) { if (!this.timed_mode) { // 计时到了 // if (this.target_timed <= Date.now()) { this.target_timed = 0 this.pause() notice('计时器暂停了音乐 ╮(′~‵〞)╭') }...
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 timing AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#...
private async timing() { setInterval(() => { // 若有定时任务 // if (this.target_timed != 0) { if (!this.timed_mode) { // 计时到了 // if (this.target_timed <= Date.now()) { this.target_timed = 0 this.pause() notice('计时器暂停了音乐 ╮(′~‵〞)╭') }...
https://github.com/Nekofox-POT/LinMusic
0361fe8aaeb6209657305cbf22cf08d9c345ac06
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/WebUploadServer.ets
arkts
handleConnection
处理客户端连接 关键设计(对比 PPSSPP): PPSSPP 使用 C++ 阻塞式 HTTP 库,天然支持流式读取。 我们使用鸿蒙 TCPSocketServer 事件驱动模型,数据分片到达。 浏览器端已经做了分批(MAX_BATCH_FILES=50, MAX_BATCH_BYTES=50MB), 每批是一个独立的 HTTP POST 请求。所以服务端只需要: 1. 用 chunks 数组收集数据片段(避免 O(n²) 的逐次拷贝) 2. 等 body 收齐后一次性合并处理 3. 返回 200 让浏览器发下一批
private handleConnection(connection: socket.TCPSocketConnection): void { const connId = ++this.connectionId; const context: ConnectionContext = { chunks: [], totalLength: 0, headersParsed: false, contentLength: 0, boundary: '', method: '', path: '' }; this.co...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleConnection AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left connection AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right...
private handleConnection(connection: socket.TCPSocketConnection): void { const connId = ++this.connectionId; const context: ConnectionContext = { chunks: [], totalLength: 0, headersParsed: false, contentLength: 0, boundary: '', method: '', path: '' }; this.co...
https://github.com/richshaw2015/nds
236f642b182327e76bb3268d9002b9f578e6c3e8
github
openharmony/applications_calendar_data
datamanager/src/main/ets/processor/DefaultProcessor.ets
arkts
doDelete
删除的公共方法 @param rdbStore rdb数据库 @param uri DataShare的uri @param predicates 删除条件 @param callback 回调方法
doDelete(rdbStore: data_rdb.RdbStore, uri: string, predicates: dataSharePredicates.DataSharePredicates, callback: Function) { const table = getTableByUri(uri); rdbStore.delete(table, predicates, (err: BusinessError, count) => { Log.log(this.logTag, `delete ${table} before callback`); ca...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left doDelete AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left rdbStore AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Left d...
doDelete(rdbStore: data_rdb.RdbStore, uri: string, predicates: dataSharePredicates.DataSharePredicates, callback: Function) { const table = getTableByUri(uri); rdbStore.delete(table, predicates, (err: BusinessError, count) => { Log.log(this.logTag, `delete ${table} before callback`); ca...
https://gitee.com/openharmony/applications_calendar_data.git
b889e8f2cd2e8d119dc00e063aac56a1e562af9f
gitee
openharmony/applications_permission_manager
permissionmanager/src/main/ets/pages/authority-tertiary-groups.ets
arkts
getGrantApplicationNumber
Take the total number of access applications
getGrantApplicationNumber() { if (polymorphismGroup.indexOf(this.currentGroup) !== -1) { if (this.currentGroup === 'FOLDER') { let sum = this.folderStatusArray.filter(item => item.includes(true)); return sum.length; } else { let sum = this.polymorphismIsOn.filter( ite...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getGrantApplicationNumber 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#statemen...
getGrantApplicationNumber() { if (polymorphismGroup.indexOf(this.currentGroup) !== -1) { if (this.currentGroup === 'FOLDER') { let sum = this.folderStatusArray.filter(item => item.includes(true)); return sum.length; } else { let sum = this.polymorphismIsOn.filter( ite...
https://gitee.com/openharmony/applications_permission_manager.git
fbdff44591fcde28f4c80957272a7640bd9a0e24
gitee
Your-USTC/DailyNic_HMOS
entry/src/main/ets/utils/Classes/ScheduleManager.ets
arkts
setDefaultSemester
初始化或切换默认课表,将会用于首页、添加日程以及桌面卡片 @param target 目标学期索引 @returns undefined,但如果发生错误则返回错误信息的字符串
setDefaultSemester(target: number): string | undefined { try { UnifyPreferences.putSync('DefaultSemester', target); this.defaultSemester = target; return this.rebuildDefaultIndex(JSON.parse(UnifyPreferences.getSync('SemesterDataAt' + String(this.semesters[target].createTime), '[]'))); } catc...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left setDefaultSemester AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left target AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie...
setDefaultSemester(target: number): string | undefined { try { UnifyPreferences.putSync('DefaultSemester', target); this.defaultSemester = target; return this.rebuildDefaultIndex(JSON.parse(UnifyPreferences.getSync('SemesterDataAt' + String(this.semesters[target].createTime), '[]'))); } catc...
https://github.com/Your-USTC/DailyNic_HMOS
4d2bdff14f1d97727fe482899007e8d1d6866e5d
github
HarmonyOS_Samples/accountkit-samplecode-clientdemo-arkts
entry/src/main/ets/pages/ProtocolWebView.ets
arkts
onCheckOtherWeb
Check whether the link is an internal web page link and return to the previous URL using a gesture.
onCheckOtherWeb(): boolean { try { const url = this.controller.getUrl(); if (url !== this.url && url !== this.url + '&bgmode=black') { this.controller.backward(); return true; } return false; } catch (error) { hilog.error(domainId, logTag, `Failed to getUrl, errCo...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onCheckOtherWeb 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#sta...
onCheckOtherWeb(): boolean { try { const url = this.controller.getUrl(); if (url !== this.url && url !== this.url + '&bgmode=black') { this.controller.backward(); return true; } return false; } catch (error) { hilog.error(domainId, logTag, `Failed to getUrl, errCo...
https://gitcode.com/HarmonyOS_Samples/accountkit-samplecode-clientdemo-arkts
1911ed01ba4f2daab0eae82d4daf7a1a7b6178dd
gitcode
ibestservices/ibest-ui
library/src/main/ets/components/checkbox/index.ets
arkts
isShowBackground
是否展示背景色
isShowBackground() { let value = this.getValue() return (typeof value === 'boolean' ? value : value === this.trueValue) || this.indeterminate }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left isShowBackground 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#L...
isShowBackground() { let value = this.getValue() return (typeof value === 'boolean' ? value : value === this.trueValue) || this.indeterminate }
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/checkbox/index.ets#L173-L176
018e4c47b117b9acab7280fcd3c9fe6fe74f3a72
github
ZestBox-18/kitebook-frontend
features/home/src/main/ets/pages/Index.ets
arkts
SwiperSection
构建首页顶部统计卡片轮播区与指示器。
SwiperSection() { Column() { Swiper(this.swiperController) { BudgetOverviewCardComponent({ themeState: this.themeState, compactLayout: this.isCompactSwiperLayout(), currentMonthText: this.currentMonthText, budgetProgressValue: this.budgetProgressValue, ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left SwiperSection 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#expression_statement...
SwiperSection() { Column() { Swiper(this.swiperController) { BudgetOverviewCardComponent({ themeState: this.themeState, compactLayout: this.isCompactSwiperLayout(), currentMonthText: this.currentMonthText, budgetProgressValue: this.budgetProgressValue, ...
https://github.com/ZestBox-18/kitebook-frontend
4bfd3d9fe81e37c67842cc3cd6d0f9e44a0cee8d
github
wuba/omni-ui
omni_component/src/main/ets/components/popup/Builder.ets
arkts
setPopupCallback
设置弹窗回调 @param callback @returns
setPopupCallback(callback: PopupCallback): Builder { this.popupCallback = callback this.dialogOptions.onWillDismiss = callback.onBackPressed this.dialogOptions.onWillAppear = callback.beforeShow this.dialogOptions.onWillDisappear = callback.beforeDismiss this.dialogOptions.onDidAppear = callback.o...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setPopupCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left PopupCallback AST#identifier#Right ...
setPopupCallback(callback: PopupCallback): Builder { this.popupCallback = callback this.dialogOptions.onWillDismiss = callback.onBackPressed this.dialogOptions.onWillAppear = callback.beforeShow this.dialogOptions.onWillDisappear = callback.beforeDismiss this.dialogOptions.onDidAppear = callback.o...
https://github.com/wuba/omni-ui
7acc18256919cb5ef6aba5ae3f4164654fe02873
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Debug/PerformanceAnalyzer.ets
arkts
addWarning
添加性能警告
private addWarning(warning: PerformanceWarning): void { this.warnings.push(warning); // 限制警告数量 if (this.warnings.length > this.maxWarningsSize) { this.warnings.shift(); } // 发布警告事件 eventBus.publish(GameEvent.PERFORMANCE_WARNING, new PerformanceWarningPayload(warning)); log...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left addWarning AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left warning AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left...
private addWarning(warning: PerformanceWarning): void { this.warnings.push(warning); // 限制警告数量 if (this.warnings.length > this.maxWarningsSize) { this.warnings.shift(); } // 发布警告事件 eventBus.publish(GameEvent.PERFORMANCE_WARNING, new PerformanceWarningPayload(warning)); log...
https://github.com/DaLongZhuaZi/manxia
90506ae9e700061044c31b278c6b34fd031b2806
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test11_original_index.ets
arkts
testStrictEquality
--- Strict equality comparison ---
function testStrictEquality(): string { let a: boolean = 0 === -0; let b: boolean = Number.isNaN(NaN); let c: boolean = 'hello' === 'hello'; return String(a) + ',' + String(b) + ',' + String(c); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testStrictEquality 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#predefin...
function testStrictEquality(): string { let a: boolean = 0 === -0; let b: boolean = Number.isNaN(NaN); let c: boolean = 'hello' === 'hello'; return String(a) + ',' + String(b) + ',' + String(c); }
https://github.com/miaochiahao/ark-ghidra
de5fbaa5ab44067d57e0aa1f6dd20b00dff86e9b
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/network/PairingManager.ets
arkts
saveCertificatesToFile
保存证书和私钥到文件
private async saveCertificatesToFile(): Promise<void> { if (!this.certFilePath || !this.keyFilePath || !this.keyPair || !this.clientCertPem) { console.warn('PairingManager: 无法保存证书(路径或数据不完整)'); return; } try { // 保存证书(clientCertPem 已是 Uint8Array,直接转为字符串) const textDecoder = util.Te...
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 saveCertificatesToFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#...
private async saveCertificatesToFile(): Promise<void> { if (!this.certFilePath || !this.keyFilePath || !this.keyPair || !this.clientCertPem) { console.warn('PairingManager: 无法保存证书(路径或数据不完整)'); return; } try { // 保存证书(clientCertPem 已是 Uint8Array,直接转为字符串) const textDecoder = util.Te...
https://github.com/AlkaidLab/moonlight-harmony
68e171a81152a9aeda2d18848f85c66b591729fd
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/SettingsManager.ets
arkts
getDuplicateDetectionScope
获取重复检测范围
async getDuplicateDetectionScope(): Promise<string> { return this.getString(SettingKeys.DUPLICATE_DETECTION_SCOPE, 'same_type'); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getDuplicateDetectionScope AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_par...
async getDuplicateDetectionScope(): Promise<string> { return this.getString(SettingKeys.DUPLICATE_DETECTION_SCOPE, 'same_type'); }
https://github.com/DaLongZhuaZi/manxia
4978747d7510abd5c1dce2537227bc693ff33a90
github
cduestc-course/ArkLearn
entry/src/main/ets/pages/05/prac2.ets
arkts
aboutToAppear
页面刚进入 应该去获取数据 等待的过程中 显示进度 数据获取完 进度消失 钩子函数
aboutToAppear(): void { // 请求数据 // setTimeout/setInterval this.showLoading = true setTimeout(() => { this.showLoading = false },5000) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc...
aboutToAppear(): void { // 请求数据 // setTimeout/setInterval this.showLoading = true setTimeout(() => { this.showLoading = false },5000) }
https://github.com/cduestc-course/ArkLearn
0b46cf50c4395c996b8b690f1e42494fb3202734
github
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/services/RdpSessionManager.ets
arkts
cleanup
Cleanup session manager
async cleanup(): Promise<void> { console.info(`${TAG}: Cleaning up session manager`); await this.stopSession(); NetworkManager.uninitialize(); AudioFocusManager.cleanup(); backgroundService = null; }
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left cleanup 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#gen...
async cleanup(): Promise<void> { console.info(`${TAG}: Cleaning up session manager`); await this.stopSession(); NetworkManager.uninitialize(); AudioFocusManager.cleanup(); backgroundService = null; }
https://github.com/tangwengang-del/freerdp-harmonyos
afd710fdcfa929660cb32d2401efbb2c7f1f0a8e
github
LZZLHY/hlib
entry/src/main/ets/viewmodel/SpeedTestVM.ets
arkts
testAll
全量测速。 - force=true:总是重测。 - force=false:若缓存命中当前域列表且在 6h TTL 内直接返回;否则继续测速。
static async testAll(force: boolean = true, domains?: string[]): Promise<DomainTestResult[]> { if (SpeedTestVM.running) { Logger.w(TAG, 'already running, skip'); return SpeedTestVM.getResults(); } const list: string[] = domains !== undefined ? domains.slice() : DomainManifest.getActiveDomains(...
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 testAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left force AST#identifier#Right AST#:#Left : AST#:#Ri...
static async testAll(force: boolean = true, domains?: string[]): Promise<DomainTestResult[]> { if (SpeedTestVM.running) { Logger.w(TAG, 'already running, skip'); return SpeedTestVM.getResults(); } const list: string[] = domains !== undefined ? domains.slice() : DomainManifest.getActiveDomains(...
https://github.com/LZZLHY/hlib
9abb1b6f7c5ceef7486db369b0a6296456cdbec3
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/SparseArray.ets
arkts
constructor
Creates a new instance of SparseArray with the specified initial length. @param { int } length The initial length of the array. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public constructor(length: int) { this.buffer = new Map<int, T>() this.maxLength = length < 0 ? 0 : length }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left length AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier...
public constructor(length: int) { this.buffer = new Map<int, T>() this.maxLength = length < 0 ? 0 : length }
https://gitcode.com/iop123123/arkts-static-skills
74a155a1e575e316d50085036c04df9d7ab675df
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
some
Checks that at least one element of Uint8Array satisfies the passed function @param fn check function @returns true if some element satisfies fn
public some(fn: (element: number, index: int) => boolean): boolean { let newF: (element: number, index: int, array: Uint8Array) => boolean = (element: number, index: int, array: Uint8Array): boolean => { return fn(element, index) } return this.some(newF) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left some AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Righ...
public some(fn: (element: number, index: int) => boolean): boolean { let newF: (element: number, index: int, array: Uint8Array) => boolean = (element: number, index: int, array: Uint8Array): boolean => { return fn(element, index) } return this.some(newF) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
b638cdea19a7213e6e4510022e1957bcd29bdc1d
gitee
offlinecat-dev/OCNetORM
src/main/ets/mapping/EntityData.ets
arkts
removeTransient
删除临时数据 @param key 键名
removeTransient(key: string): void { this.transientData.delete(key) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left removeTransient AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) ...
removeTransient(key: string): void { this.transientData.delete(key) }
https://github.com/offlinecat-dev/OCNetORM
02e2da02f41e33925baabfa96148b43a1ee023d0
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
constructor
Creates an Int16Array with respect to data, byteOffset and length. @param { ArrayBuffer } buf - data initializer @param { Number | undefined } byteOffset - byte offset from begin of the buf @param { Number | undefined } length - size of elements of type short in newly created Int16Array @throws { RangeError } - Input p...
public constructor(buf: ArrayBuffer, byteOffset: Number | undefined, length: Number | undefined) { let intByteOffset: int = 0 if (byteOffset != undefined) { intByteOffset = byteOffset.toInt() if (intByteOffset < 0) { throw new RangeError("Range Error: byteOffs...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left buf AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Array...
public constructor(buf: ArrayBuffer, byteOffset: Number | undefined, length: Number | undefined) { let intByteOffset: int = 0 if (byteOffset != undefined) { intByteOffset = byteOffset.toInt() if (intByteOffset < 0) { throw new RangeError("Range Error: byteOffs...
https://gitcode.com/iop123123/arkts-static-skills
1cf616239d495a4ea0b1ef56d89c0fe4f5050bf9
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/ImageProcessing/ImageInterceptor.ets
arkts
intercept
拦截并处理图片
async intercept( url: string, sourceId: number, imageData: ArrayBuffer ): Promise<ArrayBuffer> { try { // 检查是否需要拦截 if (!this.shouldIntercept(url, sourceId)) { logger.debug(TAG, `图片无需处理: ${url}`); return imageData; } const config = this.sourceConfigs.get(sourc...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left intercept AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left url AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#...
async intercept( url: string, sourceId: number, imageData: ArrayBuffer ): Promise<ArrayBuffer> { try { // 检查是否需要拦截 if (!this.shouldIntercept(url, sourceId)) { logger.debug(TAG, `图片无需处理: ${url}`); return imageData; } const config = this.sourceConfigs.get(sourc...
https://github.com/DaLongZhuaZi/manxia
d950327fd616ea6ba39dee8d04d2604613ab5306
github
offlinecat-dev/OCNetORM
src/main/ets/core/ColumnMetadata.ets
arkts
setType
设置列类型 @param type 列类型 @returns 当前实例,支持链式调用
setType(type: ColumnType): ColumnMetadata { this.columnType = type return this }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ColumnType AST#identifier#Right AST#)#Left ) AST...
setType(type: ColumnType): ColumnMetadata { this.columnType = type return this }
https://github.com/offlinecat-dev/OCNetORM
ccf6ac73af2952b8a359dabcddda74c213656c12
github
LZZLHY/hlib
entry/src/main/ets/viewmodel/AuthVM.ets
arkts
logout
退登:清空 cookie / AuthStore / AppStorage[USER] / 站点语言偏好(切账号防残留)。
static async logout(): Promise<void> { ZLibraryClient.instance.logout(); await AuthStore.clearCredentials(); AppStorage.setOrCreate<User | null>(AppStorageKeys.USER, null); // 重置 HttpClient.siteLanguage 到当前显式偏好(无则空),避免上一账号 profile 语言污染下次登录 const explicit: string = await PreferencesStore.getString(...
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 logout AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : ...
static async logout(): Promise<void> { ZLibraryClient.instance.logout(); await AuthStore.clearCredentials(); AppStorage.setOrCreate<User | null>(AppStorageKeys.USER, null); // 重置 HttpClient.siteLanguage 到当前显式偏好(无则空),避免上一账号 profile 语言污染下次登录 const explicit: string = await PreferencesStore.getString(...
https://github.com/LZZLHY/hlib
ecb87ef52f6e30a8c5f4ed90868a6204b8df75c2
github
openharmony/applications_contacts
entry/src/main/ets/model/ContactAbilityModel.ets
arkts
postalContact
The contact address information is saved to the database. @param {Object} addParams Contact Information @param {string} DAHelper Database path @param {number} result Contact ID @param {string} uri Database address
postalContact(addParams: ContactInfo, DAHelper: dataShare.DataShareHelper, result: string, uri: string) { if (addParams.houses != undefined && addParams.houses.length > 0) { let index = 1; addParams.houses.forEach(element => { if (StringUtil.isEmpty(element.houseName)) { return; ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left postalContact AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left addParams AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ContactInfo AST#identi...
postalContact(addParams: ContactInfo, DAHelper: dataShare.DataShareHelper, result: string, uri: string) { if (addParams.houses != undefined && addParams.houses.length > 0) { let index = 1; addParams.houses.forEach(element => { if (StringUtil.isEmpty(element.houseName)) { return; ...
https://gitee.com/openharmony/applications_contacts.git
a4ccfa4962d6ae27d38c62873926ddbad69f17ad
gitee
Joker-x-dev/HarmonyKit
feature/demo/src/main/ets/viewmodel/DatabaseViewModel.ets
arkts
resetInputs
重置输入框内容 @returns {void} 无返回值
private resetInputs(): void { this.titleInput = ""; this.descInput = ""; this.editingId = 0; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left resetInputs AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#express...
private resetInputs(): void { this.titleInput = ""; this.descInput = ""; this.editingId = 0; }
https://github.com/Joker-x-dev/HarmonyKit
d669ab126b534937e8289eebbae66af1bb030658
github
aimilin6688/KeePassHO
entry/src/main/ets/services/template/TemplateConstants.ets
arkts
getAllCategories
获取所有分类
static getAllCategories(): TemplateCategory[] { return [ TemplateCategory.GENERAL, TemplateCategory.IDENTITY, TemplateCategory.FINANCE, TemplateCategory.NETWORK, TemplateCategory.DEVELOPMENT, TemplateCategory.OTHER ]; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getAllCategories 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 Templ...
static getAllCategories(): TemplateCategory[] { return [ TemplateCategory.GENERAL, TemplateCategory.IDENTITY, TemplateCategory.FINANCE, TemplateCategory.NETWORK, TemplateCategory.DEVELOPMENT, TemplateCategory.OTHER ]; }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/template/TemplateConstants.ets#L597-L606
8fa2a118ecd9f17a1102114c1286bde48ee6d7fb
github
openharmony/codelabs
ETSUI/MemoTime/entry/src/main/ets/service/DataService.ets
arkts
insertTag
==================== 标签操作 ==================== 插入标签
async insertTag(tag: Tag): Promise<void> { if (!this.rdbStore) { return } try { const valuesBucket = tag.toDbObject() await this.rdbStore.insert(AppConstants.TABLE_TAG, valuesBucket) } catch (error) { Logger.error(TAG, `Failed to insert tag: ${JSON.stringify(error)}`) } ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left insertTag AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left tag AST#identifier#Right AST#type_a...
async insertTag(tag: Tag): Promise<void> { if (!this.rdbStore) { return } try { const valuesBucket = tag.toDbObject() await this.rdbStore.insert(AppConstants.TABLE_TAG, valuesBucket) } catch (error) { Logger.error(TAG, `Failed to insert tag: ${JSON.stringify(error)}`) } ...
https://gitcode.com/openharmony/codelabs
7bfcef9ca7b3361f97173f0bc37b4aeec5a268ad
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/TypeGuards.ets
arkts
isNullOrUndefined
检查值是否为null或undefined @param value - 要检查的值 @returns 是否为null或undefined
static isNullOrUndefined(value: Object): boolean { return value === null || value === undefined; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isNullOrUndefined 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#Le...
static isNullOrUndefined(value: Object): boolean { return value === null || value === undefined; }
https://github.com/DaLongZhuaZi/manxia
3b509d37e6057665bdca77cc61d971dc677490f1
github
DaLongZhuaZi/manxia
entry/src/main/ets/pages/MainMenuPage.ets
arkts
showMoveToShelf
显示移动到书架对话框
private showMoveToShelf(itemId: string, contentType: ContentType): void { this.moveState.toShelfItemId = itemId; this.moveState.toShelfContentType = contentType; // 获取可用于移动的书架列表(只显示支持该内容类型的自定义书架) this.availableShelvesForMove = this.typeShelfManager.getShelvesForContentType(contentType); this.getUI...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left showMoveToShelf AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left itemId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#...
private showMoveToShelf(itemId: string, contentType: ContentType): void { this.moveState.toShelfItemId = itemId; this.moveState.toShelfContentType = contentType; // 获取可用于移动的书架列表(只显示支持该内容类型的自定义书架) this.availableShelvesForMove = this.typeShelfManager.getShelvesForContentType(contentType); this.getUI...
https://github.com/DaLongZhuaZi/manxia
158a8215ccf0fb5e8ea6bb03115b0753b8fec1dd
github
Joker-x-dev/CoolMallArkTS
feature/order/src/main/ets/viewmodel/OrderRefundViewModel.ets
arkts
convertOrderGoodsToCart
将订单商品列表转换为购物车结构 @param {Order} order - 订单数据 @returns {Cart[]} 购物车列表
private convertOrderGoodsToCart(order: Order): Cart[] { return order.goodsList?.length ? this.buildCartList(order.goodsList) : []; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left convertOrderGoodsToCart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left order AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#iden...
private convertOrderGoodsToCart(order: Order): Cart[] { return order.goodsList?.length ? this.buildCartList(order.goodsList) : []; }
https://github.com/Joker-x-dev/CoolMallArkTS
6277428bc287cad1f2acbeb14e3d1c0f1a1a00c6
github
openharmony/applications_photos
feature/browser/src/main/ets/default/view/album/AlbumSetPage.ets
arkts
onInActive
Callback when the page is in the background
onInActive() { if (this.isActive) { Log.info(TAG, 'onInActive'); this.isActive = false; this.albums && this.albums.onInActive(); } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onInActive AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AS...
onInActive() { if (this.isActive) { Log.info(TAG, 'onInActive'); this.isActive = false; this.albums && this.albums.onInActive(); } }
https://gitee.com/openharmony/applications_photos.git
248596bc81d09e71522df21da99d5f0635639ec2
gitee
arkui-x/samples
CodeLab/Cases/feature/customdrawtabbar/src/main/ets/utils/CircleClass.ets
arkts
getAutoPositionX
根据选项自动获取距离 X 值 @param { number } index - 当球选中项的下标 @returns { number }
getAutoPositionX(index: number): number { return this.getMenuCenterX(index) - this.circleRadius }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getAutoPositionX AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left...
getAutoPositionX(index: number): number { return this.getMenuCenterX(index) - this.circleRadius }
https://gitcode.com/arkui-x/samples
ec0fc6f7d8d92b48f7569145e03bbe2435d3fbaf
gitcode
wuba/omni-ui
omni_component/src/main/ets/components/guide/model/HighLightOptionsBuilder.ets
arkts
build
获取高亮区域的额外配置项 @returns
public build(): HighLightOptions { return this.options; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left build 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 build(): HighLightOptions { return this.options; }
https://github.com/wuba/omni-ui
f830d4d5a12e46f3e461c547402ca662c638bdb6
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
entries
Returns an array of key, value pairs for every entry in the BigInt64Array @returns { IterableIterator<[int, BigInt]> } - key, value pairs for every entry in the array @syscap SystemCapability.Utils.Lang @FaAndStageModel
public entries(): IterableIterator<[int, BigInt]> { return new BigInt64ArrayIteratorEntries(this) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left entries AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_sta...
public entries(): IterableIterator<[int, BigInt]> { return new BigInt64ArrayIteratorEntries(this) }
https://gitcode.com/iop123123/arkts-static-skills
185f9b4c5d73791307ed7db65292ce4843f558c8
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Diagnostics/StartupRecovery.ets
arkts
executeResetStrategy
执行重置策略
private async executeResetStrategy(failureType: StartupFailureType): Promise<RecoveryResult> { logger.info('StartupRecovery', '🔄 执行重置策略'); try { // 清理状态 this.recoveryAttempts.clear(); this.lastSnapshot = null; // 发送重置事件 const resetPayload: IEventPayload = { failureTy...
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 executeResetStrategy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left failureType AST#identifier#Right...
private async executeResetStrategy(failureType: StartupFailureType): Promise<RecoveryResult> { logger.info('StartupRecovery', '🔄 执行重置策略'); try { // 清理状态 this.recoveryAttempts.clear(); this.lastSnapshot = null; // 发送重置事件 const resetPayload: IEventPayload = { failureTy...
https://github.com/DaLongZhuaZi/manxia
71f0f2297392a138c5a3dcd101258752454824d2
github
aimilin6688/KeePassHO
entry/src/main/ets/common/utils/KdbxUtils.ets
arkts
arrayBufferToKdbx
将ArrayBuffer转换为对象 @param arrayBuffer ArrayBuffer对象 @param credentialsParam 凭据参数 @param credentials 凭据 @throws KdbxError 如果凭据无效,则抛出KdbxError
public static async arrayBufferToKdbx(arrayBuffer: ArrayBuffer | Kdbx, credentialsParam: CredentialsParam, credentials?: KdbxCredentials): Promise<Kdbx> { if (arrayBuffer instanceof Kdbx) { return arrayBuffer; } if (credentials == undefined) { credentials = await CredentialsService.createKdbxC...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left arrayBufferToKdbx AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ...
public static async arrayBufferToKdbx(arrayBuffer: ArrayBuffer | Kdbx, credentialsParam: CredentialsParam, credentials?: KdbxCredentials): Promise<Kdbx> { if (arrayBuffer instanceof Kdbx) { return arrayBuffer; } if (credentials == undefined) { credentials = await CredentialsService.createKdbxC...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/KdbxUtils.ets#L328-L342
279c39534ed00181e1ca28cc911e619538eb7287
github
LJ666-ui/harmony-health-care
entry/src/main/ets/services/TerminalManager.ets
arkts
showAccessDenied
显示访问拒绝提示
private async showAccessDenied(): Promise<void> { // 这里可以显示一个对话框或提示 console.error('访问被拒绝:您无权访问此页面'); // 可以跳转到首页 const config = this.getCurrentTerminalConfig(); if (config) { await router.replaceUrl({ url: config.entryPage }); } }
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 showAccessDenied AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right ...
private async showAccessDenied(): Promise<void> { // 这里可以显示一个对话框或提示 console.error('访问被拒绝:您无权访问此页面'); // 可以跳转到首页 const config = this.getCurrentTerminalConfig(); if (config) { await router.replaceUrl({ url: config.entryPage }); } }
https://github.com/LJ666-ui/harmony-health-care
42d6400f436d424fc6e011cdddf91f15e92e2f63
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/SessionManager.ets
arkts
getNextRefreshTime
获取下次刷新时间
getNextRefreshTime(sourceId: number): number | null { const state = this.sessionStates.get(sourceId); return state ? state.nextRefreshTime : null; }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getNextRefreshTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#...
getNextRefreshTime(sourceId: number): number | null { const state = this.sessionStates.get(sourceId); return state ? state.nextRefreshTime : null; }
https://github.com/DaLongZhuaZi/manxia
67d925f4f45a434d3e0503c205320fd39b115e1f
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/StreamInputHandler.ets
arkts
setMenuKey
设置用于打开串流菜单的按键(由设置页配置) @param keyName 按键名称: 'ESC' | 'F1' | 'F12' | '~'
setMenuKey(keyName: string): void { switch (keyName) { case 'F1': this.menuKeyCode = 2090; break; case 'F12': this.menuKeyCode = 2101; break; case '~': this.menuKeyCode = 2056; break; default: // 'ESC' this.menuKeyCode = StreamInputHa...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setMenuKey AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left keyName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST#)#Rig...
setMenuKey(keyName: string): void { switch (keyName) { case 'F1': this.menuKeyCode = 2090; break; case 'F12': this.menuKeyCode = 2101; break; case '~': this.menuKeyCode = 2056; break; default: // 'ESC' this.menuKeyCode = StreamInputHa...
https://github.com/AlkaidLab/moonlight-harmony
137bfe5f2a3cbff469fee3cf6c608bd700c69ae1
github
fuhhhhhhhh/openharmony
entry/src/main/ets/data/DatabaseHelper.ets
arkts
deleteTransactionsByAmountRange
删除某个金额范围内的交易记录 @param minAmount 最小金额 @param maxAmount 最大金额 @param transactionType 交易类型 (0=支出, 1=收入, undefined=全部) @returns 删除的记录数量
public static async deleteTransactionsByAmountRange(minAmount: number, maxAmount: number, transactionType?: number): Promise<number> { if (!DatabaseHelper.isInitialized || !DatabaseHelper.transactionDao) { throw new Error('数据库未初始化,请先调用 DatabaseHelper.initialize()'); } return await DatabaseHelper.tra...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left deleteTransactionsByAmountRange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left m...
public static async deleteTransactionsByAmountRange(minAmount: number, maxAmount: number, transactionType?: number): Promise<number> { if (!DatabaseHelper.isInitialized || !DatabaseHelper.transactionDao) { throw new Error('数据库未初始化,请先调用 DatabaseHelper.initialize()'); } return await DatabaseHelper.tra...
https://github.com/fuhhhhhhhh/openharmony
994bacd0f57af21411e98a185146fdfe946ba5fc
github
ibestservices/ibest-ui
library/src/main/ets/components/checkbox/index.ets
arkts
getIconColor
获取图标的颜色
getIconColor() { return this.getIsDisabled() ? IBestCheckboxColor.disabledIconColor : IBestCheckboxColor.whiteColor }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getIconColor 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 ...
getIconColor() { return this.getIsDisabled() ? IBestCheckboxColor.disabledIconColor : IBestCheckboxColor.whiteColor }
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/checkbox/index.ets#L198-L200
a49b0a05229f2ce78e63349bbab4e2d8efa7f833
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets
arkts
constructor
`Date` constructor. NOTE: Dates before `1921-01-01T00:00:00 GMT` can be represented as UTC milliseconds in different ways then TS do. @param { int } year @param { int } monthIndex @param { int } [ day ] @param { int } [ hours ] @param { int } [ minutes ] @param { int } [ seconds ] @param { int } [ ms ] @syscap SystemCa...
constructor(year: int, monthIndex: int, day?: int, hours?: int, minutes?: int, seconds?: int, ms?: int) { this.ms = ecmaMakeDate( ecmaMakeDay(ecmaMakeFullYear(year), monthIndex, day ?? 1), ecmaMakeTime(hours ?? 0, minutes ?? 0, seconds ?? 0, ms ?? 0) ); this.ms += thi...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left year AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#Right AST#ERROR#Right AST#...
constructor(year: int, monthIndex: int, day?: int, hours?: int, minutes?: int, seconds?: int, ms?: int) { this.ms = ecmaMakeDate( ecmaMakeDay(ecmaMakeFullYear(year), monthIndex, day ?? 1), ecmaMakeTime(hours ?? 0, minutes ?? 0, seconds ?? 0, ms ?? 0) ); this.ms += thi...
https://gitcode.com/iop123123/arkts-static-skills
7d96abb4743596431d3205b7e85475fae51881da
gitcode
OSpark-Team/Free-PCM
library/src/main/ets/utils/AudioDecoderManager.ets
arkts
decodeFile
直接同步解码本地文件 @param {string} inputPath - 输入文件绝对路径 @param {string} outputPath - 输出 PCM 文件绝对路径 @returns {boolean}
public decodeFile(inputPath: string, outputPath: string): boolean { return testNapi.decodeAudio(inputPath, outputPath); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left decodeFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left inputPath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Ri...
public decodeFile(inputPath: string, outputPath: string): boolean { return testNapi.decodeAudio(inputPath, outputPath); }
https://github.com/OSpark-Team/Free-PCM/blob/3440e7220d07d28815d172b4b3237145434075ee/library/src/main/ets/utils/AudioDecoderManager.ets#L233-L235
a42019693f4c2123d88874f4a0a64395914ece52
github
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/hosts/system/windows/classes/meowUiHost.ets
arkts
reportAddressBarBlur
Called after blurring the address bar, to synchronize the statuses in this meowUiHost.
reportAddressBarBlur() { clearTimeout(this.addressBarBlurTimeoutId); if (this.addressBarFocused) { this.addressBarBlurTimeoutId = setTimeout(() => { animateToImmediately(defaultAnimation(), () => { this.addressBarFocused = false; }); }, 50); } this.requestHideAddr...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left reportAddressBarBlur 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...
reportAddressBarBlur() { clearTimeout(this.addressBarBlurTimeoutId); if (this.addressBarFocused) { this.addressBarBlurTimeoutId = setTimeout(() => { animateToImmediately(defaultAnimation(), () => { this.addressBarFocused = false; }); }, 50); } this.requestHideAddr...
https://github.com/awaLiny2333/LinysBrowser_NEXT
3d3195a5d708667827e23bcfce3eeefd29b00b60
github
arkui-x/samples
CodeLab/Cases/feature/calendarswitch/src/main/ets/customcalendar/utils/TimeUtils.ets
arkts
addSchedule
开始时间和结束时间涉及多日时,支持在月视图和周视图中显示添加的多日日程点 @param startDate 开始时间 @param endDate 结束时间
static addSchedule(startDate: Date, endDate: Date) { // 当前日期设置为开始日期 let currentDateTime = new Date(startDate); let endDateTime = new Date(endDate); // 使用 while 循环遍历日期范围 while (currentDateTime <= endDateTime) { // 只保留日期部分,格式化为 yyyy/MM/dd let scheduleTime = currentDateTime.toLoca...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left addSchedule AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left startDate AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Date AST#identi...
static addSchedule(startDate: Date, endDate: Date) { // 当前日期设置为开始日期 let currentDateTime = new Date(startDate); let endDateTime = new Date(endDate); // 使用 while 循环遍历日期范围 while (currentDateTime <= endDateTime) { // 只保留日期部分,格式化为 yyyy/MM/dd let scheduleTime = currentDateTime.toLoca...
https://gitcode.com/arkui-x/samples
7ec3df49d9cbc1c3115d8ab9c1fc012ff2d4f0ee
gitcode
iHongRen/harmony-study-demo
entry/src/main/ets/pages/oss/OssUploader.ets
arkts
upload
上传方法 @param token OSS 临时凭证 @param config 上传配置 @returns 统一格式的上传结果
async upload( token: OSSToken, config: OSSUploadConfig ): Promise<OSSUploadResponse> { if (!token.AccessKeyId || !token.AccessKeySecret) { return { success: false, message: 'OSS凭证:AccessKeyId/AccessKeySecret 不能为空', }; } if (!config.bucket || !config.endpoint || !con...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left upload AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left token AST#identifier#Right AST#type_an...
async upload( token: OSSToken, config: OSSUploadConfig ): Promise<OSSUploadResponse> { if (!token.AccessKeyId || !token.AccessKeySecret) { return { success: false, message: 'OSS凭证:AccessKeyId/AccessKeySecret 不能为空', }; } if (!config.bucket || !config.endpoint || !con...
https://github.com/iHongRen/harmony-study-demo
b2002f9abac0076ce60765c92439a0fb922430a7
github
AetheriumSimulator/qemu-hmos
entry/src/main/ets/utils/Windows11Config.ets
arkts
checkTPMAvailability
快速检查 TPM 可用性
static async checkTPMAvailability(vmName?: string): Promise<boolean> { console.log('[Windows11Tester] 检查 TPM 2.0 支持...'); return Windows11ConfigManager.isTPMAvailable(vmName); }
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 checkTPMAvailability AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left vmName AST#identifier#Right AST#?#L...
static async checkTPMAvailability(vmName?: string): Promise<boolean> { console.log('[Windows11Tester] 检查 TPM 2.0 支持...'); return Windows11ConfigManager.isTPMAvailable(vmName); }
https://github.com/AetheriumSimulator/qemu-hmos
ac7a5bad7db27ca23d26a10a9ce9b0de935c01b2
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/Char.ets
arkts
compare
compare(Char, Char) compares two Chars by their underlying chars. @param lhs the first Char to compare. @param rhs the second Char to compare. @returns comparison result of the underlying chars.
public static compare(lhs: Char, rhs: Char): boolean { return (lhs.unboxed() == rhs.unboxed()); }
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 compare AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left lhs AST#identifier#Right AST#:#Left : AST#:#Rig...
public static compare(lhs: Char, rhs: Char): boolean { return (lhs.unboxed() == rhs.unboxed()); }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
20f7c3e3839fb26de0a00dc2f59aa7314db6d8f5
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/components/BookOpenTransition.ets
arkts
getCurrentMode
获取当前过渡模式
public getCurrentMode(): TransitionMode { return this.currentMode; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCurrentMode 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 Transit...
public getCurrentMode(): TransitionMode { return this.currentMode; }
https://github.com/DaLongZhuaZi/manxia
edca36407151af11fa642b2a19d04ab006a0bc5a
github
offlinecat-dev/OCNetORM
src/main/ets/mapping/TypedEntityData.ets
arkts
hasValue
检查属性是否存在 @param key 属性名 @returns 是否存在
hasValue(key: string): boolean { return this.data.has(key) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)#R...
hasValue(key: string): boolean { return this.data.has(key) }
https://github.com/offlinecat-dev/OCNetORM
c6feb1c94b07a4d6c64042aa33b4808b8c3de5df
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/utils/ViewPortHandler.ets
arkts
refresh
call this method to refresh the graph with a given matrix @param newMatrix @return
public refresh(newMatrix: Matrix, chart: Chart<ChartData<IDataSet<EntryOhos>>>, invalidate: boolean): Matrix { this.mMatrixTouch.set(newMatrix); // make sure scale and translation are within their bounds this.limitTransAndScale(this.mMatrixTouch, this.mContentRect); if (invalidate) chart.inva...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left refresh AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left newMatrix AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Matrix AST#identifi...
public refresh(newMatrix: Matrix, chart: Chart<ChartData<IDataSet<EntryOhos>>>, invalidate: boolean): Matrix { this.mMatrixTouch.set(newMatrix); // make sure scale and translation are within their bounds this.limitTransAndScale(this.mMatrixTouch, this.mContentRect); if (invalidate) chart.inva...
https://gitee.com/openharmony-tpc/ohos_mpchart.git
da2a11b3a234787b005bb351e6031605a78998e2
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/EAWorker.ets
arkts
current
Get the current worker instance @returns { EAWorker } The current worker instance
public static current(): EAWorker | undefined { let currentWorker = EAWorker.getWorkers().get(CoroutineExtras.getWorkerId()); if (currentWorker !== undefined && currentWorker.isTaskpool) { throw new Error('EAWorker:: Cannot get current worker in taskpool'); } return curre...
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 current AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left ...
public static current(): EAWorker | undefined { let currentWorker = EAWorker.getWorkers().get(CoroutineExtras.getWorkerId()); if (currentWorker !== undefined && currentWorker.isTaskpool) { throw new Error('EAWorker:: Cannot get current worker in taskpool'); } return curre...
https://gitcode.com/iop123123/arkts-static-skills
8490970f39d95b7de4098c09c4605e2f9dc32057
gitcode
openharmony/codelabs
Media/VideoPlayer/entry/src/main/ets/controller/VideoController.ets
arkts
onVolumeActionStart
Volume gesture method onActionStart. @param event Gesture event.
onVolumeActionStart(event?: GestureEvent) { if (!event) { return; } this.positionX = event.offsetX; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onVolumeActionStart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#...
onVolumeActionStart(event?: GestureEvent) { if (!event) { return; } this.positionX = event.offsetX; }
https://gitee.com/openharmony/codelabs.git
5e8d4883b87b88424ef635dd595fbd784b2303b5
gitee
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/StreamingSession.ets
arkts
setConnectionTerminatedCallback
设置连接终止回调 errorCode: 0 = 正常关闭, <0 = 错误
setConnectionTerminatedCallback(callback: ((errorCode: number) => void) | null): void { this.connectionTerminatedCallback = callback; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setConnectionTerminatedCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#(#Left ( AST#(#Right AST#...
setConnectionTerminatedCallback(callback: ((errorCode: number) => void) | null): void { this.connectionTerminatedCallback = callback; }
https://github.com/AlkaidLab/moonlight-harmony
a2f8783878069385510714c10f33fd574ef12944
github
luojiang001/Pulse
Pulse/oh_modules/collect_personal_info/src/main/ets/common/WindowModel.ets
arkts
registerKeyboardListener
注册监听键盘区域变化
public registerKeyboardListener(callback: Callback<number>) { window.getLastWindow(getContext()).then(currentWindow => { const keyboardH = currentWindow.getWindowAvoidArea(window.AvoidAreaType.TYPE_KEYBOARD).bottomRect.height; callback(keyboardH); currentWindow.on('keyboardHeightChange', callbac...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left registerKeyboardListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ins...
public registerKeyboardListener(callback: Callback<number>) { window.getLastWindow(getContext()).then(currentWindow => { const keyboardH = currentWindow.getWindowAvoidArea(window.AvoidAreaType.TYPE_KEYBOARD).bottomRect.height; callback(keyboardH); currentWindow.on('keyboardHeightChange', callbac...
https://github.com/luojiang001/Pulse
8c61e597c007e6fa59d4eba682383529cc6d8ac6
github
openharmony-sig/ohos_danmaku_flame_master
library/src/main/ets/components/common/master/flame/danmaku/ui/widget/DanmakuView.ets
arkts
getView
------------- View方法 --------------------
getView(): IDanmakuView{ return this }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getView 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 IDanmakuView AST#identifier#Right AST#ERROR#Right AST#...
getView(): IDanmakuView{ return this }
https://gitee.com/openharmony-sig/ohos_danmaku_flame_master.git
c790fe262c75ed9f3f10766472939e52c9f612fc
gitee
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test26_original_index.ets
arkts
testArrayReverse
--- Array reverse in-place ---
function testArrayReverse(): string { let arr: number[] = [1, 2, 3, 4, 5]; let reversed: number[] = arr.reverse(); return String(reversed[0]) + ',' + String(reversed[4]); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testArrayReverse 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 testArrayReverse(): string { let arr: number[] = [1, 2, 3, 4, 5]; let reversed: number[] = arr.reverse(); return String(reversed[0]) + ',' + String(reversed[4]); }
https://github.com/miaochiahao/ark-ghidra
bc5068f261dd4a442acf60a418421019712891ee
github
honjow/Next2V
entry/src/main/ets/model/AccountPageCoordinator.ets
arkts
hasAnyAccount
Returns true only when the app has identifiable accounts. Gate priority: 1. AccountStore records exist (definitive identity) 2. Token-based auth (PAT) is configured (legacy, token-only identity) 3. Cookie is configured AND session contains a real username A lone stale cookie WITHOUT an accompanying session username or ...
static hasAnyAccount( authCookieConfigured: boolean, authTokenConfigured: boolean, accountsCount: number, sessionUsername: string, ): boolean { if (accountsCount > 0) { return true } if (authTokenConfigured) { return true } if (authCookieConfigured && (sessionUsername...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left hasAnyAccount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left authCookieConfigured AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boole...
static hasAnyAccount( authCookieConfigured: boolean, authTokenConfigured: boolean, accountsCount: number, sessionUsername: string, ): boolean { if (accountsCount > 0) { return true } if (authTokenConfigured) { return true } if (authCookieConfigured && (sessionUsername...
https://github.com/honjow/Next2V
f58350a57e69e871e9b79db7ed6948fdde84d187
github
openharmony-tpc/XmlGraphicsBatik
library/src/main/ets/batik/StringReader.ets
arkts
peek
获取从当前索引位置开始的给定字符数的字符 @param count:要获取的字符数 @return 返回给定数量的字符串
public peek(count: number = 1): string { if (this.charIndex >= this._charCount) { return this.emptyString; } if (count === 1) { return this._chars[this.charIndex]; } let _charsToBytes: number[]=this._charsToBytes let charIndex: number=this.charIndex return this.xmlDetailInfo...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left peek AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left count AST#identifier#Right AST#:#Left : AST#:#Right AST#ERR...
public peek(count: number = 1): string { if (this.charIndex >= this._charCount) { return this.emptyString; } if (count === 1) { return this._chars[this.charIndex]; } let _charsToBytes: number[]=this._charsToBytes let charIndex: number=this.charIndex return this.xmlDetailInfo...
https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git
ad557885b07907e73caf7a303df2d25a8ed3c0e9
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/TarPackager.ets
arkts
createTarArchive
创建 tar 包 @param sourceDir 源目录 @param outputPath 输出文件路径(.mxbackup)
async createTarArchive(sourceDir: string, outputPath: string): Promise<void> { try { logger.info(TAG, `正在创建tar归档: ${outputPath}`); // 获取目录中的所有文件 const files = await this.getAllFiles(sourceDir); logger.info(TAG, `找到 ${files.length} 个文件待归档`); // 创建临时 tar 文件 const te...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left createTarArchive AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceDir AST#identifier#Right AST#type_annotation#Le...
async createTarArchive(sourceDir: string, outputPath: string): Promise<void> { try { logger.info(TAG, `正在创建tar归档: ${outputPath}`); // 获取目录中的所有文件 const files = await this.getAllFiles(sourceDir); logger.info(TAG, `找到 ${files.length} 个文件待归档`); // 创建临时 tar 文件 const te...
https://github.com/DaLongZhuaZi/manxia
de5b71ff4410252ce987cfd531bc9892b5367af7
github
offlinecat-dev/OCNetORM
src/main/ets/core/EntityMetadata.ets
arkts
isSoftDeleteEnabled
检查是否启用软删除 @returns 是否启用软删除
isSoftDeleteEnabled(): boolean { return this.softDelete }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isSoftDeleteEnabled 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...
isSoftDeleteEnabled(): boolean { return this.softDelete }
https://github.com/offlinecat-dev/OCNetORM
ac3c4cd5745f7505969eafc12a3413dcae4a7d1f
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.PlainArray.ets
arkts
removeRangeFrom
Delete a range of elements. @param index the index of the element to remove @param size the number of elements to remove @returns the number of elements removed
public removeRangeFrom(index: int, size: int): int { this.checkIndexType(index); this.checkEmptyContainer(); if (size > Int.MAX_VALUE) { throw createBusinessError(TypeErrorCodeId, `The type of \"size\" must be small integer. Received value is: ${size}`); }...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left removeRangeFrom AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left index AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identif...
public removeRangeFrom(index: int, size: int): int { this.checkIndexType(index); this.checkEmptyContainer(); if (size > Int.MAX_VALUE) { throw createBusinessError(TypeErrorCodeId, `The type of \"size\" must be small integer. Received value is: ${size}`); }...
https://gitcode.com/iop123123/arkts-static-skills
3e48ee9d561bb75c233b7ba106e0d60c5f91378b
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/TabContentCacheManager.ets
arkts
hasSuwayomiCache
是否有Suwayomi缓存数据
hasSuwayomiCache(): boolean { return this.suwayomiCache !== null && this.suwayomiCache.mangas.length > 0; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasSuwayomiCache 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...
hasSuwayomiCache(): boolean { return this.suwayomiCache !== null && this.suwayomiCache.mangas.length > 0; }
https://github.com/DaLongZhuaZi/manxia
8481fe84a1e698f237236d2ce7899b97eeb95d50
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets
arkts
sum
Return a new Decimal whose value is the sum of the arguments, rounded to `precision` significant digits using rounding mode `rounding`. Only the result is rounded, not the intermediate calculations. @param { Value[] } n {double | string | Decimal} @returns { Decimal } the Decimal type
static sum(...values: Value[]): Decimal { let result = new Decimal(values[0]); external = false; for (let i = 1; i < values.length; i++) { if (result.isNaN()) { break; } result = result.add(values[i]); } external = true; ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left sum AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#ERROR#Left AST#identifier#Left value...
static sum(...values: Value[]): Decimal { let result = new Decimal(values[0]); external = false; for (let i = 1; i < values.length; i++) { if (result.isNaN()) { break; } result = result.add(values[i]); } external = true; ...
https://gitcode.com/iop123123/arkts-static-skills
ec047d344930ab73e5cfca2047658a581dcecb7f
gitcode
HarmonyOS_Samples/BestPracticeSnippets
ArkUI/orientationDevelopment/entry/src/main/ets/pages/MediaQueryPage.ets
arkts
onPortrait
When the media query conditions are met, a callback is triggered
onPortrait(mediaQueryResult: mediaquery.MediaQueryResult) { if (mediaQueryResult.matches as boolean) { // If the device is in landscape orientation, change the corresponding page layout this.color = '#FFD700'; this.text = 'Landscape'; } else { this.color = '#DB7093'; this.text = ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onPortrait AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left mediaQueryResult AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left mediaqu...
onPortrait(mediaQueryResult: mediaquery.MediaQueryResult) { if (mediaQueryResult.matches as boolean) { // If the device is in landscape orientation, change the corresponding page layout this.color = '#FFD700'; this.text = 'Landscape'; } else { this.color = '#DB7093'; this.text = ...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
81b7144f28572da0a30ecdf488da41c66fbddfd7
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Array.ets
arkts
isArray
Checks whether the passed value is an Array. @param arr @returns true is arr is a non-null and non-empty array, false otherwise
public static isArray<T>(arr: Array<T>): boolean { if(arr.getData() == null){ return false } return true }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#binary_expression#Left AST#identifier#Left isArray AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST...
public static isArray<T>(arr: Array<T>): boolean { if(arr.getData() == null){ return false } return true }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
1a0a47df4f734ca9a490fc65495f43afeb110519
gitee
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/services/RdpSessionManager.ets
arkts
onForeground
Handle app going to foreground
async onForeground(): Promise<void> { if (!isSessionActive) { console.info(`${TAG}: No active session, skip foreground handling`); return; } console.info(`${TAG}: App going to foreground`); isInBackground = false; // Stop keepalive timer this.stopKeepaliveTimer(); ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left onForeground AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AS...
async onForeground(): Promise<void> { if (!isSessionActive) { console.info(`${TAG}: No active session, skip foreground handling`); return; } console.info(`${TAG}: App going to foreground`); isInBackground = false; // Stop keepalive timer this.stopKeepaliveTimer(); ...
https://github.com/tangwengang-del/freerdp-harmonyos
e8763120f0ce1c1d94f8327e95c2292cc8dfd6f6
github
LJ666-ui/harmony-health-care
entry/src/main/ets/ar/ARNavigationService.ets
arkts
saveNavigationHistory
保存导航历史
private saveNavigationHistory(): void { if (!this.currentDestination || !this.navigationState.currentPath) return; const history: NavigationHistory = { id: `HISTORY_${Date.now()}`, destinationId: this.currentDestination.id, destinationName: this.currentDestination.name, startTime: thi...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left saveNavigationHistory 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 voi...
private saveNavigationHistory(): void { if (!this.currentDestination || !this.navigationState.currentPath) return; const history: NavigationHistory = { id: `HISTORY_${Date.now()}`, destinationId: this.currentDestination.id, destinationName: this.currentDestination.name, startTime: thi...
https://github.com/LJ666-ui/harmony-health-care
4a2b053339650d4efa197489549665076daebcff
github
openharmony/codelabs
ETSUI/ChatAppDemo/entry/src/main/ets/pages/Register.ets
arkts
onPageShow
利用生命周期钩子
onPageShow() { // 获取从 LocationSelectPage 返回时的参数 const params = router.getParams() as Record<string, string>; if (params && params.province) { // 这里的 key 要和 LocationSelectPage 中 back 传的 key 一致 const countryName = params.country || $r('app.string.label_china'); const provinceName = params....
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onPageShow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AS...
onPageShow() { // 获取从 LocationSelectPage 返回时的参数 const params = router.getParams() as Record<string, string>; if (params && params.province) { // 这里的 key 要和 LocationSelectPage 中 back 传的 key 一致 const countryName = params.country || $r('app.string.label_china'); const provinceName = params....
https://gitcode.com/openharmony/codelabs
ce8b353e1986719e46c950edd7f7c1219eacc084
gitcode
the-wwyang/kids-learning-app
src/main/ets/storage/UserSettingsStorageService.ets
arkts
getDefaultSettings
获取默认设置
private static getDefaultSettings(): UserSettings { return { audio: { soundEnabled: true, musicEnabled: false, soundVolume: 0.7, musicVolume: 0.5 }, defaultDifficulty: Difficulty.EASY, defaultQuestionType: QuestionType.CALCULATION, showExplanation: tru...
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 getDefaultSettings AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Rig...
private static getDefaultSettings(): UserSettings { return { audio: { soundEnabled: true, musicEnabled: false, soundVolume: 0.7, musicVolume: 0.5 }, defaultDifficulty: Difficulty.EASY, defaultQuestionType: QuestionType.CALCULATION, showExplanation: tru...
https://github.com/the-wwyang/kids-learning-app
0f64b90807fcf0d4cbfbed99ba737f27b283b33f
github
aimilin6688/KeePassHO
entry/src/main/ets/common/utils/WebImageDownloader.ets
arkts
isValidImageType
验证图片类型 @param contentType 内容类型 @returns 是否支持
private static isValidImageType(contentType: string): boolean { const supportedTypes = [ 'image/jpeg', 'image/jpg', 'image/png', 'image/gif', 'image/webp', 'image/bmp', 'image/x-icon' ]; return supportedTypes.some(type => contentType.includes(type)); }
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 isValidImageType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left contentType AST#identifier#Right AST#ERROR#Left AS...
private static isValidImageType(contentType: string): boolean { const supportedTypes = [ 'image/jpeg', 'image/jpg', 'image/png', 'image/gif', 'image/webp', 'image/bmp', 'image/x-icon' ]; return supportedTypes.some(type => contentType.includes(type)); }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/WebImageDownloader.ets#L83-L94
bd3ec8d39194f8e93755c8152e628e816d521ece
github
honjow/Next2V
shared/src/main/ets/network/ApiService.ets
arkts
getNodeTopicsPage
Get topics from node page, supports /go/{node}?p=N pagination. When `cookie` is supplied the page is fetched as the authenticated session (login-gated nodes like /go/sandbox return signin HTML for anonymous reads, which the public parser would otherwise turn into a misleading empty list). For cookie-backed loads we the...
async getNodeTopicsPage( nodeName: string, page: number = 1, cookie: string = '', ): Promise<V2exNodeTopicsPageResult> { const clean = (nodeName || '').trim() if (!clean) { throw ApiErrors.nodeNameRequired() } const safePage = Math.max(1, Math.floor(page)) const endpoint = `/go...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getNodeTopicsPage AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left nodeName AST#identifier#Right AST#type_annotation#Left AST#:#...
async getNodeTopicsPage( nodeName: string, page: number = 1, cookie: string = '', ): Promise<V2exNodeTopicsPageResult> { const clean = (nodeName || '').trim() if (!clean) { throw ApiErrors.nodeNameRequired() } const safePage = Math.max(1, Math.floor(page)) const endpoint = `/go...
https://github.com/honjow/Next2V
5125ebe84fc926a8aa73d16b6aacb9c7b905a161
github
Joker-x-dev/CoolMallArkTS
core/data/src/main/ets/repository/CustomerServiceRepository.ets
arkts
readMessage
标记消息为已读 @param params 标记消息为已读请求参数 @returns 操作结果
async readMessage(params: ReadMessageRequest): Promise<NetworkResponse<boolean>> { return this.networkDataSource.readMessage(params); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left readMessage 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 : A...
async readMessage(params: ReadMessageRequest): Promise<NetworkResponse<boolean>> { return this.networkDataSource.readMessage(params); }
https://github.com/Joker-x-dev/CoolMallArkTS
c466c26cce4d47e1f751738b093d9fb833a99ab7
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.LightWeightMap.ets
arkts
getIndexOfKey
Gets the index of the specified key in the LightWeightMap @param key the key to find the index of @returns the index of the key, or -1 if the key is not found
getIndexOfKey(key: K): int { const index = this.checkIndexOfKey(key); return index < 0 ? -1 : index; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getIndexOfKey AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left key AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left K AST#identifier#Right AST#ERROR#Right AST#)#Left ) AST#)#R...
getIndexOfKey(key: K): int { const index = this.checkIndexOfKey(key); return index < 0 ? -1 : index; }
https://gitcode.com/iop123123/arkts-static-skills
3cce246550c392647bedd95b6c16c8adcd20715c
gitcode
HarmonyOS_Samples/MusicHome
features/recommendation/src/main/ets/view/HomeCapsuleHeader.ets
arkts
build
Full-width row with centered capsule list and trailing brand block with marquee text.
build() { Row() { Blank() .width('25%') Row({ space: 10 }) { Row({ space: 8 }) { SymbolGlyph($r('sys.symbol.person_fill')) .fontSize(26) .fontWeight(FontWeight.Regular) .height(26) .fontColor(['#99ffffff']) .margin(1...
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() { Row() { Blank() .width('25%') Row({ space: 10 }) { Row({ space: 8 }) { SymbolGlyph($r('sys.symbol.person_fill')) .fontSize(26) .fontWeight(FontWeight.Regular) .height(26) .fontColor(['#99ffffff']) .margin(1...
https://gitcode.com/HarmonyOS_Samples/MusicHome
8dfc17f6fec4b8a06cf10d792c30b5640b404c29
gitcode
HarmonyOS_Samples/BestPracticeSnippets
ArkUI/StateManagement/entry/src/main/ets/segment/segment6.ets
arkts
getUserData
[EndExclude Case3_start] Getting server-side user information in a business class
getUserData(): void { this.userAccountRepository.getUserData().then((data: UserData) => { // 1.Storing user information data into AppStorage AppStorage.setOrCreate('userData', data); }); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getUserData 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#...
getUserData(): void { this.userAccountRepository.getUserData().then((data: UserData) => { // 1.Storing user information data into AppStorage AppStorage.setOrCreate('userData', data); }); }
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
1b3f7b72b3c6b1bcb204c88678a1bf2c36d09d01
gitcode
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/components/YAxis.ets
arkts
isDrawBottomYLabelEntryEnabled
returns true if drawing the bottom y-axis label entry is enabled @return
public isDrawBottomYLabelEntryEnabled(): boolean { return this.mDrawBottomYLabelEntry; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isDrawBottomYLabelEntryEnabled 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...
public isDrawBottomYLabelEntryEnabled(): boolean { return this.mDrawBottomYLabelEntry; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
2998a539e7dd6773f9f6d9c8c1911e81db27099b
gitee
honjow/Next2V
shared/src/main/ets/utils/ImageBytesUtils.ets
arkts
readImageBytes
The picker returns a file:// / content uri, not a sandbox path, so readTextSync(path) fails on it. Open the uri to a fd and read the raw bytes (mirrors BackupFilePickerCoordinator.readText but keeps binary — no TextDecoder).
static readImageBytes(uri: string): ImageBytes { let file: fileIo.File | null = null try { file = fileIo.openSync(uri, fileIo.OpenMode.READ_ONLY) const size = fileIo.statSync(file.fd).size if (size > MAX_IMAGE_BYTES) { // Gate before allocating so a pathologically large pick can't OO...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left readImageBytes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uri AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left st...
static readImageBytes(uri: string): ImageBytes { let file: fileIo.File | null = null try { file = fileIo.openSync(uri, fileIo.OpenMode.READ_ONLY) const size = fileIo.statSync(file.fd).size if (size > MAX_IMAGE_BYTES) { // Gate before allocating so a pathologically large pick can't OO...
https://github.com/honjow/Next2V
5036539c5531e1d55dd3d998bec68ddd9f6b9d4f
github
encorexin/WordPressCMS
harmonyos/entry/src/main/ets/stores/ThemeStore.ets
arkts
getColorMode
将 themeMode 转为 ArkUI WithTheme 所需的 colorMode 值 0 = LIGHT, 1 = DARK, -1 = 跟随系统(未设置)
static getColorMode(): number { const mode = ThemeStore.getTheme() if (mode === ThemeMode.Light) { return ThemeColorMode.Light } else if (mode === ThemeMode.Dark) { return ThemeColorMode.Dark } return ThemeColorMode.System }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getColorMode 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#nu...
static getColorMode(): number { const mode = ThemeStore.getTheme() if (mode === ThemeMode.Light) { return ThemeColorMode.Light } else if (mode === ThemeMode.Dark) { return ThemeColorMode.Dark } return ThemeColorMode.System }
https://github.com/encorexin/WordPressCMS
19b0c67dc9e14740b0e2f7c3b3cd6e58619c6434
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/GamepadManager.ets
arkts
ensureGCKitCallbacks
确保 Game Controller Kit 回调已设置 用于处理回调被其他组件(如测试页面)覆盖的情况
private ensureGCKitCallbacks(): void { // 检查 GC Kit 是否初始化 if (!gameControllerService.init()) { console.warn('[GAMEPAD] GC Kit 初始化失败'); return; } // 重新设置回调 console.info('[GAMEPAD] 重新设置 Game Controller Kit 回调'); this.setupGCCallbacks(); // 确保监听器已启动 gameControllerSer...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left ensureGCKitCallbacks 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 AS...
private ensureGCKitCallbacks(): void { // 检查 GC Kit 是否初始化 if (!gameControllerService.init()) { console.warn('[GAMEPAD] GC Kit 初始化失败'); return; } // 重新设置回调 console.info('[GAMEPAD] 重新设置 Game Controller Kit 回调'); this.setupGCCallbacks(); // 确保监听器已启动 gameControllerSer...
https://github.com/AlkaidLab/moonlight-harmony
7894054dba2e9c43be58135d3c3c79f06be24608
github
XHXYT/Pixark
entry/src/main/ets/viewmodel/RankViewModel.ets
arkts
handleNovelClick
小说点击逻辑
handleNovelClick(novel: PixivNovel) { // TODO: 跳转小说详情 logger.info(`[handleNovelClick] Clicked novel: ${novel.id}`); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left handleNovelClick AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left novel AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left PixivNovel AST#identifi...
handleNovelClick(novel: PixivNovel) { // TODO: 跳转小说详情 logger.info(`[handleNovelClick] Clicked novel: ${novel.id}`); }
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/viewmodel/RankViewModel.ets#L179-L182
c5c7fc0520b9980b977bba33aa33c53ed7cfbaca
github
CLMC2025/Vignette
entry/src/main/ets/ui/Animations.ets
arkts
ScaleIn
缩放动画组件
@Builder function ScaleIn( key: string, duration: number = 300, progress: number ): void { Column() { // 内容直接嵌入 } .scale({ x: progress, y: progress }) .opacity(progress) .animation({ duration: duration, curve: Curve.EaseInOut, iterations: 1, playMode: PlayMode.Normal }) }
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Builder AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left ScaleIn AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_...
@Builder function ScaleIn( key: string, duration: number = 300, progress: number ): void { Column() { // 内容直接嵌入 } .scale({ x: progress, y: progress }) .opacity(progress) .animation({ duration: duration, curve: Curve.EaseInOut, iterations: 1, playMode: PlayMode.Normal }) }
https://github.com/CLMC2025/Vignette
7e7d0308c472a915a4df958d07a2d284a0941b6e
github
CPF-ApplicationTPC/openharmony_tpc_samples
SwipeMenuListView/library/src/main/ets/model/AnimationConfig.ets
arkts
fast
创建快速动画配置
static fast(): AnimationConfig { let config = new AnimationConfig(); config.duration = 150; config.interpolator = InterpolatorType.DECELERATE; return config; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left fast AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Righ...
static fast(): AnimationConfig { let config = new AnimationConfig(); config.duration = 150; config.interpolator = InterpolatorType.DECELERATE; return config; }
https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples
48b9ff8239ff357f8bc21d82229c902c80111d05
gitcode
CarGuo/GSYGithubAppOH
entry/src/main/ets/entryability/EntryAbility.ets
arkts
handleBootIssueInjection
测试通道:want.parameters.bootIssue=fullName|number, HomePage 启动后会读取该值并 push 到 IssueDetailPage,方便对详情页做真机回归。
private handleBootIssueInjection(want: Want): void { const params: Record<string, Object> | undefined = want.parameters as Record<string, Object> | undefined; if (!params) { return; } const raw: Object | undefined = params[PARAM_BOOT_ISSUE]; if (typeof raw !== 'string') { return; }...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleBootIssueInjection AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#iden...
private handleBootIssueInjection(want: Want): void { const params: Record<string, Object> | undefined = want.parameters as Record<string, Object> | undefined; if (!params) { return; } const raw: Object | undefined = params[PARAM_BOOT_ISSUE]; if (typeof raw !== 'string') { return; }...
https://github.com/CarGuo/GSYGithubAppOH
d6a5a5e437b3e1a1272d33f20c477b51c73a6b99
github
openharmony/arkcompiler_taihe_ffi_gen
test/ani_tuple/user/main.ets
arkts
testProcessMixed
====== Test 4: MixedTuple - all primitive types ======
function testProcessMixed() { let m: TupleTest.MixedTuple = [ (1 as byte), // i8 (2 as short), // i16 3, // i32 4 as long, // i64 5.0f, // f32 6.0, // f64 true, // bool ]; let result = TupleTest.processMix...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testProcessMixed AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#lexical_de...
function testProcessMixed() { let m: TupleTest.MixedTuple = [ (1 as byte), // i8 (2 as short), // i16 3, // i32 4 as long, // i64 5.0f, // f32 6.0, // f64 true, // bool ]; let result = TupleTest.processMix...
https://gitcode.com/openharmony/arkcompiler_taihe_ffi_gen
be95757f36d39fbe74c1cddbd84780dfe6086a52
gitcode
openharmony-sig/flutter_engine
shell/platform/ohos/flutter_embedding/flutter/src/main/ets/util/ByteBuffer.ets
arkts
setUint8Array
Sets an array of unsigned bytes. @param byteOffset The byte offset. @param value The value.
setUint8Array(byteOffset: number, value: Uint8Array): void { const byteLength = value.byteLength this.getUint8Array(byteOffset, byteLength).set(value) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setUint8Array AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left byteOffset AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , AST...
setUint8Array(byteOffset: number, value: Uint8Array): void { const byteLength = value.byteLength this.getUint8Array(byteOffset, byteLength).set(value) }
https://gitee.com/openharmony-sig/flutter_engine.git
12f1ef5805f89257d6cf7eac0345578e68768838
gitee
PollenWang6/HiXD
entry/src/main/ets/services/ScoreService.ets
arkts
extractRaw
根据 API 路径反查 appId
static extractRaw(body: string): object[] { return extractRaw(body, TAG); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left extractRaw AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left body AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left strin...
static extractRaw(body: string): object[] { return extractRaw(body, TAG); }
https://github.com/PollenWang6/HiXD
7fac70f6867103f8ae12aab1faeb8c1e951678e4
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
sort
Sorts in-place @param fn comparator @returns sorted Uint16Array
public sort(fn: (a: number, b: number) => number): Uint16Array { let arr: number[] = new number[this.length] for (let i = 0; i < this.length; ++i) { arr[i] = this.at(i) } // TODO(ivan-tyulyandin): unresolved reference i in for loop, blocked by internal issue 12961 ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left sort AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Righ...
public sort(fn: (a: number, b: number) => number): Uint16Array { let arr: number[] = new number[this.length] for (let i = 0; i < this.length; ++i) { arr[i] = this.at(i) } // TODO(ivan-tyulyandin): unresolved reference i in for loop, blocked by internal issue 12961 ...
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
170ee4fe18bf05b0fe8cfb4dd73b02048c287c7b
gitee
LJ666-ui/harmony-health-care
entry/src/main/ets/ancientimage/AncientOCRService.ets
arkts
addMedicalTerm
添加医学术语 @param term 术语
addMedicalTerm(term: string): void { this.medicalTerms.add(term); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addMedicalTerm AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left term AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) ...
addMedicalTerm(term: string): void { this.medicalTerms.add(term); }
https://github.com/LJ666-ui/harmony-health-care
683674845d0f81852da51fc8bab0468f1690ee7a
github
HarmonyOS_Samples/guide-snippets
Ability/StartOptions/GetLaunchResult/src/main/ets/getlaunchresultability/GetLaunchResultAbility.ets
arkts
onForeground
[EndExclude startOptions_completionHandler]
onForeground(): void { // Ability has brought to foreground hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onForeground'); let want: Want = { deviceId: '', // deviceId为空表示本设备 bundleName: 'com.example.startoptions', abilityName: 'EntryAbility', parameters: { // 自定义信息 ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onForeground 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...
onForeground(): void { // Ability has brought to foreground hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onForeground'); let want: Want = { deviceId: '', // deviceId为空表示本设备 bundleName: 'com.example.startoptions', abilityName: 'EntryAbility', parameters: { // 自定义信息 ...
https://gitcode.com/HarmonyOS_Samples/guide-snippets
f343d37a9e052dcd74c0c40a9bd5ef2b81559798
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/WebViewImageLoader.ets
arkts
initialize
初始化拦截器
initialize(): void { if (this.isInitialized) { return; } try { logger.info(TAG, '开始初始化WebView图片拦截器'); // 初始化图片缓存 this.imageCache.initialize(); this.isInitialized = true; logger.info(TAG, 'WebView图片拦截器初始化完成'); } catch (error) { logger.erro...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left initialize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#{#Left { AST#{#Right AST#method_d...
initialize(): void { if (this.isInitialized) { return; } try { logger.info(TAG, '开始初始化WebView图片拦截器'); // 初始化图片缓存 this.imageCache.initialize(); this.isInitialized = true; logger.info(TAG, 'WebView图片拦截器初始化完成'); } catch (error) { logger.erro...
https://github.com/DaLongZhuaZi/manxia
540c4ccd1346c2a2e875fe405380b2b70be6222d
github
PollenWang6/HiXD
entry/src/main/ets/utils/HttpUtil.ets
arkts
loadCookies
===== Cookie 持久化 =====
async loadCookies(): Promise<void> { // 只有已成功加载过 cookieStore 中有数据时才跳过 if (this.cookiesLoaded && Object.keys(this.cookieStore).length > 0) return; try { const raw: string = PreferenceUtil.getString('http_cookies'); if (raw.length > 0) { const entries: CookieEntry[] = JSON.parse(raw) as ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left loadCookies AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_...
async loadCookies(): Promise<void> { // 只有已成功加载过 cookieStore 中有数据时才跳过 if (this.cookiesLoaded && Object.keys(this.cookieStore).length > 0) return; try { const raw: string = PreferenceUtil.getString('http_cookies'); if (raw.length > 0) { const entries: CookieEntry[] = JSON.parse(raw) as ...
https://github.com/PollenWang6/HiXD
ca3b59e07340ed77486daeef9475e9d7f949901c
github
Joker-x-dev/CoolMallArkTS
core/base/src/main/ets/viewmodel/BaseViewModel.ets
arkts
aboutToDisappear
页面隐藏前 @returns {void} 无返回值
aboutToDisappear(): void { }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToDisappear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expressio...
aboutToDisappear(): void { }
https://github.com/Joker-x-dev/CoolMallArkTS
d8ac8cc4ea9126483a46becb42b149b9350f29d2
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Diagnostics/StartupRecovery.ets
arkts
getResourceLoadingRecoveryOptions
获取资源加载恢复选项
private getResourceLoadingRecoveryOptions(attempts: number): RecoveryOption[] { const options: RecoveryOption[] = []; if (attempts < this.maxRetryAttempts) { const retryOption: RecoveryOption = { strategy: RecoveryStrategy.RETRY, description: '重试资源加载', priority: 80, ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getResourceLoadingRecoveryOptions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left attempts AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#...
private getResourceLoadingRecoveryOptions(attempts: number): RecoveryOption[] { const options: RecoveryOption[] = []; if (attempts < this.maxRetryAttempts) { const retryOption: RecoveryOption = { strategy: RecoveryStrategy.RETRY, description: '重试资源加载', priority: 80, ...
https://github.com/DaLongZhuaZi/manxia
db7fdf0a70e07593c8841dce0a0b9a6ca0282128
github
LZZLHY/hlib
entry/src/main/ets/api/CookieJar.ets
arkts
captureFrom
解析响应头里的 set-cookie,写入 jar。忽略由上层独占管理的 cookie 名。
captureFrom(headers: Record<string, string | string[]>): void { if (headers === null || headers === undefined) { return; } let raw: string | string[] | undefined = undefined; const keys: string[] = Object.keys(headers); for (let i = 0; i < keys.length; i++) { if (keys[i].toLowerCase() ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left captureFrom AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left headers AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identifier#Left Record ...
captureFrom(headers: Record<string, string | string[]>): void { if (headers === null || headers === undefined) { return; } let raw: string | string[] | undefined = undefined; const keys: string[] = Object.keys(headers); for (let i = 0; i < keys.length; i++) { if (keys[i].toLowerCase() ...
https://github.com/LZZLHY/hlib
3fad57d57467a54a01a3b31520029805d990d7ef
github
openharmony/communication_netmanager_ext
frameworks/vpn_dialog/dialog_ui/vpn_dialog/src/main/ets/pages/VpnDialog.ets
arkts
controlFontSize
content style
@Extend(Text) function controlFontSize(fontSize : number) { .fontSize(fontSize) .width('180%') .fontColor('rgba(10, 10, 10, 1.00)') .textAlign(TextAlign.Center) .padding({ top: 30, left: 50, right: 50 }) .alignSelf(ItemAlign.Center) .margin({ top: 10 }); }
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#call_expression#Left AST#identifier#Left Extend AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left Text AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#R...
@Extend(Text) function controlFontSize(fontSize : number) { .fontSize(fontSize) .width('180%') .fontColor('rgba(10, 10, 10, 1.00)') .textAlign(TextAlign.Center) .padding({ top: 30, left: 50, right: 50 }) .alignSelf(ItemAlign.Center) .margin({ top: 10 }); }
https://gitee.com/openharmony/communication_netmanager_ext.git
0c87dc621d4653baa723ac44134d69c31038dd06
gitee