nwo
stringclasses
449 values
path
stringlengths
9
173
language
stringclasses
1 value
identifier
stringlengths
1
53
docstring
stringlengths
5
4.13k
function
stringlengths
10
87.2k
ast_function
stringlengths
351
354k
obf_function
stringlengths
10
87.2k
url
stringlengths
30
175
function_sha
stringlengths
40
40
source
stringclasses
3 values
openharmony/codelabs
Data/PersonalAssistantPro/entry/src/main/ets/viewmodel/EventViewModel.ets
arkts
checkConflict
检查是否与现有日程冲突
public async checkConflict(startTime: number, endTime: number, excludeId?: number): Promise<boolean> { this.logger.info('Checking for event conflicts...'); try { const allEvents = await EventModel.queryUpcoming(); for (const event of allEvents) { if (excludeId && event.id === excludeId) ...
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 checkConflict AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left startTime AST#identifier#Right AST#ERROR#Left AST#:#Left ...
public async checkConflict(startTime: number, endTime: number, excludeId?: number): Promise<boolean> { this.logger.info('Checking for event conflicts...'); try { const allEvents = await EventModel.queryUpcoming(); for (const event of allEvents) { if (excludeId && event.id === excludeId) ...
https://gitcode.com/openharmony/codelabs
f3fac2c1088ff45cc3bb3f4f10f34715693faa38
gitcode
openharmony/arkui_ace_engine
advanced_ui_component_static/assembled_advanced_ui_component/@ohos.arkui.advanced.GridObjectSortComponentV2.ets
arkts
imageTextAddIconVisible
Displaying and hiding area icons in image_text mode
imageTextAddIconVisible(select: GridObjectSortComponentV2Item): Visibility { const iconHideShow: boolean = this.clickAddBtn && this.content.id === select.id && !this.gridComState; const visible = iconHideShow ? Visibility.Hidden : Visibility.Visible; return visible; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left imageTextAddIconVisible AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left select AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left GridObjectSortComponentV2Item ...
imageTextAddIconVisible(select: GridObjectSortComponentV2Item): Visibility { const iconHideShow: boolean = this.clickAddBtn && this.content.id === select.id && !this.gridComState; const visible = iconHideShow ? Visibility.Hidden : Visibility.Visible; return visible; }
https://gitcode.com/openharmony/arkui_ace_engine
e2673dec54b11c13bc30e272db4daddff45ce0ff
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Exceptions.ets
arkts
constructor
Constructs an IllegalArgumentError instance. @param { String } [ message ] The error message. @param { ErrorOptions } [ options ] Error options, usually containing the error stack information. @syscap SystemCapability.Utils.Lang @FaAndStageModel
constructor(message?: String, options?: ErrorOptions) { super("IllegalArgumentError", message, options) }
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 message AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#identifier#Left String AST#identi...
constructor(message?: String, options?: ErrorOptions) { super("IllegalArgumentError", message, options) }
https://gitcode.com/iop123123/arkts-static-skills
8defbb520e5bdbdbc1f264fa320f79e8c0316996
gitcode
Tencent-RTC/TUIKit_Harmony
atomic_x/src/main/ets/messagelist/components/MessageList.ets
arkts
showForwardTypeSelector
Show the forward type selector (ActionSheet) Allows user to choose between separate forward and merged forward
showForwardTypeSelector() { const selectedCount = this.selectedMessageIDs.size; const exceedsLimit = selectedCount > MessageList.MAX_SEPARATE_FORWARD_COUNT; this.forwardTypeDialogController = new CustomDialogController({ builder: ForwardTypeDialog({ showSeparateOption: !exceedsLimit, ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left showForwardTypeSelector 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_...
showForwardTypeSelector() { const selectedCount = this.selectedMessageIDs.size; const exceedsLimit = selectedCount > MessageList.MAX_SEPARATE_FORWARD_COUNT; this.forwardTypeDialogController = new CustomDialogController({ builder: ForwardTypeDialog({ showSeparateOption: !exceedsLimit, ...
https://github.com/Tencent-RTC/TUIKit_Harmony
c79d2190fd2d9c5148d0f410505360432d16e1e9
github
harmonyos/codelabs
HarmonyOS_NEXT/OxHornCampus/entry/src/main/ets/controller/MapController.ets
arkts
calLandmarksPosition
Calculating Landmark Locations.
calLandmarksPosition(data: AddressItem): void { data.locations = data.locations.map((item: Location) => { item.positionX = item.oriPositionX * this.mapMultiples() - Const.MAP_LANDMARKS_SIZE * Const.MAP_ZOOM_RATIO / Const.DOUBLE_OR_HALF; item.positionY = item.oriPositionY * this.mapMultiples() ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left calLandmarksPosition AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left AddressItem AST#identifier#Right AS...
calLandmarksPosition(data: AddressItem): void { data.locations = data.locations.map((item: Location) => { item.positionX = item.oriPositionX * this.mapMultiples() - Const.MAP_LANDMARKS_SIZE * Const.MAP_ZOOM_RATIO / Const.DOUBLE_OR_HALF; item.positionY = item.oriPositionY * this.mapMultiples() ...
https://gitee.com/harmonyos/codelabs.git
be16329bf57aeb71328c7fabce927015c950c7fe
gitee
openharmony-tpc/openharmony_tpc_samples
LibphoneNumber/entry/src/main/ets/pages/Index.ets
arkts
useLibPhoneNumberJsCore
使用自定义元数据,引入libphonenumber-js/core 使用场景: 1、在某个工程中,可能只需要处理几个特定的国家的号码 2、所谓自定义元数据,就是只包含几个特定的国家的元数据,比如CN和US 3、这个元数据只能用来解析CN和US的号码,解析其他国家会异常
useLibPhoneNumberJsCore() { // 这里只列举使用自定义元数据接口的几个示例,其它接口和使用普通元数据用法相同 const number: string[] = ['+8618717452985', '+12133734253', '+78005553535']; const type = new coreAsYouType('CN', customData).input(number[0]); Log.showInfo(TAG + ' libphonenumber-js/core AsYouType : ' + type); Log...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left useLibPhoneNumberJsCore 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_...
useLibPhoneNumberJsCore() { // 这里只列举使用自定义元数据接口的几个示例,其它接口和使用普通元数据用法相同 const number: string[] = ['+8618717452985', '+12133734253', '+78005553535']; const type = new coreAsYouType('CN', customData).input(number[0]); Log.showInfo(TAG + ' libphonenumber-js/core AsYouType : ' + type); Log...
https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git
ee345b2f916b4180b2ea8cd75ce4d215448a3aee
gitee
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test9_original_index.ets
arkts
classifyNumber
--- Multiple return paths ---
function classifyNumber(n: number): string { if (n > 0) { return 'positive'; } if (n === 0) { return 'zero'; } return 'negative'; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left classifyNumber AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left n AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Righ...
function classifyNumber(n: number): string { if (n > 0) { return 'positive'; } if (n === 0) { return 'zero'; } return 'negative'; }
https://github.com/miaochiahao/ark-ghidra
ab3125e4676cb9b857cd8d984b90cdd16772e8b2
github
HarmonyOS_Samples/MusicHome
products/pc/src/main/ets/pcability/PcAbility.ets
arkts
onDestroy
Logs ability destroy.
onDestroy(): void { Logger.info('PcAbility: Ability onDestroy'); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onDestroy 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#Le...
onDestroy(): void { Logger.info('PcAbility: Ability onDestroy'); }
https://gitcode.com/HarmonyOS_Samples/MusicHome
2a05cc02de1d1086aa13ff20281b5105a4443616
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/utils/BackgroundImageUtil.ets
arkts
setContext
设置应用上下文(必须在使用前调用)
setContext(context: common.Context): void { this.context = context; this.landscapeCachePath = `${context.cacheDir}/${CACHED_BACKGROUND_LANDSCAPE}`; this.portraitCachePath = `${context.cacheDir}/${CACHED_BACKGROUND_PORTRAIT}`; // 根据当前方向设置默认缓存路径 this.updateCachePathForOrientation(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setContext AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Left common AST#iden...
setContext(context: common.Context): void { this.context = context; this.landscapeCachePath = `${context.cacheDir}/${CACHED_BACKGROUND_LANDSCAPE}`; this.portraitCachePath = `${context.cacheDir}/${CACHED_BACKGROUND_PORTRAIT}`; // 根据当前方向设置默认缓存路径 this.updateCachePathForOrientation(); }
https://github.com/AlkaidLab/moonlight-harmony
103144d7c3cb91df821f476bf4b97bb2c03b7a1f
github
RoooyHe/toona-ohos
toona/src/main/ets/database/LocalDatabase.ets
arkts
messageToEntity
── Entity ↔ Model mappers ──
private messageToEntity(msg: Message): MessageEntity { const entity = new MessageEntity(); entity.event_id = msg.eventId; entity.room_id = msg.roomId; entity.sender = msg.sender; entity.type = msg.type; entity.content = msg.content; entity.timestamp = msg.timestamp; entity.is_outgoing ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left messageToEntity 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#Lef...
private messageToEntity(msg: Message): MessageEntity { const entity = new MessageEntity(); entity.event_id = msg.eventId; entity.room_id = msg.roomId; entity.sender = msg.sender; entity.type = msg.type; entity.content = msg.content; entity.timestamp = msg.timestamp; entity.is_outgoing ...
https://github.com/RoooyHe/toona-ohos
22bd5bf81e35d856278ac2f1bd7b463ac260630e
github
openharmony-sig/flutter_engine
shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/FlutterShellArgs.ets
arkts
fromWant
从意图中解析参数,创建shellArgs @returns
static fromWant(want: Want): FlutterShellArgs { let flutterShellArgs: FlutterShellArgs = new FlutterShellArgs(); FlutterShellArgs.checkArg(FlutterShellArgs.ARG_KEY_TRACE_STARTUP, FlutterShellArgs.ARG_TRACE_STARTUP, want, flutterShellArgs); FlutterShellArgs.checkArg(FlutterShellArgs.ARG_KEY_START_PAUSED, F...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left fromWant AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Want AS...
static fromWant(want: Want): FlutterShellArgs { let flutterShellArgs: FlutterShellArgs = new FlutterShellArgs(); FlutterShellArgs.checkArg(FlutterShellArgs.ARG_KEY_TRACE_STARTUP, FlutterShellArgs.ARG_TRACE_STARTUP, want, flutterShellArgs); FlutterShellArgs.checkArg(FlutterShellArgs.ARG_KEY_START_PAUSED, F...
https://gitee.com/openharmony-sig/flutter_engine.git
87c541838f903351af485356a50c7454bb59cc18
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
findLastIndex
Finds an index of the last element in the Int16Array that satisfies the condition @param { function } fn - condition @returns { int } - the index of the last element that satisfies fn, -1 otherwise @syscap SystemCapability.Utils.Lang @FaAndStageModel
public findLastIndex(fn: (val: number, index: int, array: Int16Array) => boolean): int { for (let i = this.lengthInt - 1; i >= 0; --i) { let val = this.getUnsafe(i) if (fn((val).toDouble(), i, this)) { return i } } return -1 }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left findLastIndex 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 : ...
public findLastIndex(fn: (val: number, index: int, array: Int16Array) => boolean): int { for (let i = this.lengthInt - 1; i >= 0; --i) { let val = this.getUnsafe(i) if (fn((val).toDouble(), i, this)) { return i } } return -1 }
https://gitcode.com/iop123123/arkts-static-skills
713a192f9ad547d445b432a526e1044983ca2bcd
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/utils/BackgroundImageUtil.ets
arkts
getPipwApiUrl
获取 Pipw 二次元壁纸 API URL(根据屏幕方向)
getPipwApiUrl(): string { try { const displayInfo = display.getDefaultDisplaySync(); const isPortrait = displayInfo.height > displayInfo.width; if (this.refreshTimestamp === 0) { this.refreshTimestamp = Date.now(); } const source = BACKGROUND_API_SOURCES.pipw; const bas...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getPipwApiUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statemen...
getPipwApiUrl(): string { try { const displayInfo = display.getDefaultDisplaySync(); const isPortrait = displayInfo.height > displayInfo.width; if (this.refreshTimestamp === 0) { this.refreshTimestamp = Date.now(); } const source = BACKGROUND_API_SOURCES.pipw; const bas...
https://github.com/AlkaidLab/moonlight-harmony
e8e07e6f0c934886d7857e7f33ee5cb621489bc3
github
banggx/account_app_harmonyos
entry/src/main/ets/service/account.ets
arkts
deleteById
根据id删除一条记录
deleteById(id: number) { return AccountModel.deleteById(id); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left deleteById AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#...
deleteById(id: number) { return AccountModel.deleteById(id); }
https://github.com/banggx/account_app_harmonyos
a1cb890d8cece106ded981566361b309dbbee233
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
from
Creates an Uint16Array from array-like argument @param o array-like object to initialize Uint16Array @returns new Uint16Array
public from(o: Object): Uint16Array { throw new Error("Uint16Array.from: not implemented") }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left from AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left o AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#R...
public from(o: Object): Uint16Array { throw new Error("Uint16Array.from: not implemented") }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
937582cac15dd71427212092fc53ed1653a6abbe
gitee
cpdd5201314/harmonyOS-music-app
products/phone/src/main/ets/pages/MusicApiClient.ets
arkts
getMusicLyric
获取音乐歌词
public static async getMusicLyric(source: string, musicInfo: MusicInfo): Promise<LyricData> { if (source !== 'local') { throw new Error(`不支持的音源(${source})获取歌词`); } let songId = musicInfo.id ?? ''; if (!songId.startsWith('server_')) { throw new Error('不支持的本地文件'); } songId = songI...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left getMusicLyric AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left sour...
public static async getMusicLyric(source: string, musicInfo: MusicInfo): Promise<LyricData> { if (source !== 'local') { throw new Error(`不支持的音源(${source})获取歌词`); } let songId = musicInfo.id ?? ''; if (!songId.startsWith('server_')) { throw new Error('不支持的本地文件'); } songId = songI...
https://github.com/cpdd5201314/harmonyOS-music-app
c2df2ce3ebf4a54ad9f0f1a09ba74b149d5c8e70
github
LongLiveY96/chatcube
entry/src/main/ets/services/ProviderShareCodec.ets
arkts
encode
把一个服务商序列化、加密成 envelope JSON 字符串(QR 内容)。 includeApiKey=false 时 apiKey 字段会被置空,接收方导入后需要自己填写 key。
async encode( provider: ModelProvider, password: string, includeApiKey: boolean ): Promise<ProviderShareCodecEncodeResult> { try { const data: ProviderShareDataV1 = { n: provider.name, t: provider.type as string, as: provider.apiStyle as string, url: provider.ba...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left encode AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left provider AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#...
async encode( provider: ModelProvider, password: string, includeApiKey: boolean ): Promise<ProviderShareCodecEncodeResult> { try { const data: ProviderShareDataV1 = { n: provider.name, t: provider.type as string, as: provider.apiStyle as string, url: provider.ba...
https://github.com/LongLiveY96/chatcube
2f6851162ef553c14ebbfc2ea1b9a246764b358e
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/MangaSourceConfigParser.ets
arkts
validateWorkflows
验证工作流配置
private validateWorkflows(config: MangaSourceConfig): ValidateWorkflowsResult { // 根据图源类型确定必需的工作流 const sourceType = config.metadata?.type || 'manga'; let requiredWorkflows: string[]; if (sourceType === 'ebook') { // 电子书源只需要search和getBookDetail requiredWorkflows = ['search']; lo...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left validateWorkflows AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie...
private validateWorkflows(config: MangaSourceConfig): ValidateWorkflowsResult { // 根据图源类型确定必需的工作流 const sourceType = config.metadata?.type || 'manga'; let requiredWorkflows: string[]; if (sourceType === 'ebook') { // 电子书源只需要search和getBookDetail requiredWorkflows = ['search']; lo...
https://github.com/DaLongZhuaZi/manxia
6205c31fffd1a977b35415bc12157ddabc859bf5
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
with
Creates a copy with replaced value on index @param { int } index - index to change @param { BigInt } value - value to set @returns { BigInt64Array } - an BigInt64Array with replaced value on index @throws { RangeError } - If the index exceeds the array range, throw an exception @syscap SystemCapability.Utils.Lang @FaAn...
public with(index: int, value: BigInt): BigInt64Array { let res = new BigInt64Array(this) res.set(index, value.getLong()) return res }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#ERROR#Right AST#with_statement#Left AST#with#Left with AST#with#Right AST#parenthesized_expression#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST...
public with(index: int, value: BigInt): BigInt64Array { let res = new BigInt64Array(this) res.set(index, value.getLong()) return res }
https://gitcode.com/iop123123/arkts-static-skills
13051e53ca17e37f2ce4c1f1f9385646c78d12ce
gitcode
openharmony-sig/ohos_image_view_zoom
library/src/main/ets/components/ImageViewTouch.ets
arkts
gestureConversion
设置滑动手势与拖拽手势的方向
public gestureConversion(panDirection: PanDirection, swipeDirection?: SwipeDirection, vertical?: boolean): void { this.panOption.setDirection(panDirection) if (swipeDirection !== undefined) { this.swipeDirection = swipeDirection if(vertical !== undefined) { this.vertical = vert...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left gestureConversion AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left panDirection AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi...
public gestureConversion(panDirection: PanDirection, swipeDirection?: SwipeDirection, vertical?: boolean): void { this.panOption.setDirection(panDirection) if (swipeDirection !== undefined) { this.swipeDirection = swipeDirection if(vertical !== undefined) { this.vertical = vert...
https://gitee.com/openharmony-sig/ohos_image_view_zoom.git
0b9695b084074023534f0276dfc8b769c4256df8
gitee
dingzhilin1990/zhilinclaw
src/security/SandboxedExecutor.ets
arkts
getToolCode
获取工具代码
private getToolCode(toolName: string): string { // 实际项目中应该从工具库中加载 return `// ${toolName} 的工具代码`; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getToolCode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left toolName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string...
private getToolCode(toolName: string): string { // 实际项目中应该从工具库中加载 return `// ${toolName} 的工具代码`; }
https://github.com/dingzhilin1990/zhilinclaw
7cca4ed71c2ae15ca5306c682637cf918cfe6640
github
Joker-x-dev/CoolMallArkTS
core/navigation/src/main/ets/user/UserNavigator.ets
arkts
toAddressDetail
跳转到收货地址详情 @param {boolean} isEditMode - 是否为编辑模式(默认 false) @param {number} addressId - 地址 ID(0表示新增,默认 0) @returns {Promise<RefreshResult | undefined>} 返回结果 Promise
static toAddressDetail(isEditMode: boolean = false, addressId: number = 0): Promise<RefreshResult | undefined> { const params: UserAddressDetailParam = { isEditMode, addressId }; return navigateToForResult<RefreshResult>(UserRoutes.AddressDetail, params); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left toAddressDetail AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left isEditMode AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment...
static toAddressDetail(isEditMode: boolean = false, addressId: number = 0): Promise<RefreshResult | undefined> { const params: UserAddressDetailParam = { isEditMode, addressId }; return navigateToForResult<RefreshResult>(UserRoutes.AddressDetail, params); }
https://github.com/Joker-x-dev/CoolMallArkTS
1bc75e15f4271b08da8557114749480412ee12c1
github
encorexin/WordPressCMS
harmonyos/entry/src/main/ets/pages/AdminPage.ets
arkts
build
========== 构建 UI ==========
build() { NavDestination() { Stack() { Column() { // 顶部工具栏 this.ToolbarArea() // 内容区 if (this.currentUserRole !== UserRole.Admin) { this.AccessDeniedView() } else if (this.isLoading) { this.LoadingView() } else if (...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST...
build() { NavDestination() { Stack() { Column() { // 顶部工具栏 this.ToolbarArea() // 内容区 if (this.currentUserRole !== UserRole.Admin) { this.AccessDeniedView() } else if (this.isLoading) { this.LoadingView() } else if (...
https://github.com/encorexin/WordPressCMS
2839471b889deb04ab26c5b42c1bf1d5fc5753e6
github
1ilI/WebViewJavascriptBridge_harmony
webview_javascript_bridge/src/main/ets/WebViewJavascriptBridgeTools.ets
arkts
_mapGetValue
内部方法,获取一个 字典 下,对应 keys 顺序的 值 @param map map 对象 @param keys [aaa, bbb, ccc] 多级 key 拆分的数组 @returns 结果
private static _mapGetValue(map: Object | undefined, keys: Array<string>): Object | undefined { // map 无数据 if (map === undefined || map === null) { return undefined; } // map 转 newMap const newMap = WebViewJavascriptBridgeTools.objToObjMap(map); // newMap 无数据 if (newMap.size === 0) {...
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 _mapGetValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left map AST#identifier#Right AST#:#Left : A...
private static _mapGetValue(map: Object | undefined, keys: Array<string>): Object | undefined { // map 无数据 if (map === undefined || map === null) { return undefined; } // map 转 newMap const newMap = WebViewJavascriptBridgeTools.objToObjMap(map); // newMap 无数据 if (newMap.size === 0) {...
https://github.com/1ilI/WebViewJavascriptBridge_harmony
29032f062e1c8dd03ddabacb9e9f324fcc457380
github
openharmony/applications_app_samples
code/BasicFeature/Media/Image/photomodify/src/main/ets/components/util/FileUtil.ets
arkts
packToFileFromPicture
将picture编码成file
async packToFileFromPicture(fileName: string): Promise<string> { let context = getContext(); let filePath = context.filesDir + `/` + fileName; let file = await fs.open(filePath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); let message = ndkTest.packToFilePicture(file.fd); if (message != 0) { ...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left packToFileFromPicture AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left fileName AST#identifier#Right AST#type_annotatio...
async packToFileFromPicture(fileName: string): Promise<string> { let context = getContext(); let filePath = context.filesDir + `/` + fileName; let file = await fs.open(filePath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); let message = ndkTest.packToFilePicture(file.fd); if (message != 0) { ...
https://github.com/openharmony/applications_app_samples
fe5a3bc54382376389ed16ae68f5a3ba46de9c88
github
DaLongZhuaZi/manxia
entry/src/main/ets/pages/NovelSourceManagementPage.ets
arkts
batchDeleteSources
批量删除书源
batchDeleteSources(): void { if (this.selectedSourceIds.size === 0) { this.getUIContext().getPromptAction().showToast({ message: '请先选择书源' }); return; } const sourceIds = Array.from(this.selectedSourceIds); const payload: DeleteDialogPayload = { mode: 'batch', sourceIds: source...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left batchDeleteSources AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#{#Left { AST#{#Right AST#...
batchDeleteSources(): void { if (this.selectedSourceIds.size === 0) { this.getUIContext().getPromptAction().showToast({ message: '请先选择书源' }); return; } const sourceIds = Array.from(this.selectedSourceIds); const payload: DeleteDialogPayload = { mode: 'batch', sourceIds: source...
https://github.com/DaLongZhuaZi/manxia
e532afa2774a0dec33be615d9e32af8a2aa8f106
github
apap6628114/nga_oh
entry/src/main/ets/parser/nga/html-thread/DomMarkerExtractor.ets
arkts
extractThreadSubject
提取主题标题(已 trim)。 @param html 源 HTML @returns 主题标题;未找到时返回空串
function extractThreadSubject(html: string): string { const marker: string = "<h1 id='currentTopicName'"; const startIdx: number = html.indexOf(marker); if (startIdx < 0) { return ''; } const tagEnd: number = html.indexOf('>', startIdx); if (tagEnd < 0) { return ''; } const contentStart: number ...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left extractThreadSubject AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left html AST#identifier#Right AST#type_annotation#Left AST#:#Left : A...
function extractThreadSubject(html: string): string { const marker: string = "<h1 id='currentTopicName'"; const startIdx: number = html.indexOf(marker); if (startIdx < 0) { return ''; } const tagEnd: number = html.indexOf('>', startIdx); if (tagEnd < 0) { return ''; } const contentStart: number ...
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/parser/nga/html-thread/DomMarkerExtractor.ets#L113-L129
cf3c7883fbdf15aa4d54e2fe3827236b124990f5
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test31_original_index.ets
arkts
testVoidExpr
--- void operator (returns undefined) ---
function testVoidExpr(): string { let a: number = 42; let b: number | undefined = void a; return String(b); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testVoidExpr 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_typ...
function testVoidExpr(): string { let a: number = 42; let b: number | undefined = void a; return String(b); }
https://github.com/miaochiahao/ark-ghidra
21c1f716b810963e6df466f99036f1c74c899bb4
github
Dabing-0x19d/berverage_HarmonyOS6.0
entry/src/main/ets/components/HomeCard.ets
arkts
getRecentWeekRecords
过滤出最近一周的记录
getRecentWeekRecords(): CoffeeRecord[] { const now = new Date() const oneWeekAgo = new Date(now.getTime() - 7 * 24 * 60 * 60 * 1000) oneWeekAgo.setHours(0, 0, 0, 0) return this.recentRecords.filter(record => { const recordDate = new Date(record.createTime) return recordDate >= oneWeekAgo ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getRecentWeekRecords 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 CoffeeRecord AST#identifie...
getRecentWeekRecords(): CoffeeRecord[] { const now = new Date() const oneWeekAgo = new Date(now.getTime() - 7 * 24 * 60 * 60 * 1000) oneWeekAgo.setHours(0, 0, 0, 0) return this.recentRecords.filter(record => { const recordDate = new Date(record.createTime) return recordDate >= oneWeekAgo ...
https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0
29705b3a7242c4b77410da2c481c0922776bd7db
github
aimilin6688/KeePassHO
entry/src/main/ets/storage/onedrive/OneDriveConfig.ets
arkts
setRefreshToken
设置刷新令牌 @param refreshToken 刷新令牌
public setRefreshToken(refreshToken: string): void { this.refreshToken = Sm4Utils.encryptWithPrefix(refreshToken); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setRefreshToken AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left refreshToken AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#s...
public setRefreshToken(refreshToken: string): void { this.refreshToken = Sm4Utils.encryptWithPrefix(refreshToken); }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/onedrive/OneDriveConfig.ets#L93-L95
f0ebe472f297dd0aece9ec2ee75f4ea598ea72d7
github
ibestservices/ibest-ui
entry/src/main/ets/pages/Index.ets
arkts
viewAppStoreDetail
跳转应用市场详情
viewAppStoreDetail(){ let bundleName = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_DEFAULT).name let link = 'https://appgallery.huawei.com/app/detail?id=' + bundleName + '&action=write-review' this.context.openLink(link, { appLinkingOnly: false }) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left viewAppStoreDetail 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...
viewAppStoreDetail(){ let bundleName = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_DEFAULT).name let link = 'https://appgallery.huawei.com/app/detail?id=' + bundleName + '&action=write-review' this.context.openLink(link, { appLinkingOnly: false }) }
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/entry/src/main/ets/pages/Index.ets#L782-L786
c7be906baf72902c5a3e9d41010a36f59a00807d
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Source/SuwayomiCacheManager.ets
arkts
clearAllCache
清除所有Suwayomi缓存
public clearAllCache(): boolean { const coverResult = this.clearCoverCache(); const iconResult = this.clearSourceIconCache(); const chapterResult = this.clearChapterCache(); return coverResult && iconResult && chapterResult; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left clearAllCache 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...
public clearAllCache(): boolean { const coverResult = this.clearCoverCache(); const iconResult = this.clearSourceIconCache(); const chapterResult = this.clearChapterCache(); return coverResult && iconResult && chapterResult; }
https://github.com/DaLongZhuaZi/manxia
9fb9704b8c1fed20e8d42794e571b735df6d32a3
github
openharmony/codelabs
Media/VideoPlayer/entry/src/main/ets/viewmodel/HomeDialogModel.ets
arkts
failureCallback
This parameter is used to report error information when an error occurs in function invoking. @param error Error information.
failureCallback(error: Error) { Logger.error(`[HomeDialogModel] error happened: ` + JSON.stringify(error)); this.showPrompt($r('app.string.link_check_fail')); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left failureCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left error AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Error AST#identifier#Rig...
failureCallback(error: Error) { Logger.error(`[HomeDialogModel] error happened: ` + JSON.stringify(error)); this.showPrompt($r('app.string.link_check_fail')); }
https://gitee.com/openharmony/codelabs.git
808e791ee9c73b6f058f76ce9d9e29d6b9aa4a40
gitee
cpdd5201314/harmonyOS-music-app
products/phone/src/main/ets/pages/SearchHistoryManager.ets
arkts
importSearchHistory
导入搜索历史数据
static async importSearchHistory(jsonData: string): Promise<void> { try { if (!SearchHistoryManager.checkInitialized()) { throw new SearchHistoryError('存储未初始化') } const importData = JSON.parse(jsonData) as ExportData if (importData.records && Array.isArray(importData.records)) { ...
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 importSearchHistory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left jsonData AST#identifier#Right AST#ERROR#Left AST#:#...
static async importSearchHistory(jsonData: string): Promise<void> { try { if (!SearchHistoryManager.checkInitialized()) { throw new SearchHistoryError('存储未初始化') } const importData = JSON.parse(jsonData) as ExportData if (importData.records && Array.isArray(importData.records)) { ...
https://github.com/cpdd5201314/harmonyOS-music-app
2edc9d3694cab920f1c3a11ee7dc51fd95d8aac5
github
Joker-x-dev/CoolMallArkTS
core/model/src/main/ets/entity/User.ets
arkts
constructor
构造函数,初始化用户对象 @param {Partial<User>} data - 原始用户数据
constructor(data?: Partial<User>) { if (data) { this.id = data.id ?? 0; this.unionid = data.unionid ?? ""; this.avatarUrl = data.avatarUrl ?? ""; this.nickName = data.nickName ?? ""; this.phone = data.phone ?? ""; this.gender = data.gender ?? 0; this.status = data.status ...
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 data AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expres...
constructor(data?: Partial<User>) { if (data) { this.id = data.id ?? 0; this.unionid = data.unionid ?? ""; this.avatarUrl = data.avatarUrl ?? ""; this.nickName = data.nickName ?? ""; this.phone = data.phone ?? ""; this.gender = data.gender ?? 0; this.status = data.status ...
https://github.com/Joker-x-dev/CoolMallArkTS
d213e277e799f4bfdc605ace03d77e73b9391f20
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/common/utils/DAOHelper.ets
arkts
convertToSmartCategoryTraining
转换为SmartCategoryTraining
static convertToSmartCategoryTraining(resultSet: relationalStore.ResultSet): SmartCategoryTraining { const training = new SmartCategoryTraining(); training.recordId = DAOHelper.getNumberValue(resultSet, 'record_id'); training.userId = DAOHelper.getNumberValue(resultSet, 'user_id'); training.billNote =...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left convertToSmartCategoryTraining AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resultSet AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right ...
static convertToSmartCategoryTraining(resultSet: relationalStore.ResultSet): SmartCategoryTraining { const training = new SmartCategoryTraining(); training.recordId = DAOHelper.getNumberValue(resultSet, 'record_id'); training.userId = DAOHelper.getNumberValue(resultSet, 'user_id'); training.billNote =...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
fba67546dea05722207e7f8faf6ae5d47332bf1c
github
wuba/omni-ui
omni_component/src/main/ets/components/popup/Builder.ets
arkts
setBackgroundColor
背景颜色,默认Color.White
setBackgroundColor(backgroundColor: ResourceColor): Builder { this.popupConfig.backgroundColor = backgroundColor return this }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setBackgroundColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left backgroundColor AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left ResourceColor AST#identifier#Right AST#ERR...
setBackgroundColor(backgroundColor: ResourceColor): Builder { this.popupConfig.backgroundColor = backgroundColor return this }
https://github.com/wuba/omni-ui
28cb5c7013d56ee49b1eb955cf6f290caefb00c2
github
Harrisonls2004/WaterFlow
entry/src/main/ets/common/network/ApiService.ets
arkts
getCart
获取购物车
static async getCart(): Promise<CartResponse> { const response = await httpClient.get('/cart'); const result = parseJsonSafe(response.data); if (result) { const data = result as Record<string, Object>; const cartResponse = new CartResponse(); cartResponse.code = (data['code'] as num...
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 getCart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left :...
static async getCart(): Promise<CartResponse> { const response = await httpClient.get('/cart'); const result = parseJsonSafe(response.data); if (result) { const data = result as Record<string, Object>; const cartResponse = new CartResponse(); cartResponse.code = (data['code'] as num...
https://github.com/Harrisonls2004/WaterFlow
00bbdbb516cb352e26f36025075f017966006aa9
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/String.ets
arkts
substring
Selects a substring of this String, starting at a specified index and ending at the end of this String. @param begin to start substring @throws StringIndexOutOfBoundsException if begin param is negative or >= length @returns new String which is a substring of this String
public substring(begin: number): String { return this.substring(begin as int) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left substring AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left begin AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left numbe...
public substring(begin: number): String { return this.substring(begin as int) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
c44f070b774c107af0b51e34142576bf40248012
gitee
Cool_foolisher1/ArkTSRepository
GraphicalCode/commons/src/main/ets/viewmodel/BaseHomeViewModel.ets
arkts
handleBreakpointChange
监听断点变化 @param offsetParam OffsetParam
protected handleBreakpointChange(offsetParam: OffsetParam) { offsetParam.breakpointChange = true this.handleListOffset(offsetParam) }
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left handleBreakpointChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left offsetParam AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Rig...
protected handleBreakpointChange(offsetParam: OffsetParam) { offsetParam.breakpointChange = true this.handleListOffset(offsetParam) }
https://gitcode.com/Cool_foolisher1/ArkTSRepository
29099f14fde1d84d58267f5c5f767b003cd3ba7b
gitcode
somnio-software/my-bot-pal
entry/src/main/ets/utils/StringUtils.ets
arkts
formatDateHeader
Format a date string to show either "Today" or "Month Day" format (e.g., "Apr 5") Uses localized month names from resources @param dateString Date string in ISO format (e.g., "2025-04-03") @returns Promise that resolves to the formatted date string
static formatDateHeader(context: Context, dateString: string): string { try { const today = new Date(); // Split the string into year, month, and day const parts = dateString.split('-'); const year = parseInt(parts[0]); const month = parseInt(parts[1]) - 1; const day = parseIn...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left formatDateHeader AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
static formatDateHeader(context: Context, dateString: string): string { try { const today = new Date(); // Split the string into year, month, and day const parts = dateString.split('-'); const year = parseInt(parts[0]); const month = parseInt(parts[1]) - 1; const day = parseIn...
https://github.com/somnio-software/my-bot-pal
9a7439fecb55c02c3702635dfb4aca0eef0418a9
github
Mydstiny/RemoteDeskHarmonyOS
entry/src/main/ets/services/CloudStore.ets
arkts
subscribeCloudChanges
订阅云空间数据变更事件 (系统级推送, 替代轮询)
private subscribeCloudChanges(): void { if (!this.store) { return; } try { this.store.on('dataChange', relationalStore.SubscribeType.SUBSCRIBE_TYPE_CLOUD, (accounts: Array<string>) => { this.lastSyncTime = Date.now(); this.syncSuccessCount++; hilog.info(0x00...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left subscribeCloudChanges AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left voi...
private subscribeCloudChanges(): void { if (!this.store) { return; } try { this.store.on('dataChange', relationalStore.SubscribeType.SUBSCRIBE_TYPE_CLOUD, (accounts: Array<string>) => { this.lastSyncTime = Date.now(); this.syncSuccessCount++; hilog.info(0x00...
https://github.com/Mydstiny/RemoteDeskHarmonyOS
9641c8f6aa38a4583489788712456e962ff16c5e
github
HarmonyOS_Samples/sample_in_harmonyos
common/src/main/ets/util/ResourceUtil.ets
arkts
getResourceNumber
Obtains the number result with a specified resource. @param resource resource.
public static getResourceNumber(context: Context, resource: Resource): number { if (!context) { Logger.error(TAG, 'getResourceNumber context is null'); return 0; } if (ResourceUtil.isEmptyObj(resource)) { Logger.error(TAG, '[getResourceNumber] resource is empty.'); return 0; } ...
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 getResourceNumber AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Le...
public static getResourceNumber(context: Context, resource: Resource): number { if (!context) { Logger.error(TAG, 'getResourceNumber context is null'); return 0; } if (ResourceUtil.isEmptyObj(resource)) { Logger.error(TAG, '[getResourceNumber] resource is empty.'); return 0; } ...
https://gitcode.com/HarmonyOS_Samples/sample_in_harmonyos
506e085b1cdd5a3e3cdb0837b6096eb1c95b284f
gitcode
Countly/countly-sdk-hos
library/src/main/ets/internal/modules/ModuleConfiguration.ets
arkts
applyDevSuppliedSettings
-- Lifecycle -- Synchronous apply of the dev-supplied SBS only. Called by `CountlyInstance` BEFORE other module constructors run so consent / limits / queue thresholds reflect the dev-supplied baseline at the time those modules cache them. Storage IO is async and happens later via `loadFromStorage()`; the stored blob t...
public applyDevSuppliedSettings(): void { if (this.config.sdkBehaviorSettings) { this.applyRawSettings(this.config.sdkBehaviorSettings, 'dev-supplied (sync)'); } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left applyDevSuppliedSettings 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...
public applyDevSuppliedSettings(): void { if (this.config.sdkBehaviorSettings) { this.applyRawSettings(this.config.sdkBehaviorSettings, 'dev-supplied (sync)'); } }
https://github.com/Countly/countly-sdk-hos
57dbce94a4674985c928ee79f27c233e63db5fa8
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/UndefinableObjectArray.ets
arkts
toArray
Gets the underlying array @returns { Object[] } The underlying array containing all non-undefined elements @syscap SystemCapability.Utils.Lang
public toArray(): Object[] { let newData = new (Object)[this.curSize](new Object()) for (let i = 0; i < this.curSize; ++i) { newData[i] = this.data[i]! } return newData }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toArray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_sta...
public toArray(): Object[] { let newData = new (Object)[this.curSize](new Object()) for (let i = 0; i < this.curSize; ++i) { newData[i] = this.data[i]! } return newData }
https://gitcode.com/iop123123/arkts-static-skills
210c2ab50c47fd56f0c00b03daac910079d5c056
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
of
Creates a new Uint8ClampedArray using initializer @param data initializer @returns a new Uint8ClampedArray from data
public of(data: Object[]): Uint8ClampedArray { throw new Error("Uint8ClampedArray.of: not implemented") }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left of AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#...
public of(data: Object[]): Uint8ClampedArray { throw new Error("Uint8ClampedArray.of: not implemented") }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
b7cb732c8fafbad5ff79fe266565a8a46dab7145
gitee
mybricks/comlib-harmony-normal
packages/rt-arkts/comlib/src/main/ets/_AudioPlayer.ets
arkts
setAVPlayerCallback
设置AVPlayer回调
private setAVPlayerCallback() { this.avPlayer!.on('stateChange', (state) => { switch (state) { case 'idle': // 初始状态。当 avPlayer 实例刚创建或调用 reset() 后进入此状态,此时尚未进行任何初始化操作。 break; case 'initialized': // 初始化完成状态。调用 init() 方法并传入媒体源(如 URL 或文件路径)后,播放器完成基础初始化,准备进入预处理阶段。 ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left setAVPlayerCallback 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...
private setAVPlayerCallback() { this.avPlayer!.on('stateChange', (state) => { switch (state) { case 'idle': // 初始状态。当 avPlayer 实例刚创建或调用 reset() 后进入此状态,此时尚未进行任何初始化操作。 break; case 'initialized': // 初始化完成状态。调用 init() 方法并传入媒体源(如 URL 或文件路径)后,播放器完成基础初始化,准备进入预处理阶段。 ...
https://github.com/mybricks/comlib-harmony-normal
ed67c670fcbf0fef81e29911c17844a1e6c2f036
github
PollenWang6/HiXD
entry/src/main/ets/pages/MainPage.ets
arkts
closePhyPwdDialog
弹窗动画关闭方法
closePhyPwdDialog(): void { animateTo({ duration: 200, curve: Curve.EaseIn }, () => { this.phyOpacity = 0; this.phyTranslate = 30; }); setTimeout(() => { this.showPhyPwdDialog = false; }, 200); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left closePhyPwdDialog 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_expressi...
closePhyPwdDialog(): void { animateTo({ duration: 200, curve: Curve.EaseIn }, () => { this.phyOpacity = 0; this.phyTranslate = 30; }); setTimeout(() => { this.showPhyPwdDialog = false; }, 200); }
https://github.com/PollenWang6/HiXD
1a1656fcb59ed2e4738a437236290b8621fc8586
github
Countly/countly-sdk-hos
library/src/ohosTest/ets/test/UserProfile.test.ets
arkts
scUP_sendUserProperties
Helpers mirroring the Android private methods in scUP_UserProfileTests.java.
function scUP_sendUserProperties(h: Harness): void { const userProperties: SegmentationMap = { 'name': 'Nicola Tesla', 'username': 'nicola', 'email': 'info@nicola.tesla', 'organization': 'Trust Electric Ltd', 'phone': '+90 822 140 2546', 'picture': 'http://images2.fanpop.com/images/photos/3300...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left scUP_sendUserProperties AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left h AST#identifier#Right AST#type_annotation#Left AST#:#Left : A...
function scUP_sendUserProperties(h: Harness): void { const userProperties: SegmentationMap = { 'name': 'Nicola Tesla', 'username': 'nicola', 'email': 'info@nicola.tesla', 'organization': 'Trust Electric Ltd', 'phone': '+90 822 140 2546', 'picture': 'http://images2.fanpop.com/images/photos/3300...
https://github.com/Countly/countly-sdk-hos
8145202f918b5c9ab9a7193cbc216f94688c7716
github
HarmonyOS_Samples/MultiVideoApplication
features/multivideodetail/src/main/ets/view/VideoDetail.ets
arkts
enterFullScreen
Enters fullscreen immersive playback; updates immersive state before switching window mode.
enterFullScreen(): void { try { if (this.windowUtil !== undefined) { this.immersiveTypeBefore = this.windowUtil.mainWindow.getWindowStatus(); } } catch (error) { let err = error as BusinessError; Logger.error(TAG, `Window getWindowStatus failed, errCode = ${err.code}, errMessag...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left enterFullScreen AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bl...
enterFullScreen(): void { try { if (this.windowUtil !== undefined) { this.immersiveTypeBefore = this.windowUtil.mainWindow.getWindowStatus(); } } catch (error) { let err = error as BusinessError; Logger.error(TAG, `Window getWindowStatus failed, errCode = ${err.code}, errMessag...
https://gitcode.com/HarmonyOS_Samples/MultiVideoApplication
fde50c7064f328507c9c3875b43966461df478d6
gitcode
aimilin6688/KeePassHO
entry/src/main/ets/common/utils/ShareUtils.ets
arkts
shareFileWithCallback
分享文件到其他应用(带分享完成回调) @param context UIAbility上下文 @param filePath 文件路径 @param onShareCompleted 分享完成回调(用户真正完成分享时触发) @param title 分享标题(可选) @returns 是否成功发起分享
public static async shareFileWithCallback( context: common.UIAbilityContext, filePath: string, onShareCompleted: ShareCompletedCallback, title?: string ): Promise<boolean> { try { // 创建文件URI const uri = fileUri.getUriFromPath(filePath); hilog.info(DOMAIN, TAG, 'Share file uri: ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left shareFileWithCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#L...
public static async shareFileWithCallback( context: common.UIAbilityContext, filePath: string, onShareCompleted: ShareCompletedCallback, title?: string ): Promise<boolean> { try { // 创建文件URI const uri = fileUri.getUriFromPath(filePath); hilog.info(DOMAIN, TAG, 'Share file uri: ...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/ShareUtils.ets#L30-L76
d109f0cdd8b1653cc943ceef7f9dfdb07a37e476
github
Joker-x-dev/CoolMallArkTS
feature/main/src/main/ets/viewmodel/MeViewModel.ets
arkts
aboutToAppear
页面出现前 @returns {void} 无返回值
aboutToAppear(): void { this.userState.refreshUserInfo(); this.loadRecentFootprints(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc...
aboutToAppear(): void { this.userState.refreshUserInfo(); this.loadRecentFootprints(); }
https://github.com/Joker-x-dev/CoolMallArkTS
6181d19341dbc69cbd135f1635006c12c60e298e
github
Nekofox-POT/LinMusic
entry/src/main/ets/package/audio_player/class_audio_player.ets
arkts
send_play_mode
7x7 播放模式广播 //
private send_play_mode(mode: number) { this.play_mode = mode emitter.emit({ eventId: 717 }, { data: { play_mode: this.play_mode } }) emitter.emit({ eventId: 727 }, { data: { play_mode: this.play_mode } }) if (this.play_mode === 0) { log('播放模式切换:单曲循环.') this.av_session?.setAVPlaybackState({...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left send_play_mode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left mode AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
private send_play_mode(mode: number) { this.play_mode = mode emitter.emit({ eventId: 717 }, { data: { play_mode: this.play_mode } }) emitter.emit({ eventId: 727 }, { data: { play_mode: this.play_mode } }) if (this.play_mode === 0) { log('播放模式切换:单曲循环.') this.av_session?.setAVPlaybackState({...
https://github.com/Nekofox-POT/LinMusic
6d3e4d294f86138bdb5463a52c0eaefa987201b8
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/TypeCreator.ets
arkts
constructor
@param name method name, which can contain [a-zA-Z0-9] and be a valid identifier
public constructor(name: string) { this.name = name }
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 name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left stri...
public constructor(name: string) { this.name = name }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
a75525af0e979d582f7322fe7657eb66c1d173e2
gitee
openharmony/arkui_advanced_ui_component
customappbar/source/custom_app_bar.ets
arkts
onEyelashTitleClick
点击title栏 在ets无法实现,需要在编译后的js中加入对应的实现方法
static onEyelashTitleClick(): void { }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left onEyelashTitleClick 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#ex...
static onEyelashTitleClick(): void { }
https://gitee.com/openharmony/arkui_advanced_ui_component.git
05ff0b248e89ea4152972fb57119ef826e12799f
gitee
AlkaidLab/moonlight-harmony
entry/src/main/ets/components/ShortcutManager.ets
arkts
keysToDisplayText
将键码数组转换为显示文本(使用统一的 getVkDisplayName)
keysToDisplayText(keys: number[]): string { return keys.map(code => getVkDisplayName(code)).join('+'); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left keysToDisplayText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left keys AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left number A...
keysToDisplayText(keys: number[]): string { return keys.map(code => getVkDisplayName(code)).join('+'); }
https://github.com/AlkaidLab/moonlight-harmony
172baaf4841ee821f6f2c222a170663e702b4024
github
midori52000/ArkPilot
Agent/entry/src/main/ets/skills/SkillsBackendService.ets
arkts
uninstall
卸载 Skill(通过 Rust host)
async uninstall(id: string): Promise<string | null> { const result = uninstallSkill(this.codexHome, id); if (result.length === 0) { throw new SkillError( SkillErrorCode.SKILL_NOT_FOUND, `id=${id}`, '未找到指定的 Skill,可能已被卸载' ); } if (result.startsWith('error:')) { ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left uninstall AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#R...
async uninstall(id: string): Promise<string | null> { const result = uninstallSkill(this.codexHome, id); if (result.length === 0) { throw new SkillError( SkillErrorCode.SKILL_NOT_FOUND, `id=${id}`, '未找到指定的 Skill,可能已被卸载' ); } if (result.startsWith('error:')) { ...
https://github.com/midori52000/ArkPilot
7f3339b9485b016ef854c5ee81cf782d2559803c
github
DaLongZhuaZi/NGF
ngf_framework/src/main/ets/deviceAwareness/facades/DeviceAdaptationFacade.ets
arkts
destroy
销毁管理器,释放资源
public destroy(): void { if (this.destroyed) { return; } try { if (this.displayListenerRegistered) { display.off('change', this.displayChangeCallback); this.displayListenerRegistered = false; } if (this.foldStatusListenerRegistered) { display.off('foldStatus...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left destroy 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 ...
public destroy(): void { if (this.destroyed) { return; } try { if (this.displayListenerRegistered) { display.off('change', this.displayChangeCallback); this.displayListenerRegistered = false; } if (this.foldStatusListenerRegistered) { display.off('foldStatus...
https://github.com/DaLongZhuaZi/NGF
81a5491d8bcccd0468deb0161fc1456cb00f029c
github
terryma2024/happyword
harmonyos/entry/src/ohosTest/ets/test/AdventureFlow.ui.test.ets
arkts
returnToHome
Navigate back to HomePage after a test. Each `it` block is required to start AND end on HomePage so the next block (which may run in the same app process) finds HomeStartButton / AdventureCard immediately. Strategy: press the system back button up to a few times until HomeStartButton becomes visible. Cheaper than re-la...
async function returnToHome(driver: Driver): Promise<void> { try { for (let i = 0; i < 5; i++) { const home = await driver.findComponent(ON.id('HomeStartButton')); if (home !== null) { return; } await driver.pressBack(); await driver.delayMs(500); } } catch (err) { ...
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left returnToHome AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left driver AST#identifier#Right AST#type...
async function returnToHome(driver: Driver): Promise<void> { try { for (let i = 0; i < 5; i++) { const home = await driver.findComponent(ON.id('HomeStartButton')); if (home !== null) { return; } await driver.pressBack(); await driver.delayMs(500); } } catch (err) { ...
https://github.com/terryma2024/happyword
6dc20a0c6dd3e4675c0a5c8e458949bf537d9176
github
Tencent-RTC/TUIKit_Harmony
atomic_x/src/main/ets/basecomponent/utils/EventBus.ets
arkts
on
Subscribe to events @param eventName Event name to subscribe @param callback Event listener callback
on(eventName: string, callback: (data: emitter.EventData) => void): void { const eventId = EventBus.getEventId(eventName); console.log(`[EventBus] 📝 Subscribing to "${eventName}" (ID: ${eventId})`); emitter.on({ eventId: eventId, priority: emitter.EventPriority.LOW }, (eventData: emi...
AST#program#Left AST#ERROR#Left AST#identifier#Left on AST#identifier#Right AST#(#Left ( AST#(#Right AST#identifier#Left eventName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , AST#,#Right AST#call_expression#Left AST#identifier#Left ca...
on(eventName: string, callback: (data: emitter.EventData) => void): void { const eventId = EventBus.getEventId(eventName); console.log(`[EventBus] 📝 Subscribing to "${eventName}" (ID: ${eventId})`); emitter.on({ eventId: eventId, priority: emitter.EventPriority.LOW }, (eventData: emi...
https://github.com/Tencent-RTC/TUIKit_Harmony
1c96c8d0701de33e5b99d489c64583c3cf5939c5
github
aimilin6688/KeePassHO
entry/src/main/ets/services/kdbx/KdbxCsvService.ets
arkts
parseLines
解析CSV行 @param csvContent @returns
private static parseLines(csvContent: ArrayBuffer): KdbxGroup { // 获取CSV行 const csvLines: string[] = ByteUtils.bytesToString(csvContent).split("\n"); if (csvLines.length === 0) { throw new KeePassHoError(ErrorCodes.FILE_EMPTY); } const rootGroup = new KdbxGroup(); let currentGroup: KdbxG...
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 parseLines AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left csvContent AST#identifier#Right AST#:#Lef...
private static parseLines(csvContent: ArrayBuffer): KdbxGroup { // 获取CSV行 const csvLines: string[] = ByteUtils.bytesToString(csvContent).split("\n"); if (csvLines.length === 0) { throw new KeePassHoError(ErrorCodes.FILE_EMPTY); } const rootGroup = new KdbxGroup(); let currentGroup: KdbxG...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/kdbx/KdbxCsvService.ets#L42-L67
4044921eb7000c77a927ec4741c56c1129c0cfff
github
Kira-Yagami-Light/Kira-Projects
TodoTask/entry/src/main/ets/data/repository/CategoryRepository.ets
arkts
searchCategoriesByName
根据名称搜索分类 @param name 分类名称(支持模糊匹配) @returns Promise<Array<TaskCategoryData>> 分类模型数组
async searchCategoriesByName(name: string): Promise<Array<TaskCategoryData>> { try { const records = await this.dao.queryByName(name); return records.map(r => this.recordToModel(r)); } catch (err) { Logger.error(this.LOG_TAG, `Failed to search categories: ${JSON.stringify(err)}`); retu...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left searchCategoriesByName AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left name AST#identifier#Right AST#type_annotation#Left AST#:...
async searchCategoriesByName(name: string): Promise<Array<TaskCategoryData>> { try { const records = await this.dao.queryByName(name); return records.map(r => this.recordToModel(r)); } catch (err) { Logger.error(this.LOG_TAG, `Failed to search categories: ${JSON.stringify(err)}`); retu...
https://github.com/Kira-Yagami-Light/Kira-Projects
fb71b98c6b033612568dc543f25cc50d57d68f2c
github
zmuxuny/ai-guardian-star
entry/src/main/ets/database/DatabaseHelper.ets
arkts
queryUserByIdentifier
按登录标识(手机号或邮箱)查询用户,自动识别格式
public async queryUserByIdentifier(id: string): Promise<UserInfo | null> { if (/^1[3-9]\d{9}$/.test(id)) return this.queryUserByPhone(id); if (/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(id)) return this.queryUserByEmail(id); 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 queryUserByIdentifier AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left...
public async queryUserByIdentifier(id: string): Promise<UserInfo | null> { if (/^1[3-9]\d{9}$/.test(id)) return this.queryUserByPhone(id); if (/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(id)) return this.queryUserByEmail(id); return null; }
https://github.com/zmuxuny/ai-guardian-star/blob/87ab023d8b9aab4303a9fc1e97508e1f8ee01e07/entry/src/main/ets/database/DatabaseHelper.ets#L361-L365
e66e5e8f8e5c7c26f620c1f57f1f68578dc4bde4
github
openharmony-tpc/MMKV
entry/src/main/ets/pages/index.ets
arkts
testInstance
test key-value @param mMapID @param cryptKey @param isEncode @param rootPath
testInstance(mMapID: string, cryptKey: string, isEncode: boolean, rootPath?: string): MMKV { LogUtil.i('testInstance start') let kv = MMKV.getMMKVWithMMapID(mMapID, MMKV.SINGLE_PROCESS_MODE, cryptKey, rootPath); if (isEncode) { kv.encodeString('string', 'hello mmkv') } LogUtil.i('testInstanc...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left testInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left mMapID AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , ...
testInstance(mMapID: string, cryptKey: string, isEncode: boolean, rootPath?: string): MMKV { LogUtil.i('testInstance start') let kv = MMKV.getMMKVWithMMapID(mMapID, MMKV.SINGLE_PROCESS_MODE, cryptKey, rootPath); if (isEncode) { kv.encodeString('string', 'hello mmkv') } LogUtil.i('testInstanc...
https://gitee.com/openharmony-tpc/MMKV.git
f6f10e54401570d70bd0eea83c1b9bcb71e2e97e
gitee
CPF-ApplicationTPC/openharmony_tpc_samples
OhosVideoCache/library/src/main/ets/file/LruDiskUsage.ets
arkts
processLruLogic
LRU逻辑
private processLruLogic(files: string[], totalSize: number, totalCount: number, fileSizes: number[]): void { try { // 在主线程中实现LRU逻辑,决定哪些文件需要删除 let filesToDelete: string[] = []; let currentTotalSize = totalSize; let currentTotalCount = totalCount; // 确保至少保留一个当前正在播放的文件,如果只有一个文件则不删除任何文件...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left processLruLogic AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left files AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_ex...
private processLruLogic(files: string[], totalSize: number, totalCount: number, fileSizes: number[]): void { try { // 在主线程中实现LRU逻辑,决定哪些文件需要删除 let filesToDelete: string[] = []; let currentTotalSize = totalSize; let currentTotalCount = totalCount; // 确保至少保留一个当前正在播放的文件,如果只有一个文件则不删除任何文件...
https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples
bce01061212b91ed71e8e29ffba5bbf9f16ab88e
gitcode
Dabing-0x19d/berverage_HarmonyOS6.0
entry/src/main/ets/model/WindowUtil.ets
arkts
getWidthBreakpoint
平板横屏:70% 获取窗口宽度断点值 @returns 断点值:0=xs, 1=sm, 2=md, 3=lg, 4=xl
static getWidthBreakpoint(): number { const width = display.getDefaultDisplaySync().width; if (width < WindowUtil.BREAKPOINT_SMALL) return 0; // xs if (width < WindowUtil.BREAKPOINT_MEDIUM) return 1; // sm if (width < WindowUtil.BREAKPOINT_LARGE) return 2; // md if (width < WindowUti...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getWidthBreakpoint 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 ...
static getWidthBreakpoint(): number { const width = display.getDefaultDisplaySync().width; if (width < WindowUtil.BREAKPOINT_SMALL) return 0; // xs if (width < WindowUtil.BREAKPOINT_MEDIUM) return 1; // sm if (width < WindowUtil.BREAKPOINT_LARGE) return 2; // md if (width < WindowUti...
https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0
fa10be9a168566d0816dcc8feb341e60a3a159ec
github
Open-Tech-Project/OpenBoard
entry/src/main/ets/InputMethodExtensionAbility/model/PredictionModel.ets
arkts
blockWord
Block a word from being learned
blockWord(lang: string, word: string): void { const m = this.ensure(lang); const w = word.toLowerCase(); // Add to blocked list m.blockedWords.add(w); // Also delete the word if it's already learned this.deleteWord(lang, word); console.info(`OpenBoard: Blocked word "${w}" from being lea...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left blockWord AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left lang AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,...
blockWord(lang: string, word: string): void { const m = this.ensure(lang); const w = word.toLowerCase(); // Add to blocked list m.blockedWords.add(w); // Also delete the word if it's already learned this.deleteWord(lang, word); console.info(`OpenBoard: Blocked word "${w}" from being lea...
https://github.com/Open-Tech-Project/OpenBoard/blob/bb49f3c9e04bdcc0d5b6d40e9a7cd3a3790da74a/entry/src/main/ets/InputMethodExtensionAbility/model/PredictionModel.ets#L427-L443
2d8ff53d21ef92ae4b0cacc944f67cc0fb0f88b6
github
HarmonyOS_Samples/MusicHome
features/player/src/main/ets/util/LrcUtils.ets
arkts
isIn
True if (x,y) lies inside the closed rectangle.
public isIn(x: number, y: number): boolean { return x >= this.left && x <= this.right && y >= this.top && y <= this.bottom; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left isIn AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left x AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#R...
public isIn(x: number, y: number): boolean { return x >= this.left && x <= this.right && y >= this.top && y <= this.bottom; }
https://gitcode.com/HarmonyOS_Samples/MusicHome
fb436c93fdb6ee10c3a802f8e6fd2d25e62c6942
gitcode
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/hosts/userdata/history/classes/meowHistorian.ets
arkts
init
Initializes the Historian. Reads the lastUpdate time, the history chunks list and record them.
async init() { // List all files let chunkNames = await listFilesUnderDir(this.chunkBasePath); // Jump out if (!chunkNames || chunkNames.length == 0) { meow(`No history files found in ${this.chunkBasePath}`, 'meowHistorian][init', meowLevel.WARN); this.busy = false; return; } ...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#{#Left { AST#{#Right AST#ERROR#Right AST#comment#Left //...
async init() { // List all files let chunkNames = await listFilesUnderDir(this.chunkBasePath); // Jump out if (!chunkNames || chunkNames.length == 0) { meow(`No history files found in ${this.chunkBasePath}`, 'meowHistorian][init', meowLevel.WARN); this.busy = false; return; } ...
https://github.com/awaLiny2333/LinysBrowser_NEXT
baca3c26b288c901d11ecd595c0608a5aedd0e81
github
Amaz1ny/HarmonyDO-public
entry/src/main/ets/models/Badge.ets
arkts
badgeTypeName
获取徽章类型名称
get badgeTypeName(): string { if (this.badgeTypeId === 1) return '金牌'; if (this.badgeTypeId === 2) return '银牌'; return '铜牌'; }
AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left badgeTypeName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Rig...
get badgeTypeName(): string { if (this.badgeTypeId === 1) return '金牌'; if (this.badgeTypeId === 2) return '银牌'; return '铜牌'; }
https://github.com/Amaz1ny/HarmonyDO-public
77282a49c27c5e826b142181af8d7c1b4719b038
github
HarmonyOS_Samples/BestPracticeSnippets
MultipleImage/entry/src/main/ets/pages/Index.ets
arkts
build
[End progress_component] DocsCode 2
build() { Column() { Row() { Image($r('app.media.back')) .width($r('app.float.image_width')) .height($r('app.float.image_height')) .margin({ top: $r('app.float.image_margin_top') }) } .width(CommonConstants.FULL_PERCENT) .height($r('app.float.row_image...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST...
build() { Column() { Row() { Image($r('app.media.back')) .width($r('app.float.image_width')) .height($r('app.float.image_height')) .margin({ top: $r('app.float.image_margin_top') }) } .width(CommonConstants.FULL_PERCENT) .height($r('app.float.row_image...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
08db84b0420096a56ac43af6aa02daaa4deb52ce
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/DataManager.ets
arkts
batchAddOnlinePages
[性能优化] 批量添加在线页面信息(事务包裹) 替代逐条 addOnlinePageInfo,将所有 INSERT 放在一个事务内执行 @param chapterId 章节ID @param pages 页面信息数组
public async batchAddOnlinePages(chapterId: string, pages: OnlinePageInfoInput[]): Promise<void> { if (pages.length === 0) return; try { const now = Date.now(); await this.databaseManager.beginTransaction(); try { const sql = `INSERT INTO online_page (id, chapte...
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 batchAddOnlinePages AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left chapterId AST#identifier#Right AST#ERROR#Left AST#:...
public async batchAddOnlinePages(chapterId: string, pages: OnlinePageInfoInput[]): Promise<void> { if (pages.length === 0) return; try { const now = Date.now(); await this.databaseManager.beginTransaction(); try { const sql = `INSERT INTO online_page (id, chapte...
https://github.com/DaLongZhuaZi/manxia
0d3f641295e9d07d6b6e14044ee4ea5b000339c1
github
openharmony/applications_calendar_data
datamanager/src/main/ets/processor/DefaultProcessor.ets
arkts
removeObserver
删除一个观察者
removeObserver(observer: Observer) { this.mObserverList.remove(observer); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left removeObserver AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left observer AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Observer AST#identifie...
removeObserver(observer: Observer) { this.mObserverList.remove(observer); }
https://gitee.com/openharmony/applications_calendar_data.git
9bd9d4fdc1ff268598f74592983150a62b222df1
gitee
jjjjjjava/ffmpeg_tools
src/main/ets/ffmpeg/FFmpegCommandBuilder.ets
arkts
reset
重置构建器
public reset(): FFmpegCommandBuilder { this.inputFiles = []; this.outputPath = ''; this.useHwDecode = false; this.useHwEncode = false; this.filters = []; this.vCodec = ''; this.aCodec = ''; this.vBitrate = ''; this.aBitrate = ''; this.presetValue = ''; this.crfValue = -1; ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left reset AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Rig...
public reset(): FFmpegCommandBuilder { this.inputFiles = []; this.outputPath = ''; this.useHwDecode = false; this.useHwEncode = false; this.filters = []; this.vCodec = ''; this.aCodec = ''; this.vBitrate = ''; this.aBitrate = ''; this.presetValue = ''; this.crfValue = -1; ...
https://github.com/jjjjjjava/ffmpeg_tools
6b26cffd69ef8bf0ec8bed3bb0e6746eb77503f3
github
SakuraNeko/Deepseek-Harmony
entry/src/main/ets/pages/Index.ets
arkts
onSystemLanguageChange
系统语言变化时,重新注入 JS 覆盖 navigator.language 并显示刷新按钮。 用户可点击按钮手动刷新以应用新语言,避免自动刷新打断当前操作。
onSystemLanguageChange(): void { if (this.systemLanguage && this.systemLanguage !== '') { hilog.info(DOMAIN, TAG, 'System language changed, re-injecting language override'); this.injectLanguageOverride(); this.showLangRefreshBtn = true; } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onSystemLanguageChange 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_exp...
onSystemLanguageChange(): void { if (this.systemLanguage && this.systemLanguage !== '') { hilog.info(DOMAIN, TAG, 'System language changed, re-injecting language override'); this.injectLanguageOverride(); this.showLangRefreshBtn = true; } }
https://github.com/SakuraNeko/Deepseek-Harmony
5b24c7847660c53b14838224d2c22322d47c3e4a
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoJsExtensions.ets
arkts
setCookie
设置Cookie(同时保存到持久化存储)
async setCookie(tag: string, value: string, key?: string): Promise<void> { // 保存到内存 const cookieKey = key ? `${tag}_${key}` : tag; this.cookies.set(cookieKey, value); // 保存到持久化存储 const cookieStore = getCookieStore(); const url = tag.includes('.') ? `https://${tag}` : tag; await cookie...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left setCookie AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left tag AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#...
async setCookie(tag: string, value: string, key?: string): Promise<void> { // 保存到内存 const cookieKey = key ? `${tag}_${key}` : tag; this.cookies.set(cookieKey, value); // 保存到持久化存储 const cookieStore = getCookieStore(); const url = tag.includes('.') ? `https://${tag}` : tag; await cookie...
https://github.com/DaLongZhuaZi/manxia
384ce5056a4bf372a4b7a1999efcead90d181e86
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets
arkts
ecmaHourFromTime
@see ECMA-262, 21.4.1.13 @returns Hour component of a given time.
function ecmaHourFromTime(time: long): byte { let timeInDay = ecmaTimeInDayFromTime(time); return (timeInDay / msPerHour).toByte(); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left ecmaHourFromTime AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left time AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:...
function ecmaHourFromTime(time: long): byte { let timeInDay = ecmaTimeInDayFromTime(time); return (timeInDay / msPerHour).toByte(); }
https://gitcode.com/iop123123/arkts-static-skills
aa60f3592c81c2f51d353e8eb0a4e3a35ce69792
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/StreamInputHandler.ets
arkts
mapSystemKeyToVK
==================== 映射工具 ==================== 将 HarmonyOS 系统按键码映射到 Windows 虚拟键码
private mapSystemKeyToVK(keyCode: number): number { switch (keyCode) { case 1: return 0; // Home - 不转发(避免触发 Windows 开始菜单) case 2: return 0x1B; // Back → VK_ESCAPE case 3: return 0; // Recent/多任务 - 不转发 case 10: return 0xB3; // Media Play/Pause → VK_MEDIA_PLAY_PAUSE case 11: return 0xB...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left mapSystemKeyToVK AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left keyCode AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#nu...
private mapSystemKeyToVK(keyCode: number): number { switch (keyCode) { case 1: return 0; // Home - 不转发(避免触发 Windows 开始菜单) case 2: return 0x1B; // Back → VK_ESCAPE case 3: return 0; // Recent/多任务 - 不转发 case 10: return 0xB3; // Media Play/Pause → VK_MEDIA_PLAY_PAUSE case 11: return 0xB...
https://github.com/AlkaidLab/moonlight-harmony
003fe925ad0929e1a8e332e76337dacf361b4c96
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/CoverCacheManager.ets
arkts
deleteSourceCovers
删除图源所有封面(删除新旧两种格式的目录)
async deleteSourceCovers(sourceId: number): Promise<number> { try { if (!await this.ensurePathInitialized()) { logger.warn(TAG, '封面路径未初始化,无法删除封面'); return 0; } // 先确保 pkg 已缓存 const pkg = await this.ensureSourcePkg(sourceId); let deletedCount = 0; /...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left deleteSourceCovers AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceId AST#identifier#Right AST#type_annotation#Left AST#:...
async deleteSourceCovers(sourceId: number): Promise<number> { try { if (!await this.ensurePathInitialized()) { logger.warn(TAG, '封面路径未初始化,无法删除封面'); return 0; } // 先确保 pkg 已缓存 const pkg = await this.ensureSourcePkg(sourceId); let deletedCount = 0; /...
https://github.com/DaLongZhuaZi/manxia
3e95fe3873d2424ed99ec774842f1a97eb669ff9
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoUrlAnalyzer.ets
arkts
setVariables
设置多个变量
setVariables(vars: Record<string, string>): LegadoUrlAnalyzer { Object.keys(vars).forEach(key => { this.variables.set(key, vars[key]); }); return this; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setVariables AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left vars AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identifier#Left Record AS...
setVariables(vars: Record<string, string>): LegadoUrlAnalyzer { Object.keys(vars).forEach(key => { this.variables.set(key, vars[key]); }); return this; }
https://github.com/DaLongZhuaZi/manxia
10b97bb1aecbac6e6f941fb3b269c9576d9a9633
github
openharmony-sig/smartperf
device/device_ui/entry/src/main/ets/common/ui/detail/chart/components/Legend.ets
arkts
getFormSize
returns the size in dp of the legend forms @return
public getFormSize() : number { return this.mFormSize; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getFormSize 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#num...
public getFormSize() : number { return this.mFormSize; }
https://gitee.com/openharmony-sig/smartperf.git
5f5db07d9621f3a99b0aeef28bb7652507e63412
gitee
Tal-Londo/Tal_2FA
entry/src/main/ets/entryability/EntryAbility.ets
arkts
onCreate
Ability创建时的回调
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { try { this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET); } catch (err) { hilog.error(DOMAIN, 'EntryAbility', 'Failed to set colorMode. Cause: %{public}s', JSON.stringify(err))...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onCreate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Want AST#identifier#Right AST#,#Left , AST#,#Ri...
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { try { this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET); } catch (err) { hilog.error(DOMAIN, 'EntryAbility', 'Failed to set colorMode. Cause: %{public}s', JSON.stringify(err))...
https://github.com/Tal-Londo/Tal_2FA
f20526f09ae50b6a98065a2a8b98150f34eab513
github
DaLongZhuaZi/manxia
entry/src/main/ets/Utils/WelcomeGuideTestHelper.ets
arkts
completeGuide
完成引导 用于跳过引导流程,直接进入应用
public static async completeGuide(): Promise<void> { try { await this.guideManager.initialize(); await this.guideManager.markGuideCompleted(); logger.info(TAG, '✅ 引导已标记为完成'); return Promise.resolve(); } catch (error) { logger.error(TAG, '完成引导失败', String(error)); return Prom...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left completeGuide AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#...
public static async completeGuide(): Promise<void> { try { await this.guideManager.initialize(); await this.guideManager.markGuideCompleted(); logger.info(TAG, '✅ 引导已标记为完成'); return Promise.resolve(); } catch (error) { logger.error(TAG, '完成引导失败', String(error)); return Prom...
https://github.com/DaLongZhuaZi/manxia
30a3a2780fdd64fefb562edb5484b63378b8f368
github
NissonCX/CQU-HarmonyOS-APP-Dev-Final
entry/src/main/ets/pages/TrendsPage.ets
arkts
getWeekDay
获取星期几
getWeekDay(dateStr: string): string { const date = new Date(dateStr); const weekDays = ['周日', '周一', '周二', '周三', '周四', '周五', '周六']; return weekDays[date.getDay()]; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getWeekDay AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left dateStr AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST#)#Rig...
getWeekDay(dateStr: string): string { const date = new Date(dateStr); const weekDays = ['周日', '周一', '周二', '周三', '周四', '周五', '周六']; return weekDays[date.getDay()]; }
https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final
5187d48aedd54e65f287bc5bdfdcc0eb7b6b9b5c
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/GamepadManager.ets
arkts
stopListening
停止监听手柄事件
stopListening(): void { MelonDSNative.unregisterGamepadCallbacks() this.inputProcessor.resetAxisStates() hilog.info(DOMAIN, TAG, 'Gamepad callbacks unregistered') }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left stopListening AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc...
stopListening(): void { MelonDSNative.unregisterGamepadCallbacks() this.inputProcessor.resetAxisStates() hilog.info(DOMAIN, TAG, 'Gamepad callbacks unregistered') }
https://github.com/richshaw2015/nds
80d118d31d662af34e382a381fad096060b6b290
github
Countly/countly-sdk-hos
library/src/main/ets/internal/Utils.ets
arkts
timezoneOffsetMinutes
Timezone offset in minutes (positive for east of UTC).
public static timezoneOffsetMinutes(): number { return -new Date().getTimezoneOffset(); }
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 timezoneOffsetMinutes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Rig...
public static timezoneOffsetMinutes(): number { return -new Date().getTimezoneOffset(); }
https://github.com/Countly/countly-sdk-hos
4286909a3a2d1a394a33f5bea221631cb0149dfc
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Download/DownloadManager.ets
arkts
extractBaseImageUrl
提取图片URL的基础部分(去除图片处理参数) PicaComic等图源的URL格式: https://storage-b.picacomic.com/static/tobeimg/xxx.../rs:fit:800:800:0/g:ce/... 需要提取: xxx(基础标识符)
private extractBaseImageUrl(url: string): string { try { // 提取URL中的唯一标识符部分 // 格式1: https://storage-b.picacomic.com/static/tobeimg/xxx // 格式2: https://storage-b.picacomic.com/static/tobeimg/xxx.../rs:fit:... const match = url.match(/\/static\/tobeimg\/([^\/]+)/); if (match && match[1]...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left extractBaseImageUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier...
private extractBaseImageUrl(url: string): string { try { // 提取URL中的唯一标识符部分 // 格式1: https://storage-b.picacomic.com/static/tobeimg/xxx // 格式2: https://storage-b.picacomic.com/static/tobeimg/xxx.../rs:fit:... const match = url.match(/\/static\/tobeimg\/([^\/]+)/); if (match && match[1]...
https://github.com/DaLongZhuaZi/manxia
6d4347c2d27049d417a2fcf617bbb8c4e003bc76
github
offlinecat-dev/OCNetORM
src/main/ets/mapping/EntityData.ets
arkts
setRelated
设置关联数据(通用方法,自动触发 UI 刷新) @param propertyName 关联属性名 @param data 关联数据值
setRelated(propertyName: string, data: RelatedDataValue): void { this.relatedData.set(propertyName, data) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setRelated AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left propertyName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , AST#...
setRelated(propertyName: string, data: RelatedDataValue): void { this.relatedData.set(propertyName, data) }
https://github.com/offlinecat-dev/OCNetORM
c851ef9aeb1280435adebaa69aa93651ec2604ef
github
the-wwyang/kids-learning-app
src/main/ets/common/UserService.ets
arkts
savePhoneUsers
保存手机号用户映射
private async savePhoneUsers(phoneUsers: Map<string, string>): Promise<boolean> { if (this.dataPreferences === null) { return false; } try { const phoneUsersObj: Record<string, string> = {}; phoneUsers.forEach((value: string, key: string) => { phoneUsersObj[key] = value; })...
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 savePhoneUsers AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left phoneUsers AST#iden...
private async savePhoneUsers(phoneUsers: Map<string, string>): Promise<boolean> { if (this.dataPreferences === null) { return false; } try { const phoneUsersObj: Record<string, string> = {}; phoneUsers.forEach((value: string, key: string) => { phoneUsersObj[key] = value; })...
https://github.com/the-wwyang/kids-learning-app
801d0e74401030ee2c2eaf5faf2140d259c08f5b
github
hhtczengjing/ohos_quickjs
quickjs/src/main/ets/JSValue.ets
arkts
callWithArguments
==================== Function Call ====================
callWithArguments(args: JSValue[]): JSValue { const argHandles = args.map((a) => a.handle); // Use global object as this const globalHandle = qjs.getGlobal(this.ctxHandle.engineHandle); const resultHandle = qjs.callFunction(this.ctxHandle.engineHandle, globalHandle, this.handle, argHandles); qjs.r...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left callWithArguments AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left args AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left JSValue ...
callWithArguments(args: JSValue[]): JSValue { const argHandles = args.map((a) => a.handle); // Use global object as this const globalHandle = qjs.getGlobal(this.ctxHandle.engineHandle); const resultHandle = qjs.callFunction(this.ctxHandle.engineHandle, globalHandle, this.handle, argHandles); qjs.r...
https://github.com/hhtczengjing/ohos_quickjs
94917694492eb2eb43098bec7dc9a2fe693f551a
github
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/hosts/system/windows/classes/meowUiHost.ets
arkts
refreshSuggestions
Refreshes the suggestions.
refreshSuggestions() { const maxResultsBookmarks = maxSuggestionsBookmark(); const maxResultsHistorian = maxSuggestionsHistory(); // History if (this.addressBarContentCurrentField.length > 0 && maxResultsHistorian > 0) { const myHistorian = AppStorageV2.connect(meowHistorian)!; myHistoria...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left refreshSuggestions 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...
refreshSuggestions() { const maxResultsBookmarks = maxSuggestionsBookmark(); const maxResultsHistorian = maxSuggestionsHistory(); // History if (this.addressBarContentCurrentField.length > 0 && maxResultsHistorian > 0) { const myHistorian = AppStorageV2.connect(meowHistorian)!; myHistoria...
https://github.com/awaLiny2333/LinysBrowser_NEXT
97345f6a2ff8301190578e56cad6a1f3a0eebf4f
github
dingzhilin1990/zhilinclaw
src/security/OAuthGateway.ets
arkts
getAuthenticatedProviders
获取所有已认证的提供商
public getAuthenticatedProviders(): string[] { const authenticated: string[] = []; this.sessions.forEach((session, providerId) => { if (!this.isTokenExpired(session.token)) { authenticated.push(providerId); } }); return authenticated; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getAuthenticatedProviders 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#L...
public getAuthenticatedProviders(): string[] { const authenticated: string[] = []; this.sessions.forEach((session, providerId) => { if (!this.isTokenExpired(session.token)) { authenticated.push(providerId); } }); return authenticated; }
https://github.com/dingzhilin1990/zhilinclaw
c4566258e0e9a76068098a2c71c3ab5e58488419
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets
arkts
skipQuoted
跳过引号内容
private skipQuoted(quote: string): void { this.pos++; // 跳过开始引号 while (this.pos < this.queue.length) { const c = this.queue[this.pos]; if (c === '\\' && this.pos + 1 < this.queue.length) { this.pos += 2; // 跳过转义字符 continue; } if (c === quote) { this.pos++; ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left skipQuoted AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left quote AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left s...
private skipQuoted(quote: string): void { this.pos++; // 跳过开始引号 while (this.pos < this.queue.length) { const c = this.queue[this.pos]; if (c === '\\' && this.pos + 1 < this.queue.length) { this.pos += 2; // 跳过转义字符 continue; } if (c === quote) { this.pos++; ...
https://github.com/DaLongZhuaZi/manxia
34037dc7259ab794edb7f87de33ca27ba9df3e02
github
genjishare/snake-game
entry/src/main/ets/pages/WebViewPage.ets
arkts
getCurrentGameState
获取当前游戏状态,用于应用接续
getCurrentGameState(): Promise<GameState> { return new Promise((resolve, reject) => { // 首先检查函数是否存在 this.webController.runJavaScript('typeof window.getCurrentGameState === "function"', (error, result) => { if (error || result === 'false') { console.error(`getCurrentGameState函数不存在,将使用...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getCurrentGameState 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...
getCurrentGameState(): Promise<GameState> { return new Promise((resolve, reject) => { // 首先检查函数是否存在 this.webController.runJavaScript('typeof window.getCurrentGameState === "function"', (error, result) => { if (error || result === 'false') { console.error(`getCurrentGameState函数不存在,将使用...
https://github.com/genjishare/snake-game
08cbdd99d12424423c04c9e0586d2a0f1df43abc
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/FinalizationQueue.ets
arkts
register
Registers an object with specific callback argument and with token object - an object which can be used to remove this registred callback. @see unregister After the object will be removed, the callback method will be called with the specific argument. @param object a tracking object @param callbackArg callback argument...
public register(object: Object, callbackArg: Object | null, token: Object | null): void { let refObject = new WeakRef<Object>(object); let refToken: WeakRef<Object> | null = null; if (token != null) { refToken = new WeakRef<Object>(token!); } let free_index = this...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left register AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left object AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Objec...
public register(object: Object, callbackArg: Object | null, token: Object | null): void { let refObject = new WeakRef<Object>(object); let refToken: WeakRef<Object> | null = null; if (token != null) { refToken = new WeakRef<Object>(token!); } let free_index = this...
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
b2e01297330e18b210943713be6da7fc811b3a5b
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Preload/ChapterPreloadManager.ets
arkts
processNextTask
处理下一个任务 [优化] 阅读器活跃时降低并发而非完全暂停
private async processNextTask(): Promise<void> { // [优化] 阅读器活跃时,将并发限制降到0(不再启动新任务,但不阻塞队列处理逻辑) const effectiveMaxConcurrent = this.isReaderActive ? 0 : this.config.maxConcurrentTasks; // 如果已达到最大并发数,等待 if (this.activeTaskCount >= effectiveMaxConcurrent) { logger.debug(TAG, `已达到最大并发数 ${effectiveMax...
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 processNextTask AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A...
private async processNextTask(): Promise<void> { // [优化] 阅读器活跃时,将并发限制降到0(不再启动新任务,但不阻塞队列处理逻辑) const effectiveMaxConcurrent = this.isReaderActive ? 0 : this.config.maxConcurrentTasks; // 如果已达到最大并发数,等待 if (this.activeTaskCount >= effectiveMaxConcurrent) { logger.debug(TAG, `已达到最大并发数 ${effectiveMax...
https://github.com/DaLongZhuaZi/manxia
b5fa517e5abbadf711ca463b080fa9720d25c572
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/model/SmartBudgetPlan.ets
arkts
getCategoryBudgets
获取分类预算分配
getCategoryBudgets(): CategoryBudgetAllocation[] { try { const parsed = JSON.parse(this.categoryBudgetsJson) as CategoryBudgetAllocation[]; return parsed; } catch (e) { return []; } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCategoryBudgets 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 CategoryBudgetAllocation AST#identifier#Rig...
getCategoryBudgets(): CategoryBudgetAllocation[] { try { const parsed = JSON.parse(this.categoryBudgetsJson) as CategoryBudgetAllocation[]; return parsed; } catch (e) { return []; } }
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
7a278a879a39806a3347eac5c713d3ff35c4c11f
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelDataManager.ets
arkts
getAllSources
获取所有书源
async getAllSources(): Promise<LegadoBookSource[]> { const store = this.getStore(); const rs = await store.querySql('SELECT configJson FROM novel_source ORDER BY weight DESC'); const sources: LegadoBookSource[] = []; if (rs.goToFirstRow()) { do { try { const json = rs.getStrin...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getAllSources 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#generi...
async getAllSources(): Promise<LegadoBookSource[]> { const store = this.getStore(); const rs = await store.querySql('SELECT configJson FROM novel_source ORDER BY weight DESC'); const sources: LegadoBookSource[] = []; if (rs.goToFirstRow()) { do { try { const json = rs.getStrin...
https://github.com/DaLongZhuaZi/manxia
c9ee11b5550d9343ca08d487050ef8334d036dcb
github
somnio-software/my-bot-pal
entry/src/main/ets/features/chat/repository/ChatRepository.ets
arkts
createTextMessage
Create a text message from AI message and tool message
private createTextMessage( aiMessage: ChatApiResponseMessage, toolMessage: ChatApiResponseMessage | undefined, locationRequired: boolean | undefined ): ChatMessage { let suggestions: FupQuestion[]; const hasArtifact = toolMessage?.artifact?.weather_api_response || toolMessage?.artifact?.nearby_...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left createTextMessage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left aiMessage AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi...
private createTextMessage( aiMessage: ChatApiResponseMessage, toolMessage: ChatApiResponseMessage | undefined, locationRequired: boolean | undefined ): ChatMessage { let suggestions: FupQuestion[]; const hasArtifact = toolMessage?.artifact?.weather_api_response || toolMessage?.artifact?.nearby_...
https://github.com/somnio-software/my-bot-pal
c1292b079694dabb0db86dda9a27403a8b5b78fa
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Services/DataService.ets
arkts
createRecord
创建测试记录
public async createRecord(record: Record<string, string | number | boolean | string[] | number[]>): Promise<void> { try { // 这里可以创建一个测试表或使用现有表 // 暂时使用内存存储 if (!this.testRecords) { this.testRecords = new Map<string, Record<string, string | number | boolean | string[] | number[]>>(); ...
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 createRecord AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left record AST#identifier#Right AST#:#Left : AS...
public async createRecord(record: Record<string, string | number | boolean | string[] | number[]>): Promise<void> { try { // 这里可以创建一个测试表或使用现有表 // 暂时使用内存存储 if (!this.testRecords) { this.testRecords = new Map<string, Record<string, string | number | boolean | string[] | number[]>>(); ...
https://github.com/DaLongZhuaZi/manxia
21fe6e6db12dffae9920d05c52715ea83b7a7cf1
github