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
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
reverse
Creates a new BigUint64Array using reversed data from the current one @returns a new BigUint64Array using reversed data from the current one
public reverse(): BigUint64Array { let res = new BigUint64Array(this) for (let i = 0; i < this.length; ++i) { res.set(this.length - 1 - i, this.at(i)) } return res }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left reverse 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 BigUint64Array...
public reverse(): BigUint64Array { let res = new BigUint64Array(this) for (let i = 0; i < this.length; ++i) { res.set(this.length - 1 - i, this.at(i)) } return res }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
af8d4ae6d405d0859f28d2d484dffc44907a152b
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/ThemeManager.ets
arkts
getActualThemeSync
获取实际显示的主题(同步,用于UI组件快速访问)
public getActualThemeSync(): ThemeType { if (this.currentTheme === ThemeType.AUTO) { return this.actualTheme; } return this.currentTheme; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getActualThemeSync 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 The...
public getActualThemeSync(): ThemeType { if (this.currentTheme === ThemeType.AUTO) { return this.actualTheme; } return this.currentTheme; }
https://github.com/DaLongZhuaZi/manxia
98c3f67f003a973e55b8c531cb3228787fa8a9f3
github
Vincent-Leon/zotero-harmony
entry/src/main/ets/components/PdfView.ets
arkts
parsePageIndex
Pulls pageIndex out of an annotationPosition JSON string. Returns 0 if missing or malformed — the list row falls back to the explicit page label when it can.
function parsePageIndex(positionJson: string): number { try { const parsed: Object = JSON.parse(positionJson); if (typeof parsed === 'object') { const obj = parsed as Record<string, Object>; const pi = obj['pageIndex']; if (typeof pi === 'number') { return pi; } } } catch...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left parsePageIndex AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left positionJson AST#identifier#Right AST#type_annotation#Left AST#:#Left :...
function parsePageIndex(positionJson: string): number { try { const parsed: Object = JSON.parse(positionJson); if (typeof parsed === 'object') { const obj = parsed as Record<string, Object>; const pi = obj['pageIndex']; if (typeof pi === 'number') { return pi; } } } catch...
https://github.com/Vincent-Leon/zotero-harmony
6256fabf5d567b450a9e56cd8e59db63620c4d0f
github
arkui-x/samples
CodeLab/Cases/feature/foldablescreencases/src/main/ets/components/MusicPlayerInfoComp.ets
arkts
getCurSeekTime
歌词列表上展示当前手动滑到的词句所在的歌曲时间 @returns {string}
getCurSeekTime(): string { const curSeekTimeMs = this.viewModel.curMusicModel?.lyricsInfo.getTimeByIndex(this.lyricsCurIndex) || 0; return this.viewModel.genTimeStr(curSeekTimeMs); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCurSeekTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#stateme...
getCurSeekTime(): string { const curSeekTimeMs = this.viewModel.curMusicModel?.lyricsInfo.getTimeByIndex(this.lyricsCurIndex) || 0; return this.viewModel.genTimeStr(curSeekTimeMs); }
https://gitcode.com/arkui-x/samples
e2367437e396f29ee40ac3ae2273b9c7910b524f
gitcode
openharmony/arkui_ace_engine
examples/AdvancedBlendMode/entry/src/main/ets/pages/ListDataSource.ets
arkts
insertItem
在指定索引位置插入一个元素
public insertItem(index: number, data: number): void { this.list.splice(index, 0, data); this.notifyDataAdd(index); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left insertItem 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 numb...
public insertItem(index: number, data: number): void { this.list.splice(index, 0, data); this.notifyDataAdd(index); }
https://gitcode.com/openharmony/arkui_ace_engine
e552ca50327b732a5d369d583266ba079b373b0e
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/greater_than/greater_than_uint.ets
arkts
main
--- desc: check greater operation for 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
80046198f75283af6a35b0a6895d6411b0728bd7
gitee
openharmony-sig/ohos_highlightguide
library/src/main/ets/highlightguide/core/HighLightGuideBuilder.ets
arkts
setOnPageChangedListener
添加页面切换监听器 @param listener 页面切换监听器 @returns 引导页组件的配置项
public setOnPageChangedListener(listener: OnPageChangedListener | null): HighLightGuideBuilder { this.pageChangedListener = listener; return this; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setOnPageChangedListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left listener AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#bin...
public setOnPageChangedListener(listener: OnPageChangedListener | null): HighLightGuideBuilder { this.pageChangedListener = listener; return this; }
https://gitee.com/openharmony-sig/ohos_highlightguide.git
6cf050c87b60fe0e9aa4fa75bdb6834b89a5867b
gitee
Joker-x-dev/CoolMallArkTS
core/data/src/main/ets/repository/CommonRepository.ets
arkts
getEntityPathInfo
获取实体信息与路径 @returns 实体信息与路径
async getEntityPathInfo(): Promise<NetworkResponse<Unknown>> { return this.networkDataSource.getEntityPathInfo(); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getEntityPathInfo AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#ge...
async getEntityPathInfo(): Promise<NetworkResponse<Unknown>> { return this.networkDataSource.getEntityPathInfo(); }
https://github.com/Joker-x-dev/CoolMallArkTS
84f9ccfdd1aeb23f1c644ddbf781ed5400e2632d
github
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/hosts/userdata/bookmarks/scripts/parser.ets
arkts
parseBookmarks
Parse bookmarks from an HTML file (High-Performance Concurrent Version). Uses a cursor-based string scanner to avoid massive memory allocations from string splitting and trimming. Throws what collections.Array.push() would throw. @param path The path of the HTML file. @returns The root folder of the bookmarks. @author ...
@Concurrent async function parseBookmarks(path: string): Promise<meowBookmarkItem> { const rootFolder = new meowBookmarkItem(true, "meow", "", 0, 0); const buffer = await readArrayBuffer(path); if (!buffer) return rootFolder; const html = fastbuffer.from(buffer).toString(); const len = html.length; const s...
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Concurrent AST#identifier#Right AST#decorator#Right AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left parseBookmarks AST#identifier#Right AST#formal_paramet...
@Concurrent async function parseBookmarks(path: string): Promise<meowBookmarkItem> { const rootFolder = new meowBookmarkItem(true, "meow", "", 0, 0); const buffer = await readArrayBuffer(path); if (!buffer) return rootFolder; const html = fastbuffer.from(buffer).toString(); const len = html.length; const s...
https://github.com/awaLiny2333/LinysBrowser_NEXT
cf8dc8120e3d1386321fee37b58baa24c939d670
github
pangpang20/antennaPodHM
entry/src/main/ets/service/PodcastService.ets
arkts
addPodcastByUrl
通过RSS URL添加播客
async addPodcastByUrl(feedUrl: string): Promise<Podcast> { // 获取RSS内容 const rssContent = await this.fetchRssFeed(feedUrl); // 解析RSS const podcast = this.parseRssFeed(rssContent, feedUrl); // 保存到数据库 podcast.subscribeDate = Date.now(); podcast.isSubscribed = true; await this.db...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left addPodcastByUrl AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left feedUrl AST#identifier#Right AST#type_annotation#Left AST#:#Lef...
async addPodcastByUrl(feedUrl: string): Promise<Podcast> { // 获取RSS内容 const rssContent = await this.fetchRssFeed(feedUrl); // 解析RSS const podcast = this.parseRssFeed(rssContent, feedUrl); // 保存到数据库 podcast.subscribeDate = Date.now(); podcast.isSubscribed = true; await this.db...
https://github.com/pangpang20/antennaPodHM
17b2173b324c6902a9c54db89dcee1bfe17a841e
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/PermanentImageCacheManager.ets
arkts
getCachedImagePath
获取缓存的图片路径(如果存在)
async getCachedImagePath( sourceId: number, mangaId: string, chapterId: string, pageIndex: number, imageUrl: string ): Promise<string | null> { try { if (!this.ensureCachePathsReady('getCachedImagePath')) { return null; } // 先检查永久缓存 const permanentPath = this....
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getCachedImagePath AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceId AST#identifier#Right AST#type_annotation#Left AST#:...
async getCachedImagePath( sourceId: number, mangaId: string, chapterId: string, pageIndex: number, imageUrl: string ): Promise<string | null> { try { if (!this.ensureCachePathsReady('getCachedImagePath')) { return null; } // 先检查永久缓存 const permanentPath = this....
https://github.com/DaLongZhuaZi/manxia
cd0ef21358c58fd31baf8cc3ed76b154e7a01273
github
Cool_foolisher1/ArkTSRepository
MultiCalculator/features/calculator/src/main/ets/components/Calculator.ets
arkts
resourceToString
将资源文件转换为字符串
resourceToString(resource: Resource): string { if (checkEmptyUtil.isEmpty(resource)) { return '' } let result = '' try { const context = AppStorage.get<common.UIAbilityContext>('context') as common.UIAbilityContext result = context.resourceManager.getStringSync(resource.id) } cat...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left resourceToString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resource AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Resource AST#identifier#Right AST#)...
resourceToString(resource: Resource): string { if (checkEmptyUtil.isEmpty(resource)) { return '' } let result = '' try { const context = AppStorage.get<common.UIAbilityContext>('context') as common.UIAbilityContext result = context.resourceManager.getStringSync(resource.id) } cat...
https://gitcode.com/Cool_foolisher1/ArkTSRepository
943b4988229c4fe9232a1bde735d57dfc1c9ce58
gitcode
CLMC2025/Vignette
entry/src/main/ets/database/DBManager.ets
arkts
insertReviewEvent
==================== REVIEW EVENT OPERATIONS ====================
async insertReviewEvent( id: string, wordId: number, rating: number, timestamp: number, prevStateJson: string, newStateJson: string, errorTag: string = '', reflection: string = '', scheduledDays: number = 0 ): Promise<string> { return this.reviewEventRepo.insertReviewEvent(id...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left insertReviewEvent AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_annotation#Left AST#:#Left :...
async insertReviewEvent( id: string, wordId: number, rating: number, timestamp: number, prevStateJson: string, newStateJson: string, errorTag: string = '', reflection: string = '', scheduledDays: number = 0 ): Promise<string> { return this.reviewEventRepo.insertReviewEvent(id...
https://github.com/CLMC2025/Vignette
c8a9a5f86a331c30994a7b85ebd3cb8667a2e640
github
the-wwyang/kids-learning-app
src/main/ets/common/UserService.ets
arkts
getUsers
获取所有注册用户
private async getUsers(): Promise<Map<string, UserInfo>> { if (this.dataPreferences === null) { return new Map<string, UserInfo>(); } try { const usersJson = await this.dataPreferences.get(UserService.USERS_KEY, '{}') as string; const usersObj: Record<string, object> = JSON.parse(usersJs...
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 getUsers AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Le...
private async getUsers(): Promise<Map<string, UserInfo>> { if (this.dataPreferences === null) { return new Map<string, UserInfo>(); } try { const usersJson = await this.dataPreferences.get(UserService.USERS_KEY, '{}') as string; const usersObj: Record<string, object> = JSON.parse(usersJs...
https://github.com/the-wwyang/kids-learning-app
9bd15e9460a5322795a285aeb834e5c5ccaa12f3
github
Joker-x-dev/CoolMallArkTS
core/navigation/src/main/ets/order/OrderNavigator.ets
arkts
toList
跳转到订单列表 @param {string} [tab] - Tab 标签 @returns {void} 无返回值
static toList(tab?: string): void { if (tab) { const params: OrderListParam = { tab }; navigateTo(OrderRoutes.List, params); return; } navigateTo(OrderRoutes.List); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left toList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tab AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#i...
static toList(tab?: string): void { if (tab) { const params: OrderListParam = { tab }; navigateTo(OrderRoutes.List, params); return; } navigateTo(OrderRoutes.List); }
https://github.com/Joker-x-dev/CoolMallArkTS
35cd49f73e7b866908baf8dc165aac0a0288b1b5
github
LZZLHY/hlib
entry/src/main/ets/utils/Layout.ets
arkts
useResultTwoColumn
搜索结果是否双列展示(≥md)。
static useResultTwoColumn(bp: Breakpoint): boolean { return bp !== 'sm'; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left useResultTwoColumn AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bp AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left...
static useResultTwoColumn(bp: Breakpoint): boolean { return bp !== 'sm'; }
https://github.com/LZZLHY/hlib
80feef62e62ae4997c0480786a7447ed80bab827
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Animation/GlobalAnimationSystem.ets
arkts
updateAnimationState
更新动画状态
public updateAnimationState(animationId: string, updates: Partial<AnimationState>): void { const state = this.activeAnimations.get(animationId); if (state) { // 手动复制更新对象的属性到状态对象 if (updates.isPlaying !== undefined) { state.isPlaying = updates.isPlaying; } if (updates.isComplete...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left updateAnimationState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left animationId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string A...
public updateAnimationState(animationId: string, updates: Partial<AnimationState>): void { const state = this.activeAnimations.get(animationId); if (state) { // 手动复制更新对象的属性到状态对象 if (updates.isPlaying !== undefined) { state.isPlaying = updates.isPlaying; } if (updates.isComplete...
https://github.com/DaLongZhuaZi/manxia
a0ed2f2491d88625c5eaffea366d18adc262fec3
github
arkui-x/samples
CodeLab/Cases/feature/customcalendarpickerdialog/src/main/ets/components/DataManager.ets
arkts
deleteDate
从缓存的Preferences实例中删除名为给定Key的存储键值对,并使数据持久化 @param { Context } Context - 应用上下文 @param { function } callback - 回调函数
static deleteDate(context: Context, callback: () => void) { try { let promise = dataPreferences.getPreferences(context, 'date') promise.then((object: dataPreferences.Preferences) => { try { // 从缓存的Preferences实例中删除名为selectedDate的存储键值对 let deletePromise = object.delete('selec...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left deleteDate AST#identifier#Right AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Context AST#identifier#Right AST#,#Left , AST#...
static deleteDate(context: Context, callback: () => void) { try { let promise = dataPreferences.getPreferences(context, 'date') promise.then((object: dataPreferences.Preferences) => { try { // 从缓存的Preferences实例中删除名为selectedDate的存储键值对 let deletePromise = object.delete('selec...
https://gitcode.com/arkui-x/samples
368f659a4e1c0fd0c6fae32f4885b9a66e2c1b1d
gitcode
tdcare/tdwebrtc
src/main/ets/utils/StrUtil.ets
arkts
strToHex
16进制字符串转换unit8Array @param hexStr @returns
static strToHex(hexStr: string): Uint8Array { return new Uint8Array(buffer.from(hexStr, 'hex').buffer); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left strToHex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left hexStr AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left strin...
static strToHex(hexStr: string): Uint8Array { return new Uint8Array(buffer.from(hexStr, 'hex').buffer); }
https://github.com/tdcare/tdwebrtc
46d009645c1ba5c226366b479c9097560a84cd12
github
Joker-x-dev/CoolMallArkTS
feature/main/src/main/ets/viewmodel/CategoryViewModel.ets
arkts
startSideBarUnlockTimer
启动侧边栏联动解锁计时器 @param {number} targetIndex - 目标索引 @returns {void} 无返回值
private startSideBarUnlockTimer(targetIndex: number): void { this.clearSideBarUnlockTimer(); const duration: number = this.calculateUnlockDuration(targetIndex); this.sideBarUnlockTimer = setTimeout((): void => { this.finishSideBarScroll(); this.sideBarUnlockTimer = -1; }, duration); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left startSideBarUnlockTimer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left targetIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left nu...
private startSideBarUnlockTimer(targetIndex: number): void { this.clearSideBarUnlockTimer(); const duration: number = this.calculateUnlockDuration(targetIndex); this.sideBarUnlockTimer = setTimeout((): void => { this.finishSideBarScroll(); this.sideBarUnlockTimer = -1; }, duration); }
https://github.com/Joker-x-dev/CoolMallArkTS
9d759188dfcc70530491b3f7d13afc62bb6d77ba
github
terryma2024/happyword
harmonyos/entry/src/main/ets/services/ParentApiClient.ets
arkts
getLessonDraft
Fetch a single draft by id (used by the review page).
async getLessonDraft(draftId: string): Promise<LessonDraftDto> { const url: string = `${this.lessonFamilyBase()}/lesson-drafts/${draftId}`; const res: ParentFetchResult = await this.adapter.get(url, ParentApiClient.acceptJsonHeaders()); ParentApiClient.assertOk(res, 'getLessonDraft'); return ParentApi...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getLessonDraft AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left draftId AST#identifier#Right AST#type_annotation#Left AST#:#Left...
async getLessonDraft(draftId: string): Promise<LessonDraftDto> { const url: string = `${this.lessonFamilyBase()}/lesson-drafts/${draftId}`; const res: ParentFetchResult = await this.adapter.get(url, ParentApiClient.acceptJsonHeaders()); ParentApiClient.assertOk(res, 'getLessonDraft'); return ParentApi...
https://github.com/terryma2024/happyword
630cdfd2b1b0f7dc86e759334a73c72b2a09071f
github
openharmony/codelabs
Data/PersonalAssistantPro/entry/src/main/ets/services/JumpService.ets
arkts
handleDeepLink
处理 DeepLink 协议 格式: pa://jump?target=detail&id=123
public handleDeepLink(link: string): void { this.logger.info(`Handling DeepLink: ${link}`); if (!link || !link.startsWith('pa://')) { this.logger.warn('Invalid scheme, ignored.'); return; } // 简单的参数解析模拟 // 实际项目中可以引入 url 模块进行解析 if (link.includes('target=detail')) { this.logg...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left handleDeepLink AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left link AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left s...
public handleDeepLink(link: string): void { this.logger.info(`Handling DeepLink: ${link}`); if (!link || !link.startsWith('pa://')) { this.logger.warn('Invalid scheme, ignored.'); return; } // 简单的参数解析模拟 // 实际项目中可以引入 url 模块进行解析 if (link.includes('target=detail')) { this.logg...
https://gitcode.com/openharmony/codelabs
8bcb89a1c37732cd1e144e559101930a940599a7
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/network/WakeOnLan.ets
arkts
sendWolPacket
发送 WOL 魔术包唤醒目标设备(单地址版本)
static async sendWolPacket(macAddress: string, address: string, httpPort: number = WakeOnLan.DEFAULT_HTTP_PORT): Promise<void> { await WakeOnLan.sendWolToAddresses(macAddress, [address], httpPort); }
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 sendWolPacket AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left macAddress AST#identifier#Right AST#ERROR#Left AST#:#Left...
static async sendWolPacket(macAddress: string, address: string, httpPort: number = WakeOnLan.DEFAULT_HTTP_PORT): Promise<void> { await WakeOnLan.sendWolToAddresses(macAddress, [address], httpPort); }
https://github.com/AlkaidLab/moonlight-harmony
f2e2a97a2635dcb78629853431b837d3061b0a49
github
killetom/ktretrofit
ktretrofit/src/main/ets/retrofit/interceptor/AuthInterceptor.ets
arkts
constructor
Create a new StaticTokenProvider. @param token The token to provide.
constructor(token: string) { this.token = token; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left token AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right ...
constructor(token: string) { this.token = token; }
https://github.com/killetom/ktretrofit
13e7d733d2f3cdccac9573c3bb89ce8856b6aef5
github
RedRackham-R/WanAndroidHarmoney
entry/src/main/ets/global/viewmodel/GlobalSettingViewModel.ets
arkts
isShowTopArticle
获取显示置顶文章状态
public async isShowTopArticle(): Promise<boolean> { const showTopArticle: boolean = await GlobalWanCache.get(this.KEY_SHOW_TOP_ARTICLE, true) as boolean return new Promise<boolean>((resolve, _reject) => { resolve(showTopArticle) }) }
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 isShowTopArticle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST...
public async isShowTopArticle(): Promise<boolean> { const showTopArticle: boolean = await GlobalWanCache.get(this.KEY_SHOW_TOP_ARTICLE, true) as boolean return new Promise<boolean>((resolve, _reject) => { resolve(showTopArticle) }) }
https://github.com/RedRackham-R/WanAndroidHarmoney
0840bd060e04cde9510f68d4363232522a0c470b
github
HarmonyOS_Samples/guide-snippets
Ability/ApplicationContextDemo/entry/src/main/ets/entrylifecycleability/EntryLifecycleAbility.ets
arkts
onWindowStageCreate
当窗口创建时被调用
onWindowStageCreate(uiAbility, windowStage: window.WindowStage) { hilog.info(DOMAIN_NUMBER, TAG, `onWindowStageCreate uiAbility.launchWant: ${JSON.stringify(uiAbility.launchWant)}`); hilog.info(DOMAIN_NUMBER, TAG, `onWindowStageCreate windowStage: ${JSON.stringify(windowStage)}`); },
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onWindowStageCreate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left uiAbility AST#identifier#Right AST#,#Left , AST#,#Right AST#member_expression#Left AST#identifier#Left windowStage AST#iden...
onWindowStageCreate(uiAbility, windowStage: window.WindowStage) { hilog.info(DOMAIN_NUMBER, TAG, `onWindowStageCreate uiAbility.launchWant: ${JSON.stringify(uiAbility.launchWant)}`); hilog.info(DOMAIN_NUMBER, TAG, `onWindowStageCreate windowStage: ${JSON.stringify(windowStage)}`); },
https://gitcode.com/HarmonyOS_Samples/guide-snippets
f5559eb27f19144e4efca2ae283de2ec81e3b54e
gitcode
LongLiveY96/chatcube
entry/src/main/ets/services/DatabaseService.ets
arkts
updateProvidersOrder
批量更新供应商排序顺序
async updateProvidersOrder(providerIds: string[]): Promise<void> { await this.waitForInitialization() if (this.rdbStore === null) { return } try { for (let i = 0; i < providerIds.length; i++) { const valueBucket: relationalStore.ValuesBucket = { sort_order: i } ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left updateProvidersOrder 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 ...
async updateProvidersOrder(providerIds: string[]): Promise<void> { await this.waitForInitialization() if (this.rdbStore === null) { return } try { for (let i = 0; i < providerIds.length; i++) { const valueBucket: relationalStore.ValuesBucket = { sort_order: i } ...
https://github.com/LongLiveY96/chatcube
56094390772c8d9772a022073727ad0caf1c3b83
github
erosTeam/NextE
feature/home/src/main/ets/viewmodel/GalleryListViewModel.ets
arkts
reload
Reload the first page for a selector/site/period change without blanking the current body first. The pinned selector may update immediately, but the old rows stay visible until the new page lands; this avoids the white-screen remount regression while still invalidating stale loadMore results.
async reload(): Promise<void> { DiagnosticLogger.info('home-list-anchor', 'reload_enter', this.debugState()) if (this.isLoading) { DiagnosticLogger.info('home-list-anchor', 'reload_skip_loading', this.debugState()) return } // Invalidate any in-flight loadMore (it runs without the isLoadin...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left reload 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#gene...
async reload(): Promise<void> { DiagnosticLogger.info('home-list-anchor', 'reload_enter', this.debugState()) if (this.isLoading) { DiagnosticLogger.info('home-list-anchor', 'reload_skip_loading', this.debugState()) return } // Invalidate any in-flight loadMore (it runs without the isLoadin...
https://github.com/erosTeam/NextE
8df282889dfa5ba6f7c224acc87a5757e36961ca
github
Cool_foolisher1/ArkTSRepository
GraphicalCode/commons/src/main/ets/util/PreferenceUtil.ets
arkts
getInstance
获取PreferenceUtil实例 @returns PreferenceUtil
public static getInstance(): PreferenceUtil { if (!PreferenceUtil.instance) { PreferenceUtil.instance = new PreferenceUtil() } return PreferenceUtil.instance }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L...
public static getInstance(): PreferenceUtil { if (!PreferenceUtil.instance) { PreferenceUtil.instance = new PreferenceUtil() } return PreferenceUtil.instance }
https://gitcode.com/Cool_foolisher1/ArkTSRepository
4719b1d521642a971972aa9cd49c1f354fd81fe9
gitcode
openharmony/applications_contacts
entry/src/main/ets/presenter/contact/batchselectcontacts/BatchSelectContactsPresenter.ets
arkts
initVariableSpan
Assign a custom attribute to prepare for later variable font searches @param {Object} item contacts data
initVariableSpan(item:ContactVo) { // Initialize Variable Names let matchString = StringUtil.getMatchedString(item.emptyNameData, this.searchText); if (StringUtil.isEmpty(matchString) || StringUtil.isEmpty(this.searchText.trim())) { item.name.searchTextStart = ''; item.name.searchTextMiddle = ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left initVariableSpan AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left item AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ContactVo AST#identifier...
initVariableSpan(item:ContactVo) { // Initialize Variable Names let matchString = StringUtil.getMatchedString(item.emptyNameData, this.searchText); if (StringUtil.isEmpty(matchString) || StringUtil.isEmpty(this.searchText.trim())) { item.name.searchTextStart = ''; item.name.searchTextMiddle = ...
https://gitee.com/openharmony/applications_contacts.git
fa553a680fb54a162cf4aaf1e6646bacb0251988
gitee
Joker-x-dev/CoolMallArkTS
core/network/src/main/ets/datasource/coupon/CouponNetworkDataSourceImpl.ets
arkts
getUserCouponList
获取用户优惠券列表 @param {Record<string, Unknown>} params - 查询参数 @returns {Promise<NetworkResponse<Coupon[]>>} 优惠券列表
async getUserCouponList(params: Record<string, Unknown>): Promise<NetworkResponse<Coupon[]>> { const resp: AxiosResponse<NetworkResponse<Coupon[]>> = await NetworkClient.http.post("market/coupon/user/list", params); return resp.data; }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getUserCouponList 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#:#Le...
async getUserCouponList(params: Record<string, Unknown>): Promise<NetworkResponse<Coupon[]>> { const resp: AxiosResponse<NetworkResponse<Coupon[]>> = await NetworkClient.http.post("market/coupon/user/list", params); return resp.data; }
https://github.com/Joker-x-dev/CoolMallArkTS
bf1ce8ff4c9f7f9a771cc81f35d3649f91da6654
github
youyeyejie/ZhiXing_ActHub
entry/src/main/ets/core/services/FocusTimerEngine.ets
arkts
enterBackground
应用进入后台时的回调
enterBackground(): void { this.isAppInBackground = true; this.checkAndStartBackgroundPenalty(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left enterBackground 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_bl...
enterBackground(): void { this.isAppInBackground = true; this.checkAndStartBackgroundPenalty(); }
https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/core/services/FocusTimerEngine.ets#L121-L124
8ca13ae023ccd696b686ef807e731d70a9de4cf2
github
Countly/countly-sdk-hos
library/src/main/ets/internal/modules/ModuleHealthCheck.ets
arkts
loadState
-- Persistence --
private async loadState(): Promise<void> { if (!this.config.storage) return; const raw: string = await this.config.storage.getString(STORAGE_KEY, ''); if (raw.length === 0) return; try { const parsed: Object = JSON.parse(raw); if (parsed === null || typeof parsed !== 'object' || Array.isAr...
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 loadState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L...
private async loadState(): Promise<void> { if (!this.config.storage) return; const raw: string = await this.config.storage.getString(STORAGE_KEY, ''); if (raw.length === 0) return; try { const parsed: Object = JSON.parse(raw); if (parsed === null || typeof parsed !== 'object' || Array.isAr...
https://github.com/Countly/countly-sdk-hos
fca664411e75abfccb1c28fd404a5167e75ef6ec
github
Joker-x-dev/CoolMallArkTS
feature/goods/src/main/ets/viewmodel/GoodsSearchViewModel.ets
arkts
onKeywordClick
点击推荐关键词 @param {string} keyword - 关键词 @returns {void} 无返回值
async onKeywordClick(keyword: string): Promise<void> { await this.onSearch(keyword); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left onKeywordClick AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left keyword AST#identifier#Right AST#type_annotation#Left AST#:#Left...
async onKeywordClick(keyword: string): Promise<void> { await this.onSearch(keyword); }
https://github.com/Joker-x-dev/CoolMallArkTS
2f892ff285327ce37ebcd785995b213e7633a3b3
github
ZestBox-18/kitebook-frontend
features/home/src/main/ets/pages/Index.ets
arkts
onWeekBillGroupsChanged
周账单变化后同步刷新列表展示数据。
onWeekBillGroupsChanged(): void { this.updateWeeklyDisplayData(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onWeekBillGroupsChanged 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#stat...
onWeekBillGroupsChanged(): void { this.updateWeeklyDisplayData(); }
https://github.com/ZestBox-18/kitebook-frontend
fa8ea86d83385d3d03f7e3b7de6f454847544350
github
dingzhilin1990/zhilinclaw
src/agents/HanwudiWorkflow.ets
arkts
step3_Review
步骤 3: 方案评审
private async step3_Review(strategyResult: any): Promise<any> { this.addLog(3, 'Advisor', '开始方案评审', 'started'); const input = JSON.stringify(strategyResult.documents); const result = await this.advisor.process(input); this.addLog(3, 'Advisor', '方案评审完成', result.success ? 'completed' : ...
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 step3_Review AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left strategyResult AST#identifier#Right AST#ERROR#Left AST#...
private async step3_Review(strategyResult: any): Promise<any> { this.addLog(3, 'Advisor', '开始方案评审', 'started'); const input = JSON.stringify(strategyResult.documents); const result = await this.advisor.process(input); this.addLog(3, 'Advisor', '方案评审完成', result.success ? 'completed' : ...
https://github.com/dingzhilin1990/zhilinclaw
4e54e098ed7abb09ce45be6b14176214de453695
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/WebUploadServer.ets
arkts
handleFileUploadBinary
处理文件上传(二进制方式) 参考 PPSSPP 的 HandleMultipartPart 实现 使用 async 避免同步文件 I/O 阻塞事件循环, 这是大文件夹上传卡死的根本原因。
private async handleFileUploadBinary(connection: socket.TCPSocketConnection, connId: number, body: Uint8Array, boundary: string): Promise<void> { if (!boundary) { this.sendErrorResponse(connection, 400, 'Bad Request: Missing boundary'); return; } const boundaryBytes = this.stringToUint8Array(...
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 handleFileUploadBinary AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left connection AST#ide...
private async handleFileUploadBinary(connection: socket.TCPSocketConnection, connId: number, body: Uint8Array, boundary: string): Promise<void> { if (!boundary) { this.sendErrorResponse(connection, 400, 'Bad Request: Missing boundary'); return; } const boundaryBytes = this.stringToUint8Array(...
https://github.com/richshaw2015/nds
918c81fbc992277d6f62bb282e673deff376c806
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/common/utils/DAOHelper.ets
arkts
convertToSharedLedger
转换为SharedLedger
static convertToSharedLedger(resultSet: relationalStore.ResultSet): SharedLedger { const ledger = new SharedLedger(); ledger.ledgerId = DAOHelper.getNumberValue(resultSet, 'ledger_id'); ledger.name = DAOHelper.getStringValue(resultSet, 'name'); ledger.description = DAOHelper.getStringValue(resultSet, ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left convertToSharedLedger AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resultSet AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#membe...
static convertToSharedLedger(resultSet: relationalStore.ResultSet): SharedLedger { const ledger = new SharedLedger(); ledger.ledgerId = DAOHelper.getNumberValue(resultSet, 'ledger_id'); ledger.name = DAOHelper.getStringValue(resultSet, 'name'); ledger.description = DAOHelper.getStringValue(resultSet, ...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
01729d8ed1373bab2a78b7e0b27d12b8d934407e
github
openharmony/applications_app_samples
code/ArkTS1.2/TabsSample/entry/src/main/ets/pages/functionalScenes/FunctionalScenes.ets
arkts
build
主页通过瀑布流和LazyForeach加载 WaterFlow+LazyForEach详细用法可参考性能范例: waterflow_optimization.md/
build() { Column() { Row() { Text($r('app.string.custom_return')) } .margin(3) .width('100%') .onClick((e: ClickEvent) => { this.getUIContext().getRouter().back(); }) Row() { Stack() { List({ scroller: this.scrollController } as ListOptio...
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() { Row() { Text($r('app.string.custom_return')) } .margin(3) .width('100%') .onClick((e: ClickEvent) => { this.getUIContext().getRouter().back(); }) Row() { Stack() { List({ scroller: this.scrollController } as ListOptio...
https://github.com/openharmony/applications_app_samples
f18d8490672734e0e149c37350d0391466a8aa92
github
LZZLHY/hlib
entry/src/main/ets/storage/AuthStore.ets
arkts
upsertAccount
把单条账号 upsert 到 saved_accounts 列表。明文 in-memory 进入,写盘前加密。
static async upsertAccount(account: SavedAccount): Promise<void> { const list: SavedAccount[] = await AuthStore.listAccountsRaw(); // 比较时用解密后的 userId(保证查重正确) let foundIdx: number = -1; for (let i = 0; i < list.length; i++) { const decId: string = await SecretStore.decrypt(list[i].userId); ...
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 upsertAccount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left account AST#identifier#Right AST#:#Left : ...
static async upsertAccount(account: SavedAccount): Promise<void> { const list: SavedAccount[] = await AuthStore.listAccountsRaw(); // 比较时用解密后的 userId(保证查重正确) let foundIdx: number = -1; for (let i = 0; i < list.length; i++) { const decId: string = await SecretStore.decrypt(list[i].userId); ...
https://github.com/LZZLHY/hlib
b4faabe31dff84ff04351abf151e51bbcaa7822a
github
arkui-x/samples
CodeLab/Cases/common/utils/src/main/ets/component/GlobalStateDialog.ets
arkts
operateGlobalStateDialog
控制全局弹窗的显隐及内容布局 @param globalStateDialogConfig 配置全局弹窗
static operateGlobalStateDialog(globalStateDialogConfig: GlobalStateDialogConfig) { if (globalStateDialogConfig.isShowGlobalStateDialog !== undefined) { AppStorage.setOrCreate('isShowGlobalStateDialog', globalStateDialogConfig.isShowGlobalStateDialog); } if (globalStateDialogConfig.wrapBuilder) { ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left operateGlobalStateDialog AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left globalStateDialogConfig AST#identifier#Right AST#:#Left : AST#:#Right AST#ERRO...
static operateGlobalStateDialog(globalStateDialogConfig: GlobalStateDialogConfig) { if (globalStateDialogConfig.isShowGlobalStateDialog !== undefined) { AppStorage.setOrCreate('isShowGlobalStateDialog', globalStateDialogConfig.isShowGlobalStateDialog); } if (globalStateDialogConfig.wrapBuilder) { ...
https://gitcode.com/arkui-x/samples
d57bd8f1fceca4f4eb0ce370aa1449ea90b91fe8
gitcode
holg/eulumdat-rs
EulumdatHarmonyOS/Eulumdat/entry/src/main/ets/model/EulumdatEngine.ets
arkts
getIntensityAt
Get intensity at given indices @param cIndex C-plane index @param gIndex Gamma angle index @returns Intensity in cd/klm
public getIntensityAt(cIndex: number, gIndex: number): number { return eulumdat_napi.getIntensityAt(cIndex, gIndex); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getIntensityAt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left cIndex AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left...
public getIntensityAt(cIndex: number, gIndex: number): number { return eulumdat_napi.getIntensityAt(cIndex, gIndex); }
https://github.com/holg/eulumdat-rs
5e52bb5ca4e7cef23e8ac6499f82e86e2936544b
github
pangpang20/antennaPodHM
entry/src/main/ets/service/SettingsService.ets
arkts
setAutoDownloadNewEpisodes
设置自动下载新Episode
async setAutoDownloadNewEpisodes(enabled: boolean): Promise<void> { this.settings.autoDownloadNewEpisodes = enabled; await this.saveSettings(); }
AST#program#Left AST#expression_statement#Left AST#assignment_expression#Left AST#member_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left setAutoDownloadNewEpisodes AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#re...
async setAutoDownloadNewEpisodes(enabled: boolean): Promise<void> { this.settings.autoDownloadNewEpisodes = enabled; await this.saveSettings(); }
https://github.com/pangpang20/antennaPodHM
acee4a076203f308b4bf49a8a62757078fa22d76
github
751496032/ZRouter
RouterApi/src/main/ets/animation/param/NavAnimParamBuilder.ets
arkts
setPushExitAnimate
进入状态(PUSH) 离开页的动画转场参数(A进入B 的 A离开转场) @param param @returns
public setPushExitAnimate(param: INavSingleAnimationParam) { if (this._callback) { this._callback.pushExitParam = param } return this }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setPushExitAnimate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left param AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
public setPushExitAnimate(param: INavSingleAnimationParam) { if (this._callback) { this._callback.pushExitParam = param } return this }
https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/animation/param/NavAnimParamBuilder.ets#L91-L96
f68382287c26da1688c2e81bfdc4b2769c6a94dd
github
CLMC2025/Vignette
entry/src/main/ets/database/repositories/WordRepository.ets
arkts
updateWord
Update an existing word
async updateWord(word: WordItem): Promise<number> { this.ensureInitialized(); const bucket = this.wordToValuesBucket(word); const predicates = new relationalStore.RdbPredicates(TABLE_WORDS); predicates.equalTo(WordColumns.ID, word.id); const affectedRows = await this.store!.update(bucket, predi...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left updateWord AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left word AS...
async updateWord(word: WordItem): Promise<number> { this.ensureInitialized(); const bucket = this.wordToValuesBucket(word); const predicates = new relationalStore.RdbPredicates(TABLE_WORDS); predicates.equalTo(WordColumns.ID, word.id); const affectedRows = await this.store!.update(bucket, predi...
https://github.com/CLMC2025/Vignette
96a10995c64c08a0d50cd81e25188fb294dcd63c
github
SMAT-Lab/PhantomRendering
example/entry/src/main/ets/common/DeviceUtils.ets
arkts
getAnimationDuration
获取适配后的动画参数
static getAnimationDuration(baseDuration: number): number { // 在低端设备上缩短动画时间 const devicePerformanceScale = DeviceUtils.getDensity() < 2 ? 0.8 : 1.0 return Math.round(baseDuration * devicePerformanceScale) }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getAnimationDuration AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left baseDuration AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number ...
static getAnimationDuration(baseDuration: number): number { // 在低端设备上缩短动画时间 const devicePerformanceScale = DeviceUtils.getDensity() < 2 ? 0.8 : 1.0 return Math.round(baseDuration * devicePerformanceScale) }
https://github.com/SMAT-Lab/PhantomRendering
56c4c72f205ffc5da58668553770a20366e5d5cd
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/WebUploadServer.ets
arkts
sendUploadPage
发送上传页面
private sendUploadPage(connection: socket.TCPSocketConnection): void { const html = this.getUploadPageHtml(); const htmlBytes = this.stringToArrayBuffer(html); const headers = `HTTP/1.1 200 OK\r\nContent-Type: text/html; charset=utf-8\r\nContent-Length: ${htmlBytes.byteLength}\r\nConnection: close\r\n\r\n...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left sendUploadPage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left connection AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right A...
private sendUploadPage(connection: socket.TCPSocketConnection): void { const html = this.getUploadPageHtml(); const htmlBytes = this.stringToArrayBuffer(html); const headers = `HTTP/1.1 200 OK\r\nContent-Type: text/html; charset=utf-8\r\nContent-Length: ${htmlBytes.byteLength}\r\nConnection: close\r\n\r\n...
https://github.com/richshaw2015/nds
46bac8550d339c9ebf57a1d818254caf7aa5ecfe
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/BigInt.ets
arkts
pow
Returns the base to the exponent power. @param { BigInt } exponent The exponent value. @returns { BigInt } The result of base^exponent. @throws { RangeError } Throw RangeError when exponent is negative. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public pow(exponent: BigInt): BigInt { if (exponent.negative()) { throw new RangeError("Exponent must be non-negative") } if (exponent.isZero()) { return 1n } if (this.isZero()) { return 0n } const one = 1n if (expo...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left pow AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left exponent AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#i...
public pow(exponent: BigInt): BigInt { if (exponent.negative()) { throw new RangeError("Exponent must be non-negative") } if (exponent.isZero()) { return 1n } if (this.isZero()) { return 0n } const one = 1n if (expo...
https://gitcode.com/iop123123/arkts-static-skills
a5229977d75ec7d50e0e4292163456eb5f97c225
gitcode
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets
arkts
sinh
Return a new Decimal whose value is the hyperbolic sine of `n`, rounded to `precision` significant digits using rounding mode `rounding`. @param { Value } n {double | string | Decimal} @returns { Decimal } the Decimal type
static sinh(n: Value): Decimal { return new Decimal(n).sinh(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left sinh AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left n AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#R...
static sinh(n: Value): Decimal { return new Decimal(n).sinh(); }
https://gitcode.com/iop123123/arkts-static-skills
cd31bf6d441bab74cef4f94c98f28168dbd68c52
gitcode
openharmony/codelabs
Data/PersonalAssistantPro/entry/src/main/ets/common/utils/PermissionUtils.ets
arkts
checkPermission
检查是否拥有某项权限 @param permission 权限名称 @returns Promise<boolean>
public static async checkPermission(permission: Permissions): Promise<boolean> { // ❌ Fix: this.logger -> PermissionUtils.logger PermissionUtils.logger.info(`Checking permission: ${permission}`); let grantStatus: abilityAccessCtrl.GrantStatus; try { const atManager = abilityAccessCtrl.createAt...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left checkPermission AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pe...
public static async checkPermission(permission: Permissions): Promise<boolean> { // ❌ Fix: this.logger -> PermissionUtils.logger PermissionUtils.logger.info(`Checking permission: ${permission}`); let grantStatus: abilityAccessCtrl.GrantStatus; try { const atManager = abilityAccessCtrl.createAt...
https://gitcode.com/openharmony/codelabs
a88ef6811f20d3fe67dc1f2c13bc6c0a2e09c22a
gitcode
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/hosts/system/windows/classes/meowUiHost.ets
arkts
fullscreenExit
Exit fullscreen.
fullscreenExit() { this.webFullscreenHandler?.exitFullScreen(); this.windowObj?.recover().catch((e: BusinessError) => { meow(`Failed to recover window: ${e.message}`, `meowUiHost][${this.windowId}][fullscreenFull`, meowLevel.ERROR); }); animateToImmediately(defaultAnimation(), () => { this...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left fullscreenExit AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Lef...
fullscreenExit() { this.webFullscreenHandler?.exitFullScreen(); this.windowObj?.recover().catch((e: BusinessError) => { meow(`Failed to recover window: ${e.message}`, `meowUiHost][${this.windowId}][fullscreenFull`, meowLevel.ERROR); }); animateToImmediately(defaultAnimation(), () => { this...
https://github.com/awaLiny2333/LinysBrowser_NEXT
09b5c928e0ec2afc72124a804649183be9f12128
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
constructor
Creates an empty Uint8ClampedArray.
public constructor() { this.length = 0 this.byteLength = 0 this.byteOffset = 0 this.buffer = new ArrayBuffer(0) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { A...
public constructor() { this.length = 0 this.byteLength = 0 this.byteOffset = 0 this.buffer = new ArrayBuffer(0) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
39a3cf7426852f74d4ace021b4ad98b9658e34d2
gitee
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test53_original_index.ets
arkts
shortestPath
=== Round 53: Graph shortest path (Dijkstra simplified), factorial tail recursion, mutual recursion (even/odd), binary tree path sum, word ladder BFS === --- Graph shortest path (simplified Dijkstra) ---
function shortestPath(edges: string[][], start: string, end: string): number { let dist: Map<string, number> = new Map(); let visited: Set<string> = new Set(); dist.set(start, 0); let current: string = start; while (current !== end && current !== '') { visited.add(current); let curDist: number | undef...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left shortestPath AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left edges AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Ri...
function shortestPath(edges: string[][], start: string, end: string): number { let dist: Map<string, number> = new Map(); let visited: Set<string> = new Set(); dist.set(start, 0); let current: string = start; while (current !== end && current !== '') { visited.add(current); let curDist: number | undef...
https://github.com/miaochiahao/ark-ghidra
c1e978cc086cd753e420b59850795a0f29fefdf1
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/MouseEmulationService.ets
arkts
cleanup
停止模拟并清理资源
cleanup(): void { this.stop(); this.callback = null; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left cleanup 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...
cleanup(): void { this.stop(); this.callback = null; }
https://github.com/AlkaidLab/moonlight-harmony
55e31f1e04544216b4a76ac72d70e1a731fba27d
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/BarLineChartBaseModel.ets
arkts
calcExtensionLine
y轴计算延长线
private calcExtensionLine(render: YAxisRenderer | null) { let extensionLength = 0; if (render) { if (this.mXAxis) { extensionLength = this.mXAxis.getYOffset() + this.mXAxis.mLabelRotatedHeight / 2 + Utils.getLabelTextSize(render.getPaintAxisLine(), '0', this.textSizeCache).heig...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left calcExtensionLine AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left render AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_ex...
private calcExtensionLine(render: YAxisRenderer | null) { let extensionLength = 0; if (render) { if (this.mXAxis) { extensionLength = this.mXAxis.getYOffset() + this.mXAxis.mLabelRotatedHeight / 2 + Utils.getLabelTextSize(render.getPaintAxisLine(), '0', this.textSizeCache).heig...
https://gitee.com/openharmony-tpc/ohos_mpchart.git
6183105251b0e741ae4cde07ef67bbdf2588a341
gitee
CPF-ApplicationTPC/openharmony_tpc_samples
SwipeMenuListView/library/src/main/ets/utils/Logger.ets
arkts
setTag
设置日志标签
public setTag(tag: string): void { this.tag = tag; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setTag AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tag AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST...
public setTag(tag: string): void { this.tag = tag; }
https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples
8cd87bb0db15f1097ec559793d19a63a015074a7
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/GamepadManager.ets
arkts
releaseKnownSlot
释放已知槽位,并移除对应映射。 用于 GCK 多 HID 接口共槽场景:断开流程会先清理 deviceId 映射, 不能再依赖 releaseSlot() 从 map 中回查 slot。
private releaseKnownSlot(deviceKey: string, slot: number, keyToSlotMap: Map<string, number>, logPrefix: string): void { if (slot >= 0 && slot < GamepadManager.MAX_CONTROLLERS) { this.slotOccupied[slot] = false; console.info(`[${logPrefix}] 释放设备槽位: Key=${deviceKey}, Slot=${slot}`); } keyToSlotM...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left releaseKnownSlot AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left deviceKey AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#...
private releaseKnownSlot(deviceKey: string, slot: number, keyToSlotMap: Map<string, number>, logPrefix: string): void { if (slot >= 0 && slot < GamepadManager.MAX_CONTROLLERS) { this.slotOccupied[slot] = false; console.info(`[${logPrefix}] 释放设备槽位: Key=${deviceKey}, Slot=${slot}`); } keyToSlotM...
https://github.com/AlkaidLab/moonlight-harmony
339ff79ffb9ed7f50cb644ad02a74bf944f82329
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ets
arkts
encode
Asynchronously encodes the input byte array into a Base64 encoded Uint8Array. @param src The byte array to encode. @param options The encoding options (Base64 type). @returns A Promise that resolves to a Uint8Array containing the Base64 encoded string.
encode(src: Uint8Array, options?: Type): Promise<Uint8Array> { if (options === undefined) { options = Type.BASIC; } return Promise.resolve(this.encodeSync(src, options)); }
AST#program#Left AST#ERROR#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left encode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left src AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Uint8Array AST#identifi...
encode(src: Uint8Array, options?: Type): Promise<Uint8Array> { if (options === undefined) { options = Type.BASIC; } return Promise.resolve(this.encodeSync(src, options)); }
https://gitcode.com/iop123123/arkts-static-skills
7ec34d99e05164972ef25ee16e8cc30eeaf47c29
gitcode
openharmony/codelabs
ETSUI/RoundThreadScheduler/entry/src/main/ets/workers/IncrementWorker.ets
arkts
run
执行一次累加任务 @param roundIndex 当前轮次 @returns Promise<number> 返回本次累加的值
run(roundIndex: number): Promise<number> { return new Promise((resolve) => { // 使用 setTimeout 模拟异步并发执行 setTimeout(() => { // 模拟计算耗时 let mockCompute = 0; for (let i = 0; i < 10000; i++) { mockCompute += i; } // 每个 worker 每轮只做一次 +1 resolve(1); ...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left run AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left roundIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Le...
run(roundIndex: number): Promise<number> { return new Promise((resolve) => { // 使用 setTimeout 模拟异步并发执行 setTimeout(() => { // 模拟计算耗时 let mockCompute = 0; for (let i = 0; i < 10000; i++) { mockCompute += i; } // 每个 worker 每轮只做一次 +1 resolve(1); ...
https://gitcode.com/openharmony/codelabs
3627821082c0c7937156394c7df4e5ef24d5dbbd
gitcode
HarmonyOS_Samples/MusicHome
features/player/src/main/ets/model/MediaService.ets
arkts
release
Releases AVPlayer and AVSession; intended for ability teardown (best-effort sync calls).
public release() { if (this.avPlayer && this.session && this.abilityContext) { try { this.updateIsPlay(false); this.stop(); this.reset(); this.avPlayer.release(); this.state = AudioPlayerState.IDLE; BackgroundUtil.stopContinuousTask(this.abilityContext); ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left release 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#{...
public release() { if (this.avPlayer && this.session && this.abilityContext) { try { this.updateIsPlay(false); this.stop(); this.reset(); this.avPlayer.release(); this.state = AudioPlayerState.IDLE; BackgroundUtil.stopContinuousTask(this.abilityContext); ...
https://gitcode.com/HarmonyOS_Samples/MusicHome
1c3d97e252d22be6f0a7f89b2376d46b359011cb
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Parsers/PdfToMangaImporter.ets
arkts
buildComicInfo
构建ComicInfo对象
private buildComicInfo( metadata: PdfMetadata, pageCount: number, mangaId: string, chapterId: string ): PdfComicInfo { const now = Date.now(); const contentTypeTag = this.config.contentType === PdfContentType.EBOOK ? 'PDF电子书' : 'PDF漫画'; return { // 基本信息 title: metadata.title...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildComicInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left metadata AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier...
private buildComicInfo( metadata: PdfMetadata, pageCount: number, mangaId: string, chapterId: string ): PdfComicInfo { const now = Date.now(); const contentTypeTag = this.config.contentType === PdfContentType.EBOOK ? 'PDF电子书' : 'PDF漫画'; return { // 基本信息 title: metadata.title...
https://github.com/DaLongZhuaZi/manxia
495fc410a7ad3777267f710946d1147f5bc50b7e
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test2_original_index.ets
arkts
testRecordType
=== Record type ===
function testRecordType(): number { let scores: Record<string, number> = {}; scores['alice'] = 90; scores['bob'] = 85; scores['charlie'] = 95; return scores['alice'] + scores['bob'] + scores['charlie']; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testRecordType 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_t...
function testRecordType(): number { let scores: Record<string, number> = {}; scores['alice'] = 90; scores['bob'] = 85; scores['charlie'] = 95; return scores['alice'] + scores['bob'] + scores['charlie']; }
https://github.com/miaochiahao/ark-ghidra
e4f41b95c1da1bc0244a513db689c86411b88eb7
github
openharmony/codelabs
ETSUI/Habit/entry/src/main/ets/model/repository/AchievementRepository.ets
arkts
unlockAchievement
解锁指定成就,更新状态和时间戳
async unlockAchievement(id: number): Promise<void> { const store = RdbHelper.getRdbStore(); if (!store) { return; } const valueBucket: relationalStore.ValuesBucket = { isUnlocked: 1, unlockTime: new Date().getTime() }; const predicates = new relationalStore.RdbPredicates(Co...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left unlockAchievement AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_annotation#Left AST#:#Left :...
async unlockAchievement(id: number): Promise<void> { const store = RdbHelper.getRdbStore(); if (!store) { return; } const valueBucket: relationalStore.ValuesBucket = { isUnlocked: 1, unlockTime: new Date().getTime() }; const predicates = new relationalStore.RdbPredicates(Co...
https://gitcode.com/openharmony/codelabs
b0c8d2b0bb182a8e078d1be89373f652270cfdb7
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/utils/BackgroundImageUtil.ets
arkts
clearLocalCache
清除本地缓存的背景图文件(清除所有方向的缓存)
async clearLocalCache(): Promise<void> { const paths: string[] = [this.landscapeCachePath, this.portraitCachePath]; for (const cachePath of paths) { if (cachePath) { try { await fileIo.access(cachePath); await fileIo.unlink(cachePath); console.info(`BackgroundImageU...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left clearLocalCache 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#gene...
async clearLocalCache(): Promise<void> { const paths: string[] = [this.landscapeCachePath, this.portraitCachePath]; for (const cachePath of paths) { if (cachePath) { try { await fileIo.access(cachePath); await fileIo.unlink(cachePath); console.info(`BackgroundImageU...
https://github.com/AlkaidLab/moonlight-harmony
82adabddec74ee8dd796c9c751ad043b02445466
github
XJTUWYD/ArkDiff
entry/src/main/ets/viewmodel/DiffSessionViewModel.ets
arkts
syncBlockToLeft
块同步到左侧:patch diffResult 原地修改
syncBlockToLeft(sbsStartIdx: number): void { if (!this.diffResult) return; const leftLines = this.diffResult.leftLines; const rightLines = this.diffResult.rightLines; if (sbsStartIdx < 0 || sbsStartIdx >= rightLines.length) return; const startType = rightLines[sbsStartIdx].type; if (startType...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left syncBlockToLeft AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sbsStartIdx AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) ...
syncBlockToLeft(sbsStartIdx: number): void { if (!this.diffResult) return; const leftLines = this.diffResult.leftLines; const rightLines = this.diffResult.rightLines; if (sbsStartIdx < 0 || sbsStartIdx >= rightLines.length) return; const startType = rightLines[sbsStartIdx].type; if (startType...
https://github.com/XJTUWYD/ArkDiff
b9c606ef713fe32671f9ae2f6d9f0e64c306f227
github
Joker-x-dev/HarmonyKit
feature/demo/src/main/ets/view/NetworkRequestPage.ets
arkts
build
构建通用网络请求示例页 @returns {void} 无返回值
build() { AppNavDestination({ title: $r("app.string.demo_network_request_title"), viewModel: this.vm }) { this.NetworkRequestContent(); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c...
build() { AppNavDestination({ title: $r("app.string.demo_network_request_title"), viewModel: this.vm }) { this.NetworkRequestContent(); } }
https://github.com/Joker-x-dev/HarmonyKit
003168e4b58904a19d1c797a0ec00e1099b4206c
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Components/ContentPanel.ets
arkts
showInfo
显示通用信息
showInfo(title: string, content: string, source: ContentSource = ContentSource.INLINE): string { return this.addTab({ title, type: ContentPanelType.INFO, source, content }); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left showInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left title AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,...
showInfo(title: string, content: string, source: ContentSource = ContentSource.INLINE): string { return this.addTab({ title, type: ContentPanelType.INFO, source, content }); }
https://github.com/DaLongZhuaZi/manxia
e8bd38c6449aacf82464e8d8108fdcdb23257ea4
github
AGenUI/AGenUI
playground/harmony/entry/src/main/ets/utils/PlaygroundRuntimeLogger.ets
arkts
getTimestamp
Get formatted timestamp for log messages Format: HH:mm:ss.SSS (e.g., 14:30:25.123)
private getTimestamp(): string { const date = new Date(); const hours = this.padZero(date.getHours(), 2); const minutes = this.padZero(date.getMinutes(), 2); const seconds = this.padZero(date.getSeconds(), 2); const milliseconds = this.padZero(date.getMilliseconds(), 3); return `${hours}:${min...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getTimestamp AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST...
private getTimestamp(): string { const date = new Date(); const hours = this.padZero(date.getHours(), 2); const minutes = this.padZero(date.getMinutes(), 2); const seconds = this.padZero(date.getSeconds(), 2); const milliseconds = this.padZero(date.getMilliseconds(), 3); return `${hours}:${min...
https://github.com/AGenUI/AGenUI
7cd745b4e10c4c68ec2df289497e147e412b5874
github
CPF-ApplicationTPC/imageknifepro
library/src/main/ets/ImageKnife.ets
arkts
getCacheLimitNum
获取文件或内存缓存的图片数量上限 该接口只获取默认内存缓存,文件缓存的上限 @param cacheStrategy : 指定需要查询类型。CacheStrategy::FILE为查询文件缓存,其余枚举为查询内存缓存 @param cacheName 需要操作的文件缓存名称,默认名称为空即操作大端文件缓存, 不为空则匹配小端文件缓存 @returns 文件或者内存图片数量上限, 获取文缓存上限失败返回-1
getCacheLimitNum(cacheStrategy: CacheStrategy, cacheName?:string) :number | undefined { return nativeNode.getCacheLimitNum(cacheStrategy, cacheName); }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getCacheLimitNum AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left cacheStrategy AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#iden...
getCacheLimitNum(cacheStrategy: CacheStrategy, cacheName?:string) :number | undefined { return nativeNode.getCacheLimitNum(cacheStrategy, cacheName); }
https://gitcode.com/CPF-ApplicationTPC/imageknifepro/blob/5b2c39b2925d2e6c4a267ce62edc340b3150dcb9/library/src/main/ets/ImageKnife.ets#L210-L212
b2c95b5df692ac4104ada06d216981342947f63e
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/TypeGuards.ets
arkts
isValidUrl
检查值是否为有效的URL @param value - 要检查的值 @returns 是否为有效URL
static isValidUrl(value: Object): boolean { if (!TypeGuards.isString(value)) { return false; } const urlValue = value as string; // 使用正则表达式检查URL格式,替代URL构造函数 const urlRegex = /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)$/; re...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isValidUrl 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 Obje...
static isValidUrl(value: Object): boolean { if (!TypeGuards.isString(value)) { return false; } const urlValue = value as string; // 使用正则表达式检查URL格式,替代URL构造函数 const urlRegex = /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)$/; re...
https://github.com/DaLongZhuaZi/manxia
ee7446bd5c352ec3348253c78aecb93d11804f03
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
from
Creates an array from an array of the same type. @param { Int32Array } arr - An array to convert to a new array. @returns { Int32Array } - A new Int32Array @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static from(arr: Int32Array): Int32Array { let result = new Int32Array(arr.length) result.set(arr) return result }
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#from#Left from AST#from#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#identifier#Righ...
public static from(arr: Int32Array): Int32Array { let result = new Int32Array(arr.length) result.set(arr) return result }
https://gitcode.com/iop123123/arkts-static-skills
b69d6e5ca2a99e8b3fd5e564824779a78b5c69b8
gitcode
Joker-x-dev/HarmonyKit
feature/user/src/main/ets/viewmodel/ProfileViewModel.ets
arkts
getDisplayUserId
获取展示用户 ID @returns {ResourceStr} 展示用户 ID
getDisplayUserId(): ResourceStr { const userId: number = this.userState.getUserInfo().id ?? 0; return userId > 0 ? `${userId}` : $r("app.string.user_profile_id_empty"); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getDisplayUserId 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 ResourceStr AST#identifier#Right AST#ERROR#Ri...
getDisplayUserId(): ResourceStr { const userId: number = this.userState.getUserInfo().id ?? 0; return userId > 0 ? `${userId}` : $r("app.string.user_profile_id_empty"); }
https://github.com/Joker-x-dev/HarmonyKit
eb25b755f2d27fd3dc9cec7fb3df1d7f4a30e5b2
github
openharmony-sig/flutter_engine
shell/platform/ohos/flutter_embedding/flutter/src/main/ets/util/ByteBuffer.ets
arkts
writeInt8
Writes the next signed byte. @param value The value.
writeInt8(value: number): void { this.checkWriteCapacity(1) this.setInt8(this.mByteOffset++, value) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left writeInt8 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 ) AST#...
writeInt8(value: number): void { this.checkWriteCapacity(1) this.setInt8(this.mByteOffset++, value) }
https://gitee.com/openharmony-sig/flutter_engine.git
647a0525648cd28b262d7daa3ea69b9a8c1e46dd
gitee
honjow/Next2V
shared/src/main/ets/components/MarkdownContent.ets
arkts
CustomBlockBuilder
---------- Custom block rendering ---------- Handles token types we've hijacked from the library (code blocks, lists).
@Builder function CustomBlockBuilder(token: Token, options: MarkdownOptions) { if (token.type === CODE_MONO) { MarkdownCodeBlock({ codeToken: token as Tokens.Code, options: options }); } else if (token.type === LIST_MONO) { CustomList({ listToken: token as Tokens.List, options: options, in...
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 CustomBlockBuilder AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AS...
@Builder function CustomBlockBuilder(token: Token, options: MarkdownOptions) { if (token.type === CODE_MONO) { MarkdownCodeBlock({ codeToken: token as Tokens.Code, options: options }); } else if (token.type === LIST_MONO) { CustomList({ listToken: token as Tokens.List, options: options, in...
https://github.com/honjow/Next2V
da331f8362bd180e5e3aabec01e42342d1fc4f86
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/String.ets
arkts
strike
The strike() method creates a string that embeds a string in a <strike> element (<strike>str</strike>), which causes a string to be displayed in a big font.
public strike(): String{ return this.CreateHTMLString("strike", "") }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left strike 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 String AST#iden...
public strike(): String{ return this.CreateHTMLString("strike", "") }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
ed1f6065fc830fc7289a4f79b5ba50eefa0b2de6
gitee
openharmony/arkcompiler_taihe_ffi_gen
test/ani_overload/user/main.ets
arkts
test_10param
测试 10 param
function test_10param() { let instance: test_overload.OverloadInterface = test_overload.get_interface(); let arri8: byte[] = [1, 2, 3]; let arri16: short[] = [1, 2, 3, 4]; let arri32: int[] = [1, 2, 3, 4, 5]; instance.overloadFunc( (1).toByte(), (1).toShort(), (1).toInt(), 1.1f, (1.1...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left test_10param AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#lexical_declar...
function test_10param() { let instance: test_overload.OverloadInterface = test_overload.get_interface(); let arri8: byte[] = [1, 2, 3]; let arri16: short[] = [1, 2, 3, 4]; let arri32: int[] = [1, 2, 3, 4, 5]; instance.overloadFunc( (1).toByte(), (1).toShort(), (1).toInt(), 1.1f, (1.1...
https://gitcode.com/openharmony/arkcompiler_taihe_ffi_gen
29cb1117fce676e4e6d266b5759940d5bfa9f4d2
gitcode
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets
arkts
ceil
Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the direction of positive Infinity. @returns { Decimal } the Decimal type
public ceil(): Decimal { return Utils.finalise(new Decimal(this), this.exponent + 1, Decimal.ROUND_CEILING); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left ceil AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Righ...
public ceil(): Decimal { return Utils.finalise(new Decimal(this), this.exponent + 1, Decimal.ROUND_CEILING); }
https://gitcode.com/iop123123/arkts-static-skills
af449aa7ea513cba325056ff75c7e52f8df951cb
gitcode
SMAT-Lab/PhantomRendering
Harmoney_Next-Tiktok/entry/src/main/ets/common/Function/commonFn.ets
arkts
redirect
路由重定向
redirect() { //如果不是空字符串跳转到登录页 if (!tiktok.getUserInfo()) { AlertDialog.show({ title: '登录状态监测', message: '请先登录!', alignment: DialogAlignment.Center, confirm: { value: '确定', action: () => { router.pushUrl({ url: Constants.LOADIN...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left redirect 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#comment#Left //如果不是空字符串跳转到登录...
redirect() { //如果不是空字符串跳转到登录页 if (!tiktok.getUserInfo()) { AlertDialog.show({ title: '登录状态监测', message: '请先登录!', alignment: DialogAlignment.Center, confirm: { value: '确定', action: () => { router.pushUrl({ url: Constants.LOADIN...
https://github.com/SMAT-Lab/PhantomRendering
2a85a635045bb6616de7f3bcdfdbd099dde04c0a
github
LongLiveY96/chatcube
entry/src/main/ets/services/search/SearchEngineRegistry.ets
arkts
getBaseUrlPrefKey
获取指定引擎的 Base URL 字段的 preference key
getBaseUrlPrefKey(id: SearchEngine): string { const desc = this.getById(id) if (desc === undefined) { return '' } for (const field of desc.configFields) { if (!field.isPassword && field.defaultValue !== '') { return field.key } } return '' }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getBaseUrlPrefKey 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 SearchEngine AST#identifier#Right AST#)#...
getBaseUrlPrefKey(id: SearchEngine): string { const desc = this.getById(id) if (desc === undefined) { return '' } for (const field of desc.configFields) { if (!field.isPassword && field.defaultValue !== '') { return field.key } } return '' }
https://github.com/LongLiveY96/chatcube
c68ce593e966c8a1cf449b803b3f4589e881d8c3
github
openharmony/codelabs
Card/MovieCard/entry/src/main/ets/common/utils/CommonUtils.ets
arkts
createRdbStore
Create rdb store. @param {context} Context @return {rdbStore} return rdbStore RDB database
async createRdbStore(context: Context) { let rdbStore = GlobalContext.getContext().getObject('rdbStore') as relationalStore.RdbStore; if (this.isEmpty(rdbStore)) { rdbStore = await relationalStore.getRdbStore(context, CommonConstants.STORE_CONFIG); if (!this.isEmpty(rdbStore)) { rdbStore.e...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left createRdbStore AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#Right AST#type_annotation#Left A...
async createRdbStore(context: Context) { let rdbStore = GlobalContext.getContext().getObject('rdbStore') as relationalStore.RdbStore; if (this.isEmpty(rdbStore)) { rdbStore = await relationalStore.getRdbStore(context, CommonConstants.STORE_CONFIG); if (!this.isEmpty(rdbStore)) { rdbStore.e...
https://gitee.com/openharmony/codelabs.git
a642d42f32d030b832c4c392e12fc0616c23704e
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
findIndex
Finds an index of the first element in the Float64Array that satisfies the condition @param fn condition @returns the index of the first element that satisfies fn
public findIndex(fn: (val: double, index: int, array: Float64Array) => boolean): int { for (let i = 0; i < this.length; ++i) { let val = this.at(i) if (fn(val, i, this)) { return i } } return -1 }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left findIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#...
public findIndex(fn: (val: double, index: int, array: Float64Array) => boolean): int { for (let i = 0; i < this.length; ++i) { let val = this.at(i) if (fn(val, i, this)) { return i } } return -1 }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
37cd08b26bee44f6115e6965add32a8276a7a6a9
gitee
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/Writer.ets
arkts
bytes
Write length-delimited bytes
bytes(a: Uint8Array): Writer { this.uint32(a.length) for (let i = 0; i < a.length; i++) this.push(a[i]) return this }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left bytes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left a AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Uint8Array AST#identifier#Right AST#)#Left ) AST#)#Ri...
bytes(a: Uint8Array): Writer { this.uint32(a.length) for (let i = 0; i < a.length; i++) this.push(a[i]) return this }
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
e83828d7eb47e59a88302e237d143f3ae22518f7
gitcode
openharmony-sig/flutter_engine
shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/FlutterNapi.ets
arkts
handlePlatformMessageResponse
Called by native to respond to a platform message that we sent.
handlePlatformMessageResponse(replyId: number, reply: ArrayBuffer): void { Log.d(TAG, "called handlePlatformMessageResponse Response ID: " + replyId); if (this.platformMessageHandler != null) { this.platformMessageHandler.handlePlatformMessageResponse(replyId, reply); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left handlePlatformMessageResponse AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left replyId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST...
handlePlatformMessageResponse(replyId: number, reply: ArrayBuffer): void { Log.d(TAG, "called handlePlatformMessageResponse Response ID: " + replyId); if (this.platformMessageHandler != null) { this.platformMessageHandler.handlePlatformMessageResponse(replyId, reply); } }
https://gitee.com/openharmony-sig/flutter_engine.git
e0f427cbce222e85662ef8cc3343fea35a8f656a
gitee
egavrin/arkts_agent_kit
examples/fslib/src/tests/fslib.test.ets
arkts
testLstat
--- lstat (symlink info, does not follow) ---
function testLstat(): void { ensureSetup() let fs = new FileSystem() let target: string = TMPDIR + "/lstat_tgt.txt" let link: string = TMPDIR + "/lstat_lnk.txt" fs.writeText(target, "target") fs.symlink(target, link) let st: FileStat = fs.lstat(link) arktest.assertTrue(st.isSymlink()) ...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testLstat 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#L...
function testLstat(): void { ensureSetup() let fs = new FileSystem() let target: string = TMPDIR + "/lstat_tgt.txt" let link: string = TMPDIR + "/lstat_lnk.txt" fs.writeText(target, "target") fs.symlink(target, link) let st: FileStat = fs.lstat(link) arktest.assertTrue(st.isSymlink()) ...
https://gitcode.com/egavrin/arkts_agent_kit
a2a4a7452897c144d8594984d91b6728ac61510a
gitcode
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/PieChartModel.ets
arkts
needsHighlight
Checks if the given index is set to be highlighted. @param index @return
public needsHighlight(index: number): boolean { // no highlight if (!this.valuesToHighlight()) return false; if (this.mIndicesToHighlight) { for (let i: number = 0; i < this.mIndicesToHighlight.length; i++) { // check if the xvalue for the given dataset needs highlight if ( /...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left needsHighlight 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 ...
public needsHighlight(index: number): boolean { // no highlight if (!this.valuesToHighlight()) return false; if (this.mIndicesToHighlight) { for (let i: number = 0; i < this.mIndicesToHighlight.length; i++) { // check if the xvalue for the given dataset needs highlight if ( /...
https://gitee.com/openharmony-tpc/ohos_mpchart.git
44e0ff30d10d48f3007e4972654042221ae318a9
gitee
Joker-x-dev/HarmonyKit
core/database/src/main/ets/datasource/demo/DemoLocalDataSourceImpl.ets
arkts
updateItem
更新 Demo 记录 @param {DemoEntity} entity - 待更新实体 @returns {Promise<void>} Promise<void>
async updateItem(entity: DemoEntity): Promise<void> { this.orm.save(entity); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left updateItem AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left ...
async updateItem(entity: DemoEntity): Promise<void> { this.orm.save(entity); }
https://github.com/Joker-x-dev/HarmonyKit
86000cbe78d8f0f161fcec245824b8f9c3685dbd
github
LZZLHY/hlib
entry/src/main/ets/viewmodel/HomeVM.ets
arkts
fetchSection
拉取一个可分页的 section(order=popular / date)的第 1 页。 失败回退空列表且 hasMore=false(不显示"加载更多",不会拉到重复页)。
private static async fetchSection(order: string, langs: string[] | undefined): Promise<SectionPage> { const opts: SearchOptions = { order: order, page: 1, limit: 30 }; if (langs !== undefined) { opts.languages = langs; } try { const page: SearchPage = await ZLibraryClient.instance.search(o...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left fetchSection AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left or...
private static async fetchSection(order: string, langs: string[] | undefined): Promise<SectionPage> { const opts: SearchOptions = { order: order, page: 1, limit: 30 }; if (langs !== undefined) { opts.languages = langs; } try { const page: SearchPage = await ZLibraryClient.instance.search(o...
https://github.com/LZZLHY/hlib
a681ab96d17c3d4a0a41f33c6d8b83577963eeef
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/GamepadManager.ets
arkts
reportControllerMotion
USB 控制器运动数据报告(陀螺仪/加速度计) 当 USB 手柄自带 IMU 时,直接转发数据到串流
reportControllerMotion( controllerId: number, motionType: number, x: number, y: number, z: number ): void { const slot = this.getControllerSlot(controllerId); if (this.sensorDataCallback) { this.sensorDataCallback(slot, motionType, x, y, z); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left reportControllerMotion AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left controllerId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,...
reportControllerMotion( controllerId: number, motionType: number, x: number, y: number, z: number ): void { const slot = this.getControllerSlot(controllerId); if (this.sensorDataCallback) { this.sensorDataCallback(slot, motionType, x, y, z); } }
https://github.com/AlkaidLab/moonlight-harmony
a618f5c685d4bbd7b445d574a71d59d9d706add9
github
the-wwyang/kids-learning-app
src/main/ets/services/AnswerValidator.ets
arkts
getFeedback
获取答题反馈信息 @param isCorrect 是否答对 @param difficulty 难度等级 @returns 反馈信息对象
static getFeedback(isCorrect: boolean, difficulty: Difficulty): AnswerFeedback { if (!isCorrect) { return { isCorrect: false, message: '再想想哦!', points: 0 }; } const points = AnswerValidator.calculatePoints(difficulty); return { isCorrect: true, message:...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getFeedback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isCorrect AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolea...
static getFeedback(isCorrect: boolean, difficulty: Difficulty): AnswerFeedback { if (!isCorrect) { return { isCorrect: false, message: '再想想哦!', points: 0 }; } const points = AnswerValidator.calculatePoints(difficulty); return { isCorrect: true, message:...
https://github.com/the-wwyang/kids-learning-app
34732f14db7c0bfdafcd7ea126f4a7903feeb0e1
github
Jiagu1218/mrpohos
entry/src/main/ets/pages/OpenSourceNotices.ets
arkts
getLicenseColor
根据许可证类型返回文字颜色
getLicenseColor(license: string): string { if (license.includes('GPL-3.0')) { return '#ff6b6b'; } else if (license.includes('GPL-2.0')) { return '#ffa94d'; } else if (license.includes('LGPL')) { return '#51cf66'; } else if (license.includes('BSD')) { return '#4dabf7'; } els...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getLicenseColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left license AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST#...
getLicenseColor(license: string): string { if (license.includes('GPL-3.0')) { return '#ff6b6b'; } else if (license.includes('GPL-2.0')) { return '#ffa94d'; } else if (license.includes('LGPL')) { return '#51cf66'; } else if (license.includes('BSD')) { return '#4dabf7'; } els...
https://github.com/Jiagu1218/mrpohos
58900f596336e3bcb1f6dc393f4183742617949e
github
openharmony-sig/FastBle
library/src/main/ets/BleManager.ets
arkts
stopNotify
stop notify, remove callback @param bleDevice @param uuid_service @param uuid_notify @param useCharacteristicDescriptor @return
public stopNotify(bleDevice: BleDevice, uuid_service: string, uuid_notify: string, useCharacteristicDescriptor: boolean = false): boolean { if (this.multipleBluetoothController === null) { return false } let bleBluetooth: BleBluetooth | null = this.multipleBluetoothController.getBleBluetooth(bleDev...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left stopNotify AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bleDevice AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ...
public stopNotify(bleDevice: BleDevice, uuid_service: string, uuid_notify: string, useCharacteristicDescriptor: boolean = false): boolean { if (this.multipleBluetoothController === null) { return false } let bleBluetooth: BleBluetooth | null = this.multipleBluetoothController.getBleBluetooth(bleDev...
https://gitee.com/openharmony-sig/FastBle.git
b2b6e362100378b4221c03167ab74654e418085d
gitee
qiuhaotc/HarmonyOSPlayground
entry/src/main/ets/pages/StatisticsPage.ets
arkts
roundUpToNiceNumber
将数值向上取整到合适的刻度值(用于正数最大值)
roundUpToNiceNumber(value: number): number { if (value <= 0) return 0; if (value < 10) { // 小于10的值,向上取整到整数 return Math.ceil(value); } // 找到合适的刻度单位 const magnitude = Math.pow(10, Math.floor(Math.log10(value))); const normalized...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left roundUpToNiceNumber 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#)#L...
roundUpToNiceNumber(value: number): number { if (value <= 0) return 0; if (value < 10) { // 小于10的值,向上取整到整数 return Math.ceil(value); } // 找到合适的刻度单位 const magnitude = Math.pow(10, Math.floor(Math.log10(value))); const normalized...
https://github.com/qiuhaotc/HarmonyOSPlayground
a28d914bb115e4d68a4d1573575c5f39535ff64c
github
HarmonyOS_Samples/BestPracticeSnippets
DealStrideSolution/entry/src/main/ets/utils/CameraServiceTwo.ets
arkts
onImageArrival
[Start Case2_start]
onImageArrival(receiver: image.ImageReceiver): void { receiver.on('imageArrival', () => { receiver.readNextImage((err: BusinessError, nextImage: image.Image) => { // [StartExclude Case2_start] if (err || nextImage === undefined) { Logger.error(TAG, `requestPermissionsFromUser call ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onImageArrival AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left receiver AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left image AST#identifier#Right...
onImageArrival(receiver: image.ImageReceiver): void { receiver.on('imageArrival', () => { receiver.readNextImage((err: BusinessError, nextImage: image.Image) => { // [StartExclude Case2_start] if (err || nextImage === undefined) { Logger.error(TAG, `requestPermissionsFromUser call ...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
c8ddb79bf5931a7ee429188a23975c12ccb9ddf7
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
subarray
Creates a Uint16Array with the same underlying ArrayBuffer @param begin start index, inclusive @param end last index, exclusive @returns new Uint16Array with the same underlying ArrayBuffer
public subarray(begin: number, end: number): Uint16Array { return this.subarray(begin as int, end as int) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left subarray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left begin AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number...
public subarray(begin: number, end: number): Uint16Array { return this.subarray(begin as int, end as int) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
bdab88c1b2bb049ae806db55ec73224723785f4f
gitee
Mydstiny/RemoteDeskHarmonyOS
entry/src/main/ets/model/SshKey.ets
arkts
typeLabel
密钥类型显示名
static typeLabel(kt: SshKeyType): string { if (kt === SshKeyType.RSA) { return 'RSA'; } if (kt === SshKeyType.ED25519) { return 'ED25519'; } if (kt === SshKeyType.ECDSA) { return 'ECDSA'; } if (kt === SshKeyType.DSA) { return 'DSA'; } return 'Unknown'; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left typeLabel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left kt AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left SshKeyTy...
static typeLabel(kt: SshKeyType): string { if (kt === SshKeyType.RSA) { return 'RSA'; } if (kt === SshKeyType.ED25519) { return 'ED25519'; } if (kt === SshKeyType.ECDSA) { return 'ECDSA'; } if (kt === SshKeyType.DSA) { return 'DSA'; } return 'Unknown'; }
https://github.com/Mydstiny/RemoteDeskHarmonyOS
5c6f3d49d073798f21c5bf5edf45455645e93db2
github
codelably/tuniao-ui
packages/main/src/main/ets/view/TnTagPage.ets
arkts
build
构建标签展示页面
build() { AppNavDestination({ title: "标签", viewModel: this.vm, paddingValue: { top: this.windowSafeAreaState.topInset, left: this.windowSafeAreaState.leftInset, right: this.windowSafeAreaState.rightInset, } }) { this.TagContent(); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c...
build() { AppNavDestination({ title: "标签", viewModel: this.vm, paddingValue: { top: this.windowSafeAreaState.topInset, left: this.windowSafeAreaState.leftInset, right: this.windowSafeAreaState.rightInset, } }) { this.TagContent(); } }
https://github.com/codelably/tuniao-ui
f7485de8e5cd04622fbd6178edf5be83ffe2cff5
github
Cool_foolisher1/ArkTSRepository
GraphicalCode/commons/src/main/ets/util/WindowUtil.ets
arkts
setAvoidArea
获取状态栏高度和指示器高度 @param type window.AvoidAreaType @param area window.AvoidArea
public static setAvoidArea(type: window.AvoidAreaType, area: window.AvoidArea): void { const globalInfoModel: GlobalInfoModel = AppStorage.get(StorageKeyEnum.GLOBAL_INFO) || new GlobalInfoModel() if (type === window.AvoidAreaType.TYPE_SYSTEM) { globalInfoModel.statusBarHeight = WindowUtil.uiContext.px2v...
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 setAvoidArea AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST...
public static setAvoidArea(type: window.AvoidAreaType, area: window.AvoidArea): void { const globalInfoModel: GlobalInfoModel = AppStorage.get(StorageKeyEnum.GLOBAL_INFO) || new GlobalInfoModel() if (type === window.AvoidAreaType.TYPE_SYSTEM) { globalInfoModel.statusBarHeight = WindowUtil.uiContext.px2v...
https://gitcode.com/Cool_foolisher1/ArkTSRepository
87fdf8590ec5d6fd3dabd759ab46f1a77ad38cfc
gitcode
HarmonyOS_Samples/BestPracticeSnippets
ScreenFlickerSolution/entry/src/main/ets/pages/PullToRefreshError.ets
arkts
aboutToDisappear
[End get_list_view_error]
aboutToDisappear(): void { this.newsData = []; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToDisappear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_b...
aboutToDisappear(): void { this.newsData = []; }
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
6a17ca5395638c64f5cc87cc4e30060ebd72109c
gitcode
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/Writer.ets
arkts
fork
Create a child writer for length-delimited section
fork(): Writer { return new Writer() }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left fork 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 Writer AST#identifier#Right AST#ERROR#Right AST#statement...
fork(): Writer { return new Writer() }
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
16d22a061df19f3c1b98fec30a941f16c03abe78
gitcode
OMGCA/sakipay
sakipay_hmos/main/src/main/ets/viewmodels/SettingsViewModel.ets
arkts
getTotalWorkHours
Computes the total working hours per day accounting for breaks. Used to auto-wire customWorkHours when saving an overtime override.
public getTotalWorkHours(): number { const windowMinutes: number = this.getWorkDurationMinutes() const breakMinutes: number = this.getTotalBreakMinutes() const workMinutes: number = Math.max(0, windowMinutes - breakMinutes) return workMinutes / 60 }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getTotalWorkHours 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 A...
public getTotalWorkHours(): number { const windowMinutes: number = this.getWorkDurationMinutes() const breakMinutes: number = this.getTotalBreakMinutes() const workMinutes: number = Math.max(0, windowMinutes - breakMinutes) return workMinutes / 60 }
https://github.com/OMGCA/sakipay
4adffb8d49de446724c96b8cddec3f119bd21f5c
github