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
azhu0001/localsend-harmony
entry/src/main/ets/pages/transfer/TransferPage.ets
arkts
onReceiveComplete
接收完成,弹窗提示移动文件到Download应用文件夹
onReceiveComplete() { this.mMoveFileAuthorizeDialogId = DialogHelper.showCustomDialog<MoveFileDialogOptions>( wrapBuilder(MoveFileDialogBuilder), { uiContext: this.getUIContext(), onAction: (action: DialogAction) => { if (action === DialogAction.ONE && this.mMoveFileAuthorize...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onReceiveComplete 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#...
onReceiveComplete() { this.mMoveFileAuthorizeDialogId = DialogHelper.showCustomDialog<MoveFileDialogOptions>( wrapBuilder(MoveFileDialogBuilder), { uiContext: this.getUIContext(), onAction: (action: DialogAction) => { if (action === DialogAction.ONE && this.mMoveFileAuthorize...
https://gitcode.com/azhu0001/localsend-harmony
53dbc5ba700b5945aaef0f6f08a0ff32a4dd9b67
gitcode
huaweicloud/huaweicloud-iot-device-sdk-arkts
huaweicloud_iot_device_library/src/main/ets/client/DeviceClient.ets
arkts
respondPropsGet
上报读属性响应 @param requestId 请求id,响应的请求id必须和请求的一致 @param services 服务属性 @param qos
respondPropsGet(requestId: string, services: ServiceProperty[], qos: IoTMqttQos = 0): Promise<IoTMqttResponse> { if (!this.mqttClient) { return new Promise<IoTMqttResponse>((resolve, reject) => reject("mqtt client is null")); } const deviceProperties: DeviceProperties = { services: services ...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left respondPropsGet AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left requestId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AS...
respondPropsGet(requestId: string, services: ServiceProperty[], qos: IoTMqttQos = 0): Promise<IoTMqttResponse> { if (!this.mqttClient) { return new Promise<IoTMqttResponse>((resolve, reject) => reject("mqtt client is null")); } const deviceProperties: DeviceProperties = { services: services ...
https://github.com/huaweicloud/huaweicloud-iot-device-sdk-arkts
ccc5c97ebeeaad93bf6d305b9b606031999f490a
github
David8Idira/AI-OA
packages/harmonyos/commons/src/main/ets/services/KnowledgeService.ets
arkts
updateDocument
更新文档 @param documentId 文档ID @param params 更新参数
async updateDocument(documentId: string, params: UpdateDocumentParams): Promise<ApiResponse<KnowledgeDocument>> { return this.client.put<KnowledgeDocument>(`/api/v1/knowledge/documents/${documentId}`, params) }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left updateDocument AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left documentId AST#identifier#Right AST#type_annotation#Left AST#:#L...
async updateDocument(documentId: string, params: UpdateDocumentParams): Promise<ApiResponse<KnowledgeDocument>> { return this.client.put<KnowledgeDocument>(`/api/v1/knowledge/documents/${documentId}`, params) }
https://github.com/David8Idira/AI-OA
51e5e358094a4066557f96e207796e38f5dac028
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
findIndex
Finds an index of the first element in the Uint32Array that satisfies the condition @param fn condition @returns the index of the first element that satisfies fn
public findIndex(fn: (val: number, index: int, array: Uint32Array) => boolean): int { for (let i = 0; i < this.length; ++i) { let val = this.at(i) if (fn(val, i, this)) { return i } } return -1 }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left findIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#...
public findIndex(fn: (val: number, index: int, array: Uint32Array) => boolean): int { for (let i = 0; i < this.length; ++i) { let val = this.at(i) if (fn(val, i, this)) { return i } } return -1 }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
90fd420657545e09dbd615b742e96abb277a9d2e
gitee
ASweetBite/HarmonyPulse
entry/src/main/ets/utils/managers/RdbManager.ets
arkts
getPlaylistById
根据歌单 ID 获取单个歌单的完整信息 @param playlistId 歌单 ID @returns 对应的 SongListItemType (无匹配则返回 null)
async getPlaylistById(playlistId: number): Promise<SongListItemType | null> { if (!this.rdbStore) return null; try { // 1. 查询指定 ID 的歌单基础信息 const predicates = new relationalStore.RdbPredicates(this.tableNamePlaylist); predicates.equalTo('id', playlistId); // 精准匹配歌单 ID const playlistSet...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getPlaylistById AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left playlistId AST#identifier#Rig...
async getPlaylistById(playlistId: number): Promise<SongListItemType | null> { if (!this.rdbStore) return null; try { // 1. 查询指定 ID 的歌单基础信息 const predicates = new relationalStore.RdbPredicates(this.tableNamePlaylist); predicates.equalTo('id', playlistId); // 精准匹配歌单 ID const playlistSet...
https://github.com/ASweetBite/HarmonyPulse/blob/a7fcf153a20bafa29ac1fb8c25743dd5350dc54c/entry/src/main/ets/utils/managers/RdbManager.ets#L327-L365
fdd487c31990c58e80890ff9dc190b6106a14e05
github
openharmony/codelabs
ETSUI/PositioningDemo/entry/src/main/ets/model/ReminderModel.ets
arkts
setGoal
设置运动目标
setGoal(goal: SportGoal): void { console.log('ReminderSettings.setGoal - 设置前 - 距离:', globalGoal.distance, '米'); console.log('ReminderSettings.setGoal - 设置前 - 时长:', globalGoal.duration, '分钟'); console.log('ReminderSettings.setGoal - 设置前 - 卡路里:', globalGoal.calories); console.log('ReminderSettings.setG...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setGoal AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left goal AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left SportGoal AST#identifier#Right AST#)#Left ) AST#...
setGoal(goal: SportGoal): void { console.log('ReminderSettings.setGoal - 设置前 - 距离:', globalGoal.distance, '米'); console.log('ReminderSettings.setGoal - 设置前 - 时长:', globalGoal.duration, '分钟'); console.log('ReminderSettings.setGoal - 设置前 - 卡路里:', globalGoal.calories); console.log('ReminderSettings.setG...
https://gitcode.com/openharmony/codelabs
81e83d87ec2df02aa05533ab00ac833cbf90bc8b
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/String.ets
arkts
toString
The `toString()` method returns the string representation of the given String in the form of a copy of the original object. @returns a copy of the original String
public override toString(): String { return new String(this); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left toString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Le...
public override toString(): String { return new String(this); }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
efee4120dd950a015b138f8108bdc76ae31d2314
gitee
tdcare/tdwebrtc
src/main/ets/utils/StrUtil.ets
arkts
unit8ArrayToStr
Uint8Array转字符串 @param src Uint8Array @returns 字符串
static unit8ArrayToStr(src: Uint8Array, encoding: buffer.BufferEncoding = 'utf-8'): string { const textDecoder = util.TextDecoder.create(encoding, { ignoreBOM: true }) const result = textDecoder.decodeToString(src, { stream: true }); return result; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left unit8ArrayToStr AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left src AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left U...
static unit8ArrayToStr(src: Uint8Array, encoding: buffer.BufferEncoding = 'utf-8'): string { const textDecoder = util.TextDecoder.create(encoding, { ignoreBOM: true }) const result = textDecoder.decodeToString(src, { stream: true }); return result; }
https://github.com/tdcare/tdwebrtc
7833f89e474b35f6e3691250b93fb4f4bc78bdcb
github
openharmony-sig/flutter_engine
shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/platform/PlatformViewsController.ets
arkts
configureForHybridComposition
Configures the view for Hybrid Composition mode.
private configureForHybridComposition(platformView: PlatformView, request: PlatformViewCreationRequest): void { Log.i(TAG, "Using hybrid composition for platform view: " + request.viewId); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left configureForHybridComposition AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left platformView AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#R...
private configureForHybridComposition(platformView: PlatformView, request: PlatformViewCreationRequest): void { Log.i(TAG, "Using hybrid composition for platform view: " + request.viewId); }
https://gitee.com/openharmony-sig/flutter_engine.git
39bab93a0caf37dbb1ce485241838aac7e507d80
gitee
RicardoWesleyli/HarmonyNEXT_Examples
Chapter11/entry/src/main/ets/viewModel/AlbumViewModel.ets
arkts
getAlbumPhoto
获得相册图片方法
async getAlbumPhoto(){ AlbumManager.selectPhoto( this.MIMEType, this.maxSelectNumber, this.isPhotoTakingSupported ) .then(selectedUris => { if (selectedUris && selectedUris.length > 0) { this.selectedUris = selectedUris } else { console.log('No photo...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getAlbumPhoto 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#expres...
async getAlbumPhoto(){ AlbumManager.selectPhoto( this.MIMEType, this.maxSelectNumber, this.isPhotoTakingSupported ) .then(selectedUris => { if (selectedUris && selectedUris.length > 0) { this.selectedUris = selectedUris } else { console.log('No photo...
https://github.com/RicardoWesleyli/HarmonyNEXT_Examples
772fde300af18726cccdf96a954d42773d920ce8
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/Char.ets
arkts
getHighSurrogate
getHighSurrogate(UTF_16_CodePoint) splits code point as a two code units and return the first one. The result can be malformed und thus has to be checked with {@link <isHighSurrogate(char)>}. @param value an encoded code point. @returns the high surrogate, possibly malformed.
public static getHighSurrogate(value: UTF_16_CodePoint): char { return (((value - 0x10000) >>> 10) + Char.HIGH_SURROGATE_MIN) as char }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getHighSurrogate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left ...
public static getHighSurrogate(value: UTF_16_CodePoint): char { return (((value - 0x10000) >>> 10) + Char.HIGH_SURROGATE_MIN) as char }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
18920d6fca9f50f9b97eae445d9964d5c512b747
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/DataView.ets
arkts
setInt16
Sets bytes as they represent given type @param { int } byteOffset zero index to write @param { number } value @param { boolean } [ littleEndian ] read as little or big endian @throws { RangeError } - Input parameter error. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public setInt16(byteOffset: int, value: number, littleEndian?: boolean): void { if (littleEndian !== undefined && littleEndian.valueOf() == true) { this.setInt16Little(byteOffset, value) } else { this.setInt16Big(byteOffset, value) } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setInt16 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left byteOffset AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifie...
public setInt16(byteOffset: int, value: number, littleEndian?: boolean): void { if (littleEndian !== undefined && littleEndian.valueOf() == true) { this.setInt16Little(byteOffset, value) } else { this.setInt16Big(byteOffset, value) } }
https://gitcode.com/iop123123/arkts-static-skills
0ba7fd3ebd0d14661836788044452c9cc281f017
gitcode
offlinecat-dev/OCNetORM
src/main/ets/query/QueryExecutor.ets
arkts
avg
计算指定列的平均值 @param column 列名或属性名 @returns Promise<number>
async avg(column: string): Promise<number> { return await this.withStoreLease(async () => { return await this.aggregateExecutor.avg(column) }) }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left avg AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left column AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Rig...
async avg(column: string): Promise<number> { return await this.withStoreLease(async () => { return await this.aggregateExecutor.avg(column) }) }
https://github.com/offlinecat-dev/OCNetORM
b765c9c6dc5c22ca18e575eecb2b5bfd2e6c7ed0
github
Delsin-Yu/JustPDF
entry/src/main/ets/components/PageInfo.ets
arkts
importPdfPolylineAnnotationsRange
按页区间导入 PDF 折线批注,供异步分批扫描大文档时调用。
public importPdfPolylineAnnotationsRange( uiContext: UIContext, canvasOverSampling: number, startPageIndex: number, endPageIndex: number ): number[] { const affectedPageIndices: number[] = []; const start = Math.max(0, startPageIndex); const end = Math.min(this.pages.length, endPageIndex...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left importPdfPolylineAnnotationsRange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uiContext AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Rig...
public importPdfPolylineAnnotationsRange( uiContext: UIContext, canvasOverSampling: number, startPageIndex: number, endPageIndex: number ): number[] { const affectedPageIndices: number[] = []; const start = Math.max(0, startPageIndex); const end = Math.min(this.pages.length, endPageIndex...
https://github.com/Delsin-Yu/JustPDF/blob/07d9dd917e7592f584d67821fb06a7369bd3f15b/entry/src/main/ets/components/PageInfo.ets#L1312-L1329
44660cdd6346508e7f389c34aa6828313cc546e2
github
LongLiveY96/chatcube
entry/src/main/ets/state/AppSettingsStore.ets
arkts
getProviderById
根据 ID 查找内存中的 provider;未命中返回 null(不触发回源)
getProviderById(providerId: string): ModelProvider | null { const list = this.getProviders() for (let i = 0; i < list.length; i++) { if (list[i].id === providerId) { return list[i] } } return null }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getProviderById AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left providerId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#s...
getProviderById(providerId: string): ModelProvider | null { const list = this.getProviders() for (let i = 0; i < list.length; i++) { if (list[i].id === providerId) { return list[i] } } return null }
https://github.com/LongLiveY96/chatcube
0cf15e7e3308000591da184c8566d89fc9f4a960
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
findLast
Finds the last element in the BigUint64Array that satisfies the condition @param { function } fn - condition @returns { BigInt } - the last element that satisfies fn @throws { Error } - If the element cannot be found, throw an exception @syscap SystemCapability.Utils.Lang @FaAndStageModel
public findLast(fn: (val: BigInt, index: int, array: BigUint64Array) => boolean): BigInt { for (let i = this.lengthInt - 1; i >= 0; i--) { let val = new BigInt(this.getUnsafe(i)) if (fn(val, i, this)) { return val } } throw new Error("BigUi...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left findLast AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:...
public findLast(fn: (val: BigInt, index: int, array: BigUint64Array) => boolean): BigInt { for (let i = this.lengthInt - 1; i >= 0; i--) { let val = new BigInt(this.getUnsafe(i)) if (fn(val, i, this)) { return val } } throw new Error("BigUi...
https://gitcode.com/iop123123/arkts-static-skills
77f137859db70caa1914b2c0aaefdcd251c0689c
gitcode
aimilin6688/KeePassHO
entry/src/main/ets/services/otp/OtpCompatibilityManager.ets
arkts
extractOtpUrls
从条目中提取所有 OTP URL @param entry KeePass 条目 @returns OTPURL 数组
public extractOtpUrls(entry: KdbxEntry): string[] { const urls: string[] = []; const processedFields = new Set<string>(); // 遍历所有解析器 for (const parser of this.parsers) { entry.fields.forEach((value, key) => { // 跳过已处理的字段 if (processedFields.has(key)) { return; ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left extractOtpUrls AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left entry AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ...
public extractOtpUrls(entry: KdbxEntry): string[] { const urls: string[] = []; const processedFields = new Set<string>(); // 遍历所有解析器 for (const parser of this.parsers) { entry.fields.forEach((value, key) => { // 跳过已处理的字段 if (processedFields.has(key)) { return; ...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/otp/OtpCompatibilityManager.ets#L56-L82
8422e1326100c71b433bc246695e1cf73bd94a55
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/TabContentCacheManager.ets
arkts
initialize
初始化(从持久化存储加载缓存)
async initialize(): Promise<void> { if (this.initialized) return; try { const dataPreferences = await preferences.getPreferences(getContext(), this.PREF_NAME); // 加载书源缓存 const bookSourceJson = await dataPreferences.get(this.BOOK_SOURCE_KEY, '') as string; if (bookSourceJson) { ...
AST#program#Left AST#expression_statement#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left initialize AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AS...
async initialize(): Promise<void> { if (this.initialized) return; try { const dataPreferences = await preferences.getPreferences(getContext(), this.PREF_NAME); // 加载书源缓存 const bookSourceJson = await dataPreferences.get(this.BOOK_SOURCE_KEY, '') as string; if (bookSourceJson) { ...
https://github.com/DaLongZhuaZi/manxia
e82db940ed8572ea003fe5c90f855559d65dda30
github
openharmony/xts_acts
ability/ability_runtime/actsabilitymanageretstest/entry/src/ohosTest/ets/test/Utils.ets
arkts
getDurationTime
接口调用时间 @param startTime 接口调用开始时间 @param endTime 接口调用结束时间
static getDurationTime(msg: string, startTime: number, endTime: number) { console.info(msg + 'Get Interface startTime: ' + startTime); console.info(msg + 'Get Interface endTime: ' + endTime); let duration = (endTime - startTime); console.info(msg + 'Get Interface Duration: ' + duration); return du...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getDurationTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left msg AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left s...
static getDurationTime(msg: string, startTime: number, endTime: number) { console.info(msg + 'Get Interface startTime: ' + startTime); console.info(msg + 'Get Interface endTime: ' + endTime); let duration = (endTime - startTime); console.info(msg + 'Get Interface Duration: ' + duration); return du...
https://gitee.com/openharmony/xts_acts.git
bb3c3afbb3edcdfc7c11edb91cdbfc4479835a30
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelSettingsManager.ets
arkts
notifyBrowseHistoryListeners
通知所有历史浏览变化监听器
private notifyBrowseHistoryListeners(): void { for (const listener of this.browseHistoryListeners) { try { listener(); } catch (e) { logger.warn(TAG, `历史浏览监听器执行失败: ${String(e)}`); } } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left notifyBrowseHistoryListeners 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#...
private notifyBrowseHistoryListeners(): void { for (const listener of this.browseHistoryListeners) { try { listener(); } catch (e) { logger.warn(TAG, `历史浏览监听器执行失败: ${String(e)}`); } } }
https://github.com/DaLongZhuaZi/manxia
576ad123946a5d9d91ab5e606e57c571627a3055
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test40_original_index.ets
arkts
createMultiplier
--- Higher-order function returns function ---
function createMultiplier(factor: number): (n: number) => number { let fn = (n: number): number => { return n * factor; }; return fn; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left createMultiplier AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left factor AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST...
function createMultiplier(factor: number): (n: number) => number { let fn = (n: number): number => { return n * factor; }; return fn; }
https://github.com/miaochiahao/ark-ghidra
e30b89667bbc68db88ea4481747ab6847aa546e8
github
AetheriumSimulator/qemu-hmos
entry/src/main/ets/managers/QemuVMManager.ets
arkts
startVM
============================================================ 虚拟机生命周期管理 ============================================================ 启动虚拟机
async startVM(vmConfig: VMConfig): Promise<VMStartResult> { try { // Worker 不可用时直接调用 NAPI if (!this.workerAvailable) { const native = await this.ensureNative() // 安全填充参数,避免传 0/空导致 native 崩溃 const cpu = vmConfig.cpuCount ?? vmConfig.cpuCores ?? 2 const mem = vmConfig.mem...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left startVM AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left vmConfig AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST...
async startVM(vmConfig: VMConfig): Promise<VMStartResult> { try { // Worker 不可用时直接调用 NAPI if (!this.workerAvailable) { const native = await this.ensureNative() // 安全填充参数,避免传 0/空导致 native 崩溃 const cpu = vmConfig.cpuCount ?? vmConfig.cpuCores ?? 2 const mem = vmConfig.mem...
https://github.com/AetheriumSimulator/qemu-hmos
b6a4435991a26075c891ef14b2e496a0c65ac905
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/String.ets
arkts
trimLeft
Trims all specified characters from the beginning this String. @param remove that contains the characters to trim @throws NullPointerException if remove param is null @returns new left trimmed string
public trimLeft(remove: char[]): String { let firstNotSpecCharIdx: int = 0; for (let i: int = 0; i < this.length(); i++) { if (!String.isCharOneOf(this.charAt(i), remove)) { firstNotSpecCharIdx = i; break; } } return new String(...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left trimLeft AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left remove AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left char AST#identifier#R...
public trimLeft(remove: char[]): String { let firstNotSpecCharIdx: int = 0; for (let i: int = 0; i < this.length(); i++) { if (!String.isCharOneOf(this.charAt(i), remove)) { firstNotSpecCharIdx = i; break; } } return new String(...
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
ba745fa05d87f7835c66349c49f9e54cc060ff3d
gitee
openharmony/arkui_ace_engine
advanced_ui_component/treeviewv2/source/treeviewv2.ets
arkts
offNodeClick
Destroy node click callback event. @syscap SystemCapability.ArkUI.ArkUI.Full @since 26
public offNodeClick(callback?: OnChangedCallback): void { if (callback === undefined) { this.nodeClickEvents = []; this.nodeClickOnceEvents = []; } else { let index = this.nodeClickEvents.indexOf(callback); if (index >= 0) { this.nodeClickEvents.splice(index, 1); } } ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left offNodeClick AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#...
public offNodeClick(callback?: OnChangedCallback): void { if (callback === undefined) { this.nodeClickEvents = []; this.nodeClickOnceEvents = []; } else { let index = this.nodeClickEvents.indexOf(callback); if (index >= 0) { this.nodeClickEvents.splice(index, 1); } } ...
https://gitcode.com/openharmony/arkui_ace_engine
52a9a1fb6e4e5446ed775317eaf3a278471fc7fd
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
constructor
Creates an Int8Array with respect to length. @param length data initializer
public constructor(length: int) { this.length = length this.byteLength = length * Int8Array.BYTES_PER_ELEMENT this.byteOffset = 0 this.buffer = new ArrayBuffer(this.byteLength) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left length AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier...
public constructor(length: int) { this.length = length this.byteLength = length * Int8Array.BYTES_PER_ELEMENT this.byteOffset = 0 this.buffer = new ArrayBuffer(this.byteLength) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
b2ccae041ea07a84af30e4339973e7bf20ca9669
gitee
HarmonyOS_Samples/scankit-samplecode-clientdemo-arkts
common/sample_common/src/main/ets/model/ScanAccessibility.ets
arkts
announceForAccessibilityNotInterrupt
Actively announce the change text without interrupting the previous announcement. @param isFlashlight - A boolean value indicating whether the flashlight is turned on. This function checks if accessibility services are enabled, and if so, attempts to send an accessibility event to announce the change text. If accessibi...
static announceForAccessibilityNotInterrupt(isFlashlight: boolean): void { try { if (ScanAccessibility.isOpenAccessibilitySync()) { let eventInfo: accessibility.EventInfo = ({ type: 'announceForAccessibilityNotInterrupt', bundleName: SampleConstants.BUNDLE_NAME, trigger...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left announceForAccessibilityNotInterrupt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isFlashlight AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boo...
static announceForAccessibilityNotInterrupt(isFlashlight: boolean): void { try { if (ScanAccessibility.isOpenAccessibilitySync()) { let eventInfo: accessibility.EventInfo = ({ type: 'announceForAccessibilityNotInterrupt', bundleName: SampleConstants.BUNDLE_NAME, trigger...
https://gitcode.com/HarmonyOS_Samples/scankit-samplecode-clientdemo-arkts
aeb9d600f468677fc1d47773f2e6aefcfb654d7e
gitcode
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test24_original_index.ets
arkts
testTemplateWithExpr
--- String template with arithmetic expressions ---
function testTemplateWithExpr(): string { let a: number = 10; let b: number = 20; let s: string = String(a + b) + '=' + String(a) + '+' + String(b); return s; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testTemplateWithExpr 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#predef...
function testTemplateWithExpr(): string { let a: number = 10; let b: number = 20; let s: string = String(a + b) + '=' + String(a) + '+' + String(b); return s; }
https://github.com/miaochiahao/ark-ghidra
abf40f54521885526de5b2d3a0dda89df0b448f1
github
openharmony/arkui_advanced_ui_component
customappbar/source/custom_app_bar.ets
arkts
onMenuButtonClick
服务面板按钮点击回调 在ets无法实现,需要在编译后的js中加入对应的实现方法
static onMenuButtonClick(): void { }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left onMenuButtonClick 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#expr...
static onMenuButtonClick(): void { }
https://gitee.com/openharmony/arkui_advanced_ui_component.git
9639a922147c8c5ba0cb0ad19e2b1dcdb7801e99
gitee
HarmonyOS_Samples/Spatialization
products/entry/src/main/ets/util/MaterialUtil.ets
arkts
getMaterialOptions
[EndExclude immersive_dialog] [EndExclude immersive_menu] [StartExclude immersive_button]
public static getMaterialOptions<T>(option: T): MaterialOptions<T> | T { if (deviceInfo.apiAvailable('26.0.0') && hdsMaterial.getSystemMaterialTypes().length > 0) { const materialOptions = option as MaterialOptions<T>; materialOptions.systemMaterial = new uiMaterial.ImmersiveMaterial({ style: ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#binary_expression#Left AST#identifier#Left getMaterialOptions AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#...
public static getMaterialOptions<T>(option: T): MaterialOptions<T> | T { if (deviceInfo.apiAvailable('26.0.0') && hdsMaterial.getSystemMaterialTypes().length > 0) { const materialOptions = option as MaterialOptions<T>; materialOptions.systemMaterial = new uiMaterial.ImmersiveMaterial({ style: ...
https://gitcode.com/HarmonyOS_Samples/Spatialization
a5821548ef451a2b4fdbf527c0d90723d889cfba
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/libs/htmlparser/HTMLElement.ets
arkts
className
获取 className
get className(): string { return this._attrs.get('class') || ''; }
AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left className 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 A...
get className(): string { return this._attrs.get('class') || ''; }
https://github.com/DaLongZhuaZi/manxia
96cdae09bcea40494b22a2627ab5e809f01ee337
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Map.ets
arkts
get
Returns a value assosiated with key if present @param k the key to find in the Map @returns value if assosiated with key presents. TODO: specify behaviour if not found
get(k: K): V { let r = lookupTree(this.tree, k); if (r != null) { return r!; } else { assert false : "Key not found"; } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left get AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left k AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left K AST#identifier#Right AST#)#Left ) AST#)#Right AST#arg...
get(k: K): V { let r = lookupTree(this.tree, k); if (r != null) { return r!; } else { assert false : "Key not found"; } }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
7a0f2d6c02424ed954718efa2dfd0de1b9f00a92
gitee
zcg741/chengyu-game
entry/src/main/ets/pages/DailyChallengePage.ets
arkts
getDragonHint
获取接龙模式提示(上一个成语的尾字)
getDragonHint(): string { if (this.currentIndex === 0) { // 第一题随机给一个字 const chars = this.getCurrentQuestion()?.chengyu.word || ''; return chars.length > 0 ? chars[0] : ''; } // 上一题成语的尾字 const prevQuestion = this.questions[this.currentIndex - 1]; const prevWord = prevQuestion?.che...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getDragonHint 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...
getDragonHint(): string { if (this.currentIndex === 0) { // 第一题随机给一个字 const chars = this.getCurrentQuestion()?.chengyu.word || ''; return chars.length > 0 ? chars[0] : ''; } // 上一题成语的尾字 const prevQuestion = this.questions[this.currentIndex - 1]; const prevWord = prevQuestion?.che...
https://github.com/zcg741/chengyu-game
c04fc6f6f1ea1eb495ec1f9c665c3ad77163bef1
github
openharmony/applications_contacts
entry/src/main/ets/presenter/contact/detail/DetailPresenter.ets
arkts
getDetailMessage
Data required for converting the original callLogList content into call record details @param {Array} originList Original Call List @return {Array} resultList
getDetailMessage(originList: CallLog[]) { let resultList: LooseObject[] = []; if (ArrayUtil.isEmpty(originList)) { return resultList; } originList.forEach(element => { let callTimeDetail = this.getTimeDetailByCallTime(element); let contactDetailCallsItem: LooseObject = { id: element.id.toStrin...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getDetailMessage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left originList AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left CallLog AST#identifier#Right AST#[...
getDetailMessage(originList: CallLog[]) { let resultList: LooseObject[] = []; if (ArrayUtil.isEmpty(originList)) { return resultList; } originList.forEach(element => { let callTimeDetail = this.getTimeDetailByCallTime(element); let contactDetailCallsItem: LooseObject = { id: element.id.toStrin...
https://gitee.com/openharmony/applications_contacts.git
69ba6579326ac85027c02145a3fe186da52caa9f
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Download/DownloadManager.ets
arkts
retryFailedPages
重试失败页面(选择性重试) 仅下载 failedPageIndexes 中记录的失败页面,已成功的页面不会重新下载
public async retryFailedPages(taskId: string): Promise<boolean> { const task = this.tasks.get(taskId); if (!task) { logger.warn(TAG, `任务不存在: ${taskId}`); return false; } if (task.status !== TaskStatus.FAILED) { logger.warn(TAG, `任务状态不允许重试: ${task.status}`); return false; }...
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 retryFailedPages AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left taskId AST#identifier#Right AST#:#Left ...
public async retryFailedPages(taskId: string): Promise<boolean> { const task = this.tasks.get(taskId); if (!task) { logger.warn(TAG, `任务不存在: ${taskId}`); return false; } if (task.status !== TaskStatus.FAILED) { logger.warn(TAG, `任务状态不允许重试: ${task.status}`); return false; }...
https://github.com/DaLongZhuaZi/manxia
0741f4d519f3227fba2afeefb7afe30f483ed52f
github
NissonCX/CQU-HarmonyOS-APP-Dev-Final
entry/src/main/ets/utils/ExportManager.ets
arkts
generateCSVContent
生成 CSV 格式内容
private async generateCSVContent(dataType: ExportDataType): Promise<string> { let content = ''; switch (dataType) { case ExportDataType.HEALTH_RECORDS: content = await this.generateHealthRecordsCSV(); break; case ExportDataType.HEALTH_GOALS: content = await this.generateHe...
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 generateCSVContent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dataType AST#identifier#Right AST#...
private async generateCSVContent(dataType: ExportDataType): Promise<string> { let content = ''; switch (dataType) { case ExportDataType.HEALTH_RECORDS: content = await this.generateHealthRecordsCSV(); break; case ExportDataType.HEALTH_GOALS: content = await this.generateHe...
https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final
e4c6e248c8ac57c1e9ba4ddc08dc21b46fc3a7e2
github
David8Idira/AI-OA
packages/harmonyos/commons/src/main/ets/services/KnowledgeService.ets
arkts
deleteCategory
删除分类 @param categoryId 分类ID
async deleteCategory(categoryId: string): Promise<ApiResponse<any>> { return this.client.delete<any>(`/api/v1/knowledge/categories/${categoryId}`) }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left deleteCategory AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left categoryId AST#identifier#Right AST#type_annotation#Left AST#:#L...
async deleteCategory(categoryId: string): Promise<ApiResponse<any>> { return this.client.delete<any>(`/api/v1/knowledge/categories/${categoryId}`) }
https://github.com/David8Idira/AI-OA
8bd5bd5379265b6d9f9dc410c61431ac5faf265d
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/AsyncLinkedConcurrentQueue.ets
arkts
getEnd
Returns the current tail element without removing it. Returns undefined when the queue is empty. @returns { T | undefined } The current tail element when the queue is not empty, else undefined when the queue is empty. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public getEnd(): T | undefined { ConcurrencyHelpers.mutexLock(this.pushMutex); ConcurrencyHelpers.mutexLock(this.popMutex); try { let element = this.tail.element; return element; } finally { ConcurrencyHelpers.mutexU...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getEnd 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_stat...
public getEnd(): T | undefined { ConcurrencyHelpers.mutexLock(this.pushMutex); ConcurrencyHelpers.mutexLock(this.popMutex); try { let element = this.tail.element; return element; } finally { ConcurrencyHelpers.mutexU...
https://gitcode.com/iop123123/arkts-static-skills
3d8d92f2f1502509c9d16b7bb14cd6c3c2a8806a
gitcode
honjow/Next2V
shared/src/main/ets/theme/ThemeConstants.ets
arkts
BRAND_PRIMARY
Brand colors
static get BRAND_PRIMARY(): ResourceColor { return ThemeColorSettings.currentColor() }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left get AST#identifier#Right AST#call_expression#Left AST#identifier#Left BRAND_PRIMARY AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Le...
static get BRAND_PRIMARY(): ResourceColor { return ThemeColorSettings.currentColor() }
https://github.com/honjow/Next2V
26d78a9bc03d577624e757e3096559ca170f23c5
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/right_shift/right_shift_ubyte.ets
arkts
main
--- desc: check right shift operation for unsigned byte ---
function main(): void { const a: ubyte = {{v.left}} const b: int = {{v.right}} assert (a >> b) == {{v.result}}
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A...
function main(): void { const a: ubyte = {{v.left}} const b: int = {{v.right}} assert (a >> b) == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
1bc984764cefbe8a664729dc44e5764b6706a932
gitee
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/components/YAxis.ets
arkts
setSpaceBottom
Sets the bottom axis space in percent of the full range. Default 10f @param percent
public setSpaceBottom(percent: number): void { this.mSpacePercentBottom = percent; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setSpaceBottom AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left percent AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#...
public setSpaceBottom(percent: number): void { this.mSpacePercentBottom = percent; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
6c59573914693014f5219769c8dc052cbf78d78f
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/WebViewNetworkTester.ets
arkts
testHttpConnection
执行HTTP连接测试
async testHttpConnection(url: string, customHeaders?: Record<string, string>): Promise<NetworkTestResult> { logger.info(TAG, `🔍 开始HTTP连接测试: ${url}`); const startTime = Date.now(); const result: NetworkTestResult = { success: false, url: url }; try { const httpRequest = http.cr...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left testHttpConnection AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left url AST#identifier#Right AST#type_annotation#Left A...
async testHttpConnection(url: string, customHeaders?: Record<string, string>): Promise<NetworkTestResult> { logger.info(TAG, `🔍 开始HTTP连接测试: ${url}`); const startTime = Date.now(); const result: NetworkTestResult = { success: false, url: url }; try { const httpRequest = http.cr...
https://github.com/DaLongZhuaZi/manxia
7c485b7e65f2cd1470c02fd722fa89786371fdb0
github
tdcare/tdwebrtc
src/main/ets/utils/StrUtil.ets
arkts
strToBytes
字符串转Bytes @param str @returns
public static strToBytes(str: string): Uint8Array { let bytes: number[] = new Array(); for (let i = 0; i < str.length; i++) { bytes.push(str.charCodeAt(i)) } return new Uint8Array(bytes); }
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 strToBytes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#...
public static strToBytes(str: string): Uint8Array { let bytes: number[] = new Array(); for (let i = 0; i < str.length; i++) { bytes.push(str.charCodeAt(i)) } return new Uint8Array(bytes); }
https://github.com/tdcare/tdwebrtc
8bd75deb65c6c14b97dccff9c375d23f8bf7dd7a
github
Tencent-RTC/TUIKit_Harmony
atomic_x/src/main/ets/messagelist/utils/TranslationDisplayManager.ets
arkts
collapse
Collapse (hide) translation bubble for a message in this session. With hidden-set semantics, this means adding to hidden set.
collapse(messageID: string | undefined): void { if (!messageID || messageID.length === 0) { return; } if (!this.hiddenMessageIDs.has(messageID)) { this.hiddenMessageIDs.add(messageID); this.version++; // Trigger UI update console.log(`[TranslationDisplayManager] 🙈 Hide translation...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left collapse AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#identifier#Left messageID AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#R...
collapse(messageID: string | undefined): void { if (!messageID || messageID.length === 0) { return; } if (!this.hiddenMessageIDs.has(messageID)) { this.hiddenMessageIDs.add(messageID); this.version++; // Trigger UI update console.log(`[TranslationDisplayManager] 🙈 Hide translation...
https://github.com/Tencent-RTC/TUIKit_Harmony
7dc02df9436755ee1e59d41f30edf46ed86c5922
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test25_original_index.ets
arkts
testSplitLimit
--- String.split with limit ---
function testSplitLimit(): string { let csv: string = 'a,b,c,d,e'; let parts: string[] = csv.split(','); let first: string = parts[0]; let last: string = parts[parts.length - 1]; return first + ',' + last; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testSplitLimit AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_t...
function testSplitLimit(): string { let csv: string = 'a,b,c,d,e'; let parts: string[] = csv.split(','); let first: string = parts[0]; let last: string = parts[parts.length - 1]; return first + ',' + last; }
https://github.com/miaochiahao/ark-ghidra
23cfc63f0b597baaaa27d599cdfd3fc775bbf616
github
richshaw2015/nds
ohos/entry/src/main/ets/pages/settings/GameConfigSettings.ets
arkts
getConsoleTypeOptions
对齐 Android string-array: game_runtime_console_type_options
function getConsoleTypeOptions(): SelectOption[] { return [ { value: RuntimeConsoleType.DEFAULT, label: I18n.t('opt_default') }, { value: RuntimeConsoleType.DS, label: 'DS' }, { value: RuntimeConsoleType.DSi, label: 'DSi' } ]; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getConsoleTypeOptions 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#array...
function getConsoleTypeOptions(): SelectOption[] { return [ { value: RuntimeConsoleType.DEFAULT, label: I18n.t('opt_default') }, { value: RuntimeConsoleType.DS, label: 'DS' }, { value: RuntimeConsoleType.DSi, label: 'DSi' } ]; }
https://github.com/richshaw2015/nds
f65083cfddce8e596f784d5879755f59e5c073b5
github
aimilin6688/KeePassHO
entry/src/main/ets/common/utils/ShareUtils.ets
arkts
shareFile
分享文件到其他应用 @param context UIAbility上下文 @param filePath 文件路径 @param title 分享标题(可选) @returns 是否成功发起分享
public static async shareFile( context: common.UIAbilityContext, filePath: string, title?: string ): Promise<boolean> { try { // 创建文件URI const uri = fileUri.getUriFromPath(filePath); hilog.info(DOMAIN, TAG, 'Share file uri: %{public}s', uri); // 构造分享数据记录 const record: ...
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 shareFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context ...
public static async shareFile( context: common.UIAbilityContext, filePath: string, title?: string ): Promise<boolean> { try { // 创建文件URI const uri = fileUri.getUriFromPath(filePath); hilog.info(DOMAIN, TAG, 'Share file uri: %{public}s', uri); // 构造分享数据记录 const record: ...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/ShareUtils.ets#L85-L124
62160a7799eed12d109830f9a68d8163b0a93679
github
HarmonyOS_Samples/BestPracticeSnippets
AvoidTimeComsume/entry/src/main/ets/views/WaterFlowDataSource.ets
arkts
notifyDatasetChange
Notify the controller of bulk modification of data
notifyDatasetChange(operations: DataOperation[]): void { this.listeners.forEach(listener => { listener.onDatasetChange(operations); }); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left notifyDatasetChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left operations AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left ...
notifyDatasetChange(operations: DataOperation[]): void { this.listeners.forEach(listener => { listener.onDatasetChange(operations); }); }
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
e0432c6a6783141b9c0d63369a3cca37adfdac7c
gitcode
Harrisonls2004/WaterFlow
entry/src/main/ets/common/network/ApiService.ets
arkts
getCoupons
获取用户优惠券
static async getCoupons(): Promise<CouponListResponse> { const response = await httpClient.get('/coupons'); const result = parseJsonSafe(response.data); if (result) { const data = result as Record<string, Object>; const couponResponse = new CouponListResponse(); couponResponse.code ...
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 getCoupons AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Lef...
static async getCoupons(): Promise<CouponListResponse> { const response = await httpClient.get('/coupons'); const result = parseJsonSafe(response.data); if (result) { const data = result as Record<string, Object>; const couponResponse = new CouponListResponse(); couponResponse.code ...
https://github.com/Harrisonls2004/WaterFlow
3df893a871b7b73b34a7cce0e68a6de01c715795
github
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/hosts/app/tabs/classes/meowTabInfo.ets
arkts
tryPunchHistoryWebState
Try to punch a hole in the history tape! Requests the meowHistorian to save a new history after a certain period of time. Also requests a saving of web state! @param timeout The timeout.
tryPunchHistoryWebState(timeout: number, sourceInfo: string) { if (this.restoringWebState) { meow(`Restoring web state, skipping history & webstate punch.`, 'meowTabInfo][tryPunchHistoryWebState'); return; } this.clearBackupReq(sourceInfo); // Clear timeouts. if (this.saveHistoryTime...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left tryPunchHistoryWebState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left timeout AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#...
tryPunchHistoryWebState(timeout: number, sourceInfo: string) { if (this.restoringWebState) { meow(`Restoring web state, skipping history & webstate punch.`, 'meowTabInfo][tryPunchHistoryWebState'); return; } this.clearBackupReq(sourceInfo); // Clear timeouts. if (this.saveHistoryTime...
https://github.com/awaLiny2333/LinysBrowser_NEXT
b0b4598b703a9b237955371ea1475c26dec8c392
github
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/services/NetworkManager.ets
arkts
cancelReconnect
Cancel reconnection process
static cancelReconnect(): void { if (reconnectTimerId !== -1) { clearTimeout(reconnectTimerId); reconnectTimerId = -1; } isReconnecting = false; reconnectAttempts = 0; console.info(`${TAG}: Reconnection cancelled`); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left cancelReconnect 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#voi...
static cancelReconnect(): void { if (reconnectTimerId !== -1) { clearTimeout(reconnectTimerId); reconnectTimerId = -1; } isReconnecting = false; reconnectAttempts = 0; console.info(`${TAG}: Reconnection cancelled`); }
https://github.com/tangwengang-del/freerdp-harmonyos
b69107ec5983b7b1f761469b5fb546001f1d7577
github
LongLiveY96/chatcube
entry/src/main/ets/services/DatabaseService.ets
arkts
createSession
============ 会话操作 ============ 创建新会话
async createSession(session: ChatSession): Promise<void> { await this.waitForInitialization() if (this.rdbStore === null) { return } const valueBucket: relationalStore.ValuesBucket = { id: session.id, title: session.title, model_id: session.modelId, provider_id: sessio...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left createSession AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left session AST#identifier#Right AST#type_annotation#Left AST#:#Left ...
async createSession(session: ChatSession): Promise<void> { await this.waitForInitialization() if (this.rdbStore === null) { return } const valueBucket: relationalStore.ValuesBucket = { id: session.id, title: session.title, model_id: session.modelId, provider_id: sessio...
https://github.com/LongLiveY96/chatcube
39a7565aeb737e0b1b8ae36ce09033f26d4a9628
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Database/DatabaseManager.ets
arkts
beginTransaction
==================== 事务管理 ==================== 开始事务
public async beginTransaction(): Promise<void> { try { const store = this.getStore(); store.beginTransaction(); logger.debug(TAG, '开始事务'); } catch (error) { logger.error(TAG, `开始事务失败: ${String(error)}`); throw error as Error; } }
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 beginTransaction AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST...
public async beginTransaction(): Promise<void> { try { const store = this.getStore(); store.beginTransaction(); logger.debug(TAG, '开始事务'); } catch (error) { logger.error(TAG, `开始事务失败: ${String(error)}`); throw error as Error; } }
https://github.com/DaLongZhuaZi/manxia
ef4e36e53eaa7b169b0d9d1f457e5b45521e1d4a
github
fbinba3955/Flymby
common/src/main/ets/utils/VolumeUtil.ets
arkts
setMute
设置静音 @param mute 是否静音
public static async setMute(mute: boolean): Promise<void> { try { if (!VolumeUtil.audioManager) { LogUtil.error('VolumeUtil 音频管理器未初始化'); return; } // 使用音频管理器设置静音 await VolumeUtil.audioManager.mute(audio.AudioVolumeType.MEDIA, mute); LogUtil.info(`VolumeUtil 设置静音状态: $...
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 setMute AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left mute AST#i...
public static async setMute(mute: boolean): Promise<void> { try { if (!VolumeUtil.audioManager) { LogUtil.error('VolumeUtil 音频管理器未初始化'); return; } // 使用音频管理器设置静音 await VolumeUtil.audioManager.mute(audio.AudioVolumeType.MEDIA, mute); LogUtil.info(`VolumeUtil 设置静音状态: $...
https://github.com/fbinba3955/Flymby
b7c02c73ab54bfa93e556b5aab2f719d2bf5ab59
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Lifecycle/PageLifecycleManager.ets
arkts
getStats
获取当前状态统计
getStats(): PageStats { const stats: PageStats = { pageId: this.pageId, timerCount: this.timers.size, promiseCount: this.promises.size, resourceCount: this.resources.size, listenerCount: this.listeners.length, uptime: Date.now() - this.createTime }; return stats; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getStats 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 PageStats AST#identifier#Right AST#ERROR#Right AST#st...
getStats(): PageStats { const stats: PageStats = { pageId: this.pageId, timerCount: this.timers.size, promiseCount: this.promises.size, resourceCount: this.resources.size, listenerCount: this.listeners.length, uptime: Date.now() - this.createTime }; return stats; }
https://github.com/DaLongZhuaZi/manxia
740778a3c1c0e7ef64274724a3c529538af0bafb
github
ibestservices/ibest-ui
library/src/main/ets/components/calendar/calendarDialog.ets
arkts
onGetCalendarResult
获取日历选择结果 触发onConfirm回调函数 并关闭弹框
onGetCalendarResult(value: IBestCalendarConfirmResult[]) { if(value.length){ this.value = this.selectedValue this.onConfirm(value) this.visible = false } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onGetCalendarResult AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identi...
onGetCalendarResult(value: IBestCalendarConfirmResult[]) { if(value.length){ this.value = this.selectedValue this.onConfirm(value) this.visible = false } }
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/calendar/calendarDialog.ets#L177-L183
a5022f5aa0e9292c63512a2307cbf78ff89db39f
github
picklerick422/zju-learning-assistant-OH
entry/src/main/ets/services/SettingsService.ets
arkts
load
读取配置;首次无配置时返回默认值(save_path 由调用方传入下载目录)。
static load(fallbackSavePath: string): AppConfig { try { const raw = SettingsService.ensure().getSync(KEY, '') as string; if (raw && raw.length > 0) { const data = JSON.parse(raw) as AppConfigData; return AppConfig.fromData(data, fallbackSavePath); } } catch (e) { hilog...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left load AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left fallbackSavePath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Ri...
static load(fallbackSavePath: string): AppConfig { try { const raw = SettingsService.ensure().getSync(KEY, '') as string; if (raw && raw.length > 0) { const data = JSON.parse(raw) as AppConfigData; return AppConfig.fromData(data, fallbackSavePath); } } catch (e) { hilog...
https://github.com/picklerick422/zju-learning-assistant-OH
784b83dabb225522cf5ff4c644733d43c6b26dad
github
aimilin6688/KeePassHO
entry/src/main/ets/storage/onedrive/OneDriveClient.ets
arkts
convertAxiosError
转换Axios错误为HttpResponse @param error Axios错误 @returns HttpResponse
private convertAxiosError(error: AxiosError): HttpResponse { hilog.error(DOMAIN, TAG, `AxiosError: error=${error.message}`); const headers: Record<string, string> = {}; if (error.response?.headers) { const headerEntries = Object.entries(error.response.headers) as Array<[string, string]>; for (...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left convertAxiosError 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...
private convertAxiosError(error: AxiosError): HttpResponse { hilog.error(DOMAIN, TAG, `AxiosError: error=${error.message}`); const headers: Record<string, string> = {}; if (error.response?.headers) { const headerEntries = Object.entries(error.response.headers) as Array<[string, string]>; for (...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/onedrive/OneDriveClient.ets#L388-L441
13257d87f53919820ca1210cd1229983a6ce2268
github
kumaleap/ArkLuban
entry/src/main/ets/utils/PhotoHelper.ets
arkts
selectMultiple
选择多张照片 @param maxCount 最大选择数量,默认 9 @param supportTaking 是否支持拍照,默认 true @param supportEdit 是否支持编辑,默认 true @returns 返回图片 URI 数组
static async selectMultiple( maxCount: number = PhotoHelper.PHOTO_DEFAULT_SELECT_NUMBER, supportTaking: boolean = true, supportEdit: boolean = true ): Promise<Array<string>> { const options = new photoAccessHelper.PhotoSelectOptions(); options.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAG...
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 selectMultiple AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left maxCount AST#identifier#Right AST#:#Left ...
static async selectMultiple( maxCount: number = PhotoHelper.PHOTO_DEFAULT_SELECT_NUMBER, supportTaking: boolean = true, supportEdit: boolean = true ): Promise<Array<string>> { const options = new photoAccessHelper.PhotoSelectOptions(); options.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAG...
https://github.com/kumaleap/ArkLuban
8a632d4c5f906ebceedcad9cc3e1adfe751103a7
github
openharmony/multimedia_camera_framework
frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/mode/CameraService.ets
arkts
createPhotoOutputFn
创建photoOutPut输出对象
createPhotoOutputFn(cameraManager: camera.CameraManager, photoProfileObj: camera.Profile): camera.PhotoOutput | undefined { let photoOutput: camera.PhotoOutput | undefined = undefined; try { photoOutput = cameraManager.createPhotoOutput(photoProfileObj); Logger.info(TAG, `createPhotoOutputFn s...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left createPhotoOutputFn AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left cameraManager AST#identifier#Right AST#ERR...
createPhotoOutputFn(cameraManager: camera.CameraManager, photoProfileObj: camera.Profile): camera.PhotoOutput | undefined { let photoOutput: camera.PhotoOutput | undefined = undefined; try { photoOutput = cameraManager.createPhotoOutput(photoProfileObj); Logger.info(TAG, `createPhotoOutputFn s...
https://gitee.com/openharmony/multimedia_camera_framework.git
c1087f6b42c46b28ccea32e738f4aec446d04e93
gitee
Joker-x-dev/CoolMallArkTS
feature/user/src/main/ets/viewmodel/AddressDetailViewModel.ets
arkts
saveAddress
保存地址 @returns {void} 无返回值
private saveAddress(): void { const address: Address = new Address(); address.id = this.isEditMode ? this.addressId : 0; address.contact = this.contactName; address.phone = this.phone; address.province = this.province; address.city = this.city; address.district = this.district; address...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left saveAddress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#express...
private saveAddress(): void { const address: Address = new Address(); address.id = this.isEditMode ? this.addressId : 0; address.contact = this.contactName; address.phone = this.phone; address.province = this.province; address.city = this.city; address.district = this.district; address...
https://github.com/Joker-x-dev/CoolMallArkTS
02ce4014733225a3812588de48ead35db5fa37d8
github
Cool_foolisher1/ArkTSRepository
GraphicalCode/features/algorithm/src/main/ets/component/CardComponentDetailContent.ets
arkts
handleBreakPointChange
监听断点变化
handleBreakPointChange() { this.cardComponentDetailViewModel?.sendEvent(new TopNavigationChangeEvent(this.globalInfoModel.currentBreakpoint === BreakpointTypeEnum.SM ? false : this.isShowTopDivider)) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left handleBreakPointChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_b...
handleBreakPointChange() { this.cardComponentDetailViewModel?.sendEvent(new TopNavigationChangeEvent(this.globalInfoModel.currentBreakpoint === BreakpointTypeEnum.SM ? false : this.isShowTopDivider)) }
https://gitcode.com/Cool_foolisher1/ArkTSRepository
ba78c474a314ac3a6ec2f278855ae77c9d25c58c
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/TypeCreator.ets
arkts
addMethod
Adds method to `this` interface @param mc method to add @returns this
public addMethod(mc: MethodCreator): InterfaceTypeCreator throws { if ((mc.attrs.has(Attributes.STATIC))) { throw new TypeAPICreateException("interface can't have static method " + mc) } mc.addAbstract() mc.addAccessModifier(AccessModifier.PUBLIC) mc.frozen.freeze...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addMethod AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left mc AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left MethodCr...
public addMethod(mc: MethodCreator): InterfaceTypeCreator throws { if ((mc.attrs.has(Attributes.STATIC))) { throw new TypeAPICreateException("interface can't have static method " + mc) } mc.addAbstract() mc.addAccessModifier(AccessModifier.PUBLIC) mc.frozen.freeze...
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
26d4b48e9357419a02acc8eae3e4a719021da92e
gitee
aimilin6688/KeePassHO
entry/src/main/ets/services/kdbx/KdbxCsvService.ets
arkts
escapeCsvField
转义CSV字段 @param field 字段值 @returns 转义后的字段值
private static escapeCsvField(field: string): string { // 如果字段包含逗号、双引号或换行符,则需要用双引号包围,并将内部双引号转义为两个双引号 if (field.includes(',') || field.includes('"') || field.includes('\n')) { return '"' + field.replace(/"/g, '""') + '"'; } return field; }
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 escapeCsvField AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left field AST#identifier#Right AST#:#Left...
private static escapeCsvField(field: string): string { // 如果字段包含逗号、双引号或换行符,则需要用双引号包围,并将内部双引号转义为两个双引号 if (field.includes(',') || field.includes('"') || field.includes('\n')) { return '"' + field.replace(/"/g, '""') + '"'; } return field; }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/kdbx/KdbxCsvService.ets#L272-L278
b0560b020285105fef4aafc8dc94141ac343128f
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/DataManager.ets
arkts
createDownloadTask
==================== 下载管理 ==================== 创建下载任务
public async createDownloadTask(task: DownloadTaskInput): Promise<string> { try { const taskData: DownloadTask = { id: this.generateId(), comicId: task.comicId, chapterId: task.chapterId, status: task.status, progress: task.progress, totalPages: task.totalPage...
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 createDownloadTask AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left task AST#identifier#Right AST#:#Left ...
public async createDownloadTask(task: DownloadTaskInput): Promise<string> { try { const taskData: DownloadTask = { id: this.generateId(), comicId: task.comicId, chapterId: task.chapterId, status: task.status, progress: task.progress, totalPages: task.totalPage...
https://github.com/DaLongZhuaZi/manxia
f6803307ae670980134eeddea26b8b0363bf5140
github
honjow/Next2V
shared/src/main/ets/settings/DraftSettings.ets
arkts
saveTopicDraft
Returns the unix-seconds timestamp persisted on the draft (0 when the draft was empty and therefore cleared). Callers that need to display the saved time should use this return value rather than recomputing the clock, so the shown time always matches what was written.
static async saveTopicDraft(context: common.UIAbilityContext, nodeName: string, title: string, content: string, nodeTitle: string = ''): Promise<number> { const cleanNode = (nodeName ?? '').trim() const cleanTitle = (title ?? '').trim() const cleanContent = content ?? '' if (!cleanNode && !cleanTitle ...
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 saveTopicDraft AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left :...
static async saveTopicDraft(context: common.UIAbilityContext, nodeName: string, title: string, content: string, nodeTitle: string = ''): Promise<number> { const cleanNode = (nodeName ?? '').trim() const cleanTitle = (title ?? '').trim() const cleanContent = content ?? '' if (!cleanNode && !cleanTitle ...
https://github.com/honjow/Next2V
5a018b8cc6104705df001f437144235a8cc0d74d
github
cpdd5201314/harmonyOS-music-app
products/phone/src/main/ets/pages/SearchHistoryManager.ets
arkts
getSearchStatistics
获取搜索统计信息
static async getSearchStatistics(): Promise<SearchStatistics> { try { const records = await SearchHistoryManager.getSearchHistory() let totalSearches = records.length let totalResults = 0 const sourceCount = new Map<string, number>() for (let i = 0; i < records.length; i++) { ...
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 getSearchStatistics AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right ...
static async getSearchStatistics(): Promise<SearchStatistics> { try { const records = await SearchHistoryManager.getSearchHistory() let totalSearches = records.length let totalResults = 0 const sourceCount = new Map<string, number>() for (let i = 0; i < records.length; i++) { ...
https://github.com/cpdd5201314/harmonyOS-music-app
f0df8410dfe7847df729f615ada06431bc347085
github
offlinecat-dev/OCNetORM
src/main/ets/mapping/EntityData.ets
arkts
hasTransient
检查是否存在临时数据 @param key 键名 @returns 是否存在
hasTransient(key: string): boolean { return this.transientData.has(key) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasTransient AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST...
hasTransient(key: string): boolean { return this.transientData.has(key) }
https://github.com/offlinecat-dev/OCNetORM
78d33f56037186e0315c9820a133014704716445
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Source/SuwayomiSourceExecutor.ets
arkts
search
搜索漫画 如果设置了当前源,则从该源搜索;否则从库中搜索
public async search(query: string): Promise<ComicInfo[]> { try { let results: ComicInfo[]; if (this.currentSourceId) { results = await this.suwayomiSource.searchManga(this.currentSourceId, query); } else { results = await this.suwayomiSource.searchLibrary(query); } re...
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 search AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left query AST#identifier#Right AST#:#Left : AST#:#Rig...
public async search(query: string): Promise<ComicInfo[]> { try { let results: ComicInfo[]; if (this.currentSourceId) { results = await this.suwayomiSource.searchManga(this.currentSourceId, query); } else { results = await this.suwayomiSource.searchLibrary(query); } re...
https://github.com/DaLongZhuaZi/manxia
f3b814dae49e65fa51faacd122a1ac603870dc9c
github
wuba/omni-ui
omni_component/src/main/ets/components/popup/Builder.ets
arkts
setTextFontSize
内容大小,列表时,列表项文字大小 @param textFontSize @returns
setTextFontSize(textFontSize?: number | string | Resource): Builder { this.popupOptions.textFontSize = textFontSize return this }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setTextFontSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#binary_expression#Left AST#identifier#Left textFontSize AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : A...
setTextFontSize(textFontSize?: number | string | Resource): Builder { this.popupOptions.textFontSize = textFontSize return this }
https://github.com/wuba/omni-ui
42d38d074a3488a3ca5679d858e51119db60eaf3
github
Cool_foolisher1/ArkTSRepository
GraphicalCode/commons/src/main/ets/util/BreakpointSystemUtil.ets
arkts
getValue
获取当前断点 @param currentBreakpoint 当前断点 @returns T
public getValue(currentBreakpoint: string): T { if (currentBreakpoint === BreakpointTypeEnum.XS) { return this.xs } if (currentBreakpoint === BreakpointTypeEnum.SM) { return this.sm } if (currentBreakpoint === BreakpointTypeEnum.MD) { return this.md } if (currentBreakpoin...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left currentBreakpoint AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#str...
public getValue(currentBreakpoint: string): T { if (currentBreakpoint === BreakpointTypeEnum.XS) { return this.xs } if (currentBreakpoint === BreakpointTypeEnum.SM) { return this.sm } if (currentBreakpoint === BreakpointTypeEnum.MD) { return this.md } if (currentBreakpoin...
https://gitcode.com/Cool_foolisher1/ArkTSRepository
f004d9ff4317c8d09bf04ee479df24085dc69978
gitcode
cpdd5201314/harmonyOS-music-app
products/phone/src/main/ets/pages/MusicApiClient.ets
arkts
handleWyResponse
处理网易API响应
private static handleWyResponse(response: MusicUrlResponse): string { if (!response || isNaN(Number(response.code))) { throw new Error('未知错误'); } switch (response.code) { case 0: if (!response.data) { throw new Error('返回数据为空'); } return response.data; c...
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 handleWyResponse AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left response AST#identifier#Right AST#:...
private static handleWyResponse(response: MusicUrlResponse): string { if (!response || isNaN(Number(response.code))) { throw new Error('未知错误'); } switch (response.code) { case 0: if (!response.data) { throw new Error('返回数据为空'); } return response.data; c...
https://github.com/cpdd5201314/harmonyOS-music-app
cf6290d2f80d54a35912cefd9adce3e340c290e0
github
openharmony-sig/flutter_packages
packages/image_picker/image_picker_ohos/ohos/src/main/ets/image_picker/ImagePickerDelegate.ets
arkts
chooseVideoFromGallery
选择一个视频
chooseVideoFromGallery(options: VideoSelectionOptions, usePhotoPicker: boolean, result: Result<ArrayList<string>>): void { if (!this.setPendingOptionsAndResult(null, options, result)) { this.finishWithAlreadyActiveError(result); return; } this.chooseMedia(1, 'handleChooseVideoResult', photoAc...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left chooseVideoFromGallery AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left options AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left VideoSelectionOptions AST#iden...
chooseVideoFromGallery(options: VideoSelectionOptions, usePhotoPicker: boolean, result: Result<ArrayList<string>>): void { if (!this.setPendingOptionsAndResult(null, options, result)) { this.finishWithAlreadyActiveError(result); return; } this.chooseMedia(1, 'handleChooseVideoResult', photoAc...
https://gitee.com/openharmony-sig/flutter_packages.git
0054a76093452144cb545adf54a9e3fddcc7899e
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Download/UnifiedDownloadManager.ets
arkts
getTasksByContent
获取指定内容的下载任务
public getTasksByContent(contentId: string): UnifiedDownloadTask[] { return this.getIndexedTasks(this.taskIdsByContent.get(contentId)); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getTasksByContent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left contentId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#st...
public getTasksByContent(contentId: string): UnifiedDownloadTask[] { return this.getIndexedTasks(this.taskIdsByContent.get(contentId)); }
https://github.com/DaLongZhuaZi/manxia
51ead545f94fba79e7ea525c02be68768021565e
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Console.ets
arkts
count
@section Console.count* API Counts the number of times this method has been called with a specific label Prints the current count to stdout @param {string} [label='default'] - The label to identify this counter @returns {void}
public count(label?: string): void { const key = label ?? 'default' const current = this.counters.get(key) ?? 0 this.counters.set(key, current + 1) this.log(`${key}: ${current + 1}`) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left count AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left label AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#...
public count(label?: string): void { const key = label ?? 'default' const current = this.counters.get(key) ?? 0 this.counters.set(key, current + 1) this.log(`${key}: ${current + 1}`) }
https://gitcode.com/iop123123/arkts-static-skills
75c122f6198d34071d269302104ed0b7138227d0
gitcode
GrassyUnknown/Health-Life-HarmonyOS-Next
oh_modules/.ohpm/cjcalendar@2.0.4/oh_modules/cjcalendar/src/main/ets/components/components/CJDateItem.ets
arkts
smallThan
小于日期 @param other @returns
smallThan(other: CJDateItem, hasEqual: boolean = false) { if (!other) { return false } if (other) { if (this.fullYear > other.fullYear) { return false } else if (this.fullYear < other.fullYear) { return true } else { if (this.month > other.month) { ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left smallThan AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left CJDateItem AST#identifier#Righ...
smallThan(other: CJDateItem, hasEqual: boolean = false) { if (!other) { return false } if (other) { if (this.fullYear > other.fullYear) { return false } else if (this.fullYear < other.fullYear) { return true } else { if (this.month > other.month) { ...
https://github.com/GrassyUnknown/Health-Life-HarmonyOS-Next
a4b561c8666dac810c743fc881524b2c859cd9ca
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/WebViewSourceManager.ets
arkts
createWebViewInstance
创建WebView实例
private createWebViewInstance(sourceId: string): WebViewInstanceInfo | null { try { const config = this.sourceConfigs.get(sourceId); if (!config) { logger.warn(TAG, `源配置不存在,无法创建WebView实例: ${sourceId}`); return null; } // 创建WebView控制器 const controller = new webview.We...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left createWebViewInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string ...
private createWebViewInstance(sourceId: string): WebViewInstanceInfo | null { try { const config = this.sourceConfigs.get(sourceId); if (!config) { logger.warn(TAG, `源配置不存在,无法创建WebView实例: ${sourceId}`); return null; } // 创建WebView控制器 const controller = new webview.We...
https://github.com/DaLongZhuaZi/manxia
1cfa23f595dabf5c06a3071ff21c1b3022d0d7a7
github
SMAT-Lab/PhantomRendering
example/entry/src/main/ets/common/DeviceUtils.ets
arkts
getAdaptiveSize
根据屏幕尺寸自适应尺寸
static getAdaptiveSize(baseSize: number, screenType: 'width' | 'height' = 'width'): number { const baseScreenSize = screenType === 'width' ? 360 : 780 // 基准屏幕尺寸 const currentScreenSize = screenType === 'width' ? DeviceUtils.getScreenWidth() : DeviceUtils.getScreenHeight() const scale = currentScreenSize /...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getAdaptiveSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left baseSize AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#numbe...
static getAdaptiveSize(baseSize: number, screenType: 'width' | 'height' = 'width'): number { const baseScreenSize = screenType === 'width' ? 360 : 780 // 基准屏幕尺寸 const currentScreenSize = screenType === 'width' ? DeviceUtils.getScreenWidth() : DeviceUtils.getScreenHeight() const scale = currentScreenSize /...
https://github.com/SMAT-Lab/PhantomRendering
ba8865e988973cd9fc0b8a41688e45cc808357ff
github
cduestc-course/ArkLearn
entry/src/main/ets/pages/05/5.2.3-1.ets
arkts
build
@Builder refreshContent() { Text('正在加载中...') .width('100%') .textAlign(TextAlign.Center) .backgroundColor(Color.Pink) }
build() { Column() { Refresh({ refreshing: $$this.refreshing, /*builder: this.refreshContent()*/}) { List() { ForEach(this.list, (item: number) => { ListItem() { Row() { Text(item.toString()) }.width('100%').padding(20).border({ ...
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() { Refresh({ refreshing: $$this.refreshing, /*builder: this.refreshContent()*/}) { List() { ForEach(this.list, (item: number) => { ListItem() { Row() { Text(item.toString()) }.width('100%').padding(20).border({ ...
https://github.com/cduestc-course/ArkLearn
a01c3dde566917fa4d7a5a82f1da0b65da0b9496
github
wuba/omni-ui
omni_component/src/main/ets/components/popup/Builder.ets
arkts
setMaxWidth
弹窗最大宽度,仅限于wrap=true
setMaxWidth(maxWidth: Length): Builder { this.popupConfig.maxWidth = maxWidth return this }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setMaxWidth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left maxWidth AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Length AST#identifier#Right AST#ERROR#Right AST#)#Left )...
setMaxWidth(maxWidth: Length): Builder { this.popupConfig.maxWidth = maxWidth return this }
https://github.com/wuba/omni-ui
a1653e6f03d44adeb614f7ddc0f57d4c62d9f7e7
github
CPF-ApplicationTPC/openharmony_tpc_samples
SwipeMenuListView/entry/src/main/ets/pages/ComprehensiveDemo.ets
arkts
isDynamicMenuTestEnabled
动态菜单相关方法
isDynamicMenuTestEnabled(): boolean { return this.dynamicMenuTestEnabled; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isDynamicMenuTestEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Righ...
isDynamicMenuTestEnabled(): boolean { return this.dynamicMenuTestEnabled; }
https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples
963269954460cdfd644b4312a74457557f668e54
gitcode
aimilin6688/KeePassHO
entry/src/main/ets/services/template/TemplateBuilder.ets
arkts
peek
获取当前正在构建的条目(不完成构建)
peek(): KdbxEntry { return this.entry; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left peek 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 KdbxEntry AST#identifier#Right AST#ERROR#Right AST#statem...
peek(): KdbxEntry { return this.entry; }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/template/TemplateBuilder.ets#L315-L317
a35cb753d7cc6ba4a2d1279053ceac7adc8d9841
github
Joker-x-dev/CoolMallArkTS
entry/src/main/ets/viewmodel/EntryViewModel.ets
arkts
aboutToAppear
入口页面初始化 由 EntryPage.aboutToAppear 调用,统一触发窗口相关初始化 @param {Context} context - 组件上下文 @returns {void} 无返回值
aboutToAppear(context: common.Context): void { this.windowAdapter.init(context); }
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#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#i...
aboutToAppear(context: common.Context): void { this.windowAdapter.init(context); }
https://github.com/Joker-x-dev/CoolMallArkTS
1f67bc2bcfb94adc5adc8f491b303cb1c3fa77a7
github
openharmony-sig/applications_calculator
common/src/main/ets/util/CommonUtil.ets
arkts
formatPasteNumber
将粘贴的数字去除小数点 @param numberArr 操作的字符串数组 @param setIndex 位置索引 @returns 去除小数点后的字符串数组
private static formatPasteNumber(numberArr: string[], setIndex: number): string[] { if (numberArr[setIndex].indexOf('.') >= 0 && numberArr.indexOf('.') >= 0) { if (numberArr[setIndex].includes('-') && setIndex > numberArr.indexOf('.')) { // 如果粘贴内容包含负号,切在所在内容数字数组里的小数点后面,则不进行任何操作 } else { ...
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 formatPasteNumber AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left numberArr AST#identifier#Right AST#ERROR#Left AST...
private static formatPasteNumber(numberArr: string[], setIndex: number): string[] { if (numberArr[setIndex].indexOf('.') >= 0 && numberArr.indexOf('.') >= 0) { if (numberArr[setIndex].includes('-') && setIndex > numberArr.indexOf('.')) { // 如果粘贴内容包含负号,切在所在内容数字数组里的小数点后面,则不进行任何操作 } else { ...
https://gitee.com/openharmony-sig/applications_calculator.git
29f1fcb3931bceb426177c1a90d075d40fcd4c6f
gitee
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/components/LimitLine.ets
arkts
enableDashedLine
Enables the line to be drawn in dashed mode, e.g. like this "- - - - - -" @param lineLength the length of the line pieces @param spaceLength the length of space in between the pieces @param phase offset, in degrees (normally, use 0)
public enableDashedLine(lineLength: number, spaceLength: number, phase: number) { this.mDashPathEffect = new DashPathEffect([lineLength, spaceLength], phase); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left enableDashedLine AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left lineLength AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#nu...
public enableDashedLine(lineLength: number, spaceLength: number, phase: number) { this.mDashPathEffect = new DashPathEffect([lineLength, spaceLength], phase); }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
e465cf9aad68276ce3a184dd7711a0023e5e6a9d
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelChapterCacheManager.ets
arkts
createNoMediaFile
创建.nomedia文件 防止系统媒体扫描器将目录识别为媒体文件夹
private createNoMediaFile(folderPath: string): void { try { const nomediaPath = `${folderPath}/.nomedia`; try { SafeFileUtils.accessSync(nomediaPath); } catch (e) { // 文件不存在,创建它 const file = SafeFileUtils.openSync(nomediaPath, fileIo.OpenMode.CREATE | fileIo.OpenMode.WRIT...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left createNoMediaFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left folderPath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AS...
private createNoMediaFile(folderPath: string): void { try { const nomediaPath = `${folderPath}/.nomedia`; try { SafeFileUtils.accessSync(nomediaPath); } catch (e) { // 文件不存在,创建它 const file = SafeFileUtils.openSync(nomediaPath, fileIo.OpenMode.CREATE | fileIo.OpenMode.WRIT...
https://github.com/DaLongZhuaZi/manxia
993594ed3707446435fff1b5cd4bca4d22e5d101
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/network/NetworkBoostService.ets
arkts
addSceneListener
订阅网络场景变更(弱信号预测/拥塞等)
addSceneListener(listener: SystemNetSceneListener): void { this.sceneListeners.add(listener); if (this.latestScene) { try { listener(this.latestScene); } catch (err) { console.warn(`[NetworkBoost] scene listener 异常: ${(err as Error).message}`); } } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addSceneListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left listener AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left SystemNetSceneListener AST#identifi...
addSceneListener(listener: SystemNetSceneListener): void { this.sceneListeners.add(listener); if (this.latestScene) { try { listener(this.latestScene); } catch (err) { console.warn(`[NetworkBoost] scene listener 异常: ${(err as Error).message}`); } } }
https://github.com/AlkaidLab/moonlight-harmony
a36d6e59f8fede8d78db30aabcf32e570071fb7c
github
openharmony/applications_mms
entry/src/main/ets/pages/infomsg/InfoMsgController.ets
arkts
clickMore
Tap More at the bottom of the screen
clickMore() { // this.$element('moreDialog').show(); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left clickMore AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AST...
clickMore() { // this.$element('moreDialog').show(); }
https://gitee.com/openharmony/applications_mms.git
428a19123e8cad567811a08eb9a11fe156fe3098
gitee
FinalScave/SweetLine
platform/OHOS/sweetline/src/main/ets/Index.ets
arkts
analyze
Perform full highlight analysis on the text @return Highlight result
public analyze(): DocumentHighlight { if (this.nativeHandle == 0) { return new DocumentHighlight(); } let buffer: Int32Array = lib.DocumentAnalyzer_Analyze(this.nativeHandle); return NativeBufferPack.readDocumentHighlight(buffer); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left analyze 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 DocumentHighli...
public analyze(): DocumentHighlight { if (this.nativeHandle == 0) { return new DocumentHighlight(); } let buffer: Int32Array = lib.DocumentAnalyzer_Analyze(this.nativeHandle); return NativeBufferPack.readDocumentHighlight(buffer); }
https://github.com/FinalScave/SweetLine
0a0485be417cbd765f0a9065b1af139f15d010a8
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/MouseEmulationService.ets
arkts
handleButtons
处理鼠标模拟下的按键变化 对齐 Android: sendControllerInputPacket() mouseEmulationActive 分支 A → 左键, B → 右键, D-Pad ↑↓ → 垂直滚轮, D-Pad ←→ → 水平滚轮
private handleButtons(buttons: number): void { if (!this.callback) return; const changed = buttons ^ this.lastButtons; this.lastButtons = buttons; // A 键 → 鼠标左键 if (changed & MoonlightButton.A) { if (buttons & MoonlightButton.A) { this.callback.sendMouseButtonDown(0x01); // BUTTON_...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleButtons AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left buttons AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#numbe...
private handleButtons(buttons: number): void { if (!this.callback) return; const changed = buttons ^ this.lastButtons; this.lastButtons = buttons; // A 键 → 鼠标左键 if (changed & MoonlightButton.A) { if (buttons & MoonlightButton.A) { this.callback.sendMouseButtonDown(0x01); // BUTTON_...
https://github.com/AlkaidLab/moonlight-harmony
9b5fa8328918cac40c32b46dfaf4f04e69d22bf3
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Promise.ets
arkts
catch
Schedule callback to execute after the promise is rejected @param [onRejected] callback that will be called after the promise is rejected @returns { Promise } new promise that will be resolved after the execution of the callback or rejected or the callback finished with an exception
catch<U = never>(onRejected?: (error: Error) => PromiseLike<U>|U): Promise<Awaited<T|U>> { let promise = new Promise<Awaited<T|U>>(); let fn: () => void = (): void => { try { if (this.state == Promise.STATE_REJECTED) { if (onRejected) { ...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#identifier#Left catch AST#identifier#Right AST#<#Left < AST#<#Right AST#assignment_expression#Left AST#identifier#Left U AST#identifier#Right AST#=#Left = AST#=#Right AST#binary_expression#Left AST#identifier#Left never AST#identifier#Right A...
catch<U = never>(onRejected?: (error: Error) => PromiseLike<U>|U): Promise<Awaited<T|U>> { let promise = new Promise<Awaited<T|U>>(); let fn: () => void = (): void => { try { if (this.state == Promise.STATE_REJECTED) { if (onRejected) { ...
https://gitcode.com/iop123123/arkts-static-skills
a9ac4e50efe42fd9ce7449f76d18993a5375aa4d
gitcode
fbinba3955/Flymby
common/src/main/ets/utils/VolumeUtil.ets
arkts
isMuted
判断是否静音 @returns 是否静音
public static async isMuted(): Promise<boolean> { try { if (!VolumeUtil.audioVolumeGroupManager) { LogUtil.error('VolumeUtil 音量组管理器未初始化'); return false; } // 使用音量组管理器同步方法检查是否静音 const isMuted = VolumeUtil.audioVolumeGroupManager.isMuteSync(audio.AudioVolumeType.MEDIA); ...
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 isMuted AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right ...
public static async isMuted(): Promise<boolean> { try { if (!VolumeUtil.audioVolumeGroupManager) { LogUtil.error('VolumeUtil 音量组管理器未初始化'); return false; } // 使用音量组管理器同步方法检查是否静音 const isMuted = VolumeUtil.audioVolumeGroupManager.isMuteSync(audio.AudioVolumeType.MEDIA); ...
https://github.com/fbinba3955/Flymby
309fe1c3fe7a25de8c8da911392ca6fee558868c
github
openharmony/arkui_ace_engine
examples/DrawableDescriptor/entry/src/main/ets/pages/drawableDescriptorStaticTest.ets
arkts
testPixelMapDrawDefaultConstructor
===================== PixelMapDrawableDescriptor 测试 =====================
testPixelMapDrawDefaultConstructor() { this.addLog('=== Test: PixelMapDrawableDescriptor constructor() ==='); try { const desc = new PixelMapDrawableDescriptor(); this.pixelMapDrawDesc = desc; if (desc) { this.addLog('PASS: PixelMapDrawableDescriptor() 默认构造成功', '#4CAF50'); } ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left testPixelMapDrawDefaultConstructor 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...
testPixelMapDrawDefaultConstructor() { this.addLog('=== Test: PixelMapDrawableDescriptor constructor() ==='); try { const desc = new PixelMapDrawableDescriptor(); this.pixelMapDrawDesc = desc; if (desc) { this.addLog('PASS: PixelMapDrawableDescriptor() 默认构造成功', '#4CAF50'); } ...
https://gitcode.com/openharmony/arkui_ace_engine
aadc3e0e11958f858eec23f1d085f4953b1f5011
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/Array.ets
arkts
lastIndexOf
lastIndexOf(arr: float[], key: float, fromIndex: int) tries to find entry of key into arr which is not greater than fromIndex @param arr array to find a key @param key a value to find @param fromIndex an index of arr to begin search with (including, search is performed backwards) @returns last index of key if found in ...
function lastIndexOf(arr: float[], key: float, fromIndex: int): int throws { return lastIndexOf(arr, key, -1, fromIndex) }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left lastIndexOf AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left arr AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right...
function lastIndexOf(arr: float[], key: float, fromIndex: int): int throws { return lastIndexOf(arr, key, -1, fromIndex) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
546079375a7d762f2c24dafccbddb78b245e1a61
gitee
openharmony/applications_contacts
entry/src/main/ets/presenter/contact/ContactListPresenter.ets
arkts
setCurItem
Touch and hold the current contact information saved by a contact item in the contact list. The information can be deleted or shared later. @param curItem
setCurItem(curItem: ContactVo) { HiLog.i(TAG, 'setCurItem'); this.curItem = curItem; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setCurItem AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left curItem AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ContactVo AST#identifier#Ri...
setCurItem(curItem: ContactVo) { HiLog.i(TAG, 'setCurItem'); this.curItem = curItem; }
https://gitee.com/openharmony/applications_contacts.git
730affcc4a1c4c38b0fb3bdfa985b8e446e2ab19
gitee
offlinecat-dev/OCNetORM
src/main/ets/query/WhereCondition.ets
arkts
isNull
创建 IS NULL 条件 @param column 列名 @returns WhereCondition 实例
static isNull(column: string): WhereCondition { const condition = new WhereCondition() condition.column = column condition.operator = ConditionOperator.IS_NULL condition.value = null return condition }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isNull AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left column AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string ...
static isNull(column: string): WhereCondition { const condition = new WhereCondition() condition.column = column condition.operator = ConditionOperator.IS_NULL condition.value = null return condition }
https://github.com/offlinecat-dev/OCNetORM
4b7522bea6b9d12ad396d7db128f917fdfbd893b
github
Tencent-RTC/TUIKit_Harmony
atomic_x/src/main/ets/basecomponent/language/LanguageState.ets
arkts
getLanguage
Get current language code
getLanguage(): string { return this.currentLanguage; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getLanguage 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#statement_...
getLanguage(): string { return this.currentLanguage; }
https://github.com/Tencent-RTC/TUIKit_Harmony
519d0473476754a39425869b408fac5b262c3a56
github
wuba/omni-ui
omni_component/src/main/ets/components/popup/Config.ets
arkts
getDialogOptions
获取弹窗系统设置 @returns
static getDialogOptions(): promptAction.BaseDialogOptions { return JSON.parse(JSON.stringify(Config.dialogOptions)) }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getDialogOptions 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#member_expression#Lef...
static getDialogOptions(): promptAction.BaseDialogOptions { return JSON.parse(JSON.stringify(Config.dialogOptions)) }
https://github.com/wuba/omni-ui
22c7e66f692a20822b6abd512a4a1c26d5da454a
github
DaLongZhuaZi/manxia
entry/src/main/ets/Utils/MetadataXmlGenerator.ets
arkts
unescapeXml
XML特殊字符反转义
private static unescapeXml(text: string): string { if (!text) return ''; return text .replace(/&amp;/g, '&') .replace(/&lt;/g, '<') .replace(/&gt;/g, '>') .replace(/&quot;/g, '"') .replace(/&apos;/g, "'"); }
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 unescapeXml AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : A...
private static unescapeXml(text: string): string { if (!text) return ''; return text .replace(/&amp;/g, '&') .replace(/&lt;/g, '<') .replace(/&gt;/g, '>') .replace(/&quot;/g, '"') .replace(/&apos;/g, "'"); }
https://github.com/DaLongZhuaZi/manxia
8642e26271e76df52cf40d4a3bee3efac812385f
github
the-wwyang/kids-learning-app
src/main/ets/common/ErrorHandler.ets
arkts
handleSync
处理同步操作的错误
public static handleSync<T>( operation: () => T, context: string, type: ErrorType = ErrorType.UNKNOWN, showToUser: boolean = true ): ErrorResult<T> { try { const data = operation(); return { success: true, data: data }; } catch (error) { const errorInf...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#binary_expression#Left AST#identifier#Left handleSync AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right ...
public static handleSync<T>( operation: () => T, context: string, type: ErrorType = ErrorType.UNKNOWN, showToUser: boolean = true ): ErrorResult<T> { try { const data = operation(); return { success: true, data: data }; } catch (error) { const errorInf...
https://github.com/the-wwyang/kids-learning-app
c3c5f398af9ba9ce7f2ef126e56ae0cdd72e3e81
github
751496032/ZRouter
RouterApi/src/main/ets/api/Router.ets
arkts
getParamByKey
获取路由参数 建议带上默认值和泛型 @param key @param defVal @returns
public static getParamByKey<P = ObjectOrNull>(key: string, defVal: ObjectOrNull = null): P { return ZRouter.getInstance().getParamByKey<P>(key, defVal) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#identifier#Left getParamByKey AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left P AST#identifier#Right AST#=#Left = AST#=#Right AST#identifier#Left ObjectOrNull AST#identifier#Righ...
public static getParamByKey<P = ObjectOrNull>(key: string, defVal: ObjectOrNull = null): P { return ZRouter.getInstance().getParamByKey<P>(key, defVal) }
https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/api/Router.ets#L358-L360
fb9195627fe75603d4a9cc1cfc4a60f6f8f6b0aa
github