nwo
stringclasses
449 values
path
stringlengths
9
173
language
stringclasses
1 value
identifier
stringlengths
1
53
docstring
stringlengths
5
4.13k
function
stringlengths
10
87.2k
ast_function
stringlengths
351
354k
obf_function
stringlengths
10
87.2k
url
stringlengths
30
175
function_sha
stringlengths
40
40
source
stringclasses
3 values
AlkaidLab/moonlight-harmony
entry/src/main/ets/utils/RcpSessionPool.ets
arkts
invalidate
标记 session 损坏(请求出错时调用),从池中移除并关闭 下次同 cacheKey 请求会重建 session
static invalidate(cacheKey: string): void { const entry = RcpSessionPool.entries.get(cacheKey); if (!entry) return; RcpSessionPool.entries.delete(cacheKey); try { entry.session.close(); } catch (_e) { // 忽略 } console.warn(`RcpSessionPool: invalidate ${cacheKey}`); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left invalidate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left cacheKey AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Rig...
static invalidate(cacheKey: string): void { const entry = RcpSessionPool.entries.get(cacheKey); if (!entry) return; RcpSessionPool.entries.delete(cacheKey); try { entry.session.close(); } catch (_e) { // 忽略 } console.warn(`RcpSessionPool: invalidate ${cacheKey}`); }
https://github.com/AlkaidLab/moonlight-harmony
808e2e5c636bd4cc3ad2eee5c44d6d93392bb60a
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/DuplicateDetection/DuplicateDetectionService.ets
arkts
calculateMatch
计算单个候选的匹配度
private calculateMatch( normalizedInputTitle: string, normalizedInputAuthor: string, candidate: DuplicateCandidateItem, config: DuplicateDetectionConfig ): DuplicateMatchItem { const normalizedCandidateTitle = normalizeText(candidate.title); const normalizedCandidateAuthor = normalizeText(ca...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left calculateMatch AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left normalizedInputTitle AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left st...
private calculateMatch( normalizedInputTitle: string, normalizedInputAuthor: string, candidate: DuplicateCandidateItem, config: DuplicateDetectionConfig ): DuplicateMatchItem { const normalizedCandidateTitle = normalizeText(candidate.title); const normalizedCandidateAuthor = normalizeText(ca...
https://github.com/DaLongZhuaZi/manxia
47f7407f58f71eabe5496da9f3b06b1730e3f4f7
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/AsyncLinkedConcurrentQueue.ets
arkts
appendIterable
Appends all defined values from an iterable in iteration order. Centralizes constructor iteration so the undefined filtering rule is documented once. @param { Iterable<T> } iterable The iterable source used to initialize the queue. @returns { void } No return value. @syscap SystemCapability.Utils.Lang @FaAndStageModel
private appendIterable(iterable: Iterable<T>): void { const entriesIter = iterable.$_iterator(); for (let iterRes = entriesIter.next(); !iterRes.done; iterRes = entriesIter.next()) { const val = iterRes.value; if (val !== undefined) { /...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left appendIterable AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left iterable AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiat...
private appendIterable(iterable: Iterable<T>): void { const entriesIter = iterable.$_iterator(); for (let iterRes = entriesIter.next(); !iterRes.done; iterRes = entriesIter.next()) { const val = iterRes.value; if (val !== undefined) { /...
https://gitcode.com/iop123123/arkts-static-skills
c1cf386e7a4c9e346c392f1697b5512d1a5fe6d9
gitcode
LJ666-ui/harmony-health-care
entry/src/main/ets/utils/DeviceTypeUtil.ets
arkts
isWatchOrWearable
判断是否为手环/手表设备
public isWatchOrWearable(): boolean { return this.currentDeviceType === DeviceType.WEARABLE; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isWatchOrWearable AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean...
public isWatchOrWearable(): boolean { return this.currentDeviceType === DeviceType.WEARABLE; }
https://github.com/LJ666-ui/harmony-health-care
fbe48d94949fda9587cf92c27de826fba6ccbfee
github
Joker-x-dev/CoolMallArkTS
entry/src/main/ets/adapter/WindowAdapter.ets
arkts
updateSafeArea
更新安全区状态 @param {SafeAreaInsets} insets - 安全区数据(vp) @returns {void} 无返回值
private updateSafeArea(insets: SafeAreaInsets): void { if ( insets.top === this.currentSafeArea.top && insets.left === this.currentSafeArea.left && insets.bottom === this.currentSafeArea.bottom && insets.right === this.currentSafeArea.right ) { return; } this.curren...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left updateSafeArea AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left insets AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
private updateSafeArea(insets: SafeAreaInsets): void { if ( insets.top === this.currentSafeArea.top && insets.left === this.currentSafeArea.left && insets.bottom === this.currentSafeArea.bottom && insets.right === this.currentSafeArea.right ) { return; } this.curren...
https://github.com/Joker-x-dev/CoolMallArkTS
8cb556d80927fc77e05e8899e3876f696e7d9182
github
huaiminqin/TankWar-Master-with-Many-Tasks
game/src/main/ets/actors/actor/Highland.ets
arkts
checkCapture
检查占领状态
checkCapture(player: PlayerTank): void { if (!this.isVisible()) { return; } // 检查玩家是否在区域内 this.playerInZone = this.isInCaptureZone(player.getX(), player.getY()); // 检查是否有敌人在区域内 this.enemyInZone = false; for (let i = 1; i < Tanks.TANKS.length; i++) { const tank = Tanks.TAN...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left checkCapture AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left player AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left PlayerTank AST#identifier#Right AST#)#Lef...
checkCapture(player: PlayerTank): void { if (!this.isVisible()) { return; } // 检查玩家是否在区域内 this.playerInZone = this.isInCaptureZone(player.getX(), player.getY()); // 检查是否有敌人在区域内 this.enemyInZone = false; for (let i = 1; i < Tanks.TANKS.length; i++) { const tank = Tanks.TAN...
https://github.com/huaiminqin/TankWar-Master-with-Many-Tasks
d04e0de3d9881155d271cf980524e5a07e894f49
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/ReflectInstanceMethod.ets
arkts
isSetter
Checks if the method is a setter method. @returns { boolean } Returns true if the method is a setter, otherwise returns false. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public isSetter(): boolean { return (this.attributes & Attributes.SETTER) != 0 }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isSetter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#bool...
public isSetter(): boolean { return (this.attributes & Attributes.SETTER) != 0 }
https://gitcode.com/iop123123/arkts-static-skills
f78152266c1efcc5a9ce944bd28657160a033da0
gitcode
RoooyHe/toona-ohos
toona/src/main/ets/pages/JoinRoomPage.ets
arkts
CreateRoomDialogDecorator
创建聊天室弹窗 - 装饰器(半透明背景)
@Builder function CreateRoomDialogDecorator(decoratorParams: QuickDialogDecoratorParams) { Stack() { Column() .width('100%') .height('100%') .backgroundColor('rgba(0, 0, 0, 0.5)') NodeContainer( QuickDialogManager.decoratorCreateContentNodeController(decoratorParams) ) } }
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 CreateRoomDialogDecorator AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#R...
@Builder function CreateRoomDialogDecorator(decoratorParams: QuickDialogDecoratorParams) { Stack() { Column() .width('100%') .height('100%') .backgroundColor('rgba(0, 0, 0, 0.5)') NodeContainer( QuickDialogManager.decoratorCreateContentNodeController(decoratorParams) ) } }
https://github.com/RoooyHe/toona-ohos
803463e9389eb8f10554afcd1b5aec302e18e108
github
Mydstiny/RemoteDeskHarmonyOS
entry/src/main/ets/services/DataCrypto.ets
arkts
constantTimeEqual
常量时间字节比较 (防时序攻击)
private constantTimeEqual(a: Uint8Array, b: Uint8Array): boolean { if (a.length !== b.length) { return false; } let result = 0; for (let i = 0; i < a.length; i++) { result |= (a[i] ^ b[i]); } return result === 0; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left constantTimeEqual 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#Lef...
private constantTimeEqual(a: Uint8Array, b: Uint8Array): boolean { if (a.length !== b.length) { return false; } let result = 0; for (let i = 0; i < a.length; i++) { result |= (a[i] ^ b[i]); } return result === 0; }
https://github.com/Mydstiny/RemoteDeskHarmonyOS
6f8a82ae34f05d272baf57146be913061610883a
github
openharmony/codelabs
Media/VideoPlayer/entry/src/main/ets/viewmodel/HomeVideoListModel.ets
arkts
getLocalVideo
Scan the local video. @return Local video list data
async getLocalVideo() { this.videoLocalList = []; await this.assemblingVideoBean(); GlobalContext.getContext().setObject('videoLocalList', this.videoLocalList); return this.videoLocalList; }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getLocalVideo AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#...
async getLocalVideo() { this.videoLocalList = []; await this.assemblingVideoBean(); GlobalContext.getContext().setObject('videoLocalList', this.videoLocalList); return this.videoLocalList; }
https://gitee.com/openharmony/codelabs.git
38e9ce423841c6a5796218d25c27df668c4ec742
gitee
eternaljust/Msea_HarmonyOS
entry/src/main/ets/view/ComponentExtend.ets
arkts
systemFont
HarmonyOS Sans 系统默认字体字号规范
@Extend(Text) function systemFont(category: FontCategory) { .fontSize(FontCategory.fontSize(category)) .fontWeight(FontCategory.fontWeight(category)) }
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#call_expression#Left AST#identifier#Left Extend AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left Text AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#R...
@Extend(Text) function systemFont(category: FontCategory) { .fontSize(FontCategory.fontSize(category)) .fontWeight(FontCategory.fontWeight(category)) }
https://github.com/eternaljust/Msea_HarmonyOS
a74d0d2be16119aed9a3fa7d5ae56cdc68125909
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/MangaDataLoader.ets
arkts
loadChapterPages
加载章节的页面列表 策略: 1. 优先从数据库加载 2. 如果是在线章节且未下载,从网络加载 3. 如果是在线章节且已下载,使用本地文件
async loadChapterPages( chapterId: string, manga: Manga ): Promise<ChapterPagesLoadResult> { logger.info(TAG, `加载章节页面: chapterId=${chapterId}`); try { // 1. 从数据库加载章节信息 const legacyChapter = await this.dataManager.getChapterById(chapterId); if (!legacyChapter) { throw n...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left loadChapterPages AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left chapterId AST#identifier#Right AST#type_annotation#Le...
async loadChapterPages( chapterId: string, manga: Manga ): Promise<ChapterPagesLoadResult> { logger.info(TAG, `加载章节页面: chapterId=${chapterId}`); try { // 1. 从数据库加载章节信息 const legacyChapter = await this.dataManager.getChapterById(chapterId); if (!legacyChapter) { throw n...
https://github.com/DaLongZhuaZi/manxia
fa63177b481398491a12221a01932e11000f7d76
github
HarmonyOS_Samples/MusicHome
common/musicbasic/src/main/ets/model/TabItem.ets
arkts
constructor
@param title Tab title resource. @param iconSelected Active-state icon. @param iconUnselected Inactive-state icon.
public constructor(title: Resource, iconSelected: Resource, iconUnselected: Resource) { this.title = title; this.iconSelected = iconSelected; this.iconUnselected = iconUnselected; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left title AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Res...
public constructor(title: Resource, iconSelected: Resource, iconUnselected: Resource) { this.title = title; this.iconSelected = iconSelected; this.iconUnselected = iconUnselected; }
https://gitcode.com/HarmonyOS_Samples/MusicHome
b08b933f2f031acae3ccdca2ba27c61db64c745d
gitcode
LongLiveY96/chatcube
entry/src/main/ets/services/DatabaseService.ets
arkts
getToolEventsBySession
获取会话的所有工具事件
async getToolEventsBySession(sessionId: string): Promise<ToolEventData[]> { await this.waitForInitialization() if (this.rdbStore === null) { return [] } const events: ToolEventData[] = [] const predicates = new relationalStore.RdbPredicates(TableNames.TOOL_EVENTS) predicates.equalTo('se...
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 getToolEventsBySession AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#...
async getToolEventsBySession(sessionId: string): Promise<ToolEventData[]> { await this.waitForInitialization() if (this.rdbStore === null) { return [] } const events: ToolEventData[] = [] const predicates = new relationalStore.RdbPredicates(TableNames.TOOL_EVENTS) predicates.equalTo('se...
https://github.com/LongLiveY96/chatcube
e9d6360c0b3cf130c3c0da554a5a8996107161b3
github
hiyuey3/Hixy_MyMemories
entry/src/main/ets/utils/MemDBUtils.ets
arkts
queryMemories
查询数据并返回 Memory[]
async queryMemories(tableName: string, column: Array<string>): Promise<Memory[]> { await this.readyPromise if (this.rdbStore === null) { return [] } try { let queryPredicates = new relationalStore.RdbPredicates(tableName) // 首先返回最新的,以便 UI 在顶部显示最近的添加 try { queryPredicates.order...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left queryMemories AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left tableName AST#identifier#Right AST#type_annotation#Left AST#:#Lef...
async queryMemories(tableName: string, column: Array<string>): Promise<Memory[]> { await this.readyPromise if (this.rdbStore === null) { return [] } try { let queryPredicates = new relationalStore.RdbPredicates(tableName) // 首先返回最新的,以便 UI 在顶部显示最近的添加 try { queryPredicates.order...
https://github.com/hiyuey3/Hixy_MyMemories/blob/9769d82c97a877be3d464456e79f66c5c84a9590/entry/src/main/ets/utils/MemDBUtils.ets#L153-L224
5e06c5f80b83dc8855ae5a08a6dfa01257c6a334
github
tdcare/tdwebrtc
src/main/ets/CameraCapture.ets
arkts
setupFrameCapture
创建 ImageReceiver 和帧捕获输出 官方文档要求 ImageReceiver 使用 JPEG 格式创建: - image.createImageReceiver(size, image.ImageFormat.JPEG, capacity) - 虽然格式为 JPEG,但摄像头预览流输出的实际数据是 NV21 原始帧 - 通过 getComponent(ComponentType.JPEG) 获取帧数据
private async setupFrameCapture(profile: camera.Profile): Promise<void> { if (this.cameraManager === null) { return; } try { // 创建 ImageReceiver(官方文档标准:使用 JPEG 格式) // v17: capacity 从 8 降到 2,减少缓冲延迟(旧帧在 buffer 中等待的时间更短) const receiverSize: image.Size = { width: this.actualWidth, hei...
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 setupFrameCapture AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left profile AST#identifier#Right AST#:#...
private async setupFrameCapture(profile: camera.Profile): Promise<void> { if (this.cameraManager === null) { return; } try { // 创建 ImageReceiver(官方文档标准:使用 JPEG 格式) // v17: capacity 从 8 降到 2,减少缓冲延迟(旧帧在 buffer 中等待的时间更短) const receiverSize: image.Size = { width: this.actualWidth, hei...
https://github.com/tdcare/tdwebrtc
c59dc8dfb2322f0c50e045b36daec13410e32ad3
github
HarmonyOS_Samples/MusicHome
common/musicbasic/src/main/ets/util/MusicDbApi.ets
arkts
getRecommendPlaylists
@returns Recommend-card rows sorted by feed sort order.
public getRecommendPlaylists(): RecommendCardApiDto[] { return this.feedSorted() .filter((feedRow) => feedRow.kind === RecommendFeedKind.RECOMMEND_CARD) .map((feedRow) => this.rowToRecommendCardApiDto(feedRow)); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getRecommendPlaylists AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#...
public getRecommendPlaylists(): RecommendCardApiDto[] { return this.feedSorted() .filter((feedRow) => feedRow.kind === RecommendFeedKind.RECOMMEND_CARD) .map((feedRow) => this.rowToRecommendCardApiDto(feedRow)); }
https://gitcode.com/HarmonyOS_Samples/MusicHome
8731ce0239d1063e0c2cfb605b61b64bdd9aa1cc
gitcode
qiuhaotc/Sunshine_HarmonyOS
entry/src/main/ets/pages/LauncherPage.ets
arkts
onCancel
不同意按钮回调
onCancel(): void { Logger.info(CommonConstants.LAUNCHER_PAGE_TAG, 'Privacy not agreed'); // 退出应用 try { let context = this.getUIContext().getHostContext() as common.UIAbilityContext; context.terminateSelf(); } catch (err) { Logger.error(CommonConstants.LAUNCHER_PAGE_TAG, 'Terminate se...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onCancel 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#Lef...
onCancel(): void { Logger.info(CommonConstants.LAUNCHER_PAGE_TAG, 'Privacy not agreed'); // 退出应用 try { let context = this.getUIContext().getHostContext() as common.UIAbilityContext; context.terminateSelf(); } catch (err) { Logger.error(CommonConstants.LAUNCHER_PAGE_TAG, 'Terminate se...
https://github.com/qiuhaotc/Sunshine_HarmonyOS
a23931a2bfff02ea55c07d10619a3f04b85f7867
github
Joker-x-dev/CoolMallArkTS
core/data/src/main/ets/repository/OrderCacheStoreRepository.ets
arkts
loadSelectedGoodsList
读取已选商品列表 @returns {Promise<SelectedGoods[] | null>} 已选商品列表,不存在返回 null
loadSelectedGoodsList(): Promise<SelectedGoods[] | null> { return this.dataSource.getSelectedGoodsList(); }
AST#program#Left AST#expression_statement#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left loadSelectedGoodsList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Ri...
loadSelectedGoodsList(): Promise<SelectedGoods[] | null> { return this.dataSource.getSelectedGoodsList(); }
https://github.com/Joker-x-dev/CoolMallArkTS
fa46aaea186304594dd854d611d3b52d2ba39884
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/SourceContentCache.ets
arkts
loadCacheFromStorage
从存储加载缓存
private async loadCacheFromStorage(): Promise<void> { try { const dataPreferences = await preferences.getPreferences(this.getAbilityContext(), 'source_content_cache'); const cacheJson = await dataPreferences.get('cache_data', '{}') as string; if (cacheJson && cacheJson !== '{}') { ...
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 loadCacheFromStorage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Ri...
private async loadCacheFromStorage(): Promise<void> { try { const dataPreferences = await preferences.getPreferences(this.getAbilityContext(), 'source_content_cache'); const cacheJson = await dataPreferences.get('cache_data', '{}') as string; if (cacheJson && cacheJson !== '{}') { ...
https://github.com/DaLongZhuaZi/manxia
03d63123a545c4af1d09a51fe0fc8a0759d54438
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/DataManager.ets
arkts
convertLegacyIdToString
转换遗留数字ID为字符串ID(用于数据迁移)
private convertLegacyIdToString(id: number | string): string { return convertLegacyId(id); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left convertLegacyIdToString 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#binary_...
private convertLegacyIdToString(id: number | string): string { return convertLegacyId(id); }
https://github.com/DaLongZhuaZi/manxia
2b003b5dde6cf7446ed420cf925ad59a4263d2aa
github
LJ666-ui/harmony-health-care
entry/src/main/ets/aiagent/IntentClassifier.ets
arkts
classifyWithEntities
完整的意图分类(包含实体提取) @param question 用户问题 @returns 意图分类结果
async classifyWithEntities(question: string): Promise<IntentClassificationResult> { const primaryIntent = await this.classify(question); const allEntities = await this.extractEntities(question); return { primaryIntent, allEntities }; }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left classifyWithEntities AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left question AST#identifier#Right AST#type_annotation#Left AST...
async classifyWithEntities(question: string): Promise<IntentClassificationResult> { const primaryIntent = await this.classify(question); const allEntities = await this.extractEntities(question); return { primaryIntent, allEntities }; }
https://github.com/LJ666-ui/harmony-health-care
836b4611993ff4f37aa9fa3ae0b7ddb6152fbc38
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/06.conversions_and_contexts/02.assignment_contexts/null.ets
arkts
main
--- desc: >- A value of the null type (the null reference is the only such value) may be assigned to any reference type, resulting in a null reference of that type. ---
function main(): int { {%- for t in case['types'] %} let v_{{t}}: {{t}}? = null; if (v_{{t}} !== null) { return 1; } type ArrayOf{{t}} = {{t}}[]; let a_{{t}}: ArrayOf{{t}}? = null;
AST#program#Left AST#expression_statement#Left AST#function_expression#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Rig...
function main(): int { {%- for t in case['types'] %} let v_{{t}}: {{t}}? = null; if (v_{{t}} !== null) { return 1; } type ArrayOf{{t}} = {{t}}[]; let a_{{t}}: ArrayOf{{t}}? = null;
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
831457f225ecc1cc098979ceba42bc4c5c1e1312
gitee
dingzhilin1990/zhilinclaw
src/agents/HanwudiWorkflow.ets
arkts
execute
执行完整工作流 @param requirement 需求描述
async execute(requirement: string): Promise<TaskResult> { const startTime = Date.now(); this.log = []; this.addLog(0, 'Workflow', '开始执行工作流', 'started'); try { // 步骤 1: 研究调研 const researchResult = await this.step1_Research(requirement); // 步骤 2: 策略规划 const strategyR...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left execute AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left requirement AST#identifier#Right AST#type_annotation#Left AST#:#Left : ...
async execute(requirement: string): Promise<TaskResult> { const startTime = Date.now(); this.log = []; this.addLog(0, 'Workflow', '开始执行工作流', 'started'); try { // 步骤 1: 研究调研 const researchResult = await this.step1_Research(requirement); // 步骤 2: 策略规划 const strategyR...
https://github.com/dingzhilin1990/zhilinclaw
942bc656c87325e6c41317e5af333f29490d1c91
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Parsers/EBookParser.ets
arkts
readFileContent
读取文件内容(支持多种编码自动检测)
private async readFileContent(): Promise<string> { // 先读取文件的原始字节 const buffer = await this.readFileBuffer(); // 检测编码并解码 const encoding = this.detectEncodingFromBuffer(buffer); this.encoding = encoding; logger.info(TAG, `检测到文件编码: ${encoding}`); try { const decoder = new util...
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 readFileContent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A...
private async readFileContent(): Promise<string> { // 先读取文件的原始字节 const buffer = await this.readFileBuffer(); // 检测编码并解码 const encoding = this.detectEncodingFromBuffer(buffer); this.encoding = encoding; logger.info(TAG, `检测到文件编码: ${encoding}`); try { const decoder = new util...
https://github.com/DaLongZhuaZi/manxia
8c9b05db98481d68ff0fe88613c291c3c6a150b2
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/07.expressions/21.shift_expressions/rshift_int.ets
arkts
main
--- desc: Corner case for right shift ---
function main(): void { let n: {{rn.type}} = {{rn.value}};
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A...
function main(): void { let n: {{rn.type}} = {{rn.value}};
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
1fde6efbb0385424d19946ffdae6d8196c3b6beb
gitee
apap6628114/nga_oh
entry/src/main/ets/store/AppStore.ets
arkts
loadVoteRecord
---------- Facade: Vote ----------
loadVoteRecord(uid: string, tid: string): Promise<Set<string>[]> { return this.voteStore.loadVoteRecord(uid, tid) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left loadVoteRecord AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left ...
loadVoteRecord(uid: string, tid: string): Promise<Set<string>[]> { return this.voteStore.loadVoteRecord(uid, tid) }
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/store/AppStore.ets#L226-L228
df387541e7358752a0d7f89a521428e0e137723e
github
openharmony/arkui_ace_engine
examples/Image/entry/src/main/ets/pages/SVG/svgExample017.ets
arkts
ApplyPreset
Preset helper methods
ApplyPreset(index: number): void { switch (index) { case 0: // None this.blurRadius = 0 this.shadowRadius = 0 this.brightnessValue = 100 this.contrastValue = 100 this.saturationValue = 100 break case 1: // Soft Glow this.blurRadius = 2 th...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left ApplyPreset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) AS...
ApplyPreset(index: number): void { switch (index) { case 0: // None this.blurRadius = 0 this.shadowRadius = 0 this.brightnessValue = 100 this.contrastValue = 100 this.saturationValue = 100 break case 1: // Soft Glow this.blurRadius = 2 th...
https://gitcode.com/openharmony/arkui_ace_engine
be9376529477e162d1fa260d3a2131108572af29
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/EnhancedBackupManager.ets
arkts
copyMangaSourceCovers
复制图源封面到备份目录 按照沙盒目录结构,使用pkg名称建立单独的文件夹
private async copyMangaSourceCovers(coversDir: string, mangaSources: MangaSourceBackup[]): Promise<void> { const filesDir = this.sandboxManager.getDirectory('files'); const sourceCoversDir = `${filesDir}/covers`; logger.debug(TAG, `检查图源封面目录: ${sourceCoversDir}`); if (!SafeFileUtils.accessSyn...
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 copyMangaSourceCovers AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left coversDir AST#identifier#Right AST#ERROR#Left ...
private async copyMangaSourceCovers(coversDir: string, mangaSources: MangaSourceBackup[]): Promise<void> { const filesDir = this.sandboxManager.getDirectory('files'); const sourceCoversDir = `${filesDir}/covers`; logger.debug(TAG, `检查图源封面目录: ${sourceCoversDir}`); if (!SafeFileUtils.accessSyn...
https://github.com/DaLongZhuaZi/manxia
2485f421c7a8fa9e2b68967fc52712a15c6d5391
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/TypeGuards.ets
arkts
assertArray
类型断言辅助函数 - 数组 @param value - 要断言的值 @param context - 上下文信息 @returns 数组值 @throws 如果类型不匹配
static assertArray(value: Object, context: string = 'value'): Array<Object> { if (!TypeGuards.isArray(value)) { const error = `${context} 必须是数组类型,实际类型: ${typeof value}`; logger.error(TAG, error); throw new Error(error); } return value as Array<Object>; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left assertArray 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 Obj...
static assertArray(value: Object, context: string = 'value'): Array<Object> { if (!TypeGuards.isArray(value)) { const error = `${context} 必须是数组类型,实际类型: ${typeof value}`; logger.error(TAG, error); throw new Error(error); } return value as Array<Object>; }
https://github.com/DaLongZhuaZi/manxia
c15cf175c208fbec63ffcf5ae5c5b405cc2fd5c0
github
codelably/HCompass
entry/src/main/ets/entryability/EntryAbility.ets
arkts
onForeground
应用进入前台时调用 刷新应用状态、重新注册路由
onForeground(): void {}
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onForeground AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Le...
onForeground(): void {}
https://github.com/codelably/HCompass
5dd595078b6d175f1138a95e0f50105434da3944
github
chendi126/harmonyOS-TCP
entry/src/main/ets/pages/DeviceMonitor.ets
arkts
getFilteredLogs
获取过滤后的日志
getFilteredLogs(): LogEntry[] { if (this.selectedLogLevel === 'ALL') { return this.logs; } return this.logs.filter(log => log.level === this.selectedLogLevel); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getFilteredLogs AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left LogEntry AST#identifier#Right A...
getFilteredLogs(): LogEntry[] { if (this.selectedLogLevel === 'ALL') { return this.logs; } return this.logs.filter(log => log.level === this.selectedLogLevel); }
https://github.com/chendi126/harmonyOS-TCP
1e83849c94b015eeaee1a90a373a434d7429301d
github
itrainhub/wu-ui
WuUI/wu_ui/src/main/ets/components/toast/index.ets
arkts
renderIcon
渲染成功、失败、加载图标,否则如果有用户传递 icon 则渲染用户图标 @param type @param name @param iconSize @param color
@Builder function renderIcon(type: WuToastType, name: string, iconSize: Length, loadingType: 'circular' | 'spinner', color: ResourceColor) { if (type === 'success') { WuIcon({ name: 'check', iconSize, color }) } else if (type === 'fail') { WuIcon({ name: 'warn', iconSize, color }) } else if (type === 'loa...
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 renderIcon AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#requir...
@Builder function renderIcon(type: WuToastType, name: string, iconSize: Length, loadingType: 'circular' | 'spinner', color: ResourceColor) { if (type === 'success') { WuIcon({ name: 'check', iconSize, color }) } else if (type === 'fail') { WuIcon({ name: 'warn', iconSize, color }) } else if (type === 'loa...
https://github.com/itrainhub/wu-ui
b0d442bbb555a7e6ef62c6a28623d89187b0538c
github
LJ666-ui/harmony-health-care
entry/src/main/ets/ar/PathPlanner.ets
arkts
getNearestPOI
查找最近的POI @param position 当前位置 @param category 分类(可选)
public getNearestPOI( position: Position3D, category?: DestinationCategory ): NavigationDestination | null { if (!this.buildingData) return null; let pois = this.buildingData.pois; if (category) { pois = pois.filter(poi => poi.category === category); } let nearest: NavigationDest...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getNearestPOI AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left position AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
public getNearestPOI( position: Position3D, category?: DestinationCategory ): NavigationDestination | null { if (!this.buildingData) return null; let pois = this.buildingData.pois; if (category) { pois = pois.filter(poi => poi.category === category); } let nearest: NavigationDest...
https://github.com/LJ666-ui/harmony-health-care
f4a81149e3a7cc39f7ddd2d75ea8d0c55bc4239a
github
the-wwyang/kids-learning-app
src/main/ets/storage/WrongQuestionStorageService.ets
arkts
addWrongQuestion
添加新错题记录 @param record 错题记录
static async addWrongQuestion(record: WrongQuestionRecord): Promise<void> { try { const records = await WrongQuestionStorageService.loadWrongQuestions(); // 检查是否已存在 const existingIndex = records.findIndex(r => r.id === record.id); if (existingIndex >= 0) { // 更新已存在的记录 reco...
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 addWrongQuestion AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left record AST#identifier#Right AST#:#Left ...
static async addWrongQuestion(record: WrongQuestionRecord): Promise<void> { try { const records = await WrongQuestionStorageService.loadWrongQuestions(); // 检查是否已存在 const existingIndex = records.findIndex(r => r.id === record.id); if (existingIndex >= 0) { // 更新已存在的记录 reco...
https://github.com/the-wwyang/kids-learning-app
16bfe5b0248bd6f0be35c5ae3d6837949b81eac8
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Parsers/TxtMetadataExtractor.ets
arkts
extractDescription
提取简介/文案
private static extractDescription(headerText: string): string { let description = ''; // 尝试提取文案/简介 for (const pattern of TxtMetadataExtractor.DESCRIPTION_PATTERNS) { const match = headerText.match(pattern); if (match && match[1]) { description = match[1].trim(); break; }...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left extractDescription AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left headerText AST#identifier#Right AST#ERROR#Left A...
private static extractDescription(headerText: string): string { let description = ''; // 尝试提取文案/简介 for (const pattern of TxtMetadataExtractor.DESCRIPTION_PATTERNS) { const match = headerText.match(pattern); if (match && match[1]) { description = match[1].trim(); break; }...
https://github.com/DaLongZhuaZi/manxia
d94fccaa693e07697deeb575d9fd7dfa3a46ab13
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/utils/StringUtil.ets
arkts
getTextDecoder
获取 TextDecoder 实例(单例)
private static getTextDecoder(): util.TextDecoder { if (!StringUtil.textDecoder) { StringUtil.textDecoder = util.TextDecoder.create('utf-8'); } return StringUtil.textDecoder; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getTextDecoder AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A...
private static getTextDecoder(): util.TextDecoder { if (!StringUtil.textDecoder) { StringUtil.textDecoder = util.TextDecoder.create('utf-8'); } return StringUtil.textDecoder; }
https://github.com/AlkaidLab/moonlight-harmony
241d849cb701c38507ca5c79725d2ef3cc23dcf9
github
harmonyos/codelabs
HarmonyOS_NEXT/Healthy_life/entry/src/main/ets/common/database/tables/FormInfoApi.ets
arkts
queryFormData
Query form data @param {Function} callback Return processing callback
public queryFormData(callback: Function): void { let predicates = new dataRdb.RdbPredicates(Const.FORM_INFO.tableName ? Const.FORM_INFO.tableName : ''); RdbUtils.query(predicates).then(resultSet => { let count = resultSet.rowCount; if (count === 0) { callback([]); } else { re...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left queryFormData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
public queryFormData(callback: Function): void { let predicates = new dataRdb.RdbPredicates(Const.FORM_INFO.tableName ? Const.FORM_INFO.tableName : ''); RdbUtils.query(predicates).then(resultSet => { let count = resultSet.rowCount; if (count === 0) { callback([]); } else { re...
https://gitee.com/harmonyos/codelabs.git
66e81ef13c3cb54a78179fc414242245992a591d
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Editor/FileEditorService.ets
arkts
createInstanceId
生成新的编辑器实例标识
public createInstanceId(): string { this.sequence++; return `file_editor_${Date.now()}_${this.sequence}`; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left createInstanceId 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 AS...
public createInstanceId(): string { this.sequence++; return `file_editor_${Date.now()}_${this.sequence}`; }
https://github.com/DaLongZhuaZi/manxia
89f14e2f193faaa5bb4618c2323614846209eb77
github
encorexin/WordPressCMS
harmonyos/entry/src/main/ets/services/search/GlobalSearchService.ets
arkts
searchKeywords
搜索关键词
private static async searchKeywords(searchTerm: string, userId: string): Promise<SearchResult[]> { const results: SearchResult[] = [] try { const keywords = await KeywordDao.findByUserId(userId) let count = 0 for (let i = 0; i < keywords.length && count < 5; i++) { const keyword = k...
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 searchKeywords AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left searchTerm AST#...
private static async searchKeywords(searchTerm: string, userId: string): Promise<SearchResult[]> { const results: SearchResult[] = [] try { const keywords = await KeywordDao.findByUserId(userId) let count = 0 for (let i = 0; i < keywords.length && count < 5; i++) { const keyword = k...
https://github.com/encorexin/WordPressCMS
898d6c2ba3d1d5bc6a0126b22eab8e531a15ae8c
github
LZZLHY/hlib
entry/src/main/ets/viewmodel/AuthVM.ets
arkts
switchToAccount
仅注入凭证,不发请求;用于"切换账号"快路径。
static async switchToAccount(account: SavedAccount): Promise<User> { return await AuthVM.loginWithToken(account.userId, account.userKey); }
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 switchToAccount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left account AST#identifier#Right AST#:#Left ...
static async switchToAccount(account: SavedAccount): Promise<User> { return await AuthVM.loginWithToken(account.userId, account.userKey); }
https://github.com/LZZLHY/hlib
a5a9df56897475124d7c148ce41a06ba9b4dd582
github
HarmonyOS_Samples/MusicHome
features/recommendation/src/main/ets/viewmodel/RecommendViewModel.ets
arkts
selectCategory
Updates the selected category chip index. @param index - Selected index in the category tab items array.
public selectCategory(index: number): void { this.selectedCategoryIndex = index; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left selectCategory 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 selectCategory(index: number): void { this.selectedCategoryIndex = index; }
https://gitcode.com/HarmonyOS_Samples/MusicHome
8685f2bb656b51f0497f49a0faf3571681ab6a0f
gitcode
aimilin6688/KeePassHO
entry/src/main/ets/services/RecentFilesService.ets
arkts
getRecentFile
获取最近打开的文件 @param filePath 文件路径
public async getRecentFile(filePath: string): Promise<RecentFile | null> { // 遍历最近打开的文件路径,找到匹配的文件 for (const recentFile of await this.getRecentFiles()) { if (recentFile.filePath === filePath) { // 如果找到匹配的文件,返回该文件 return recentFile; } } return null; }
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 getRecentFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath AST#identifier#Right AST#ERROR#Left AST#:#Left :...
public async getRecentFile(filePath: string): Promise<RecentFile | null> { // 遍历最近打开的文件路径,找到匹配的文件 for (const recentFile of await this.getRecentFiles()) { if (recentFile.filePath === filePath) { // 如果找到匹配的文件,返回该文件 return recentFile; } } return null; }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/RecentFilesService.ets#L430-L439
b4a3c0e8b60844469e46e1deb0d2aa0584ed7bee
github
Octo-o-o-o/harmonyos-ai-workspace
samples/templates/llm-sse-client/SseStreamManager.ets
arkts
consumeChunk
─── chunk → frame 切分 ─────────────────────────────────────
private consumeChunk(streamId: string, stream: SseStream, chunk: ArrayBuffer, listener: SseEventListener): void { if (stream.cancelled) { return } const bytes = new Uint8Array(chunk) // 关键:stream: true 让 UTF-8 多字节字符跨 chunk 时不乱码 stream.buffer += stream.decoder.decodeToString(bytes, { stream: ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left consumeChunk AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left streamId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#strin...
private consumeChunk(streamId: string, stream: SseStream, chunk: ArrayBuffer, listener: SseEventListener): void { if (stream.cancelled) { return } const bytes = new Uint8Array(chunk) // 关键:stream: true 让 UTF-8 多字节字符跨 chunk 时不乱码 stream.buffer += stream.decoder.decodeToString(bytes, { stream: ...
https://github.com/Octo-o-o-o/harmonyos-ai-workspace
79d1d642e7178f765eba207757d162a8e0643362
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
from
Creates an array from an object of std.core.Array<BigInt>. @param { Array<BigInt> } arr - An instance of the std.core.Array type to convert to an array. @returns { BigInt64Array } - A new BigInt64Array @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static from(arr: Array<BigInt>): BigInt64Array { let result = new BigInt64Array(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: Array<BigInt>): BigInt64Array { let result = new BigInt64Array(arr.length) result.set(arr) return result }
https://gitcode.com/iop123123/arkts-static-skills
97c5b6c38c998e20eb2009e4073a14014f90713f
gitcode
RedRackham-R/WanAndroidHarmoney
entry/src/main/ets/global/viewmodel/GlobalSettingViewModel.ets
arkts
setTheme
设置主题 @param themeNum 1 亮色主题 0 深色主题
public async setTheme(themeNum: number) { await lock.acquire() await GlobalWanCache.put(this.KEY_WAN_THEME, themeNum) if (themeNum === 0) { this.currentTheme = Wanthemes.DarkTheme } else { this.currentTheme = Wanthemes.LightTheme } this.currentThemeNum = themeNum lock.release(...
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 setTheme AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left themeNum AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#...
public async setTheme(themeNum: number) { await lock.acquire() await GlobalWanCache.put(this.KEY_WAN_THEME, themeNum) if (themeNum === 0) { this.currentTheme = Wanthemes.DarkTheme } else { this.currentTheme = Wanthemes.LightTheme } this.currentThemeNum = themeNum lock.release(...
https://github.com/RedRackham-R/WanAndroidHarmoney
090fdd57fa5c33e746c3915af7495f80119898bc
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/07.expressions/20.additive_expressions/02.additive_operators_for_numeric_types/float.ets
arkts
main
--- desc: Additions with NaN and INF params: {{ni.x}} + {{ni.y}} == {{ni.result}} ---
function main(): void { let x: {{ni.type}} = {{ni.x}};
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A...
function main(): void { let x: {{ni.type}} = {{ni.x}};
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
d5e91928140569273c959a1f0d1cad4b178a2b29
gitee
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/BarLineChartBaseModel.ets
arkts
setMaxVisibleValueCount
sets the number of maximum visible drawn values on the chart only active when setDrawValues() is enabled @param count
public setMaxVisibleValueCount(count: number): void { this.mMaxVisibleCount = count; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setMaxVisibleValueCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left count AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif...
public setMaxVisibleValueCount(count: number): void { this.mMaxVisibleCount = count; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
491fc7c584f9be912948453778e198a4a10f9734
gitee
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/buffer/AbstractBuffer.ets
arkts
constructor
Initialization with buffer-size. @param size
constructor(size: number) { this.index = 0; for (let i = 0; i < size; i++) { this.buffer = new Array<number>(); } }
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 size AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right A...
constructor(size: number) { this.index = 0; for (let i = 0; i < size; i++) { this.buffer = new Array<number>(); } }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
97eff0101c51de6e13fcb6cd302f293d8e6ba02d
gitee
LJ666-ui/harmony-health-care
entry/src/main/ets/common/utils/HttpUtil.ets
arkts
saveFamilyToken
保存家属Token
static async saveFamilyToken(token: string): Promise<void> { try { AppStorage.setOrCreate<string>('familyToken', token); const settings: SettingsUtil = SettingsUtil.getInstance(); await settings.saveFamilyToken(token); } catch (error) { console.error('[HttpUtil] 保存家属Token失败:', error); ...
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 saveFamilyToken AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left token AST#identifier#Right AST#:#Left : ...
static async saveFamilyToken(token: string): Promise<void> { try { AppStorage.setOrCreate<string>('familyToken', token); const settings: SettingsUtil = SettingsUtil.getInstance(); await settings.saveFamilyToken(token); } catch (error) { console.error('[HttpUtil] 保存家属Token失败:', error); ...
https://github.com/LJ666-ui/harmony-health-care
e2ea03c016e91b9f670f420498be98c6f55eb817
github
openharmony-sig/flutter_engine
shell/platform/ohos/flutter_embedding/flutter/src/main/ets/util/ByteBuffer.ets
arkts
byteOffset
The byte offset. @returns The byte offset.
get byteOffset(): number { return this.mByteOffset }
AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left byteOffset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right ...
get byteOffset(): number { return this.mByteOffset }
https://gitee.com/openharmony-sig/flutter_engine.git
1a76914ff302b2c9fdc0a2ec874e6f43bd7d60cc
gitee
zhubowen-bot/Bowen_ArkWeb_framework
entry/src/main/ets/utiles/EmitterUtil.ets
arkts
onSubscribe
订阅事件 @param eventId 事件ID,string类型的eventId不支持空字符串。 @param callback 事件的回调处理函数。
static onSubscribe<T>(eventId: string | number, callback: Callback<T>) { emitter.on(eventId.toString(), (eventData: emitter.GenericEventData<T>) => { callback(eventData.data); }); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#ERROR#Right AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#identifier#Left onSubscribe AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right...
static onSubscribe<T>(eventId: string | number, callback: Callback<T>) { emitter.on(eventId.toString(), (eventData: emitter.GenericEventData<T>) => { callback(eventData.data); }); }
https://github.com/zhubowen-bot/Bowen_ArkWeb_framework
d0b030d74c8a7aaa181fdacd1a5f62d5b4fd8723
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Process.ets
arkts
setRejectedPromiseHandler
This method updates handler that is applied to unhandled rejected promises at the program exit @param { RejectedObjectListener } listener user-provided handler
function setRejectedPromiseHandler(listener: RejectedObjectListener): void { rejectedPromiseHandler.register(listener); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left setRejectedPromiseHandler AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left listener AST#identifier#Right AST#type_annotation#Left AST#:...
function setRejectedPromiseHandler(listener: RejectedObjectListener): void { rejectedPromiseHandler.register(listener); }
https://gitcode.com/iop123123/arkts-static-skills
2194ef75d708f3ca0ec55a5d3cb72412f1a5d10f
gitcode
apap6628114/nga_oh
entry/src/main/ets/store/CategoryStore.ets
arkts
loadCachedCategories
============== Cache ==============
private async loadCachedCategories(): Promise<void> { const saved = await this.store.getJSON<Category[]>('cached_categories') if (saved && saved.length > 0) { this.cachedCategories = saved this.bumpCategoriesVersion() logger.info('Loaded cached categories: %{public}d', saved.length) } ...
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 loadCachedCategories AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Ri...
private async loadCachedCategories(): Promise<void> { const saved = await this.store.getJSON<Category[]>('cached_categories') if (saved && saved.length > 0) { this.cachedCategories = saved this.bumpCategoriesVersion() logger.info('Loaded cached categories: %{public}d', saved.length) } ...
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/store/CategoryStore.ets#L40-L47
d368d9ac62b912940d52fbab52a7704ff1757d25
github
LambdaYH/ScrcpyForHarmonyOS
app/src/main/ets/helper/Logger.ets
arkts
error
Error 级别日志
error(msg: string, ...args: (string | number | boolean | object | undefined | null)[]): void { const formattedMsg = this.formatMessage(msg, args); hilog.error(DOMAIN, this.tag, '%{public}s', formattedMsg); this.writeToFile(LogLevel.ERROR, 'ERROR', formattedMsg); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left error AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left msg AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Righ...
error(msg: string, ...args: (string | number | boolean | object | undefined | null)[]): void { const formattedMsg = this.formatMessage(msg, args); hilog.error(DOMAIN, this.tag, '%{public}s', formattedMsg); this.writeToFile(LogLevel.ERROR, 'ERROR', formattedMsg); }
https://github.com/LambdaYH/ScrcpyForHarmonyOS
d162fcabe27ced70b017d844f37d8e60b40b1370
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelSourceSearchService.ets
arkts
clearCache
清除搜索缓存 @param keyword 指定关键词清除,不传则清除所有
clearCache(keyword?: string, author?: string): void { if (keyword) { const cacheKey = this.getCacheKey(keyword, author); this.searchCache.delete(cacheKey); logger.info(TAG, `清除搜索缓存: ${keyword}`); } else { this.searchCache.clear(); logger.info(TAG, '清除所有搜索缓存'); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clearCache AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left keyword AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Rig...
clearCache(keyword?: string, author?: string): void { if (keyword) { const cacheKey = this.getCacheKey(keyword, author); this.searchCache.delete(cacheKey); logger.info(TAG, `清除搜索缓存: ${keyword}`); } else { this.searchCache.clear(); logger.info(TAG, '清除所有搜索缓存'); } }
https://github.com/DaLongZhuaZi/manxia
dcd6bd5c0a671c34eb1fb1d69485e46889d0d79b
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
constructor
Creates an Int32Array with respect to data, byteOffset and length. @param { ArrayBuffer } buf - data initializer @param { Number | undefined } byteOffset - byte offset from begin of the buf @param { Number | undefined } length - size of elements of type int in newly created Int32Array @throws { RangeError } - Input par...
public constructor(buf: ArrayBuffer, byteOffset: Number | undefined, length: Number | undefined) { let intByteOffset: int = 0 if (byteOffset != undefined) { intByteOffset = byteOffset.toInt() if (intByteOffset < 0) { throw new RangeError("Range Error: byteOffs...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left buf AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Array...
public constructor(buf: ArrayBuffer, byteOffset: Number | undefined, length: Number | undefined) { let intByteOffset: int = 0 if (byteOffset != undefined) { intByteOffset = byteOffset.toInt() if (intByteOffset < 0) { throw new RangeError("Range Error: byteOffs...
https://gitcode.com/iop123123/arkts-static-skills
9eecc23b876479c95a34083285c528eeafb7f27b
gitcode
Kira-Yagami-Light/Kira-Projects
XuanyinMusic/entry/src/main/ets/pages/Play.ets
arkts
parseLrc
LRC 解析函数:[mm:ss.xx]歌词行 → LyricLine[]
function parseLrc(lrc: string): LyricLine[] { const result: LyricLine[] = []; const metaKeywords = ['作词', '作曲', '编曲', '人声', '录音', '混音', '母带', '设计', '统筹', '发行', '营销', '监制', '出品', 'OP']; const lines = lrc.split('\n'); for (let i = 0; i < lines.length; i++) { const line = lines[i].trim(); const match =...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left parseLrc AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left lrc AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AS...
function parseLrc(lrc: string): LyricLine[] { const result: LyricLine[] = []; const metaKeywords = ['作词', '作曲', '编曲', '人声', '录音', '混音', '母带', '设计', '统筹', '发行', '营销', '监制', '出品', 'OP']; const lines = lrc.split('\n'); for (let i = 0; i < lines.length; i++) { const line = lines[i].trim(); const match =...
https://github.com/Kira-Yagami-Light/Kira-Projects
5d43cb7112a9b915621d37f6e4f255a60dd2f7ec
github
LJ666-ui/harmony-health-care
entry/src/main/ets/core/SmartWardInitializer.ets
arkts
loadPresetRules
加载预设规则
private loadPresetRules(): void { console.log('SmartWardInitializer: Loading preset rules...'); // 注意:这里需要从smartward/config导入预设规则 // const automationEngine = AutomationEngine.getInstance(); // automationEngine.loadRules(presetRules); console.log('SmartWardInitializer: Preset rules loading pendin...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left loadPresetRules AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#exp...
private loadPresetRules(): void { console.log('SmartWardInitializer: Loading preset rules...'); // 注意:这里需要从smartward/config导入预设规则 // const automationEngine = AutomationEngine.getInstance(); // automationEngine.loadRules(presetRules); console.log('SmartWardInitializer: Preset rules loading pendin...
https://github.com/LJ666-ui/harmony-health-care
078ebc52842dfadead2a7bdc0a832882561b4fab
github
tdcare/tdwebrtc
src/main/ets/WebRTCManager.ets
arkts
updateVideoTrackCodec
v25/v36: 更新已注册的视频轨道的 codec 和 payloadType SDP 协商后,实际使用的编解码器可能与初始添加轨道时不同。 例如: 偏好 H264(PT=102) 但协商后选择 VP8(PT=96) 必须同步更新 localTracks,否则 RTP 发送会用错误的 PT。 v36: 开放为 public,供 MediaStream 在编码器回退时同步轨道信息
public updateVideoTrackCodec(newCodec: string): void { const newPT: number = newCodec === 'VP8' ? 96 : (newCodec === 'VP9' ? 98 : 102); for (let i = 0; i < this.localTracks.length; i++) { if (this.localTracks[i].kind === 'video') { const oldCodec: string = this.localTracks[i].codec; cons...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left updateVideoTrackCodec AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left newCodec AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST...
public updateVideoTrackCodec(newCodec: string): void { const newPT: number = newCodec === 'VP8' ? 96 : (newCodec === 'VP9' ? 98 : 102); for (let i = 0; i < this.localTracks.length; i++) { if (this.localTracks[i].kind === 'video') { const oldCodec: string = this.localTracks[i].codec; cons...
https://github.com/tdcare/tdwebrtc
2d52f6ba32c5163b5caa9d3f5078326d0f135279
github
HarmonyOS_Samples/StateStore
entry/src/main/ets/model/TodoListModel.ets
arkts
constructor
[EndExclude todo_item_data]
constructor(taskDetail: string, selected?: boolean, id?: number) { this.id = id ? id : Date.now(); this.taskDetail = taskDetail; this.selected = selected; // [StartExclude todo_item_data] this.toDoItemSendable = new ToDoItemSendable(this.id, this.taskDetail, this.selected); this.state = this.t...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left taskDetail AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST...
constructor(taskDetail: string, selected?: boolean, id?: number) { this.id = id ? id : Date.now(); this.taskDetail = taskDetail; this.selected = selected; // [StartExclude todo_item_data] this.toDoItemSendable = new ToDoItemSendable(this.id, this.taskDetail, this.selected); this.state = this.t...
https://gitcode.com/HarmonyOS_Samples/StateStore
e453ccd6f8acb96bad2f7c382738a018dd6513e3
gitcode
offlinecat-dev/OCNetORM
src/main/ets/query/QueryBuilder.ets
arkts
withCount
关联计数 @param relationPath 关联路径 @param alias 结果别名,默认 `${relationPath}_count` @returns 当前实例(支持链式调用)
withCount(relationPath: string, alias: string = ''): QueryBuilder { this.relationStrategySupport.registerWithCount(relationPath, alias) return this }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left withCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left relationPath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , AST#,...
withCount(relationPath: string, alias: string = ''): QueryBuilder { this.relationStrategySupport.registerWithCount(relationPath, alias) return this }
https://github.com/offlinecat-dev/OCNetORM
4294b373c4b7022f5a3aed8708dbcae43e69b6c5
github
Joker-x-dev/CoolMallArkTS
feature/user/src/main/ets/viewmodel/AddressListViewModel.ets
arkts
requestListData
请求地址分页数据 @returns {Promise<NetworkResponse<NetworkPageData<Address>>>} 网络请求 Promise
protected requestListData(): Promise<NetworkResponse<NetworkPageData<Address>>> { const request: PageRequest = new PageRequest(); request.page = this.currentPage; request.size = this.pageSize; return this.repository.getAddressPage(request); }
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left requestListData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right A...
protected requestListData(): Promise<NetworkResponse<NetworkPageData<Address>>> { const request: PageRequest = new PageRequest(); request.page = this.currentPage; request.size = this.pageSize; return this.repository.getAddressPage(request); }
https://github.com/Joker-x-dev/CoolMallArkTS
5ddf529a02251e69e5b15c68a56c6787245cf021
github
Explore-In-HMOS-Wearable/how-to-use-weather-kit
entry/src/main/ets/utils/WeatherIconHelper.ets
arkts
setFallbackIcon
Set fallback icon for unknown conditions
setFallbackIcon(fallbackIcon: Resource): void { this.fallbackIcon = fallbackIcon; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setFallbackIcon AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left fallbackIcon AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Resource AST#identifier#Right AST#ERROR#Right AS...
setFallbackIcon(fallbackIcon: Resource): void { this.fallbackIcon = fallbackIcon; }
https://github.com/Explore-In-HMOS-Wearable/how-to-use-weather-kit
774c1ce2644838adc897b5011cce1267799a8534
github
DaLongZhuaZi/manxia
entry/src/main/ets/components/ImageLoadStateManager.ets
arkts
getPageState
获取页面状态
getPageState(pageId: string): PageState | null { return this.pageStates.get(pageId) || null; }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getPageState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pageId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left...
getPageState(pageId: string): PageState | null { return this.pageStates.get(pageId) || null; }
https://github.com/DaLongZhuaZi/manxia
e16683e1bcf9987666cacad8cb5dffb9259a0631
github
SMAT-Lab/PhantomRendering
example/entry/src/main/ets/common/DeviceUtils.ets
arkts
logDeviceInfo
日志输出设备信息
static logDeviceInfo(): void { console.info('==================== 设备适配信息 ====================') console.info(`屏幕尺寸: ${DeviceUtils.getScreenWidth()} x ${DeviceUtils.getScreenHeight()}`) console.info(`设备密度: ${DeviceUtils.getDensity()}`) console.info(`设备类型: ${DeviceUtils.getDeviceType()}`) console.in...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left logDeviceInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expressi...
static logDeviceInfo(): void { console.info('==================== 设备适配信息 ====================') console.info(`屏幕尺寸: ${DeviceUtils.getScreenWidth()} x ${DeviceUtils.getScreenHeight()}`) console.info(`设备密度: ${DeviceUtils.getDensity()}`) console.info(`设备类型: ${DeviceUtils.getDeviceType()}`) console.in...
https://github.com/SMAT-Lab/PhantomRendering
3af6b5db68a8a96f828e2909ef6f057e8cc62f37
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Char.ets
arkts
getHighSurrogate
getHighSurrogate(UTF_16_CodePoint) splits code point as a two code units and return the first one. The result can be malformed und thus has to be checked with {@link <isHighSurrogate(char)>}. @param { UTF_16_CodePoint } value an encoded code point. @returns { char } @static @syscap SystemCapability.Utils.Lang @FaAndSta...
public static getHighSurrogate(value: UTF_16_CodePoint): char { return (((value - 0x10000) >>> 10) + Char.HIGH_SURROGATE_MIN.toInt()).toChar() }
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 getHighSurrogate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left ...
public static getHighSurrogate(value: UTF_16_CodePoint): char { return (((value - 0x10000) >>> 10) + Char.HIGH_SURROGATE_MIN.toInt()).toChar() }
https://gitcode.com/iop123123/arkts-static-skills
099375333f1efa025ebe4b0cda8f8d93bddfd50b
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets
arkts
getBaseType
Returns base type of this class If this type is the type of Object class then returns this @returns {ClassType} base type of class @throws {TypeError} - Input parameter error. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public getBaseType(): ClassType { const base = this.cls.getSuper() return (base == null) ? this : Type.resolve(base.getDescriptor(), base.getLinker())! as ClassType }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getBaseType 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 ClassType ...
public getBaseType(): ClassType { const base = this.cls.getSuper() return (base == null) ? this : Type.resolve(base.getDescriptor(), base.getLinker())! as ClassType }
https://gitcode.com/iop123123/arkts-static-skills
58bdc5a95cb126ca79786fdee18b4802a064ea9f
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Char.ets
arkts
toUpperCase
toUpperCase() converts the underlying char to upper case if it is in lower case, otherwise the char unchanged @returns { Char } @syscap SystemCapability.Utils.Lang @FaAndStageModel
public toUpperCase(): Char { return Char.toUpperCase(this.value); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toUpperCase 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 Char AST#i...
public toUpperCase(): Char { return Char.toUpperCase(this.value); }
https://gitcode.com/iop123123/arkts-static-skills
cabd339b6f4558d67243f0403cb69a141cfd8faa
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/WebViewSourceManager.ets
arkts
getAllSourceIds
获取所有源ID
getAllSourceIds(): string[] { return Array.from(this.sourceConfigs.keys()); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getAllSourceIds AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Lef...
getAllSourceIds(): string[] { return Array.from(this.sourceConfigs.keys()); }
https://github.com/DaLongZhuaZi/manxia
876a5648e67f8567690538a214bb46b2e0d75187
github
RedRackham-R/WanAndroidHarmoney
entry/src/main/ets/global/viewmodel/GlobalCollectViewModel.ets
arkts
unSubscribeUncollectEvent
取消订阅取消收藏event
unSubscribeUncollectEvent(key: string) { EventBus.getInstance().unregistByKey(WanEventId.EVENT_UNCOLLECT, key) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left unSubscribeUncollectEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#ident...
unSubscribeUncollectEvent(key: string) { EventBus.getInstance().unregistByKey(WanEventId.EVENT_UNCOLLECT, key) }
https://github.com/RedRackham-R/WanAndroidHarmoney
0a9b6dfc9757cc396fc3be1a551dad54b82f4a8a
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets
arkts
getStringListByJsonPath
通过JSONPath获取字符串列表
private getStringListByJsonPath(path: string): string[] { try { const data: Object = SafeUtils.parseObj(this.content); const embeddedResult: string | null = this.replaceJsonPathEmbeddedRules(path, data as ESObject); if (embeddedResult !== null) { return embeddedResult.length > 0 ? [embed...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getStringListByJsonPath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ident...
private getStringListByJsonPath(path: string): string[] { try { const data: Object = SafeUtils.parseObj(this.content); const embeddedResult: string | null = this.replaceJsonPathEmbeddedRules(path, data as ESObject); if (embeddedResult !== null) { return embeddedResult.length > 0 ? [embed...
https://github.com/DaLongZhuaZi/manxia
acbbad70f804a315c142f1cf5f6f75f2ed8d07f9
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
map
Creates a new Int32Array using fn(arr[i]) over all elements of current Int32Array. @param fn a function to apply for each element of current Int32Array @returns a new Int32Array where for each element from current Int32Array fn was applied
public map(fn: (val: int, index: int) => int): Int32Array { let resBuf = new ArrayBuffer(this.length * Int32Array.BYTES_PER_ELEMENT) let res = new Int32Array(resBuf) for (let i = 0; i < this.length; ++i) { res.set(i, fn(this.at(i), i)) } return res }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left map AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right...
public map(fn: (val: int, index: int) => int): Int32Array { let resBuf = new ArrayBuffer(this.length * Int32Array.BYTES_PER_ELEMENT) let res = new Int32Array(resBuf) for (let i = 0; i < this.length; ++i) { res.set(i, fn(this.at(i), i)) } return res }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
7965b45873f9aa61ef3849b12a472def8682a547
gitee
HarmonyOS_Samples/BestPracticeSnippets
SegmentedPhotograph/entry/src/main/ets/mode/CameraService.ets
arkts
createPhotoOutputFn
[Start create_photo_outputFn] Creates a photoOutPut output object
createPhotoOutputFn(cameraManager: camera.CameraManager, photoProfileObj: camera.Profile): camera.PhotoOutput | undefined { let photoOutput: camera.PhotoOutput; try { photoOutput = cameraManager.createPhotoOutput(photoProfileObj); Logger.info(TAG, `createPhotoOutputFn success: ${photoOutput}`)...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left createPhotoOutputFn AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left cameraManager AST#identifier#Right AST#ERR...
createPhotoOutputFn(cameraManager: camera.CameraManager, photoProfileObj: camera.Profile): camera.PhotoOutput | undefined { let photoOutput: camera.PhotoOutput; try { photoOutput = cameraManager.createPhotoOutput(photoProfileObj); Logger.info(TAG, `createPhotoOutputFn success: ${photoOutput}`)...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
30c050fb72041f3ca2919a978d9203f05487f7c3
gitcode
richshaw2015/nds
ohos/entry/src/main/ets/utils/RAManager.ets
arkts
initAuth
初始化认证状态 (从持久化存储恢复)
async initAuth(): Promise<void> { const username = await this.settingsManager.get<string>('ra_username', ''); const token = await this.settingsManager.get<string>('ra_token', ''); if (username.length > 0 && token.length > 0) { const auth: RAUserAuth = { username: username, token: token }; this...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left initAuth AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_typ...
async initAuth(): Promise<void> { const username = await this.settingsManager.get<string>('ra_username', ''); const token = await this.settingsManager.get<string>('ra_token', ''); if (username.length > 0 && token.length > 0) { const auth: RAUserAuth = { username: username, token: token }; this...
https://github.com/richshaw2015/nds
b41d169f6303fbc0947b1123eb8e20a4d9180905
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/utils/NetworkErrorClassifierSelfCheck.ets
arkts
run
启动时调用一次。失败仅日志告警,不阻断应用启动。 @returns 失败用例数(0 表示全部通过)
static run(): number { let failed = 0; failed += NetworkErrorClassifierSelfCheck.runTransientErrorCases(); failed += NetworkErrorClassifierSelfCheck.runNetHelperCases(); failed += NetworkErrorClassifierSelfCheck.runWakeOnLanCases(); failed += NetworkErrorClassifierSelfCheck.runAddressSelectionCase...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left run AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right...
static run(): number { let failed = 0; failed += NetworkErrorClassifierSelfCheck.runTransientErrorCases(); failed += NetworkErrorClassifierSelfCheck.runNetHelperCases(); failed += NetworkErrorClassifierSelfCheck.runWakeOnLanCases(); failed += NetworkErrorClassifierSelfCheck.runAddressSelectionCase...
https://github.com/AlkaidLab/moonlight-harmony
def11bd021cfa8aa4cce557b27394e8bde368282
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelTxtTocRuleManager.ets
arkts
compilePatterns
编译正则表达式
private compilePatterns(): void { this.compiledPatterns.clear(); for (const rule of this.getEnabledRules()) { try { const pattern = new RegExp(rule.rule, 'm'); this.compiledPatterns.set(rule.id, pattern); } catch (error) { logger.warn(TAG, `编译正则失败 [${rule.name}]: ${String(e...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left compilePatterns AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#exp...
private compilePatterns(): void { this.compiledPatterns.clear(); for (const rule of this.getEnabledRules()) { try { const pattern = new RegExp(rule.rule, 'm'); this.compiledPatterns.set(rule.id, pattern); } catch (error) { logger.warn(TAG, `编译正则失败 [${rule.name}]: ${String(e...
https://github.com/DaLongZhuaZi/manxia
1fe159e70538b8976c4fe05c2e91d01daf7045c6
github
HarmonyOS_Samples/BestPracticeSnippets
ArkUI/Component_Reuse_Scenarios/entry/src/main/ets/segment/segment3.ets
arkts
build
[EndExclude Case3]
build() { Column() { List() { LazyForEach(this.dataSource, (item: MemoInfo) => { ListItem() { MemoItem({ memoItem: item })// Control of component reuse using reuseId .reuseId((item.imageSrc !== '') ? 'withImage' : 'noImage') } }, (item: MemoInfo)...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#object#Left AST#{#Left { AST#{#Right AST#method_def...
build() { Column() { List() { LazyForEach(this.dataSource, (item: MemoInfo) => { ListItem() { MemoItem({ memoItem: item })// Control of component reuse using reuseId .reuseId((item.imageSrc !== '') ? 'withImage' : 'noImage') } }, (item: MemoInfo)...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
41f5378269dbef48a2c866beaf0f24fd309b878c
gitcode
aimilin6688/KeePassHO
entry/src/main/ets/storage/cache/CacheConstants.ets
arkts
setForceRefresh
设置强制刷新标志 @param forceRefresh 是否强制刷新
static setForceRefresh(forceRefresh: boolean): void { AppStorage.setOrCreate(CacheConstants.FORCE_REFRESH_KEY, forceRefresh); hilog.debug(DOMAIN, TAG, `Set force refresh: ${forceRefresh}`); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setForceRefresh AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left forceRefresh AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST...
static setForceRefresh(forceRefresh: boolean): void { AppStorage.setOrCreate(CacheConstants.FORCE_REFRESH_KEY, forceRefresh); hilog.debug(DOMAIN, TAG, `Set force refresh: ${forceRefresh}`); }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/cache/CacheConstants.ets#L170-L173
8df23881721ce4681cfda6d1083e44c671c345f2
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/CloudSyncService.ets
arkts
cleanupOldRecords
清理旧的同步记录
static async cleanupOldRecords(userId: number, keepCount: number = 50): Promise<void> { try { await CloudSyncRecordDAO.deleteOldRecords(userId, keepCount); console.log(`[CloudSyncService] 清理旧记录成功`); } catch (error) { const errorMsg: string = error instanceof Error ? error.message : String(er...
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 cleanupOldRecords AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left...
static async cleanupOldRecords(userId: number, keepCount: number = 50): Promise<void> { try { await CloudSyncRecordDAO.deleteOldRecords(userId, keepCount); console.log(`[CloudSyncService] 清理旧记录成功`); } catch (error) { const errorMsg: string = error instanceof Error ? error.message : String(er...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
62dde01daa79af2be750315ed448eaea57b7d43e
github
iop123123/arkts-static-skills
benchmark/runs/20260508-173204/arkts_granularity_dev_9005/solution.ets
arkts
parseArrayAt
Function-level ArkTS language benchmark fixture task_id: arkts_granularity_dev_9005 title: ArkTS Dev TDD Bitmask Operation Order focus: Development-only TDD regression focused on bitmask_operation_order. The task uses a standalone task id and case text distinct from the formal benchmark pack. contract: Parse the raw JS...
function parseArrayAt(raw: string, keyIdx: number, keyLen: number): number[] { let result: number[] = []; let i: number = keyIdx + keyLen; while (i < raw.length && raw.charAt(i) !== '[') { i++; } if (i >= raw.length) { return result; } i++; while (i < raw.length && raw.charAt(i) !== ']') { while (i < ra...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left parseArrayAt AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left raw AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Righ...
function parseArrayAt(raw: string, keyIdx: number, keyLen: number): number[] { let result: number[] = []; let i: number = keyIdx + keyLen; while (i < raw.length && raw.charAt(i) !== '[') { i++; } if (i >= raw.length) { return result; } i++; while (i < raw.length && raw.charAt(i) !== ']') { while (i < ra...
https://gitcode.com/iop123123/arkts-static-skills
f2b3ae3e2877d77379e67307787568ce7d37b5a1
gitcode
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test53_original_index.ets
arkts
compressString
--- String compression (simple) ---
function compressString(s: string): string { if (s.length === 0) { return ''; } let result: string = ''; let count: number = 1; for (let i: number = 1; i < s.length; i++) { if (s.charAt(i) === s.charAt(i - 1)) { count = count + 1; } else { result = result + s.charAt(i - 1) + String(cou...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left compressString AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left s AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Righ...
function compressString(s: string): string { if (s.length === 0) { return ''; } let result: string = ''; let count: number = 1; for (let i: number = 1; i < s.length; i++) { if (s.charAt(i) === s.charAt(i - 1)) { count = count + 1; } else { result = result + s.charAt(i - 1) + String(cou...
https://github.com/miaochiahao/ark-ghidra
1b29aebf928ee1a868a0ce3a98312356e459c9e9
github
azhu0001/localsend-harmony
entry/src/main/ets/service/flush/FlushService.ets
arkts
cancel
取消文件写入
cancel() { this.isCanceled = true }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left cancel 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#...
cancel() { this.isCanceled = true }
https://gitcode.com/azhu0001/localsend-harmony
c0da04a49050f6570f9c59d72453af0e381d3da4
gitcode
openharmony-tpc/XmlGraphicsBatik
library/src/main/ets/batik/svggen/SVGLine.ets
arkts
getX1
获取起始点X坐标
public getX1(): number{ return this._x1; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left getX1 AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Rig...
public getX1(): number{ return this._x1; }
https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git
52c476852337acd80154e66013f7f92a98061526
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Source/SourceTester.ets
arkts
testLatest
测试最新更新
private async testLatest(sourceId: number): Promise<TestItemResult> { const startTime = Date.now(); try { const comics = await this.executor.getLatest(sourceId, 1, 5); if (!comics || comics.length === 0) { return { name: '最新更新', feature: 'latest', ...
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 testLatest AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left :...
private async testLatest(sourceId: number): Promise<TestItemResult> { const startTime = Date.now(); try { const comics = await this.executor.getLatest(sourceId, 1, 5); if (!comics || comics.length === 0) { return { name: '最新更新', feature: 'latest', ...
https://github.com/DaLongZhuaZi/manxia
fd58d31bf1052367fe171403fe005471a51a95ba
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/ArrayBuffer.ets
arkts
final
Sets the byte value at the specified index. @param { int } pos The position in the buffer. @param { byte } val The byte value to set. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public final set(pos: int, val: byte): void { if (this.data !== undefined) { this.doBoundaryCheck(pos) // NOTE(dslynko, #24647) research performance of managed code compared to intrinsics this.data![pos] = val } else { // Fallback to access through nat...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left final AST#identifier#Right AST#set#Left set AST#set#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pos AST#identifier#Right AS...
public final set(pos: int, val: byte): void { if (this.data !== undefined) { this.doBoundaryCheck(pos) // NOTE(dslynko, #24647) research performance of managed code compared to intrinsics this.data![pos] = val } else { // Fallback to access through nat...
https://gitcode.com/iop123123/arkts-static-skills
a5b0de8b484e5ef2cd9ada31f5f82511620f086f
gitcode
arkui-x/samples
CodeLab/Cases/feature/imageviewer/src/main/ets/view/ImageItemView.ets
arkts
evaluateBound
TODO:需求:在偏移时评估是否到达边界,以便进行位移限制与图片的切换 @returns:长度为4的boolean数组,表示上下左右是否到达边界
evaluateBound(): boolean[] { return [false, false, false, false]; }
AST#program#Left AST#expression_statement#Left AST#subscript_expression#Left AST#call_expression#Left AST#identifier#Left evaluateBound AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#bool...
evaluateBound(): boolean[] { return [false, false, false, false]; }
https://gitcode.com/arkui-x/samples
b62a5ec148c151fdf91a0a04b57194962824729d
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/pages/MainMenuPage.ets
arkts
activateNovelSwipeFor
==================== 小说左滑删除:辅助方法与确认弹窗 ====================
private activateNovelSwipeFor(novelId: string): void { if (this.novelMultiSelect.isActive) { return; } this.novelSwipe.activeId = novelId; this.novelSwipe.isActive = true; this.novelSwipe.offset = 0; this.novelSwipe = this.novelSwipe; logger.info(TAG, `开始小说列表左滑删除手势: ${novelId}`); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left activateNovelSwipeFor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left novelId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string A...
private activateNovelSwipeFor(novelId: string): void { if (this.novelMultiSelect.isActive) { return; } this.novelSwipe.activeId = novelId; this.novelSwipe.isActive = true; this.novelSwipe.offset = 0; this.novelSwipe = this.novelSwipe; logger.info(TAG, `开始小说列表左滑删除手势: ${novelId}`); }
https://github.com/DaLongZhuaZi/manxia
796935cc0e60299512116384972fb486e06ba9ac
github
CPF-ApplicationTPC/ImageKnife
library/src/main/ets/ImageKnife.ets
arkts
setReadTimeout
设置读取超时时长
setReadTimeout(timeout: number) { this.readTimeout = timeout }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setReadTimeout AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left timeout AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST...
setReadTimeout(timeout: number) { this.readTimeout = timeout }
https://gitcode.com/CPF-ApplicationTPC/ImageKnife/blob/b77b0fbdd908f68c6c5b9baf28a9ca75c07b6d0a/library/src/main/ets/ImageKnife.ets#L69-L71
e4f2a10edab82e0d0e71b639d65431686a5ed6dc
gitcode
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/BarData.ets
arkts
groupBars
Groups all BarDataSet objects this data object holds together by modifying the x-value of their entries. Previously set x-values of entries will be overwritten. Leaves space between bars and groups as specified by the parameters. Do not forget to call notifyDataSetChanged() on your BarChart object after calling this me...
public groupBars(fromX: number, groupSpace: number, barSpace: number): void { let dataSets = this.mDataSets; if (dataSets) { let setCount: number = dataSets.size(); if (setCount <= 1) { throw new Error("BarData needs to hold at least 2 BarDataSets to allow grouping."); } let m...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left groupBars AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left fromX AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left numbe...
public groupBars(fromX: number, groupSpace: number, barSpace: number): void { let dataSets = this.mDataSets; if (dataSets) { let setCount: number = dataSets.size(); if (setCount <= 1) { throw new Error("BarData needs to hold at least 2 BarDataSets to allow grouping."); } let m...
https://gitee.com/openharmony-tpc/ohos_mpchart.git
28d0e56b9ccdce37d80c3ad82386d0fbec26660d
gitee
jiahaozheng406/huawei-travel-app-HarmonyOS
entry/src/main/ets/viewmodel/SearchViewModel.ets
arkts
getTabItemDate
搜索框下, 不同搜索的tabitem的数据
getTabItemDate(): TabItem[] { return [ new TabItem( $r('app.media.jiudian'), '酒店' ), new TabItem( $r('app.media.huoche'), '火车票' ), new TabItem( $r('app.media.feiji'), '机票' ), new TabItem( $r('app.media.lvyou'), ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getTabItemDate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left TabItem AST#identifier#Right AST...
getTabItemDate(): TabItem[] { return [ new TabItem( $r('app.media.jiudian'), '酒店' ), new TabItem( $r('app.media.huoche'), '火车票' ), new TabItem( $r('app.media.feiji'), '机票' ), new TabItem( $r('app.media.lvyou'), ...
https://github.com/jiahaozheng406/huawei-travel-app-HarmonyOS
abd5a088b45f3b0a289859968b4b52e985d3f9b7
github
LongLiveY96/chatcube
entry/src/main/ets/viewmodels/SettingsManager.ets
arkts
waitForInitialization
等待初始化完成
async waitForInitialization(): Promise<void> { if (this.isInitialized) { return } if (this.initPromise !== null) { return this.initPromise } // 如果还没开始初始化,等待一小段时间后重试 return new Promise((resolve) => { const checkInit = (): void => { if (this.isInitialized) { r...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left waitForInitialization AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotatio...
async waitForInitialization(): Promise<void> { if (this.isInitialized) { return } if (this.initPromise !== null) { return this.initPromise } // 如果还没开始初始化,等待一小段时间后重试 return new Promise((resolve) => { const checkInit = (): void => { if (this.isInitialized) { r...
https://github.com/LongLiveY96/chatcube
14c88dea7cece20042b7208c13f309b76610e668
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/WeakMap.ets
arkts
constructor
The WeakMap() constructor creates WeakMap objects.
constructor() { }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A...
constructor() { }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
57d2a8833ba20dc2a414662903ef7c86ee58d357
gitee
SuppliedGoat435/NumberSlidingPuzzle
entry/src/main/ets/viewmodel/GameViewModel.ets
arkts
tap
── 点击某个格子 ────────────────────────────
tap(index: number) { if (this.isCompleted || !this.isRunning) return const zeroIndex = PuzzleUtil.getZeroIndex(this.board) if (!PuzzleUtil.canMove(index, zeroIndex, this.size)) return this.board = PuzzleUtil.move(this.board, index, zeroIndex) this.steps++ if (PuzzleUtil.isSolved(this.board)) {...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left tap AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Le...
tap(index: number) { if (this.isCompleted || !this.isRunning) return const zeroIndex = PuzzleUtil.getZeroIndex(this.board) if (!PuzzleUtil.canMove(index, zeroIndex, this.size)) return this.board = PuzzleUtil.move(this.board, index, zeroIndex) this.steps++ if (PuzzleUtil.isSolved(this.board)) {...
https://github.com/SuppliedGoat435/NumberSlidingPuzzle
4624a1d0557bc572c352e2d1dda175e4724b45a9
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Array.ets
arkts
reduce
Executes a user-supplied "reducer" callback function on each element of the array, in order, passing in the return value from the calculation on the preceding element. The final result of running the reducer across all elements of the array is a single value. Order is from left-to-right. @param fn reduce function @retu...
public reduce(fn: (a: T, b: T) => T): T { if (this.data.length == 0) { throw new TypeError("Reduce of empty array with no initial value") } let acc: T = this.data[0] for(let i = 1; i < this.data.length; i++) { acc = fn(acc, this.data[i]) } retu...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left reduce 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#:#R...
public reduce(fn: (a: T, b: T) => T): T { if (this.data.length == 0) { throw new TypeError("Reduce of empty array with no initial value") } let acc: T = this.data[0] for(let i = 1; i < this.data.length; i++) { acc = fn(acc, this.data[i]) } retu...
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
8e9f6400a5963794dcb84cdc33de02a41a684eaa
gitee
openharmony/applications_permission_manager
permissionmanager/src/main/ets/common/permissionGroupManager/PermissionGroupManager.ets
arkts
getGroupConfigs
根据带申请权限获取所有权限组列表 @param callerAppInfo 调用方信息 @param context 应用上下文 @param appName 应用名 @param locationFlag 位置权限组flag @param pasteBoardName 剪贴板信息 return
public getGroupConfigs( callerAppInfo: CallerAppInfo, context: common.ServiceExtensionContext, appName: string, locationFlag: number, pasteBoardName: string ): PermissionGroupConfig[] { let groupConfigList: PermissionGroupConfig[] = []; callerAppInfo.groupWithPermission.forEach((permissi...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getGroupConfigs AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callerAppInfo AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif...
public getGroupConfigs( callerAppInfo: CallerAppInfo, context: common.ServiceExtensionContext, appName: string, locationFlag: number, pasteBoardName: string ): PermissionGroupConfig[] { let groupConfigList: PermissionGroupConfig[] = []; callerAppInfo.groupWithPermission.forEach((permissi...
https://gitee.com/openharmony/applications_permission_manager.git
04922ce77fb653c7cb6b3083e1923a3f8f848631
gitee
wodekouwei/qlog
qloglib/src/main/ets/qlog/xlog/LogFileProvider.ets
arkts
getHistoryLogFiles
Xlog需要根据不同进程指定不同保持目录 所以会在当前目录下查找下级目录获取日志
public static getHistoryLogFiles(): Promise<string[]> { let logFileDir = LogFileProvider.getLogFileDirBase(); return fs.listFile(logFileDir, { recursion: true, // true:子目录下也遍历 listNum: 0, // 0:全部 filter: { suffix: [LogFileProvider.LOG_FILE_SUFFIX, LogFileProvider.TXT_FILE_SUFFIX] ...
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 getHistoryLogFiles AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right ...
public static getHistoryLogFiles(): Promise<string[]> { let logFileDir = LogFileProvider.getLogFileDirBase(); return fs.listFile(logFileDir, { recursion: true, // true:子目录下也遍历 listNum: 0, // 0:全部 filter: { suffix: [LogFileProvider.LOG_FILE_SUFFIX, LogFileProvider.TXT_FILE_SUFFIX] ...
https://gitcode.com/wodekouwei/qlog
dae2dca51556a4dff184ff280a4272100183c3a8
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
slice
Creates a slice of current Int8Array using range [begin, this.length). @param { int } begin - start index to be taken into slice @returns { Int8Array } - a new Int8Array with elements of current Int8Array[begin, this.length) @syscap SystemCapability.Utils.Lang @FaAndStageModel
public slice(begin: int): Int8Array { return this.sliceFromTo(begin, this.lengthInt) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left slice AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left begin AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#id...
public slice(begin: int): Int8Array { return this.sliceFromTo(begin, this.lengthInt) }
https://gitcode.com/iop123123/arkts-static-skills
d7b1725163be049e38aadba9dc8a2fd6b9e5b3f3
gitcode
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/listener/BarLineChartTouchListener.ets
arkts
getYDist
calculates the distance on the y-axis between two pointers (fingers on the display) @param e @return
private static getYDist(isTouchEvent: boolean, e: TouchEvent | GestureEvent): number { let y: number = 0; if (isTouchEvent) { e = e as TouchEvent; if (!e.touches || e.touches.length < 2 || !e.touches[0] || !e.touches[1]) { return 0; } y = Math.abs(e.touches[0].y - e.touches[1]....
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getYDist AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isTouchEvent AST#identifier#Right AST#ERROR#Left AST#:#Lef...
private static getYDist(isTouchEvent: boolean, e: TouchEvent | GestureEvent): number { let y: number = 0; if (isTouchEvent) { e = e as TouchEvent; if (!e.touches || e.touches.length < 2 || !e.touches[0] || !e.touches[1]) { return 0; } y = Math.abs(e.touches[0].y - e.touches[1]....
https://gitee.com/openharmony-tpc/ohos_mpchart.git
5032f93a02878757f4648b7f06c9179b7481f99b
gitee
openharmony/applications_app_samples
code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/uploadanddownload/RequestUpload.ets
arkts
uploadFiles
失败回调 上传文件
async uploadFiles(fileUris: Array<string>, callback: (progress: number, isSucceed: boolean) => void): Promise<void> { logger.info(TAG, `uploadFiles begin, ${JSON.stringify(fileUris)}`); if (fileUris.length === 0) { return; } // Found an ongoing upload task, prompted and returned. let tasks =...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left uploadFiles AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left fileUris AST#identifier#Right AST#type_annotation#Left AST...
async uploadFiles(fileUris: Array<string>, callback: (progress: number, isSucceed: boolean) => void): Promise<void> { logger.info(TAG, `uploadFiles begin, ${JSON.stringify(fileUris)}`); if (fileUris.length === 0) { return; } // Found an ongoing upload task, prompted and returned. let tasks =...
https://github.com/openharmony/applications_app_samples
3bd956ab8020410b066c30c5f8a8b3d6cf210c06
github