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
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/Writer.ets
arkts
sfixed64
Write sfixed64 little-endian
sfixed64(v: bigint): Writer { const ab = new ArrayBuffer(8); const dv = new DataView(ab); const lo = Number(v & 0xFFFFFFFFn); const hi = Number((v >> 32n) & 0xFFFFFFFFn); dv.setInt32(0, lo | 0, true); dv.setInt32(4, hi | 0, true); const u = new Uint8Array(ab); for (let i = 0; i < 8; i++) this.push(u[i]); return this ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left sfixed64 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left v AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left bigint AST#identifier#Right AST#)#Left ) AST#)#Rig...
sfixed64(v: bigint): Writer { const ab = new ArrayBuffer(8); const dv = new DataView(ab); const lo = Number(v & 0xFFFFFFFFn); const hi = Number((v >> 32n) & 0xFFFFFFFFn); dv.setInt32(0, lo | 0, true); dv.setInt32(4, hi | 0, true); const u = new Uint8Array(ab); for (let i = 0; i < 8; i++) this.push(u[i]); return this ...
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
d473fd6177903725f1300467575c78d88ca83d11
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/OnlineComicConverter.ets
arkts
convertToOnlinePageInfoArray
批量转换数据库记录为 OnlinePageInfo 数组 @param records 数据库记录数组 @returns OnlinePageInfo 数组
public static convertToOnlinePageInfoArray(records: DatabaseRecord[]): OnlinePageInfo[] { const pages: OnlinePageInfo[] = []; for (let i = 0; i < records.length; i++) { try { const page = OnlineComicConverter.convertToOnlinePageInfo(records[i]); pages.push(page); } catch (error) { ...
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 convertToOnlinePageInfoArray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left records AST#identifier#Rig...
public static convertToOnlinePageInfoArray(records: DatabaseRecord[]): OnlinePageInfo[] { const pages: OnlinePageInfo[] = []; for (let i = 0; i < records.length; i++) { try { const page = OnlineComicConverter.convertToOnlinePageInfo(records[i]); pages.push(page); } catch (error) { ...
https://github.com/DaLongZhuaZi/manxia
55882d761ee0c9790692d4522c307a617ba81762
github
DaLongZhuaZi/manxia
entry/src/main/ets/components/PreloadManager.ets
arkts
getNextToLoad
获取下一个应该加载的页面(按优先级)
getNextToLoad(): PreloadItem | null { if (this.queue.size === 0) { return null; } // 按优先级排序(优先级高的在前,相同优先级按页码接近当前页排序) const sorted = Array.from(this.queue.values()).sort((a, b) => { if (a.priority !== b.priority) { return b.priority - a.priority; // 优先级降序 } // 优先级相同,按距离...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getNextToLoad AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identif...
getNextToLoad(): PreloadItem | null { if (this.queue.size === 0) { return null; } // 按优先级排序(优先级高的在前,相同优先级按页码接近当前页排序) const sorted = Array.from(this.queue.values()).sort((a, b) => { if (a.priority !== b.priority) { return b.priority - a.priority; // 优先级降序 } // 优先级相同,按距离...
https://github.com/DaLongZhuaZi/manxia
944c00510a10a957f15b4a61bf14c43d43ed65e1
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelTxtTocRuleManager.ets
arkts
splitByLength
按固定长度分割内容
private splitByLength(content: string, maxLength: number): TxtChapter[] { const chapters: TxtChapter[] = []; let start = 0; let index = 0; while (start < content.length) { let end = Math.min(start + maxLength, content.length); // 尝试在段落结束处分割 if (end < content.length) { ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left splitByLength AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left content AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#strin...
private splitByLength(content: string, maxLength: number): TxtChapter[] { const chapters: TxtChapter[] = []; let start = 0; let index = 0; while (start < content.length) { let end = Math.min(start + maxLength, content.length); // 尝试在段落结束处分割 if (end < content.length) { ...
https://github.com/DaLongZhuaZi/manxia
b7210fe0239e6656685349faac0141ab907e2d37
github
LZZLHY/hlib
entry/src/main/ets/api/ZLibraryClient.ets
arkts
logout
退登:清空内存中的 cookie。
logout(): void { this.http.clearAuth(); }
AST#program#Left AST#ERROR#Left 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 : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left ...
logout(): void { this.http.clearAuth(); }
https://github.com/LZZLHY/hlib
9318db3fd3e1fe2ad6e702acb78dccdcd362b7ab
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/utils/CryptoUtil.ets
arkts
generateRandomUint32
生成随机 32 位无符号整数(使用加密安全的随机数)
static generateRandomUint32(): number { const bytes = CryptoUtil.generateRandomBytes(4); return ((bytes[0] << 24) | (bytes[1] << 16) | (bytes[2] << 8) | bytes[3]) >>> 0; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left generateRandomUint32 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 numbe...
static generateRandomUint32(): number { const bytes = CryptoUtil.generateRandomBytes(4); return ((bytes[0] << 24) | (bytes[1] << 16) | (bytes[2] << 8) | bytes[3]) >>> 0; }
https://github.com/AlkaidLab/moonlight-harmony
38d069fbc83b902c5cf096fae8690100f455b9a4
github
Joker-x-dev/CoolMallArkTS
feature/order/src/main/ets/viewmodel/OrderPayViewModel.ets
arkts
startAlipaySdk
调起支付宝 SDK @param {string} payInfo - 支付参数 @returns {void} 无返回值
private startAlipaySdk(payInfo: string): void { const navStack: NavPathStack | undefined = getNavPathStack(); if (!navStack) { ToastUtils.showError($r("app.string.payment_failed")); return; } new Pay().payWithNav(payInfo, true, undefined, navStack) .then((result: Map<string, string>)...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left startAlipaySdk AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left payInfo AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#stri...
private startAlipaySdk(payInfo: string): void { const navStack: NavPathStack | undefined = getNavPathStack(); if (!navStack) { ToastUtils.showError($r("app.string.payment_failed")); return; } new Pay().payWithNav(payInfo, true, undefined, navStack) .then((result: Map<string, string>)...
https://github.com/Joker-x-dev/CoolMallArkTS
25e459665b8656b0b638ff17cfa43e5c39a973dc
github
Coke0807/NewsAPP-HarmonyOS
NewsApp/entry/src/main/ets/utils/AuthUtil.ets
arkts
clearLoginInfo
清除登录信息
static clearLoginInfo(): void { AppStorage.set(STORAGE_KEYS.TOKEN, ''); AppStorage.set(STORAGE_KEYS.USER_ID, 0); AppStorage.set(STORAGE_KEYS.USERNAME, ''); AppStorage.set(STORAGE_KEYS.IS_LOGGED_IN, false); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left clearLoginInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#express...
static clearLoginInfo(): void { AppStorage.set(STORAGE_KEYS.TOKEN, ''); AppStorage.set(STORAGE_KEYS.USER_ID, 0); AppStorage.set(STORAGE_KEYS.USERNAME, ''); AppStorage.set(STORAGE_KEYS.IS_LOGGED_IN, false); }
https://github.com/Coke0807/NewsAPP-HarmonyOS
aba83a6c0028cf29c11fbd7643b1a2549b1f1b52
github
HarmonyOS_Samples/accountkit-samplecode-clientdemo-arkts
entry/src/main/ets/components/AgreementDialog.ets
arkts
jumpToPrivacyWebView
Redirect to the privacy policy page.
jumpToPrivacyWebView(isFromDialog: boolean, protocolUrl?: string) { hilog.info(domainId, logTag, 'Click protocol url'); try { const hasNet: boolean = connection.hasDefaultNetSync(); if (!hasNet) { // Pop-up message displayed when the network is unavailable. this.getUIContext().show...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left jumpToPrivacyWebView AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isFromDialog AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#E...
jumpToPrivacyWebView(isFromDialog: boolean, protocolUrl?: string) { hilog.info(domainId, logTag, 'Click protocol url'); try { const hasNet: boolean = connection.hasDefaultNetSync(); if (!hasNet) { // Pop-up message displayed when the network is unavailable. this.getUIContext().show...
https://gitcode.com/HarmonyOS_Samples/accountkit-samplecode-clientdemo-arkts
c21466f1189a29e1e1a1bfe7640271a6170861d3
gitcode
openharmony/codelabs
ETSUI/MemoTime/entry/src/main/ets/service/DataService.ets
arkts
getSchedulesByDateRange
根据日期范围获取日程
async getSchedulesByDateRange(startTime: number, endTime: number): Promise<Schedule[]> { if (!this.rdbStore) { return [] } try { const predicates = new relationalStore.RdbPredicates(AppConstants.TABLE_SCHEDULE) predicates.equalTo('isDeleted', 0) predicates.lessThanOrEqualTo('start...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getSchedulesByDateRange AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left startTime AST#identif...
async getSchedulesByDateRange(startTime: number, endTime: number): Promise<Schedule[]> { if (!this.rdbStore) { return [] } try { const predicates = new relationalStore.RdbPredicates(AppConstants.TABLE_SCHEDULE) predicates.equalTo('isDeleted', 0) predicates.lessThanOrEqualTo('start...
https://gitcode.com/openharmony/codelabs
9fdcd7045ba1eb321c4cbf4970f2a56f79ae82e2
gitcode
daugf2527/harmonyos-libretro-emulator
entry/src/main/ets/common/ErrorCodes.ets
arkts
shouldShowUserPrompt
判断错误是否需要显示用户提示
static shouldShowUserPrompt(codeOrNumeric: string | number): boolean { let definition: ErrorCodeDefinition | undefined; if (typeof codeOrNumeric === 'number') { definition = ErrorCodeUtils.findByNumericCode(codeOrNumeric); } else { definition = ErrorCodeUtils.findByCode(codeOrNumeric); } ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left shouldShowUserPrompt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#identifier#Left codeOrNumeric AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#R...
static shouldShowUserPrompt(codeOrNumeric: string | number): boolean { let definition: ErrorCodeDefinition | undefined; if (typeof codeOrNumeric === 'number') { definition = ErrorCodeUtils.findByNumericCode(codeOrNumeric); } else { definition = ErrorCodeUtils.findByCode(codeOrNumeric); } ...
https://github.com/daugf2527/harmonyos-libretro-emulator
f8b6f96c66fb881b21f540559eabef5568fcc33f
github
Harrisonls2004/WaterFlow
entry/src/main/ets/view/PastelHeader.ets
arkts
EmptyContent
Default builder to satisfy mandatory default value lint when parent does not pass content.
@Builder function EmptyContent(): void {}
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 EmptyContent AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Le...
@Builder function EmptyContent(): void {}
https://github.com/Harrisonls2004/WaterFlow
c52ed27f1961d65bfd50e1cf7958949eab190fc1
github
openharmony/arkui_advanced_ui_component
atomicserviceweb/source/atomicserviceweb.ets
arkts
initAnalytics
应用的唯一标识
private static initAnalytics(): void { if (!HiAnalyticsUtil.processorId) { HiAnalyticsUtil.addEventProcessor(); } if (HiAnalyticsUtil.appIdentifier && HiAnalyticsUtil.runningMode) { return; } let bundleInfo: bundleManager.BundleInfo = bundleManager.getBundleInfoForSelfSync(bundle...
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 initAnalytics AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS...
private static initAnalytics(): void { if (!HiAnalyticsUtil.processorId) { HiAnalyticsUtil.addEventProcessor(); } if (HiAnalyticsUtil.appIdentifier && HiAnalyticsUtil.runningMode) { return; } let bundleInfo: bundleManager.BundleInfo = bundleManager.getBundleInfoForSelfSync(bundle...
https://gitee.com/openharmony/arkui_advanced_ui_component.git
53065b3832d55ac08ca8b72e7d8d55be73287971
gitee
pangpang20/antennaPodHM
entry/src/main/ets/service/PlayerService.ets
arkts
updateSessionMetadata
更新 AVSession 媒体信息
private async updateSessionMetadata(): Promise<void> { if (!this.session || !this.currentEpisode) { return; } try { const metadata: avSession.AVMetadata = { assetId: this.currentEpisode.id, title: this.currentEpisode.title, artist: 'Podcast', duration: this.cur...
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 updateSessionMetadata AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#R...
private async updateSessionMetadata(): Promise<void> { if (!this.session || !this.currentEpisode) { return; } try { const metadata: avSession.AVMetadata = { assetId: this.currentEpisode.id, title: this.currentEpisode.title, artist: 'Podcast', duration: this.cur...
https://github.com/pangpang20/antennaPodHM
aa8c68cb1530d98a06db82a0a3c5c11bb4fb6fd3
github
harmonyos/codelabs
HarmonyOS_NEXT/OxHornCampus/entry/src/main/ets/pages/IntroductionPage.ets
arkts
getLazySwiperData
Get the swiper data for lazy load.
getLazySwiperData() { let list: ZonesItem[] = []; zonesViewModel.getZonesList().forEach((item) => { list.push(item); }) this.zoneListSwiper = new SwiperDataSource(list); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getLazySwiperData 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#...
getLazySwiperData() { let list: ZonesItem[] = []; zonesViewModel.getZonesList().forEach((item) => { list.push(item); }) this.zoneListSwiper = new SwiperDataSource(list); }
https://gitee.com/harmonyos/codelabs.git
9e2a154199deb6884c11f48f985336d3253783f5
gitee
TDCQCX/ShiHuaMusic-Harmony
entry/src/main/ets/utils/HttpUtil.ets
arkts
post
POST请求 @param url 请求URL @param data 请求数据 @param showLoading 是否显示加载提示
static async post<T>(url: string, data?: Object, showLoading: boolean = true): Promise<ApiResponse<T>> { return HttpUtil.request<T>({ url, method: 'POST', data, showLoading }); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#binary_expression#Left AST#identifier#Left post AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#for...
static async post<T>(url: string, data?: Object, showLoading: boolean = true): Promise<ApiResponse<T>> { return HttpUtil.request<T>({ url, method: 'POST', data, showLoading }); }
https://github.com/TDCQCX/ShiHuaMusic-Harmony
d29fcfc858a8b3037f8911a15286b0a304fbbccf
github
openharmony/arkui_ace_engine
advanced_ui_component_static/assembled_advanced_ui_component/@ohos.arkui.advanced.GridObjectSortComponent.ets
arkts
getCoveringGridPositionBottom
When an item is added, the filling of other items in the addition area is calculated.
getCoveringGridPositionBottom(index: number): PositionXY { let xNew: number = 0; let yNew: number = 0; const lastCol: boolean = index % this.colNum === 0; const textShowAreaItemHeight: number = this.gridComState && !this.imageText ? -this.blockHeight + 8 : -this.blockHeight; if (index > this...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCoveringGridPositionBottom 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#Rig...
getCoveringGridPositionBottom(index: number): PositionXY { let xNew: number = 0; let yNew: number = 0; const lastCol: boolean = index % this.colNum === 0; const textShowAreaItemHeight: number = this.gridComState && !this.imageText ? -this.blockHeight + 8 : -this.blockHeight; if (index > this...
https://gitcode.com/openharmony/arkui_ace_engine
6f20e7652ad3fdbd35579cfc53fd56c5a5716d9d
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
slice
Creates a slice of current Uint16Array using range [begin, end] {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/slice} @param { int } [begin] start - index to be taken into slice @param { int } [end] - last index to be taken into slice @returns { Uint16Array } - a new ...
public slice(begin?: int, end?: int): Uint16Array { return this.sliceFromTo(begin ?? 0, end ?? this.lengthInt) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left slice AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left begin AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#...
public slice(begin?: int, end?: int): Uint16Array { return this.sliceFromTo(begin ?? 0, end ?? this.lengthInt) }
https://gitcode.com/iop123123/arkts-static-skills
55bad52f91ff9017cb0bd5c1f005e819f4a67087
gitcode
Amaz1ny/HarmonyDO-public
entry/src/main/ets/services/storage/PreferencesUtil.ets
arkts
putString
保存字符串值
static async putString(key: string, value: string): Promise<void> { if (PreferencesUtil.preferencesInstance === null) { return; } try { await PreferencesUtil.preferencesInstance.put(key, value); await PreferencesUtil.preferencesInstance.flush(); } catch (err) { hilog.error(0x00...
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 putString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Ri...
static async putString(key: string, value: string): Promise<void> { if (PreferencesUtil.preferencesInstance === null) { return; } try { await PreferencesUtil.preferencesInstance.put(key, value); await PreferencesUtil.preferencesInstance.flush(); } catch (err) { hilog.error(0x00...
https://github.com/Amaz1ny/HarmonyDO-public
18393e47d23a09333ae423c2e69159af4e50ccfe
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/DataView.ets
arkts
setInt16
Sets bytes as they represent given type @param byteOffset zero index to write @param littleEndian read as little or big endian
public setInt16(byteOffset: double, value: number, littleEndian: boolean): void { this.setInt16(byteOffset as int, value as short) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setInt16 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#identifier#Left double AST#identi...
public setInt16(byteOffset: double, value: number, littleEndian: boolean): void { this.setInt16(byteOffset as int, value as short) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
4e16971ed3e3e5d870c1fad93619478943e6cd19
gitee
HarmonyOS_Samples/hmosworld
HMOSWorld/Application/commons/aspect/src/main/ets/utils/AspectUtil.ets
arkts
addAfter
Insert some logic after the method. @param methodClassName - The name of the operated class. @param targetClass - The operated class @param methodName- The name of the operated method. @param isStatic - The flag whether the method is static. @param afterFun - The logic inserted after the method
public static addAfter<T>(methodClassName: string, targetClass: Object, methodName: string, isStatic: boolean, afterFunc?: Function) { util.Aspect.addAfter(targetClass, methodName, isStatic, (instance: Object, ret: T, ...args: Object[]): T => { afterFunc && afterFunc(...args); const currentTime: n...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#ERROR#Right AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#identifier#Left addAfter AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST...
public static addAfter<T>(methodClassName: string, targetClass: Object, methodName: string, isStatic: boolean, afterFunc?: Function) { util.Aspect.addAfter(targetClass, methodName, isStatic, (instance: Object, ret: T, ...args: Object[]): T => { afterFunc && afterFunc(...args); const currentTime: n...
https://gitcode.com/HarmonyOS_Samples/hmosworld
bb39742274e701269d1aeb2d62c4d6f9a79996b2
gitcode
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.LightWeightMap.ets
arkts
length
Returns number of Entries with unique keys in the LightWeightMap @returns number of Entries with unique keys in the LightWeightMap
get length(): int { return this.buckets.actualLength; }
AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left length 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 int AST#identifier#Right...
get length(): int { return this.buckets.actualLength; }
https://gitcode.com/iop123123/arkts-static-skills
893bef03450265d45e4142b94cdd6d832a854c1b
gitcode
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.HashMap.ets
arkts
hasValue
Checks if the value exists in the HashMap @param value the value to check in the HashMap @returns true if the value exists, false otherwise
hasValue(value: V): boolean { const iter = this.buckets.values(); let res = iter.next(); while (!res.done) { if (res.value === value) { return true; } res = iter.next(); } return false; }
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#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left V AST#identifier#Right AST#ERROR#Right AST#)#Left ) AST#)#Righ...
hasValue(value: V): boolean { const iter = this.buckets.values(); let res = iter.next(); while (!res.done) { if (res.value === value) { return true; } res = iter.next(); } return false; }
https://gitcode.com/iop123123/arkts-static-skills
92d6c803f7f4d97b9c2d7c6d308c0d492ab91e32
gitcode
offlinecat-dev/OCNetORM
src/main/ets/database/DatabaseManager.ets
arkts
resetInstanceForTesting
重置单例实例(测试桥接)
static resetInstanceForTesting(): void { const current = DatabaseManager.instance current.stopHealthCheck() current.querySlotGate.reset() const currentPool = current.storePool if (currentPool !== null) { currentPool.close().catch(() => { }) } current.store = null current....
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left resetInstanceForTesting 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...
static resetInstanceForTesting(): void { const current = DatabaseManager.instance current.stopHealthCheck() current.querySlotGate.reset() const currentPool = current.storePool if (currentPool !== null) { currentPool.close().catch(() => { }) } current.store = null current....
https://github.com/offlinecat-dev/OCNetORM
d0383a9f777fb357f60fe15c00f564a6692852be
github
LJ666-ui/harmony-health-care
entry/src/main/ets/mock/smartwardMock.ets
arkts
generateAlerts
生成告警数据
public generateAlerts(count: number, roomIds: string[]): WardAlert[] { const alerts: WardAlert[] = []; const alertLevels = [AlertLevel.EMERGENCY, AlertLevel.URGENT, AlertLevel.WARNING, AlertLevel.INFO]; const alertCategories = [ AlertCategory.VITAL_SIGN_ANOMALY, AlertCategory.DEVICE_MALFUNCTIO...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left generateAlerts AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left count AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ...
public generateAlerts(count: number, roomIds: string[]): WardAlert[] { const alerts: WardAlert[] = []; const alertLevels = [AlertLevel.EMERGENCY, AlertLevel.URGENT, AlertLevel.WARNING, AlertLevel.INFO]; const alertCategories = [ AlertCategory.VITAL_SIGN_ANOMALY, AlertCategory.DEVICE_MALFUNCTIO...
https://github.com/LJ666-ui/harmony-health-care
09a3c73f592519bed40829f927155117bcc915d3
github
HarmonyCandies/image_cropper
image_cropper/src/main/ets/model/Geometry.ets
arkts
dy
Getter for y component
get dy(): number { return this._dy; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left get AST#identifier#Right AST#ERROR#Left AST#identifier#Left dy 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#:#Right AST...
get dy(): number { return this._dy; }
https://github.com/HarmonyCandies/image_cropper/blob/dd3664946b413166307b736a5763f998084364e1/image_cropper/src/main/ets/model/Geometry.ets#L78-L80
524397060eb73e53e9a38c44e828c09dd489e395
github
openharmony/applications_call
mobiledatasettings/src/main/ets/pages/index.ets
arkts
getSimStateDataCardTwo
This interface is used to obtain sim cardTwo status
getSimStateDataCardTwo() { getSimStateCardTwo().then((res: number) => { LogUtils.i(TAG, 'getSimState Card2 :success then' + JSON.stringify(res)); const simState = { SIM_STATE_UNKNOWN: 0, SIM_STATE_NOT_PRESENT: 1, SIM_STATE_LOCKED: 2, SIM_STATE_NOT_READY: 3, SIM_...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getSimStateDataCardTwo 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_b...
getSimStateDataCardTwo() { getSimStateCardTwo().then((res: number) => { LogUtils.i(TAG, 'getSimState Card2 :success then' + JSON.stringify(res)); const simState = { SIM_STATE_UNKNOWN: 0, SIM_STATE_NOT_PRESENT: 1, SIM_STATE_LOCKED: 2, SIM_STATE_NOT_READY: 3, SIM_...
https://gitee.com/openharmony/applications_call.git
8a7576fd73658d8928be5a48aad8ad04f3e255a0
gitee
youyeyejie/ZhiXing_ActHub
entry/src/main/ets/app/AppNav.ets
arkts
createSearchParam
创建搜索覆盖页参数。 搜索页本身只有一个 route name,具体模块和标题通过参数区分。
createSearchParam(moduleName: string, pageTitle: string): SearchRouteParam { return new SearchRouteParam(moduleName, pageTitle); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left createSearchParam AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left moduleName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left ,...
createSearchParam(moduleName: string, pageTitle: string): SearchRouteParam { return new SearchRouteParam(moduleName, pageTitle); }
https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/app/AppNav.ets#L122-L124
8dad7136522ab8848839d8012d5c2def32baed7b
github
Joker-x-dev/CoolMallArkTS
feature/user/src/main/ets/viewmodel/AddressDetailViewModel.ets
arkts
requestRepository
请求地址详情 @returns {Promise<NetworkResponse<Address>>} 地址详情响应
protected requestRepository(): Promise<NetworkResponse<Address>> { return this.repository.getAddressInfo(this.addressId); }
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left requestRepository 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...
protected requestRepository(): Promise<NetworkResponse<Address>> { return this.repository.getAddressInfo(this.addressId); }
https://github.com/Joker-x-dev/CoolMallArkTS
b0a2768a1a84b10de7c483453a40a45e7a09c123
github
daugf2527/harmonyos-libretro-emulator
entry/src/main/ets/components/VirtualController.ets
arkts
build
透明模式 (单折态)
build() { Column() { // 上键 Column() { this.DirectionButton('▲', RETRO_DEVICE_ID_JOYPAD_UP) } .margin({ bottom: 8 }) Row() { // 左键 Column() { this.DirectionButton('←', RETRO_DEVICE_ID_JOYPAD_LEFT) } .margin({ right: 8 }) ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST...
build() { Column() { // 上键 Column() { this.DirectionButton('▲', RETRO_DEVICE_ID_JOYPAD_UP) } .margin({ bottom: 8 }) Row() { // 左键 Column() { this.DirectionButton('←', RETRO_DEVICE_ID_JOYPAD_LEFT) } .margin({ right: 8 }) ...
https://github.com/daugf2527/harmonyos-libretro-emulator
5c95a72b29dc5864cd69c64ff52d4ca480146288
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/prefix_increment/prefix_increment_ulong.ets
arkts
main
--- desc: check prefix increment for unsigned long integer operand ---
function main(): void { let value: ulong = {{v.value}} let result: ulong = ++value assert value == {{v.result}}
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A...
function main(): void { let value: ulong = {{v.value}} let result: ulong = ++value assert value == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
346cd8574f454f07e5073edeb4db413db4698c2a
gitee
honjow/Next2V
shared/src/main/ets/storage/LocalDataCloudSync.ets
arkts
markDistributedTables
Mark the syncable tables as cloud-distributed with autoSync on. Idempotent per process; the cloud backend identity is the system Huawei account (no in-app login). Requires the permission granted.
static async markDistributedTables(context: common.UIAbilityContext): Promise<boolean> { // The synced set follows the user's per-feature toggles; the always-on synced_kv keeps it non-empty. const activeTables: string[] = CloudSyncSettings.enabledTables() const signature: string = activeTables.join(',') ...
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 markDistributedTables AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:...
static async markDistributedTables(context: common.UIAbilityContext): Promise<boolean> { // The synced set follows the user's per-feature toggles; the always-on synced_kv keeps it non-empty. const activeTables: string[] = CloudSyncSettings.enabledTables() const signature: string = activeTables.join(',') ...
https://github.com/honjow/Next2V
1015952c7901fb9ec41ca2f1232896f468ceb2fc
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Tracking/TrackingManager.ets
arkts
deleteAllTrackRecords
删除内容的所有跟踪记录
public async deleteAllTrackRecords(contentId: string): Promise<boolean> { try { const sql = 'DELETE FROM track_record WHERE contentId = ?'; await this.dbManager.executeSql(sql, [contentId]); logger.info(TAG, `✅ 删除所有跟踪记录: contentId=${contentId}`); return true; } catch (error) { lo...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left deleteAllTrackRecords AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left contentId AST#identifier#Right AST#ERROR#Left AST...
public async deleteAllTrackRecords(contentId: string): Promise<boolean> { try { const sql = 'DELETE FROM track_record WHERE contentId = ?'; await this.dbManager.executeSql(sql, [contentId]); logger.info(TAG, `✅ 删除所有跟踪记录: contentId=${contentId}`); return true; } catch (error) { lo...
https://github.com/DaLongZhuaZi/manxia
6ad6b48e6d4cbf4282fae8488191eba7f6308b47
github
openharmony/developtools_profiler
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/utils/ViewPortHandler.ets
arkts
setDragOffsetY
Set an offset in dp that allows the user to drag the chart over it's bounds on the y-axis. @param offset
public setDragOffsetY(offset: number) { this.mTransOffsetY = Utils.convertDpToPixel(offset); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setDragOffsetY AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left offset AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left...
public setDragOffsetY(offset: number) { this.mTransOffsetY = Utils.convertDpToPixel(offset); }
https://gitee.com/openharmony/developtools_profiler.git
ab5eb43d839d90dc0661c1fdb59293e3577d66c5
gitee
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/model/UserProfile.ets
arkts
isYoungUser
判断是否为年轻用户(<30岁)
isYoungUser(): boolean { return this.age > 0 && this.age < 30; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isYoungUser 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#stateme...
isYoungUser(): boolean { return this.age > 0 && this.age < 30; }
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
9d62f5c49dc1689a340b5b057f384643c462b0a2
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Adapters/UnifiedContentAdapter.ets
arkts
getOriginalChapter
从统一章节获取原始漫画章节
static getOriginalChapter(unifiedChapter: UnifiedChapter): MangaChapter | null { if (unifiedChapter.originalType !== UnifiedContentType.MANGA) { logger.warn(TAG, '尝试从非漫画章节获取漫画数据'); return null; } return unifiedChapter.originalData as MangaChapter; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getOriginalChapter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left unifiedChapter AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ide...
static getOriginalChapter(unifiedChapter: UnifiedChapter): MangaChapter | null { if (unifiedChapter.originalType !== UnifiedContentType.MANGA) { logger.warn(TAG, '尝试从非漫画章节获取漫画数据'); return null; } return unifiedChapter.originalData as MangaChapter; }
https://github.com/DaLongZhuaZi/manxia
20af6508741b03b21178dd3ddb6b83be52ecade7
github
Tencent-RTC/TUIKit_Harmony
call/src/main/ets/feature/CallStatusObserver.ets
arkts
notify
Deduplicated against `lastStatus` so spurious rebuilds do not fan out.
notify(status: CallParticipantStatus): void { if (status === this.lastStatus) { return; } this.lastStatus = status; // Snapshot to be safe against re-entrant unsubscribe() inside a callback. const snapshot = this.listeners.slice(); for (const cb of snapshot) { cb(status); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left notify AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left status AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left CallParticipantStatus AST#identifier#Right AST#...
notify(status: CallParticipantStatus): void { if (status === this.lastStatus) { return; } this.lastStatus = status; // Snapshot to be safe against re-entrant unsubscribe() inside a callback. const snapshot = this.listeners.slice(); for (const cb of snapshot) { cb(status); } }
https://github.com/Tencent-RTC/TUIKit_Harmony
9ff469eedcf58502eebc0a99825d4612f66c0468
github
Joker-x-dev/HarmonyKit
core/state/src/main/ets/DemoCounterState.ets
arkts
reset
重置计数 @param {number} resetValue - 重置值,默认 0 @returns {void} 无返回值 @example getDemoCounterState().reset(); // 归零
reset(resetValue: number = 0): void { this.count = resetValue; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left reset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resetValue AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#identifier#Left number AST#id...
reset(resetValue: number = 0): void { this.count = resetValue; }
https://github.com/Joker-x-dev/HarmonyKit
cd9aa2c526f7f0bab818906c0e9816f832c38587
github
Joker-x-dev/CoolMallArkTS
feature/main/src/main/ets/viewmodel/CartViewModel.ets
arkts
toggleSpecSelected
切换规格选中状态 @param {number} goodsId 商品ID @param {number} specId 规格ID @returns {void} 无返回值
toggleSpecSelected(goodsId: number, specId: number): void { const key = `${goodsId}_${specId}`; const newSet = new Set(this.selectedSpecIds); if (newSet.has(key)) { newSet.delete(key); } else { newSet.add(key); } this.selectedSpecIds = newSet; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toggleSpecSelected AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left goodsId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , A...
toggleSpecSelected(goodsId: number, specId: number): void { const key = `${goodsId}_${specId}`; const newSet = new Set(this.selectedSpecIds); if (newSet.has(key)) { newSet.delete(key); } else { newSet.add(key); } this.selectedSpecIds = newSet; }
https://github.com/Joker-x-dev/CoolMallArkTS
5aeec47315cf5c6d7708ff23ab79038f0ae84de7
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Float.ets
arkts
toFloat
Returns value of this instance @returns value as float
public override toFloat(): float { return this.value; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left toFloat AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Lef...
public override toFloat(): float { return this.value; }
https://gitcode.com/iop123123/arkts-static-skills
1dd828e4d13da1529a40cd35a45f37f15fea2adc
gitcode
kumaleap/ArkLuban
library/src/main/ets/luban/LogUtil.ets
arkts
setShowLog
是否打印日志(该方法建议在Ability里调用) @param showLog
static setShowLog(showLog: boolean = true) { LogUtil.showLog = showLog }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setShowLog AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left showLog AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_express...
static setShowLog(showLog: boolean = true) { LogUtil.showLog = showLog }
https://github.com/kumaleap/ArkLuban
1f25dfc50e94d1499fc3178c2e81ec8e396dce52
github
CLMC2025/Vignette
entry/src/main/ets/utils/WordDetailCache.ets
arkts
getCachedUpdatedAt
获取缓存条目的更新时间 @param wordId 单词ID @returns 更新时间戳,如果缓存不存在返回 0
getCachedUpdatedAt(wordId: number): number { const index = this.keys.indexOf(wordId); if (index < 0) { return 0; } return this.values[index].word.updatedAt; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCachedUpdatedAt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left wordId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#L...
getCachedUpdatedAt(wordId: number): number { const index = this.keys.indexOf(wordId); if (index < 0) { return 0; } return this.values[index].word.updatedAt; }
https://github.com/CLMC2025/Vignette
402e039c9a18a73a6c2dc7f0eca76c6880816508
github
openharmony/codelabs
ETSUI/ItemManagerAPP/entry/src/main/ets/data/ItemRdb.ets
arkts
update
========== 核心新增:更新物品 ==========
async update(item: Item): Promise<number> { if (this.isMock) { // 预览器模拟更新 const index = this.mockData.findIndex(d => d.id === item.id); if (index !== -1) { this.mockData[index] = item; return 1; // 更新成功返回1 } return 0; // 未找到数据返回0 } if (!this.rdbStore) { ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left update AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left item AST#identifier#Right AST#type_ann...
async update(item: Item): Promise<number> { if (this.isMock) { // 预览器模拟更新 const index = this.mockData.findIndex(d => d.id === item.id); if (index !== -1) { this.mockData[index] = item; return 1; // 更新成功返回1 } return 0; // 未找到数据返回0 } if (!this.rdbStore) { ...
https://gitcode.com/openharmony/codelabs
665d5ef9ebcafea1a1ef96cf40e759b4ecc6c46e
gitcode
aimilin6688/KeePassHO
entry/src/main/ets/storage/googledrive/GoogleOAuth2Provider.ets
arkts
getUserInfo
获取用户信息 @param accessToken 访问令牌 @return Promise<OAuth2UserInfo> 用户信息 @throws 如果获取用户信息失败则抛出异常
public async getUserInfo(accessToken: string): Promise<OAuth2UserInfo> { if (!accessToken || accessToken.trim().length === 0) { throw new OAuth2Error(OAuth2ErrorCodes.INVALID_PARAMETERS, 'Access token is required'); } try { const response = await this.sendHttpRequestWithAuth(this.getUserInfoE...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left getUserInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left accessToken AST#identifier#Right AST#ERROR#Left AST#:#Left ...
public async getUserInfo(accessToken: string): Promise<OAuth2UserInfo> { if (!accessToken || accessToken.trim().length === 0) { throw new OAuth2Error(OAuth2ErrorCodes.INVALID_PARAMETERS, 'Access token is required'); } try { const response = await this.sendHttpRequestWithAuth(this.getUserInfoE...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/googledrive/GoogleOAuth2Provider.ets#L50-L62
c106958c36091b071c3872da65ebd4464d68a0cb
github
arkui-x/samples
CodeLab/Cases/common/routermodule/src/main/ets/router/DynamicsRouter.ets
arkts
routerInit
初始化动态路由
public static routerInit(config: RouterConfig, context: Context) { DynamicsRouter.config = config; DynamicsRouter.appRouterStack.push(HOME_PAGE); // 加载路由表 RouterLoader.load(config.mapPath, DynamicsRouter.routerMap, context); }
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 routerInit AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST...
public static routerInit(config: RouterConfig, context: Context) { DynamicsRouter.config = config; DynamicsRouter.appRouterStack.push(HOME_PAGE); // 加载路由表 RouterLoader.load(config.mapPath, DynamicsRouter.routerMap, context); }
https://gitcode.com/arkui-x/samples
cea882b1070e9417402d073c6de0a178775bed6c
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/RhinoSandboxComponent.ets
arkts
notifyReady
标记沙箱就绪
notifyReady(): void { logger.info(TAG, '沙箱就绪,执行回调'); for (const callback of this.readyCallbacks) { try { callback(); } catch (e) { logger.error(TAG, `就绪回调执行失败: ${String(e)}`); } } this.readyCallbacks = []; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left notifyReady 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#...
notifyReady(): void { logger.info(TAG, '沙箱就绪,执行回调'); for (const callback of this.readyCallbacks) { try { callback(); } catch (e) { logger.error(TAG, `就绪回调执行失败: ${String(e)}`); } } this.readyCallbacks = []; }
https://github.com/DaLongZhuaZi/manxia
ad3412349b4f40c6d148ab8c726d11f38e863c13
github
picklerick422/zju-learning-assistant-OH
entry/src/main/ets/services/NativeBridge.ets
arkts
startDownloadUpload
---------------- 下载 ---------------- 下载单个课件。进度通过 onProgress 回调上报(已解析为 Progress)。 id 由调用方生成(建议用 upload.id + reference_id 或 UUID)。
static async startDownloadUpload( id: string, upload: Upload, syncUpload: boolean, onProgress: ProgressHandler ): Promise<void> { await zla.startDownloadUpload( id, JSON.stringify(upload), syncUpload, (err: Error | null, data: string) => { if (err) { hil...
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 startDownloadUpload AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left :...
static async startDownloadUpload( id: string, upload: Upload, syncUpload: boolean, onProgress: ProgressHandler ): Promise<void> { await zla.startDownloadUpload( id, JSON.stringify(upload), syncUpload, (err: Error | null, data: string) => { if (err) { hil...
https://github.com/picklerick422/zju-learning-assistant-OH
fa5d3a38fb9080882799073c8436cd2f256e93e6
github
youyeyejie/ZhiXing_ActHub
entry/src/main/ets/core/services/AIService.ets
arkts
generateInsightStream
流式生成闪记洞察报告。 @param ideasContent 闪记内容汇总 @param onChunk 每收到一段增量文本时回调 @param onDone 流式接收完成时回调 @param onError 出错时回调 @returns HttpRequest 对象,可调用 destroy() 取消请求;若 API Key 未配置则返回 null
generateInsightStream( ideasContent: string, onChunk: (text: string) => void, onDone: () => void, onError: (error: string) => void, ): http.HttpRequest | null { if (!this.hasUsableConfig()) { onError("AI 功能尚未配置,请先前往“我的”页完成 API Key、Base URL 和 Model 配置。"); return null; } const...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left generateInsightStream AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left ideasContent AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:...
generateInsightStream( ideasContent: string, onChunk: (text: string) => void, onDone: () => void, onError: (error: string) => void, ): http.HttpRequest | null { if (!this.hasUsableConfig()) { onError("AI 功能尚未配置,请先前往“我的”页完成 API Key、Base URL 和 Model 配置。"); return null; } const...
https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/core/services/AIService.ets#L155-L196
5bc917ab6b41ffc9cf4317e78ba211be0597cad1
github
kumaleap/ArkLuban
library/src/main/ets/luban/LubanUtils.ets
arkts
getFileNameWithoutExtension
获取文件名(不包含扩展名) @param filePath 文件路径 @returns 文件名
static getFileNameWithoutExtension(filePath: string): string { const normalizedPath = LubanUtils.stripQueryAndFragment(filePath); const fileName = filePath.length > 0 ? (normalizedPath.split('/').pop() || '') : ''; const dotIndex = fileName.lastIndexOf('.'); if (dotIndex === -1) { return fileNa...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getFileNameWithoutExtension AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left stri...
static getFileNameWithoutExtension(filePath: string): string { const normalizedPath = LubanUtils.stripQueryAndFragment(filePath); const fileName = filePath.length > 0 ? (normalizedPath.split('/').pop() || '') : ''; const dotIndex = fileName.lastIndexOf('.'); if (dotIndex === -1) { return fileNa...
https://github.com/kumaleap/ArkLuban
619ba20f459d8fb0870cbb1cefff79e4bec4c98e
github
HarmonyOS_Samples/BestPracticeSnippets
HDRVivid/AVCodecVideo/entry/src/main/ets/pages/Recorder.ets
arkts
isVideoStabilizationModeSupported
[Start set_video_color]
function isVideoStabilizationModeSupported(session: camera.VideoSession, mode: camera.VideoStabilizationMode): boolean { let isSupported: boolean = false; try { isSupported = session.isVideoStabilizationModeSupported(mode); } catch (error) { // If the failure occurs, the error code error.code is returned ...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left isVideoStabilizationModeSupported AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left session AST#identifier#Right AST#type_annotation#Lef...
function isVideoStabilizationModeSupported(session: camera.VideoSession, mode: camera.VideoStabilizationMode): boolean { let isSupported: boolean = false; try { isSupported = session.isVideoStabilizationModeSupported(mode); } catch (error) { // If the failure occurs, the error code error.code is returned ...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
5c41854f58f2ffac350a44ce99369bc142875da6
gitcode
Joker-x-dev/CoolMallArkTS
feature/main/src/main/ets/viewmodel/MainViewModel.ets
arkts
playSelectedAnimation
播放选中 Tab 的动画并重置其他动画帧 @param {number} index - 选中的 Tab 索引 @returns {void} 无返回值
playSelectedAnimation(index: number): void { this.lottieControllers.forEach((controller: LottieController, controllerIndex: number) => { if (controllerIndex === index) { controller.stop(); controller.play(); return; } controller.stop(); controller.goToAndStop(0, tru...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left playSelectedAnimation 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#)...
playSelectedAnimation(index: number): void { this.lottieControllers.forEach((controller: LottieController, controllerIndex: number) => { if (controllerIndex === index) { controller.stop(); controller.play(); return; } controller.stop(); controller.goToAndStop(0, tru...
https://github.com/Joker-x-dev/CoolMallArkTS
1946348f428da04074ea338c3cbe81d70f411318
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/renderer/BarLineScatterCandleBubbleRenderer.ets
arkts
shouldDrawValues
Returns true if the DataSet values should be drawn, false if not. @param set @return
protected shouldDrawValues(dataSet: IDataSet<EntryOhos>): boolean { return dataSet.isVisible() && (dataSet.isDrawValuesEnabled() || dataSet.isDrawIconsEnabled()); }
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left shouldDrawValues AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dataSet AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ins...
protected shouldDrawValues(dataSet: IDataSet<EntryOhos>): boolean { return dataSet.isVisible() && (dataSet.isDrawValuesEnabled() || dataSet.isDrawIconsEnabled()); }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
4e0711ce05e91646f2acc059b761f3e9f773315f
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/RejectedHandler.ets
arkts
reset
Removes all registered rejection handlers.
public reset(): void { this.handlers.clear(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left reset 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 reset(): void { this.handlers.clear(); }
https://gitcode.com/iop123123/arkts-static-skills
5d4de4da1aa04f68f3f4b26ab7db01d52f619392
gitcode
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/BinaryEncodingVisitor.ets
arkts
visitRepeatedMessage
访问 repeated message 字段 ⭐ 每个消息都会递归调用 visitMessage
visitRepeatedMessage(value: Message[], fieldNumber: number): void { for (const item of value) { try { this.visitMessage(item, fieldNumber) // 自动递归 } catch (e) { throw new Error(`Failed to visit repeated message at field ${fieldNumber}: ${e}`) } } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitRepeatedMessage 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#subscript_expression#Left AST#identifier#Left Mess...
visitRepeatedMessage(value: Message[], fieldNumber: number): void { for (const item of value) { try { this.visitMessage(item, fieldNumber) // 自动递归 } catch (e) { throw new Error(`Failed to visit repeated message at field ${fieldNumber}: ${e}`) } } }
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
720ae4a5e34d709a855e0fbbab15721a57f6fcb5
gitcode
HarmonyOS_Samples/MusicHome
products/default/src/main/ets/phonebackupextability/PhoneBackupExtAbility.ets
arkts
onBackup
Invoked when the system requests a backup of this extension's data.
async onBackup() { Logger.info('PhoneBackupExtAbility: onBackup ok'); }
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left onBackup AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#{#Left { AST#{#Right AST#ERROR#Right AST#expression_...
async onBackup() { Logger.info('PhoneBackupExtAbility: onBackup ok'); }
https://gitcode.com/HarmonyOS_Samples/MusicHome
31ce124afb3ee3a1cd70de04e1ddfad43212db46
gitcode
offlinecat-dev/OCNetORM
src/main/ets/repository/BatchInsertResult.ets
arkts
getFailedCount
获取失败数量 @returns 失败数量
getFailedCount(): number { return this.totalCount - this.insertedCount }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getFailedCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#stateme...
getFailedCount(): number { return this.totalCount - this.insertedCount }
https://github.com/offlinecat-dev/OCNetORM
14f5b2e58d10cbaa898db07032f2f5181c5a8a7e
github
Joker-x-dev/CoolMallArkTS
core/network/src/main/ets/datasource/goods/GoodsNetworkDataSourceImpl.ets
arkts
getGoodsSpecList
查询商品规格列表 @param {GoodsIdRequest} params - 商品 ID 请求参数 @returns {Promise<NetworkResponse<GoodsSpec[]>>} 商品规格列表响应
async getGoodsSpecList(params: GoodsIdRequest): Promise<NetworkResponse<GoodsSpec[]>> { const resp: AxiosResponse<NetworkResponse<GoodsSpec[]>> = await NetworkClient.http.post("goods/spec/list", params); return resp.data; }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getGoodsSpecList 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#:#Lef...
async getGoodsSpecList(params: GoodsIdRequest): Promise<NetworkResponse<GoodsSpec[]>> { const resp: AxiosResponse<NetworkResponse<GoodsSpec[]>> = await NetworkClient.http.post("goods/spec/list", params); return resp.data; }
https://github.com/Joker-x-dev/CoolMallArkTS
7ea198c2f190fbe0dcab609021340cbc5a14fcb7
github
LJ666-ui/harmony-health-care
entry/src/main/ets/medicalimaging/ModelManager.ets
arkts
getAllModelStatus
获取所有模型状态 @returns 模型状态映射
getAllModelStatus(): Map<ImagingType, ModelStatus> { const statusMap = new Map<ImagingType, ModelStatus>(); this.modelInfoMap.forEach((info, type) => { statusMap.set(type, info.status); }); return statusMap; }
AST#program#Left AST#ERROR#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getAllModelStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Ma...
getAllModelStatus(): Map<ImagingType, ModelStatus> { const statusMap = new Map<ImagingType, ModelStatus>(); this.modelInfoMap.forEach((info, type) => { statusMap.set(type, info.status); }); return statusMap; }
https://github.com/LJ666-ui/harmony-health-care
2acc7a3706a503d4e3769b17af9d125e0569326f
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Parsers/TxtParser.ets
arkts
parse
解析TXT文件
async parse(filePath: string): Promise<EBook> { try { logger.info(TAG, `开始解析TXT文件: ${filePath}`); // 初始化TXT目录规则 await this.initTocRules(); // 读取文件内容 const content = await this.readFileContent(filePath); // 提取元数据 const metadata = await this.extractMetadata(filePat...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left parse AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left filePath AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:...
async parse(filePath: string): Promise<EBook> { try { logger.info(TAG, `开始解析TXT文件: ${filePath}`); // 初始化TXT目录规则 await this.initTocRules(); // 读取文件内容 const content = await this.readFileContent(filePath); // 提取元数据 const metadata = await this.extractMetadata(filePat...
https://github.com/DaLongZhuaZi/manxia
45e6e30a508dc4806c79de6dfdbd367479227060
github
openharmony/codelabs
ETSUI/PositioningDemo/entry/src/main/ets/service/AchievementService.ets
arkts
getUnlockedCount
获取已解锁成就数量
async getUnlockedCount(): Promise<number> { const achievements = await this.getAllAchievements(); return achievements.filter(a => a.isUnlocked).length; }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getUnlockedCount 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#gen...
async getUnlockedCount(): Promise<number> { const achievements = await this.getAllAchievements(); return achievements.filter(a => a.isUnlocked).length; }
https://gitcode.com/openharmony/codelabs
e6b52d0885fc10d5a6ff5f778b078aa50cad6b06
gitcode
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/components/YAxis.ets
arkts
setEnableCustomYAxisLabels
Set whether to fully use custom labels @param numbers labels
public setEnableCustomYAxisLabels(enableCustomYAxisLabels: boolean): void { this.enableCustomYAxisLabels = enableCustomYAxisLabels; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setEnableCustomYAxisLabels AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left enableCustomYAxisLabels AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#bo...
public setEnableCustomYAxisLabels(enableCustomYAxisLabels: boolean): void { this.enableCustomYAxisLabels = enableCustomYAxisLabels; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
5d33e02cf86a192451cde74b5b3658fca51faa09
gitee
RedRackham-R/WanAndroidHarmoney
entry/src/main/ets/net/wanAPI/WanHttpClient.ets
arkts
uncollect
取消收藏站内文章 https://www.wanandroid.com/lg/uncollect_originId/{id}/json @param id 文章id @returns
public uncollect(id: number): Promise<AxiosResponse<IWanCommonResponse<any>>> { return this.postRequest("/lg/uncollect_originId/" + id + "/json") }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left uncollect AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number A...
public uncollect(id: number): Promise<AxiosResponse<IWanCommonResponse<any>>> { return this.postRequest("/lg/uncollect_originId/" + id + "/json") }
https://github.com/RedRackham-R/WanAndroidHarmoney
1c5b5c95ec45fa68bc20d3ecd4c15a8a027a4e16
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/ReminderService.ets
arkts
getUpcomingReminders
获取即将到期的提醒(未来N天内)
static async getUpcomingReminders(userId: number, days: number = 7): Promise<Reminder[]> { try { const allReminders: Reminder[] = await ReminderDAO.getActiveReminders(userId); const futureDate: Date = new Date(); futureDate.setDate(futureDate.getDate() + days); const futureDateStr: string ...
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 getUpcomingReminders AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#L...
static async getUpcomingReminders(userId: number, days: number = 7): Promise<Reminder[]> { try { const allReminders: Reminder[] = await ReminderDAO.getActiveReminders(userId); const futureDate: Date = new Date(); futureDate.setDate(futureDate.getDate() + days); const futureDateStr: string ...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
ac6dbfd8508b5dd233e35ce85aa2279a823a146f
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/right_shift/right_shift_ulong.ets
arkts
main
--- desc: check right shift operation for unsigned long integer ---
function main(): void { const a: ulong = {{v.left}} const b: int = {{v.right}} assert (a >> b) == {{v.result}}
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A...
function main(): void { const a: ulong = {{v.left}} const b: int = {{v.right}} assert (a >> b) == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
779151dd44fb39d3c712b0c9f563101125aa203d
gitee
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/GamepadManager.ets
arkts
checkUsbControllerStatus
检查 USB 控制器状态,清理已断开的设备
private checkUsbControllerStatus(): void { // 获取当前 USB 设备列表,用于检查哪些控制器已断开 const controllers = this.usbDriverService.getControllers(); for (const controller of controllers) { if (!controller.isConnected()) { console.info(`[GAMEPAD] USB 控制器已断开: ID=${controller.getControllerId()}`); cont...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left checkUsbControllerStatus 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 ...
private checkUsbControllerStatus(): void { // 获取当前 USB 设备列表,用于检查哪些控制器已断开 const controllers = this.usbDriverService.getControllers(); for (const controller of controllers) { if (!controller.isConnected()) { console.info(`[GAMEPAD] USB 控制器已断开: ID=${controller.getControllerId()}`); cont...
https://github.com/AlkaidLab/moonlight-harmony
dd3dfdc5f8f085f2e591a16b2f08a09ccd4d4c14
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/components/ComponentBase.ets
arkts
setTextColor
Sets the text color to use for the labels. Make sure to use getResources().getColor(...) when using a color from the resources. @param color
public setTextColor(color: string | number | CanvasGradient | CanvasPattern): void { this.mTextColor = color; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setTextColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left color AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#...
public setTextColor(color: string | number | CanvasGradient | CanvasPattern): void { this.mTextColor = color; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
2696880472ed69e266c075131606fb5aa16c7fdf
gitee
openharmony/applications_launcher
feature/pagedesktop/src/main/ets/default/common/components/SwiperPage.ets
arkts
movingIconSwapPageDelay
Increase delay when dragging app to other page.
movingIconSwapPageDelay() { AppStorage.setOrCreate('isSwappingPage', true); setTimeout(() => { AppStorage.setOrCreate('isSwappingPage', false); }, this.APP_INFO_REFRESH_DELAY); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left movingIconSwapPageDelay 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_...
movingIconSwapPageDelay() { AppStorage.setOrCreate('isSwappingPage', true); setTimeout(() => { AppStorage.setOrCreate('isSwappingPage', false); }, this.APP_INFO_REFRESH_DELAY); }
https://gitee.com/openharmony/applications_launcher.git
fd371aeae280aa273ab9f9c3d6c461cb6fcf81fc
gitee
qiuhaotc/HarmonyOSPlayground
entry/src/main/ets/utils/BillStatisticsUtil.ets
arkts
getWeeklyTrend
获取周趋势数据(最近N周)
static getWeeklyTrend(bills: BillModel[], weeks: number = 8): WeeklyTrend[] { const weeklyMap = new Map<string, DailyStats>(); bills.forEach((bill: BillModel) => { const date = new Date(bill.date); const week = BillStatisticsUtil.getWeekString(date); ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getWeeklyTrend AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bills AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expres...
static getWeeklyTrend(bills: BillModel[], weeks: number = 8): WeeklyTrend[] { const weeklyMap = new Map<string, DailyStats>(); bills.forEach((bill: BillModel) => { const date = new Date(bill.date); const week = BillStatisticsUtil.getWeekString(date); ...
https://github.com/qiuhaotc/HarmonyOSPlayground
35b78d0258598e4514227537d8b36441da9598ca
github
codelably/tuniao-ui
core/tuniaoui/src/main/ets/components/photo-album/TnPhotoAlbum.ets
arkts
resolveImageFit
将 TnPhotoAlbumImgMode 转换为 ImageFit @param mode 图片显示模式 @returns ImageFit 枚举值
function resolveImageFit(mode: TnPhotoAlbumImgMode): ImageFit { switch (mode) { case "contain": return ImageFit.Contain; case "fill": return ImageFit.Fill; case "auto": return ImageFit.Auto; default: return ImageFit.Cover; } }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left resolveImageFit AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left mode AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#...
function resolveImageFit(mode: TnPhotoAlbumImgMode): ImageFit { switch (mode) { case "contain": return ImageFit.Contain; case "fill": return ImageFit.Fill; case "auto": return ImageFit.Auto; default: return ImageFit.Cover; } }
https://github.com/codelably/tuniao-ui
76f76f5e13a2031cd6b66fabfd17ce93b5626859
github
openharmony/vendor_unionman
unionpi_tiger/sample_api11/app/OH/entry/src/main/ets/common/PlayComponent.ets
arkts
onPlayClick
msgPort: any[] = null; 接口函数
onPlayClick() { if (this.playerModel.isPlaying) { this.playerModel.pause(); } else if (this.audioTime > 0) { this.playerModel.play(this.audioTime, true); } else { this.playerModel.preLoad(this.index, () => { this.playerModel.play(-1, true); }); } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onPlayClick AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A...
onPlayClick() { if (this.playerModel.isPlaying) { this.playerModel.pause(); } else if (this.audioTime > 0) { this.playerModel.play(this.audioTime, true); } else { this.playerModel.preLoad(this.index, () => { this.playerModel.play(-1, true); }); } }
https://gitee.com/openharmony/vendor_unionman.git
838f76274551c055b8c3aebba6f057fd869e0672
gitee
arkui-x/samples
CodeLab/Cases/feature/customcalendarpickerdialog/src/main/ets/view/CalendarView.ets
arkts
aboutToAppear
获取当前日期
aboutToAppear(): void { let dateModel: DateModel = getRealTimeDate(); // 获取当前年月日信息 this.currentMonth = dateModel.month; // 获取当前月份 this.currentDay = dateModel.day; // 获取当前日 this.currentYear = dateModel.year; // 获取当前年份 }
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 { let dateModel: DateModel = getRealTimeDate(); // 获取当前年月日信息 this.currentMonth = dateModel.month; // 获取当前月份 this.currentDay = dateModel.day; // 获取当前日 this.currentYear = dateModel.year; // 获取当前年份 }
https://gitcode.com/arkui-x/samples
b5b9bf6a918fb4904c6054aca1c4417f7826dae3
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Utils/ComicInfoParser.ets
arkts
mapXmlFieldToComicInfo
将XML字段映射到ComicInfo对象 @param fieldName XML字段名 @param fieldValue XML字段值
private mapXmlFieldToComicInfo(fieldName: string, fieldValue: string): void { try { switch (fieldName.toLowerCase()) { case 'title': this.comicInfo.title = fieldValue; break; case 'series': this.comicInfo.series = fieldValue; break; case 'numbe...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left mapXmlFieldToComicInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left fieldName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left strin...
private mapXmlFieldToComicInfo(fieldName: string, fieldValue: string): void { try { switch (fieldName.toLowerCase()) { case 'title': this.comicInfo.title = fieldValue; break; case 'series': this.comicInfo.series = fieldValue; break; case 'numbe...
https://github.com/DaLongZhuaZi/manxia
cd9f2389b78adb43759eb80987a58da6497e1d9b
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
reduceRight
Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. @param { function } callbackfn - A function that accepts four arguments. The reduceR...
public reduceRight(callbackfn: (previousValue: BigInt, currentValue: BigInt, currentIndex: int, array: BigUint64Array) => BigInt): BigInt { if (this.lengthInt == 0) { throw new TypeError("Reduce of empty array with no initial value") } let accumulatedValue: BigInt = new BigInt(t...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left reduceRight AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left callbackfn AST#identifier#Right AST#ERROR#Left AST#:#L...
public reduceRight(callbackfn: (previousValue: BigInt, currentValue: BigInt, currentIndex: int, array: BigUint64Array) => BigInt): BigInt { if (this.lengthInt == 0) { throw new TypeError("Reduce of empty array with no initial value") } let accumulatedValue: BigInt = new BigInt(t...
https://gitcode.com/iop123123/arkts-static-skills
87b2302a3342cd52ab368e47e09020753fb6d605
gitcode
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/database/CacheManager.ets
arkts
printStats
打印缓存统计报告
static printStats(): void { const stats = CacheManager.getStats(); console.log('\n========== 缓存统计报告 =========='); console.log(`总缓存数: ${stats.totalCount}`); console.log(`有效缓存: ${stats.validCount}`); console.log(`过期缓存: ${stats.expiredCount}`); if (stats.keys.length > 0) { console...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left printStats 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#Rig...
static printStats(): void { const stats = CacheManager.getStats(); console.log('\n========== 缓存统计报告 =========='); console.log(`总缓存数: ${stats.totalCount}`); console.log(`有效缓存: ${stats.validCount}`); console.log(`过期缓存: ${stats.expiredCount}`); if (stats.keys.length > 0) { console...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
e5761154a258a475e55e3857c0bec55487080ed8
github
HarmonyOS_Samples/guide-snippets
ArkGraphics2D/DisplaySync/entry/src/main/ets/DisplaySync/CustomDrawDisplaySync.ets
arkts
build
[End display_sync_call_stop]
build() { Column() { Row() { this.doSomeRenderFirst(); } .height('40%') Row() { this.doSomeRenderSecond(); } .height('40%') Row() { // [Start display_sync_start_per_frame_callback] Button('Start') .id('CustomDrawStart') ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#object#Left AST#{#Left { AST#{#Right AST#method_def...
build() { Column() { Row() { this.doSomeRenderFirst(); } .height('40%') Row() { this.doSomeRenderSecond(); } .height('40%') Row() { // [Start display_sync_start_per_frame_callback] Button('Start') .id('CustomDrawStart') ...
https://gitcode.com/HarmonyOS_Samples/guide-snippets
bc1fa685c3a9dc7a28b1a5da2a5d409ecc3c7264
gitcode
richshaw2015/nds
ohos/entry/src/main/ets/pages/settings/KeyMappingSettings.ets
arkts
findAllBindings
查找某个目标的所有绑定
function findAllBindings( keyMappings: KeyMappingEntry[], gamepadMappings: GamepadMappingEntry[], targetType: string, targetValue: number | string ): BindingDisplay[] { const result: BindingDisplay[] = [] // 键盘绑定 for (const m of keyMappings) { if (targetType === 'nds_key' && m.target.type === 'nds_key...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left findAllBindings AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left keyMappings AST#identifier#Right AST#type_annotation#Left AST#:#Left :...
function findAllBindings( keyMappings: KeyMappingEntry[], gamepadMappings: GamepadMappingEntry[], targetType: string, targetValue: number | string ): BindingDisplay[] { const result: BindingDisplay[] = [] // 键盘绑定 for (const m of keyMappings) { if (targetType === 'nds_key' && m.target.type === 'nds_key...
https://github.com/richshaw2015/nds
5b78e512136138adeb95f9a79575bc4f937cd972
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Box.ets
arkts
box
Creates a new ByteBox instance with the specified initial value. @param { byte } value - The initial byte value to be wrapped @returns { ByteBox } A new ByteBox instance containing the specified byte value @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static box(value: byte): ByteBox { return new ByteBox(value); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left box AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right ...
public static box(value: byte): ByteBox { return new ByteBox(value); }
https://gitcode.com/iop123123/arkts-static-skills
0dd11430b5fff6884c748d19eb449025d720fe1a
gitcode
LongLiveY96/chatcube
entry/src/main/ets/state/AppSettingsStore.ets
arkts
reorderProviders
按给定 id 顺序重排
async reorderProviders(providerIds: string[]): Promise<void> { await this.db.updateProvidersOrder(providerIds) const current = this.getProviders() const sorted: ModelProvider[] = [] for (let i = 0; i < providerIds.length; i++) { const id = providerIds[i] for (let j = 0; j < current.length;...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left reorderProviders AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left providerIds AST#identifier#Right AST#type_annotation#Left AST#...
async reorderProviders(providerIds: string[]): Promise<void> { await this.db.updateProvidersOrder(providerIds) const current = this.getProviders() const sorted: ModelProvider[] = [] for (let i = 0; i < providerIds.length; i++) { const id = providerIds[i] for (let j = 0; j < current.length;...
https://github.com/LongLiveY96/chatcube
273613c507e7ae25cfcca813d3946be34bc81b01
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoWebViewExecutor.ets
arkts
onPageError
页面加载错误回调(由WebView组件调用)
onPageError(errorCode: number, description: string, url: string): void { logger.error(TAG, `页面加载错误: ${url}, code: ${errorCode}, desc: ${description}`); if (this.currentTask) { this.currentTask.reject(new Error(`页面加载错误: ${description}`)); this.currentTask = null; this.isProcessing = false; ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onPageError AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left errorCode AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , AST#,#...
onPageError(errorCode: number, description: string, url: string): void { logger.error(TAG, `页面加载错误: ${url}, code: ${errorCode}, desc: ${description}`); if (this.currentTask) { this.currentTask.reject(new Error(`页面加载错误: ${description}`)); this.currentTask = null; this.isProcessing = false; ...
https://github.com/DaLongZhuaZi/manxia
4a2dfa9c8285b1d19d6f0fd770cda83ca2e9a1bd
github
HarmonyOS_Samples/BestPracticeSnippets
ClickResponseOptimization/entry/src/main/ets/pages/CityListPage.ets
arkts
onPageShow
[StartExclude onpage_show]
onPageShow() { hiTraceMeter.finishTrace("clickCity", 1); }
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() { hiTraceMeter.finishTrace("clickCity", 1); }
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
e74600428a31faf342457c5053e65a8cd15239f0
gitcode
AetheriumSimulator/qemu-hmos
entry/src/main/ets/utils/RDPPerformanceManager.ets
arkts
simpleCompress
简单压缩(降采样)- 作为降级方案
private simpleCompress(data: ArrayBuffer, ratio: number): ArrayBuffer { const targetSize = Math.floor(data.byteLength * ratio) const compressed = new ArrayBuffer(targetSize) const srcView = new Uint8Array(data) const dstView = new Uint8Array(compressed) // 间隔采样 const step = Math.ceil(srcV...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left simpleCompress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
private simpleCompress(data: ArrayBuffer, ratio: number): ArrayBuffer { const targetSize = Math.floor(data.byteLength * ratio) const compressed = new ArrayBuffer(targetSize) const srcView = new Uint8Array(data) const dstView = new Uint8Array(compressed) // 间隔采样 const step = Math.ceil(srcV...
https://github.com/AetheriumSimulator/qemu-hmos
2c385852c328dbd400d8d628ce670e258e7a869b
github
erosTeam/NextE
shared/src/main/ets/settings/DownloadQueueSettings.ets
arkts
enqueueGallery
Add or refresh a gallery queue task. Raw and resampled downloads are separate tasks.
static async enqueueGallery( context: common.UIAbilityContext, task: DownloadGalleryTask, ): Promise<boolean> { if (task.gid.length === 0) { DiagnosticLogger.warn('download', 'gallery_enqueue_skipped_empty_gid', `tokenHash=${DiagnosticLogger.ownerHash(task.token)}`) return false } co...
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 enqueueGallery AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left :...
static async enqueueGallery( context: common.UIAbilityContext, task: DownloadGalleryTask, ): Promise<boolean> { if (task.gid.length === 0) { DiagnosticLogger.warn('download', 'gallery_enqueue_skipped_empty_gid', `tokenHash=${DiagnosticLogger.ownerHash(task.token)}`) return false } co...
https://github.com/erosTeam/NextE
9434dd50e9e44f3954dd48a7ef8dd4d3ddea5d58
github
LJ666-ui/harmony-health-care
entry/src/main/ets/ai/AIOrchestrator.ets
arkts
handleVoiceCommand
处理语音命令(小艺入口)
private async handleVoiceCommand(request: AIRequest): Promise<AIResponse> { if (!request.query) { return this.createErrorResponse('MISSING_QUERY', '缺少查询内容'); } console.info(`[AI-Orch] 处理语音命令: ${request.query}`); // 使用小艺Skill管理器自动路由和处理 const xiaoyiResponse = await xiaoyiSkillManager.autoRou...
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 handleVoiceCommand AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left request AST#identifier#Right AST#:...
private async handleVoiceCommand(request: AIRequest): Promise<AIResponse> { if (!request.query) { return this.createErrorResponse('MISSING_QUERY', '缺少查询内容'); } console.info(`[AI-Orch] 处理语音命令: ${request.query}`); // 使用小艺Skill管理器自动路由和处理 const xiaoyiResponse = await xiaoyiSkillManager.autoRou...
https://github.com/LJ666-ui/harmony-health-care
ca036a8a494d57c96d724e1148373e49b1dd3926
github
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/BlurEffectViewModel.ets
arkts
getBlurItems
获取模糊级别列表 @returns 模糊项数组
getBlurItems(): BlurItem[] { return [ new BlurItem("blur-sm", "轻微模糊", BLUR_LEVEL.SM), new BlurItem("blur-default", "默认模糊", BLUR_LEVEL.DEFAULT), new BlurItem("blur-md", "中等模糊", BLUR_LEVEL.MD), new BlurItem("blur-lg", "强模糊", BLUR_LEVEL.LG), ]; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getBlurItems AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left BlurItem AST#identifier#Right AST#...
getBlurItems(): BlurItem[] { return [ new BlurItem("blur-sm", "轻微模糊", BLUR_LEVEL.SM), new BlurItem("blur-default", "默认模糊", BLUR_LEVEL.DEFAULT), new BlurItem("blur-md", "中等模糊", BLUR_LEVEL.MD), new BlurItem("blur-lg", "强模糊", BLUR_LEVEL.LG), ]; }
https://github.com/codelably/tuniao-ui
91202baefbdf30bb24a1439b12563fa18a19f157
github
openharmony-tpc/MMKV
entry/src/main/ets/pages/index.ets
arkts
get
test mmkv info
get() { LogUtil.i('version = ' + MMKV.version() + ' pageSize = ' + MMKV.pageSize() + ' rootDir = ' + MMKV.getRootDir()) this.showMsg('version = ' + MMKV.version() + ' pageSize = ' + MMKV.pageSize()) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left get AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#cal...
get() { LogUtil.i('version = ' + MMKV.version() + ' pageSize = ' + MMKV.pageSize() + ' rootDir = ' + MMKV.getRootDir()) this.showMsg('version = ' + MMKV.version() + ' pageSize = ' + MMKV.pageSize()) }
https://gitee.com/openharmony-tpc/MMKV.git
0dbcb361552fa55023b8a2e765d7a1faa87a0522
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Services/DataService.ets
arkts
getComicDetail
==================== 漫画详情服务 ==================== 获取漫画详情
public async getComicDetail(comicId: string): Promise<ComicDetail | null> { try { const comic = await this.dataManager.getComicInfo(comicId); if (!comic) { return null; } const chapters = await this.dataManager.getComicChapters(comicId); const favorites = await this.da...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left getComicDetail AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left comicId AST#identifier#Right AST#ERROR#Left AST#:#Left :...
public async getComicDetail(comicId: string): Promise<ComicDetail | null> { try { const comic = await this.dataManager.getComicInfo(comicId); if (!comic) { return null; } const chapters = await this.dataManager.getComicChapters(comicId); const favorites = await this.da...
https://github.com/DaLongZhuaZi/manxia
e328458a070dd3943dd888d1f39251288a657955
github
Octo-o-o-o/harmonyos-ai-workspace
samples/templates/web-bridge-h5-shell/BridgeJavaScriptProxy.ets
arkts
jsLiteral
─── runJavaScript 字符串字面量转义 ─────────────────────────── 必须手写,否则换行 / 反斜杠 / Unicode 行分隔符会破坏 JS 语法
function jsLiteral(value: string): string { let out: string = '"' for (let i = 0; i < value.length; i++) { const c = value.charCodeAt(i) if (c === 0x5c) { out += '\\\\' } else if (c === 0x22) { out += '\\"' } else if (c === 0x0a) { out += '\\n' } else if (c === 0x0d) { out += '\\r' } else if...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left jsLiteral AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left value AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right...
function jsLiteral(value: string): string { let out: string = '"' for (let i = 0; i < value.length; i++) { const c = value.charCodeAt(i) if (c === 0x5c) { out += '\\\\' } else if (c === 0x22) { out += '\\"' } else if (c === 0x0a) { out += '\\n' } else if (c === 0x0d) { out += '\\r' } else if...
https://github.com/Octo-o-o-o/harmonyos-ai-workspace
7668632fd98d9f1a8c12e6fe3fcf14ebf60b62d9
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/bitwise_xor/bitwise_xor_uint.ets
arkts
main
--- desc: check bitwise XOR of two unsigned integers ---
function main(): void { const a: uint = {{v.left}} const b: uint = {{v.right}} assert (a ^ b) == {{v.result}}
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A...
function main(): void { const a: uint = {{v.left}} const b: uint = {{v.right}} assert (a ^ b) == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
31b3a171e36b797ab3a9db370b9dff6e46eef873
gitee
luojiang001/Pulse
Pulse/entry/src/main/ets/pages/component/ShouYe/DoctorListComponent.ets
arkts
aboutToAppear
搜索关键字
aboutToAppear() { this.initData(); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left...
aboutToAppear() { this.initData(); }
https://github.com/luojiang001/Pulse
faa85582470ae9788fe159fb9a73e07bcb61bf06
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
sort
Sorts in-place @param { function } [compareFn] - comparator _ used to determine the order of the elements. compareFn returns a negative value if first argument is less than second argument, zero if they're equal and a positive value otherwise. @returns { this } - sorted BigInt64Array @syscap SystemCapability.Utils.Lan...
public sort(compareFn?: (a: BigInt, b: BigInt) => int | BigInt): this { if (compareFn == undefined) { this.sort() return this } let cmp = (l: long, r: long): int => { const result = compareFn!(new BigInt(l), new BigInt(r)) if (result instanceo...
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#binary_expression#Left AST#call_expression#Left AST#identifier#...
public sort(compareFn?: (a: BigInt, b: BigInt) => int | BigInt): this { if (compareFn == undefined) { this.sort() return this } let cmp = (l: long, r: long): int => { const result = compareFn!(new BigInt(l), new BigInt(r)) if (result instanceo...
https://gitcode.com/iop123123/arkts-static-skills
deb1c7df26d2cdb2e9387ee3ee246e668790965b
gitcode
ZestBox-18/kitebook-frontend
features/home/src/main/ets/components/AssetOverviewCardComponent.ets
arkts
AssetStatMetric
构建资产统计指标块。
private AssetStatMetric(label: string, value: string) { Column({ space: 6 }) { Text(label) .fontSize(this.compactLayout ? 12 : 13) .fontWeight(FontWeight.Medium) .fontColor(this.themeState.fontSecondary) Text(value) .fontSize(this.compactLayout ? 14 : 16) .fontW...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left AssetStatMetric AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left label AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
private AssetStatMetric(label: string, value: string) { Column({ space: 6 }) { Text(label) .fontSize(this.compactLayout ? 12 : 13) .fontWeight(FontWeight.Medium) .fontColor(this.themeState.fontSecondary) Text(value) .fontSize(this.compactLayout ? 14 : 16) .fontW...
https://github.com/ZestBox-18/kitebook-frontend
a85e690c5476274d5ed6b3dbe97d6c03d11d029d
github
aimilin6688/KeePassHO
entry/src/main/ets/storage/ftp/SFTPHandler.ets
arkts
uploadTo
上传本地文件到远程(支持大文件分块上传)
public async uploadTo(localPath: string, remotePath: string): Promise<void> { try { hilog.info(DOMAIN, TAG, `Starting upload: ${localPath} -> ${remotePath}`); // 读取本地文件信息 const file = await fs.open(localPath, fs.OpenMode.READ_ONLY); const fileInfo = await fs.stat(file.fd); const fil...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left uploadTo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left localPath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST...
public async uploadTo(localPath: string, remotePath: string): Promise<void> { try { hilog.info(DOMAIN, TAG, `Starting upload: ${localPath} -> ${remotePath}`); // 读取本地文件信息 const file = await fs.open(localPath, fs.OpenMode.READ_ONLY); const fileInfo = await fs.stat(file.fd); const fil...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/ftp/SFTPHandler.ets#L301-L341
7200c137597ba0802b59975b912f3886d746f16c
github
openharmony-sig/applications_compass
feature/compass/src/main/ets/components/CompassView.ets
arkts
outsideDraw
Draw outside circle.
private outsideDraw(): void { this.outsideContext.clearRect(-this.outsideSize / this.times, -this.outsideSize / this.times, this.outsideSize, this.outsideSize); this.drawAngleLine(); this.drawAngleNumber(); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left outsideDraw 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 outsideDraw(): void { this.outsideContext.clearRect(-this.outsideSize / this.times, -this.outsideSize / this.times, this.outsideSize, this.outsideSize); this.drawAngleLine(); this.drawAngleNumber(); }
https://gitee.com/openharmony-sig/applications_compass.git
08f5213f897234e7d985e46d6dbe8ba9323e62ce
gitee
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test2_original_index.ets
arkts
testAsyncAwait
=== Promise / Async ===
async function testAsyncAwait(): Promise<string> { let result: string = await Promise.resolve('hello'); return result + ' world'; }
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left testAsyncAwait AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#...
async function testAsyncAwait(): Promise<string> { let result: string = await Promise.resolve('hello'); return result + ' world'; }
https://github.com/miaochiahao/ark-ghidra
04c3bab202f611c77df9c68d10db60aa4b5b5427
github
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnButtonViewModel.ets
arkts
incrementClickCount
增加点击计数
incrementClickCount(): void { this.clickCount = this.clickCount + 1; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left incrementClickCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statemen...
incrementClickCount(): void { this.clickCount = this.clickCount + 1; }
https://github.com/codelably/tuniao-ui
809c9c2cbb3fb111336a3aa7c22a180417a9cffd
github
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/JsonEncodingVisitor.ets
arkts
visitUint32
访问 uint32 字段 JSON: number
visitUint32(value: number, fieldNumber: number): void { const fieldName = this.getFieldName(fieldNumber) this.json[fieldName] = value as Object }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitUint32 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left , AS...
visitUint32(value: number, fieldNumber: number): void { const fieldName = this.getFieldName(fieldNumber) this.json[fieldName] = value as Object }
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
550dcfb93eb855b2924b95fa45cc190c200d8541
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/06.conversions_and_contexts/05.casting_contexts/widening_refs.ets
arkts
main
--- desc: Casting contexts allow the use of the widening reference conversion. ---
function main(): int { {%- for t in c['types'] %} let s{{loop.index}}: {{t.stype}} = {{t.expr|safe}}; let d{{loop.index}}: {{t.dtype}} = s{{loop.index}} as {{t.dtype}};
AST#program#Left AST#expression_statement#Left AST#as_expression#Left AST#function_expression#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left...
function main(): int { {%- for t in c['types'] %} let s{{loop.index}}: {{t.stype}} = {{t.expr|safe}}; let d{{loop.index}}: {{t.dtype}} = s{{loop.index}} as {{t.dtype}};
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
39f37ce31f82255ec7db09ff95eb76d7b8aaee4e
gitee
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.stream.ets
arkts
constructor
The Readable constructor.
constructor() { this.initializeMembers(); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A...
constructor() { this.initializeMembers(); }
https://gitcode.com/iop123123/arkts-static-skills
e3b4657351dd788d206cc2bfa29163e42c879d85
gitcode
Vsolon0401/MallShopping
features/home/src/main/ets/model/homeService.ets
arkts
fetchNewProductList
根据分类获取专题
async fetchNewProductList(params) { return Request.get('/home/newProductList', { params: params }) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left fetchNewProductList AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left params AST#identifier#Right AST#)#Left ) AST#...
async fetchNewProductList(params) { return Request.get('/home/newProductList', { params: params }) }
https://github.com/Vsolon0401/MallShopping
085f8c3cb492f3497c6cfc606019e80ba7d536ea
github
TDCQCX/ShiHuaMusic-Harmony
entry/src/main/ets/utils/GlobalDataManager.ets
arkts
getAudioManager
获取音频管理器实例
getAudioManager(): AudioManager { return this.audioManager; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getAudioManager 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 AudioManager AST#identifier#Right AST#ERROR#Ri...
getAudioManager(): AudioManager { return this.audioManager; }
https://github.com/TDCQCX/ShiHuaMusic-Harmony
4a843b163cfe5f5e72ba31daebb63e6ac90b70d1
github