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
NissonCX/CQU-HarmonyOS-APP-Dev-Final
entry/src/main/ets/utils/DataManager.ets
arkts
deleteHealthRecord
删除健康记录
async deleteHealthRecord(id: string): Promise<boolean> { try { const records = await this.getAllHealthRecords(); const filteredRecords = records.filter(r => r.id !== id); await this.dataPreferences?.put(KEY_HEALTH_RECORDS, JSON.stringify(filteredRecords)); await this.dataPreferences?.flush...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left deleteHealthRecord AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_annotation#Left AST#:#Left ...
async deleteHealthRecord(id: string): Promise<boolean> { try { const records = await this.getAllHealthRecords(); const filteredRecords = records.filter(r => r.id !== id); await this.dataPreferences?.put(KEY_HEALTH_RECORDS, JSON.stringify(filteredRecords)); await this.dataPreferences?.flush...
https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final
48f697a8b051af12992aedd6a9acddd1f85a8393
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test3_original_index.ets
arkts
testNestedObject
=== Nested object construction ===
function testNestedObject(): string { let address: Record<string, string> = {}; address['city'] = 'Beijing'; address['street'] = 'Chaoyang Road'; let person: Record<string, Object> = {}; person['name'] = 'Alice'; person['age'] = 30; person['address'] = address; return String(person['name']); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testNestedObject 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...
function testNestedObject(): string { let address: Record<string, string> = {}; address['city'] = 'Beijing'; address['street'] = 'Chaoyang Road'; let person: Record<string, Object> = {}; person['name'] = 'Alice'; person['age'] = 30; person['address'] = address; return String(person['name']); }
https://github.com/miaochiahao/ark-ghidra
4009c982ba73cfd83f12554dbbe407675809843d
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.TreeSet.ets
arkts
entries
Return the elements in the TreeSet as an Iterator of [value, value]s @returns an Iterator of [value, value]s
entries(): IterableIterator<[T, T]> { return this.treeMap.entries(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left entries AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST...
entries(): IterableIterator<[T, T]> { return this.treeMap.entries(); }
https://gitcode.com/iop123123/arkts-static-skills
e6d53fd16a6a52b19bdd3d7cf5421edc82f210d8
gitcode
openharmony/arkui_ace_engine
advanced_ui_component_static/assembled_advanced_ui_component/@ohos.arkui.advanced.TreeViewV2.ets
arkts
alterDragNode
Alter the current node location to a needful position. 1.Create an array named 'dragNodeParamV2' to store dragging node information. 2.Delete the dragging node from the tree. 3.Add the dragging node to the tree.
public alterDragNode(rearParentNodeId: int, rearCurrentNodeId: int, dragParentNodeId: int, dragCurrentNodeId: int, frontNodeInfoItem: NodeInfo): void { let dragNodeParamV2: DragNodeParamV2[] = []; let parentNodeId: int = Double.toInt(rearParentNodeId); let currentNodeId: int = dragCurrentNodeId; l...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left alterDragNode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left rearParentNodeId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AS...
public alterDragNode(rearParentNodeId: int, rearCurrentNodeId: int, dragParentNodeId: int, dragCurrentNodeId: int, frontNodeInfoItem: NodeInfo): void { let dragNodeParamV2: DragNodeParamV2[] = []; let parentNodeId: int = Double.toInt(rearParentNodeId); let currentNodeId: int = dragCurrentNodeId; l...
https://gitcode.com/openharmony/arkui_ace_engine
f019be17ec76bad3be7ff79737ca64ac0a0861de
gitcode
DaLongZhuaZi/NGF
ngf_framework/src/main/ets/utils/PerformanceMonitor.ets
arkts
clear
清除所有记录
clear(): void { this.marks.clear(); this.measures.length = 0; this.memorySnapshots.length = 0; logger.info(TAG, '清除所有性能记录'); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left A...
clear(): void { this.marks.clear(); this.measures.length = 0; this.memorySnapshots.length = 0; logger.info(TAG, '清除所有性能记录'); }
https://github.com/DaLongZhuaZi/NGF
77b710685ae39e18650e10c66db2007c3663b43f
github
openharmony/applications_notes
common/utils/src/main/ets/default/baseUtil/NoteUtil.ets
arkts
setAllNotesChecked
Set all notes Checked status @param checkedNoteArray - Checked status Note list @param selectedNoteArray - note array
setAllNotesChecked(checkedNoteArray: NoteData[], noteArray: NoteData[]) { LogUtil.info(TAG, "setAllNotesChecked") this.unsetAllNotesChecked(checkedNoteArray) checkedNoteArray.push(...noteArray) AppStorage.Set('CheckedNoteArray', checkedNoteArray) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setAllNotesChecked AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left checkedNoteArray AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left NoteData AST#identifier#Ri...
setAllNotesChecked(checkedNoteArray: NoteData[], noteArray: NoteData[]) { LogUtil.info(TAG, "setAllNotesChecked") this.unsetAllNotesChecked(checkedNoteArray) checkedNoteArray.push(...noteArray) AppStorage.Set('CheckedNoteArray', checkedNoteArray) }
https://gitee.com/openharmony/applications_notes.git
a3d87cbe41a842cc9710948ba5fb4e0a01c14192
gitee
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/utils/ViewPortHandler.ets
arkts
zoom
Post-scales by the specified scale factors. @param scaleX @param scaleY @return
public zoom(scaleX: number, scaleY: number, x?: number, y?: number, outputMatrix?: Matrix): Matrix | void { let save: Matrix = (outputMatrix != null && outputMatrix != undefined) ? outputMatrix : new Matrix(); save.reset(); save.set(this.mMatrixTouch); if (x != undefined && x != null && y != undefine...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left zoom AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left scaleX AST#identi...
public zoom(scaleX: number, scaleY: number, x?: number, y?: number, outputMatrix?: Matrix): Matrix | void { let save: Matrix = (outputMatrix != null && outputMatrix != undefined) ? outputMatrix : new Matrix(); save.reset(); save.set(this.mMatrixTouch); if (x != undefined && x != null && y != undefine...
https://gitee.com/openharmony-tpc/ohos_mpchart.git
7b14f2ecc77a117191c983969f128ca030182480
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/json.ets
arkts
stringify
Converts shorts array to JSON format @param d: short[] - shorts array to be converted to a JSON as an Array of Numbers @returns String - JSON representation of shorts array
public static stringify(d: short[]): String { let s = new StringBuilder("[") let last_elem = d.length - 1 for (let i = 0; i < last_elem; ++i) { s.append(d[i]) s.append(',') } if (d.length > 0) { s.append(d[last_elem]) } s.ap...
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 stringify AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left d AST#identifier#Right AST#:#Left : AST#:#Rig...
public static stringify(d: short[]): String { let s = new StringBuilder("[") let last_elem = d.length - 1 for (let i = 0; i < last_elem; ++i) { s.append(d[i]) s.append(',') } if (d.length > 0) { s.append(d[last_elem]) } s.ap...
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
40c76f8ee3914f80cb37587dc4c464aa9d1c81c6
gitee
apap6628114/nga_oh
entry/src/main/ets/store/BaseStore.ets
arkts
setDeps
供子类 init 调用的依赖注入辅助方法。 各 Store init 签名不同(2 或 3 个参数),子类在自身 init 中调用此方法。
protected setDeps(store: PreferencesStore, queue: SerialQueue, auth?: AuthState): void { this.store = store this.writeQueue = queue if (auth) { this.auth = auth } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left protected AST#identifier#Right AST#ERROR#Left AST#identifier#Left setDeps AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left store AST#identifier#Right AST#:#Left : AST#:#Right A...
protected setDeps(store: PreferencesStore, queue: SerialQueue, auth?: AuthState): void { this.store = store this.writeQueue = queue if (auth) { this.auth = auth } }
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/store/BaseStore.ets#L38-L44
d055d539091d99eb61e63123a1f41e61b3a9af53
github
killetom/ktretrofit
ktretrofit/src/main/ets/retrofit/interceptor/AuthInterceptor.ets
arkts
getToken
Get the static token. @returns A Promise that resolves to the token.
getToken(): Promise<string | undefined> { return Promise.resolve(this.token); }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getToken AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : A...
getToken(): Promise<string | undefined> { return Promise.resolve(this.token); }
https://github.com/killetom/ktretrofit
95a36e6bca351499c4329e00fec19e48ef0425db
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/buffer/AbstractBuffer.ets
arkts
size
Returns the size (length) of the buffer array. @return
public size(): number { return this.buffer.length; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left size AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Righ...
public size(): number { return this.buffer.length; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
1113b10abe40599aedefa29746569da7103b64a2
gitee
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/ChartData.ets
arkts
removeEntryByXValue
Removes the Entry object closest to the given DataSet at the specified index. Returns true if an Entry was removed, false if no Entry was found that meets the specified requirements. @param xValue @param dataSetIndex @return
public removeEntryByXValue(xValue: number, dataSetIndex: number): boolean { if (!this.mDataSets) { return false; } if (dataSetIndex >= this.mDataSets.size()) return false; let dataSet: IDataSet<EntryOhos> = this.mDataSets.get(dataSetIndex); let e: EntryOhos | null = dataSet.getEntryFo...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left removeEntryByXValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left xValue AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier...
public removeEntryByXValue(xValue: number, dataSetIndex: number): boolean { if (!this.mDataSets) { return false; } if (dataSetIndex >= this.mDataSets.size()) return false; let dataSet: IDataSet<EntryOhos> = this.mDataSets.get(dataSetIndex); let e: EntryOhos | null = dataSet.getEntryFo...
https://gitee.com/openharmony-tpc/ohos_mpchart.git
a6057e17e414ed75ecf1ac7342bc1360360afe3e
gitee
huangyuanlove/HelloArkUI
entry/src/main/ets/pages/playground/take_photo/TakePhotoPage.ets
arkts
getCameraDevices
获取可用相机列表
getCameraDevices(): Array<camera.CameraDevice> { let cameraArray: Array<camera.CameraDevice> = this.cameraManager.getSupportedCameras(); hilog.error(0x01, TAG, '-------getCameraDevices----'); if (cameraArray != undefined && cameraArray.length > 0) { for (let index = 0; index < cameraArray.length; in...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getCameraDevices AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#...
getCameraDevices(): Array<camera.CameraDevice> { let cameraArray: Array<camera.CameraDevice> = this.cameraManager.getSupportedCameras(); hilog.error(0x01, TAG, '-------getCameraDevices----'); if (cameraArray != undefined && cameraArray.length > 0) { for (let index = 0; index < cameraArray.length; in...
https://github.com/huangyuanlove/HelloArkUI
6ceb56c8829eaee226ff750e673cb4357936e926
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
fill
Fills the Float64Array with specified value @param { number } value - new value @param { int } [start] - start index to begin fill from @param { int } [end] - last index to end fill from, excluded @returns { this } - modified Float64Array @syscap SystemCapability.Utils.Lang @FaAndStageModel
public fill(value: number, start?: int, end?: int): this { const k = normalizeIndex(start ?? 0, this.lengthInt) const finalPos = normalizeIndex(end ?? this.lengthInt, this.lengthInt) this.fillInternal(value.toDouble(), k, finalPos) return this }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left fill AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERR...
public fill(value: number, start?: int, end?: int): this { const k = normalizeIndex(start ?? 0, this.lengthInt) const finalPos = normalizeIndex(end ?? this.lengthInt, this.lengthInt) this.fillInternal(value.toDouble(), k, finalPos) return this }
https://gitcode.com/iop123123/arkts-static-skills
1cc87f4ab1fcfe7d10389c5ec4ad528a11791ec0
gitcode
DaLongZhuaZi/NGF
ngf_framework/src/main/ets/data/facades/DataFacade.ets
arkts
persistToRdb
持久化单条实体到 RDB
private persistToRdb(entityName: string, id: string, payloadJson: string): void { if (!this.rdbAvailable || !this.rdbStore) { return; } try { const bucket: relationalStore.ValuesBucket = { 'entity_name': entityName, 'entity_id': id, 'payload_json': payloadJson }; ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left persistToRdb AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left entityName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#str...
private persistToRdb(entityName: string, id: string, payloadJson: string): void { if (!this.rdbAvailable || !this.rdbStore) { return; } try { const bucket: relationalStore.ValuesBucket = { 'entity_name': entityName, 'entity_id': id, 'payload_json': payloadJson }; ...
https://github.com/DaLongZhuaZi/NGF
24c8abb22ad7db8874fb561b00b98c730436663e
github
CLMC2025/Vignette
entry/src/main/ets/vocabulary/UnknownWordHandler.ets
arkts
generateLearningSuggestions
生成学习建议
generateLearningSuggestions(): string[] { const suggestions: string[] = []; const stats = this.getUnknownWordStats(); if (stats.totalUnknown === 0) { suggestions.push('当前没有未知词汇'); return suggestions; } if (stats.highPriority > 0) { suggestions.push(`有 ${stats.highPriority} 个高优先...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left generateLearningSuggestions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string A...
generateLearningSuggestions(): string[] { const suggestions: string[] = []; const stats = this.getUnknownWordStats(); if (stats.totalUnknown === 0) { suggestions.push('当前没有未知词汇'); return suggestions; } if (stats.highPriority > 0) { suggestions.push(`有 ${stats.highPriority} 个高优先...
https://github.com/CLMC2025/Vignette
917784a60a436ffe6ca6fbf34a44fc2d10752ed0
github
openharmony/multimedia_camera_framework
frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/mode/CameraService.ets
arkts
createCameraInputFn
创建cameraInput输出对象
createCameraInputFn(cameraManager: camera.CameraManager, cameraDevice: camera.CameraDevice): camera.CameraInput | undefined { Logger.info(TAG, 'createCameraInputFn is called.'); let cameraInput: camera.CameraInput | undefined = undefined; try { cameraInput = cameraManager.createCameraInput(camer...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left createCameraInputFn AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left cameraManager AST#identifier#Right AST#ERR...
createCameraInputFn(cameraManager: camera.CameraManager, cameraDevice: camera.CameraDevice): camera.CameraInput | undefined { Logger.info(TAG, 'createCameraInputFn is called.'); let cameraInput: camera.CameraInput | undefined = undefined; try { cameraInput = cameraManager.createCameraInput(camer...
https://gitee.com/openharmony/multimedia_camera_framework.git
64fd3d76535eed242f26c74d65b42e01d07bc728
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/VariableReplacer.ets
arkts
replaceObject
替换对象中的所有变量 @param obj 对象 @param context 变量上下文 @returns 替换后的对象
static replaceObject(obj: Record<string, Object | undefined>, context: VariableContext): Record<string, Object | undefined> { if (typeof obj !== 'object' || obj === null) { return obj; } const result: Record<string, Object | undefined> = {}; const keys = Object.keys(obj); for (const key of...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left replaceObject AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expre...
static replaceObject(obj: Record<string, Object | undefined>, context: VariableContext): Record<string, Object | undefined> { if (typeof obj !== 'object' || obj === null) { return obj; } const result: Record<string, Object | undefined> = {}; const keys = Object.keys(obj); for (const key of...
https://github.com/DaLongZhuaZi/manxia
d14f47486866ab47ca81fb07cf94f5c3b18e61ef
github
offlinecat-dev/OCNetORM
src/main/ets/schema/SchemaBuilder.ets
arkts
escapeIdentifier
转义 SQL 标识符(表名、列名) 使用双引号包裹并转义内部的双引号,防止 SQL 注入 @param identifier 标识符(表名或列名) @returns 转义后的标识符
private escapeIdentifier(identifier: string): string { // 替换双引号为两个双引号(SQLite 转义规则) const escaped = identifier.replace(/"/g, '""') return `"${escaped}"` }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left escapeIdentifier AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left identifier AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST...
private escapeIdentifier(identifier: string): string { // 替换双引号为两个双引号(SQLite 转义规则) const escaped = identifier.replace(/"/g, '""') return `"${escaped}"` }
https://github.com/offlinecat-dev/OCNetORM
db8e1155853d66d00de9466cf57deeb596790fb6
github
GrassyUnknown/Health-Life-HarmonyOS-Next
entry/src/main/ets/viewmodel/HomeViewModel.ets
arkts
initData
MainPage show触发
public initData() { // 获取90天的字符串 let curDate = new Date(); let firstLogDate = new Date(curDate); firstLogDate.setDate(curDate.getDate() - MONTH3_DAY_NUM); let strArr:string[] = []; for (let index = 0; index <= MONTH3_DAY_NUM; index++) { let tempDate = new Date(firstLogDate); tempDa...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left initData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#...
public initData() { // 获取90天的字符串 let curDate = new Date(); let firstLogDate = new Date(curDate); firstLogDate.setDate(curDate.getDate() - MONTH3_DAY_NUM); let strArr:string[] = []; for (let index = 0; index <= MONTH3_DAY_NUM; index++) { let tempDate = new Date(firstLogDate); tempDa...
https://github.com/GrassyUnknown/Health-Life-HarmonyOS-Next
cf1c447bf292a9bf5050d7322c95a7e66faf17f8
github
apap6628114/nga_oh
entry/src/main/ets/store/settings/domain/CheckinSettings.ets
arkts
autoCheckinIfNeeded
若启用自动签到且今日未签到,则执行签到并记录日期
async autoCheckinIfNeeded(): Promise<boolean> { if (!this.ctx.auth!.isAuthenticated || !this.ctx.state.autoCheckin) { return false } const d: Date = new Date() const today: string = `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}` if (...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left autoCheckinIfNeeded AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#...
async autoCheckinIfNeeded(): Promise<boolean> { if (!this.ctx.auth!.isAuthenticated || !this.ctx.state.autoCheckin) { return false } const d: Date = new Date() const today: string = `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}` if (...
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/store/settings/domain/CheckinSettings.ets#L23-L43
d5dc87f1d849096b1382c3566fb38b87b30e6247
github
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/Message.ets
arkts
isValid
判断消息是否有效 @returns true 如果消息有效
isValid(): boolean { return this.validate() === null }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isValid AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statement_b...
isValid(): boolean { return this.validate() === null }
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
495850e257aaca26a9b9e6310d26e3ca6df55db4
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Debug/CrashRecorderService.ets
arkts
dispose
注销异常监听器
public dispose(): void { if (this.isRegistered && this.errorObserverId >= 0) { try { errorManager.off('error', this.errorObserverId); this.isRegistered = false; console.log(`[NGF] ${TAG}: 异常监听器已注销`); } catch (error) { const msg = error instanceof Error ? error.message :...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left dispose AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_sta...
public dispose(): void { if (this.isRegistered && this.errorObserverId >= 0) { try { errorManager.off('error', this.errorObserverId); this.isRegistered = false; console.log(`[NGF] ${TAG}: 异常监听器已注销`); } catch (error) { const msg = error instanceof Error ? error.message :...
https://github.com/DaLongZhuaZi/manxia
dc7759b39d0354f6a02a3e447c9660ea0b0a2242
github
Xiwei753/xiezuoruanjian
apps/harmony/entry/src/main/ets/bridge/NativeWriterCoreBridge.ets
arkts
listStarMaps
── StarMap ──
async listStarMaps(): Promise<ResultEnvelope<StarMapMeta[]>> { try { const jsonStr: string = this.getNativeModule().nativeListStarMaps() return this.parseEnvelope<StarMapMeta[]>(jsonStr) } catch (e) { return { success: false, errorCode: 'NATIVE_ERROR', messageKey: 'error.native_error', messa...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left listStarMaps AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic...
async listStarMaps(): Promise<ResultEnvelope<StarMapMeta[]>> { try { const jsonStr: string = this.getNativeModule().nativeListStarMaps() return this.parseEnvelope<StarMapMeta[]>(jsonStr) } catch (e) { return { success: false, errorCode: 'NATIVE_ERROR', messageKey: 'error.native_error', messa...
https://github.com/Xiwei753/xiezuoruanjian
eb23892bdcc7c3021fb76c34f64246efeed9bbb7
github
Nekofox-POT/LinMusic
entry/src/main/ets/package/files_manager/class_files_manager.ets
arkts
scan_data
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 外部函数 // ////////// 扫描 //
async scan_data(fast: boolean = true) { try { // 上锁 // if (this.working) {return} else {this.working = true} // 扫描 // if (fast) { // 快速扫描 log(`files_manager: 快速扫描`) await this.download_manager!.scan_data_fast() } else { // 完整扫描 log(`files_man...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left scan_data AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left fast AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:...
async scan_data(fast: boolean = true) { try { // 上锁 // if (this.working) {return} else {this.working = true} // 扫描 // if (fast) { // 快速扫描 log(`files_manager: 快速扫描`) await this.download_manager!.scan_data_fast() } else { // 完整扫描 log(`files_man...
https://github.com/Nekofox-POT/LinMusic
dc29e3683d8a9aee8be11e4b49fe3b9ec3ad93fa
github
LJ666-ui/harmony-health-care
entry/src/main/ets/store/AppStore.ets
arkts
deleteHealthRecord
Action: 删除健康记录
public deleteHealthRecord(id: string): void { const filteredRecords: HealthRecord[] = []; for (let i = 0; i < this.state.healthRecords.length; i++) { if (this.state.healthRecords[i].id !== id) { filteredRecords.push(this.state.healthRecords[i]); } } this.setState({ healthRecords: f...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left deleteHealthRecord AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left...
public deleteHealthRecord(id: string): void { const filteredRecords: HealthRecord[] = []; for (let i = 0; i < this.state.healthRecords.length; i++) { if (this.state.healthRecords[i].id !== id) { filteredRecords.push(this.state.healthRecords[i]); } } this.setState({ healthRecords: f...
https://github.com/LJ666-ui/harmony-health-care
93634280430aa0f1784a7f43020ee90bb1d2e4a5
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/ThemeManager.ets
arkts
isLightThemeSync
判断是否为浅色主题(同步)
public isLightThemeSync(): boolean { return this.getActualThemeSync() === ThemeType.LIGHT; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isLightThemeSync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean ...
public isLightThemeSync(): boolean { return this.getActualThemeSync() === ThemeType.LIGHT; }
https://github.com/DaLongZhuaZi/manxia
fe9503d43eb077b4047f894f26970379f1dea235
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Source/SourceRepositoryManager.ets
arkts
saveIndexFile
保存索引文件
private async saveIndexFile(index: SourceRepositoryIndex): Promise<void> { try { const jsonContent = JSON.stringify(index, null, 2); const savedByNgf = ngfSourceRepositoryFacade.updateIndexJson(jsonContent); if (savedByNgf) { logger.info(TAG, '索引文件保存成功(NGF facade)'); return; ...
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 saveIndexFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left :...
private async saveIndexFile(index: SourceRepositoryIndex): Promise<void> { try { const jsonContent = JSON.stringify(index, null, 2); const savedByNgf = ngfSourceRepositoryFacade.updateIndexJson(jsonContent); if (savedByNgf) { logger.info(TAG, '索引文件保存成功(NGF facade)'); return; ...
https://github.com/DaLongZhuaZi/manxia
d398a15e304f41169b008d3cd7c4366a941298f8
github
terryma2024/happyword
harmonyos/entry/src/main/ets/services/PackSelectionService.ets
arkts
recordPerfectAdventure
Record a flawless adventure on `packId`. Increments the perfect counter; once an unpinned active pack reaches PERFECT_THRESHOLD, swaps it for the next candidate from `provider`. Pinned packs are never rotated. Exhausted candidate pools simply freeze the active set (counter remains at the threshold so a later candidate ...
async recordPerfectAdventure( packId: string, provider: PackCandidateProvider, ): Promise<PerfectAdventureResult> { const out: PerfectAdventureResult = new PerfectAdventureResult(); const cur: number = this.perfectScores.get(packId) ?? 0; this.perfectScores.set(packId, cur + 1); if (this.ac...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left recordPerfectAdventure AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left packId AST#identifier#Right AST#type_annotation#Left AST...
async recordPerfectAdventure( packId: string, provider: PackCandidateProvider, ): Promise<PerfectAdventureResult> { const out: PerfectAdventureResult = new PerfectAdventureResult(); const cur: number = this.perfectScores.get(packId) ?? 0; this.perfectScores.set(packId, cur + 1); if (this.ac...
https://github.com/terryma2024/happyword
861f5a49f07e1e7ec46e52b078ff5d4d40e871d4
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
with
Creates a copy with replaced value on index @param index @param value @returns an BigUint64Array with replaced value on index
public with(index: number, value: BigInt): BigUint64Array { return this.with(index as int, value) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#ERROR#Right AST#with_statement#Left AST#with#Left with AST#with#Right AST#parenthesized_expression#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST...
public with(index: number, value: BigInt): BigUint64Array { return this.with(index as int, value) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
1f80b2fe7c9a98caba0cf98012679dc386cd300c
gitee
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/RadarChartModel.ets
arkts
getYChartMax
Returns the maximum value this chart can display on it's y-axis.
public getYChartMax(): number { return this.mYAxis.mAxisMaximum; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getYChartMax AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#nu...
public getYChartMax(): number { return this.mYAxis.mAxisMaximum; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
e1ed7329db772f9a0d5a1a1d5a3c1f49d753f02e
gitee
openharmony-tpc/XmlGraphicsBatik
library/src/main/ets/batik/SVGManager.ets
arkts
_convertObjToXML
转换Obj数据为XML格式 @param contentObj 要被转换为XML格式的对象 @return xml格式数据
private _convertObjToXML(contentObj: Object): string | undefined { let contentObjValue: Record<string, string | object > =contentObj as Record<string, string | object > let objXml = ''; if (typeof contentObjValue !== SVGAttrConstants.TYPEOF_OBJECT || !hasKeyInObj(contentObjValue, SVGAttrConstants.ATTR_KEY...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left _convertObjToXML AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left contentObj AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Object...
private _convertObjToXML(contentObj: Object): string | undefined { let contentObjValue: Record<string, string | object > =contentObj as Record<string, string | object > let objXml = ''; if (typeof contentObjValue !== SVGAttrConstants.TYPEOF_OBJECT || !hasKeyInObj(contentObjValue, SVGAttrConstants.ATTR_KEY...
https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git
3eed318d039bc551c22f796df57fe8d0f26b437b
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/libs/htmlparser/HTMLElement.ets
arkts
matches
检查元素是否匹配选择器
matches(selector: string): boolean { const selectorGroups = Matcher.parseSelector(selector); for (const chain of selectorGroups) { if (chain.length === 1 && this.matchesSelectorPart(this, chain[0].part)) { return true; } } return false; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left matches AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left selector AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST#)#Right...
matches(selector: string): boolean { const selectorGroups = Matcher.parseSelector(selector); for (const chain of selectorGroups) { if (chain.length === 1 && this.matchesSelectorPart(this, chain[0].part)) { return true; } } return false; }
https://github.com/DaLongZhuaZi/manxia
cc8d04b5e8ba054fadb74dbe678cb3a22feb5702
github
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnRegionPickerViewModel.ets
arkts
onCustomRegionConfirm
自定义数据选择确认回调 @param names 地区名称数组 @param codes 区域编码数组
onCustomRegionConfirm(names: string[], codes: string[]): void { this.customRegionDisplayText = names.join(" / "); this.customRegionCodeText = codes.join(" / "); this.customRegionOpen = false; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onCustomRegionConfirm AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left names AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left str...
onCustomRegionConfirm(names: string[], codes: string[]): void { this.customRegionDisplayText = names.join(" / "); this.customRegionCodeText = codes.join(" / "); this.customRegionOpen = false; }
https://github.com/codelably/tuniao-ui
d8ddeab59436ae17f521910f960c8a2259006388
github
openharmony/applications_filepicker
audiopicker/src/main/ets/basemvvm/AbsBaseViewData.ets
arkts
appendSingle
finish loading without data (only one data) @param newData newData
public appendSingle(newData: VD): void { this.liveData.push(newData); this.state.setViewState(BaseState.NORMAL); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left appendSingle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left newData AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left VD AST#identifie...
public appendSingle(newData: VD): void { this.liveData.push(newData); this.state.setViewState(BaseState.NORMAL); }
https://gitee.com/openharmony/applications_filepicker.git
85371c4657e94728d33f1b48a2446ac96d029a0c
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/Short.ets
arkts
createFromJSONValue
Creates a Short instance based on JSONValue @param json: JSONValue - a JSON representation @throws JSONTypeError if json does not encode a valid short @returns Short - short value decoded from JSON
static createFromJSONValue(json: JSONValue): Short { if (json instanceof JSONNumber) { let num = (json as JSONNumber).value if (Double.isInteger(num) && Short.MIN_VALUE <= num && num <= Short.MAX_VALUE) { return Short.valueOf(num as short) } } ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createFromJSONValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left json AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
static createFromJSONValue(json: JSONValue): Short { if (json instanceof JSONNumber) { let num = (json as JSONNumber).value if (Double.isInteger(num) && Short.MIN_VALUE <= num && num <= Short.MAX_VALUE) { return Short.valueOf(num as short) } } ...
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
ade353d8c3c66844ebecb51f3c208eac68489fd4
gitee
openharmony/codelabs
Security/AccessPermission/entry/src/main/ets/common/util/DeviceListUtil.ets
arkts
stopDeviceDiscovery
Stop querying devices.
stopDeviceDiscovery() { try { if (this.dmInstance !== undefined) { this.dmInstance.stopDeviceDiscovery(this.subscribeId); } } catch (err) { Logger.error(TAG, 'stopDeviceDiscovery err:' + JSON.stringify(err)); } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left stopDeviceDiscovery 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_bloc...
stopDeviceDiscovery() { try { if (this.dmInstance !== undefined) { this.dmInstance.stopDeviceDiscovery(this.subscribeId); } } catch (err) { Logger.error(TAG, 'stopDeviceDiscovery err:' + JSON.stringify(err)); } }
https://gitee.com/openharmony/codelabs.git
b00b31b117bd6df575b772ca21a859a0b2b923c4
gitee
Joker-x-dev/CoolMallArkTS
core/navigation/src/main/ets/common/CommonNavigator.ets
arkts
toUserAgreement
跳转到用户协议 @returns {void} 无返回值
static toUserAgreement(): void { navigateTo(CommonRoutes.UserAgreement); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left toUserAgreement 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#expres...
static toUserAgreement(): void { navigateTo(CommonRoutes.UserAgreement); }
https://github.com/Joker-x-dev/CoolMallArkTS
d5894409ae79331803c811e332ca336f2b7d27a2
github
cheinlu/HarmonyOS-groundhog-charging-system
TbsChargeHarmonyOs/feature/charge/src/main/ets/view/ChargeItemDialogView.ets
arkts
pileImage
区分不同状态的桩图片
pileImage(state: number) { switch (state) { case 0: return $r('app.media.pile_idle') case 1: return $r('app.media.pile_charging_in_progress') case 2: return $r('app.media.pile_faults') default: return $r('app.media.pile_idle') } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left pileImage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left state AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AS...
pileImage(state: number) { switch (state) { case 0: return $r('app.media.pile_idle') case 1: return $r('app.media.pile_charging_in_progress') case 2: return $r('app.media.pile_faults') default: return $r('app.media.pile_idle') } }
https://github.com/cheinlu/HarmonyOS-groundhog-charging-system
e1e5741bdd6949154184b3029fe9185b9074ee55
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/DynamicUrlResolver.ets
arkts
resolveUrlsInObject
解析对象中的所有URL字段
resolveUrlsInObject(obj: Record<string, any>, config: UrlResolverConfig): Record<string, any> { const result: Record<string, any> = {}; Object.keys(obj).forEach(key => { const value = obj[key]; if (typeof value === 'string') { // 如果是字符串且包含{{}},则解析 if (value.includes('{{...
AST#program#Left AST#expression_statement#Left AST#sequence_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left resolveUrlsInObject AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#:#Left : AST#:#Right AS...
resolveUrlsInObject(obj: Record<string, any>, config: UrlResolverConfig): Record<string, any> { const result: Record<string, any> = {}; Object.keys(obj).forEach(key => { const value = obj[key]; if (typeof value === 'string') { // 如果是字符串且包含{{}},则解析 if (value.includes('{{...
https://github.com/DaLongZhuaZi/manxia
80e3cdddcc93cb9cae0b4858e61247204a865ef7
github
Tencent-RTC/TUIKit_Harmony
atomic_x/src/main/ets/messagelist/components/MessageList.ets
arkts
forwardTranslatedText
Forward translated text to other conversations Called from MessageItem's translation menu
forwardTranslatedText(translatedText: string) { if (!translatedText || translatedText.length === 0) { return; } console.log(`[MessageList] 📤 Forwarding translated text`); // Show forward target selector this.forwardDialogController = new CustomDialogController({ builder: ForwardTarg...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left forwardTranslatedText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left translatedText AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#E...
forwardTranslatedText(translatedText: string) { if (!translatedText || translatedText.length === 0) { return; } console.log(`[MessageList] 📤 Forwarding translated text`); // Show forward target selector this.forwardDialogController = new CustomDialogController({ builder: ForwardTarg...
https://github.com/Tencent-RTC/TUIKit_Harmony
954917f8b5b12332a77a829b06f3b7ef08731e28
github
codelably/tuniao-ui
core/tuniaoui/src/main/ets/components/water-fall/TnWaterFallTypes.ets
arkts
resetData
重置数据 @param items 新数据数组
resetData(items: Object[]): void { this.dataArray = items; this.notifyDatasetChange(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left resetData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left items AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left Object AST#iden...
resetData(items: Object[]): void { this.dataArray = items; this.notifyDatasetChange(); }
https://github.com/codelably/tuniao-ui
ee76fb84886386d2b58e0615a7e7e8b1fca5f397
github
openharmony/applications_calendar_data
datamanager/src/main/ets/processor/instances/InstanceExpandHelper.ets
arkts
expandInstancesByResultSet
根据数据库查询的ResultSet扩展生成Instances并插入数据库 @param rdbStore 数据库实例 @param resultSet Events表查询到的结果 @return true 处理成功 false 处理失败
async function expandInstancesByResultSet(rdbStore: data_rdb.RdbStore, resultSet: data_rdb.ResultSet): Promise<boolean> { Log.debug(TAG, 'expandInstancesByResultSet generateInstancesMap begin'); const instancesMap = generateInstancesMapFromValues(resultSet); Log.debug(TAG, `expandInstancesByResultSet generateInst...
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left expandInstancesByResultSet AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left rdbStore AST#identifie...
async function expandInstancesByResultSet(rdbStore: data_rdb.RdbStore, resultSet: data_rdb.ResultSet): Promise<boolean> { Log.debug(TAG, 'expandInstancesByResultSet generateInstancesMap begin'); const instancesMap = generateInstancesMapFromValues(resultSet); Log.debug(TAG, `expandInstancesByResultSet generateInst...
https://gitee.com/openharmony/applications_calendar_data.git
ec8414da3659feaf8991b92c8d62d9832516a61c
gitee
openharmony/codelabs
ETSUI/LifeBalance/entry/src/main/ets/model/HealthConsultFavoriteModel.ets
arkts
deletePreferences
Deletes the specified Preferences persistence file from memory and removes the Preferences instance.
async deletePreferences() { try { await dataPreferences.deletePreferences(context, 'HealthPreferences'); } catch (err) { console.error(`Failed to delete preferences, Cause: ${err}`); } ; preference = preferenceTemp; }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left deletePreferences AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AS...
async deletePreferences() { try { await dataPreferences.deletePreferences(context, 'HealthPreferences'); } catch (err) { console.error(`Failed to delete preferences, Cause: ${err}`); } ; preference = preferenceTemp; }
https://gitcode.com/openharmony/codelabs
d8b09136c1cb4edc693461e2c62a8368696d373f
gitcode
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/BaseDataSet.ets
arkts
notifyDataSetChanged
Use this method to tell the data set that the underlying data has changed.
public notifyDataSetChanged(): void { this.calcMinMax(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left notifyDataSetChanged 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#e...
public notifyDataSetChanged(): void { this.calcMinMax(); }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
437145d7fae33c0e72970e24405dd73e6468308e
gitee
openharmony-sig/applications_clock
feature/worldclock/src/main/ets/utils/WorldClockUtil.ets
arkts
updateTimeZoneInfo
update timezone information @param the offset of timezone @return the formatted timezone info
static async updateTimeZoneInfo(rawOffset: number, timeZone: string, cityIndex: string): Promise<string> { const calendar = i18n.getCalendar(i18n.getSystemLocale()); calendar.setTimeZone(timeZone); let year = calendar.get(CalendarFiled.Year) let month = calendar.get(CalendarFiled.Month); let date ...
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 updateTimeZoneInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left rawOffset AST#identifier#Right AST#ERROR#Left AST#:#...
static async updateTimeZoneInfo(rawOffset: number, timeZone: string, cityIndex: string): Promise<string> { const calendar = i18n.getCalendar(i18n.getSystemLocale()); calendar.setTimeZone(timeZone); let year = calendar.get(CalendarFiled.Year) let month = calendar.get(CalendarFiled.Month); let date ...
https://gitee.com/openharmony-sig/applications_clock.git
ff1babb0d8f5d30a1eac3efded9293527e179511
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
includes
Determines whether Int8Array includes a certain element, returning true or false as appropriate @param { byte } searchElement - The element to search for. The search starts at index 0. @returns { boolean } - true if searchElement is in Int8Array, false otherwise @syscap SystemCapability.Utils.Lang @FaAndStageModel
public includes(searchElement: byte): boolean { return this.includes(searchElement, 0) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left includes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left searchElement AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left byte AST#ident...
public includes(searchElement: byte): boolean { return this.includes(searchElement, 0) }
https://gitcode.com/iop123123/arkts-static-skills
09b03e50d5df38289ae9ed22e69dd591fa603c79
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/libs/htmlparser/LegadoHtmlBridge.ets
arkts
findByText
按文本内容查找元素
private findByText(searchText: string): HTMLElement[] { if (!this.root) return []; const results: HTMLElement[] = []; const allElements = this.root.getElementsByTagName('*'); for (const elem of allElements) { if (elem.text.includes(searchText)) { results.push(elem); } ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left findByText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left searchText AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#strin...
private findByText(searchText: string): HTMLElement[] { if (!this.root) return []; const results: HTMLElement[] = []; const allElements = this.root.getElementsByTagName('*'); for (const elem of allElements) { if (elem.text.includes(searchText)) { results.push(elem); } ...
https://github.com/DaLongZhuaZi/manxia
4bd1511b6a6131b5110c4088219a0715172eca73
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/TypeGuards.ets
arkts
batchCheck
批量类型检查 @param checks - 检查配置数组 @returns 所有检查是否通过
static batchCheck(checks: Array<ITypeCheckConfig>): boolean { let allPassed = true; for (let i = 0; i < checks.length; i++) { const check = checks[i]; if (!check.guard(check.value)) { logger.warn(TAG, `类型检查失败: ${check.name}`); allPassed = false; } } return a...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left batchCheck AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left checks AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expre...
static batchCheck(checks: Array<ITypeCheckConfig>): boolean { let allPassed = true; for (let i = 0; i < checks.length; i++) { const check = checks[i]; if (!check.guard(check.value)) { logger.warn(TAG, `类型检查失败: ${check.name}`); allPassed = false; } } return a...
https://github.com/DaLongZhuaZi/manxia
f731d2415fc766369f9d18eafcdf3f140958476c
github
the-wwyang/kids-learning-app
src/main/ets/services/LearningRecordService.ets
arkts
calculateEfficiencyScore
计算学习效率分数 @param records 答题记录列表 @returns 效率分数 (0-100)
static calculateEfficiencyScore(records: AnswerRecord[]): number { if (records.length === 0) return 0; // 计算正确率 (40%) const correctCount = records.filter(r => r.isCorrect).length; const accuracyScore = (correctCount / records.length) * 40; // 计算答题速度 (30%) const avgTime = LearningRecordServic...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left calculateEfficiencyScore AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left records AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subs...
static calculateEfficiencyScore(records: AnswerRecord[]): number { if (records.length === 0) return 0; // 计算正确率 (40%) const correctCount = records.filter(r => r.isCorrect).length; const accuracyScore = (correctCount / records.length) * 40; // 计算答题速度 (30%) const avgTime = LearningRecordServic...
https://github.com/the-wwyang/kids-learning-app
7b458fae3445481744c8633c9f91586d95e5468c
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Array.ets
arkts
toSpliced
Copying version of the splice() method. @param start index @param delete number of items after start index @returns a new Array with some elements removed and/or replaced at a given index.
public toSpliced(start: number, delete: number): Array<T> { return this.toSpliced(start as int, delete as int) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toSpliced AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left start AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left numbe...
public toSpliced(start: number, delete: number): Array<T> { return this.toSpliced(start as int, delete as int) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
b9e1ebe4f7ca194b3fcab301f6c82aefdb0977ac
gitee
ZestBox-18/kitebook-frontend
features/home/src/main/ets/utils/HomeIndexCalculator.ets
arkts
getGroupTurnover
计算账单分组头部展示的当日总流水。
static getGroupTurnover(group: BillGroup): number { return group.totalIncome + group.totalExpense; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getGroupTurnover AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left group AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
static getGroupTurnover(group: BillGroup): number { return group.totalIncome + group.totalExpense; }
https://github.com/ZestBox-18/kitebook-frontend
56c9cb493b5dfb8b10487621c0be1f14e53b1a36
github
openharmony-tpc/ImageKnife
library/src/main/ets/ImageKnife.ets
arkts
putCacheImage
预加载缓存(用于外部已获取pixelmap,需要加入imageknife缓存的场景) @param url 图片地址url @param pixelMap 图片 @param cacheType 缓存策略 @param signature key自定义信息
putCacheImage(url: string, pixelMap: PixelMap, cacheType: CacheStrategy = CacheStrategy.Default, signature?: string) { let memoryKey = this.getEngineKeyImpl() .generateMemoryKey(url, ImageKnifeRequestSource.SRC, { loadSrc: url, signature: signature }); let fileKey = this.getEngineKeyImpl().generateFileK...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left putCacheImage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right ...
putCacheImage(url: string, pixelMap: PixelMap, cacheType: CacheStrategy = CacheStrategy.Default, signature?: string) { let memoryKey = this.getEngineKeyImpl() .generateMemoryKey(url, ImageKnifeRequestSource.SRC, { loadSrc: url, signature: signature }); let fileKey = this.getEngineKeyImpl().generateFileK...
https://gitee.com/openharmony-tpc/ImageKnife.git
4d920701e9add81ff0e7c1122aa5a29064a14617
gitee
aimilin6688/KeePassHO
entry/src/main/ets/services/store/DistributedKVService.ets
arkts
onKVStoreReady
KVStore 就绪后的统一初始化逻辑
private static onKVStoreReady(store: distributedKVStore.SingleKVStore, resolve: Function): void { DistributedKVService.kvStore = store; // 订阅远端数据变化 DistributedKVService.kvStore.on('dataChange', distributedKVStore.SubscribeType.SUBSCRIBE_TYPE_REMOTE, DistributedKVService.onDataChange); // 订阅同步完成事件 ...
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 onKVStoreReady AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left store AST#identifier#Right AST#:#Left...
private static onKVStoreReady(store: distributedKVStore.SingleKVStore, resolve: Function): void { DistributedKVService.kvStore = store; // 订阅远端数据变化 DistributedKVService.kvStore.on('dataChange', distributedKVStore.SubscribeType.SUBSCRIBE_TYPE_REMOTE, DistributedKVService.onDataChange); // 订阅同步完成事件 ...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/store/DistributedKVService.ets#L88-L103
d1079ea5aefe65ec7046d94cf524789f924a6a7b
github
openharmony-sig/applications_clock
common/src/main/ets/manager/SnoozeManager.ets
arkts
getNextAlertTime
Obtains the next start time. @param alarmId alarm id @return next alert time
async getNextAlertTime(alarmId: string): Promise<number> { const preferences = await this.getPreferences(); const nextAlertTime = await preferences.get(SNOOZE_ID + alarmId, ALERT_TIME_DEFAULT_DATA); return Number(nextAlertTime); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getNextAlertTime AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left alarmId AST#identifier#Right AST#type_annotation#Left AST#:#Le...
async getNextAlertTime(alarmId: string): Promise<number> { const preferences = await this.getPreferences(); const nextAlertTime = await preferences.get(SNOOZE_ID + alarmId, ALERT_TIME_DEFAULT_DATA); return Number(nextAlertTime); }
https://gitee.com/openharmony-sig/applications_clock.git
b51f7edf84e42f1c0b925168046d8f70b998cea7
gitee
openharmony/applications_photos
feature/editor/src/main/ets/default/view/CropResetButton.ets
arkts
build
编辑重置按钮按照小按钮的参数设置
build() { if (this.isPcStyle) { Stack() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { Text($r('app.string.cropModeReset_text')) .fontSize($r('sys.float.ohos_id_text_size_body2'...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#if_statement#Left AST#if#Left i...
build() { if (this.isPcStyle) { Stack() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { Text($r('app.string.cropModeReset_text')) .fontSize($r('sys.float.ohos_id_text_size_body2'...
https://gitee.com/openharmony/applications_photos.git
1caff7d6efc871805326846b1b26e108cd6d7f07
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Lifecycle/GlobalTaskCoordinator.ets
arkts
destroy
销毁协调器(通常不需要调用)
destroy(): void { this.stopStatsUpdate(); this.pageManagers.clear(); logger.info(TAG, '全局任务协调器已销毁'); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left destroy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left...
destroy(): void { this.stopStatsUpdate(); this.pageManagers.clear(); logger.info(TAG, '全局任务协调器已销毁'); }
https://github.com/DaLongZhuaZi/manxia
1b7a52784447098853bbcc3131431aa3e5a5adf6
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Theme/AppColors.ets
arkts
textPrimary
==================== 文字层级 ====================
static get textPrimary(): string { return getColorForCurrentTheme(ColorRole.TEXT_PRIMARY); }
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 textPrimary AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left...
static get textPrimary(): string { return getColorForCurrentTheme(ColorRole.TEXT_PRIMARY); }
https://github.com/DaLongZhuaZi/manxia
d28a102717548adbc0d1117933ce288a8c56f407
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/DataManager.ets
arkts
restoreOnlineComicSourceByPkg
[修复] 通过 sourcePkg 恢复在线漫画与图源的关联 当图源被删除后重新导入时,通过 sourcePkg 查找新的 sourceId 并更新在线漫画 @param sourcePkg 图源唯一包名 @returns 更新的漫画数量
public async restoreOnlineComicSourceByPkg(sourcePkg: string): Promise<number> { try { if (!sourcePkg) { logger.warn(TAG, `restoreOnlineComicSourceByPkg: sourcePkg 为空`); return 0; } // 1. 通过 pkg 查找图源 const sourceRecord = await this.getComicSourceByPkg(sourcePkg); if ...
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 restoreOnlineComicSourceByPkg AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourcePkg AST#identifier#Right AST#ERROR#...
public async restoreOnlineComicSourceByPkg(sourcePkg: string): Promise<number> { try { if (!sourcePkg) { logger.warn(TAG, `restoreOnlineComicSourceByPkg: sourcePkg 为空`); return 0; } // 1. 通过 pkg 查找图源 const sourceRecord = await this.getComicSourceByPkg(sourcePkg); if ...
https://github.com/DaLongZhuaZi/manxia
66bc735a6ea1befc7b1b9bdb1b504734670c6940
github
DaLongZhuaZi/manxia
entry/src/main/ets/Utils/WindowManager.ets
arkts
setStatusSafeBottomImmersive
专用模式:页面自行处理状态栏避让,同时允许内容延伸到底部导航栏区域 @param uiContext 可选的UIContext,推荐在组件中传入
static setStatusSafeBottomImmersive(uiContext?: UIContext): void { try { const mainWindow = uiContext ? WindowManager.getMainWindowFromUIContext(uiContext) : WindowManager.getMainWindow(); if (!mainWindow) { logger.error(WindowManager.TAG, '❌ 无法获取主窗口,设置专用沉浸模式失败'); retu...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setStatusSafeBottomImmersive 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#:#Left : AST#:...
static setStatusSafeBottomImmersive(uiContext?: UIContext): void { try { const mainWindow = uiContext ? WindowManager.getMainWindowFromUIContext(uiContext) : WindowManager.getMainWindow(); if (!mainWindow) { logger.error(WindowManager.TAG, '❌ 无法获取主窗口,设置专用沉浸模式失败'); retu...
https://github.com/DaLongZhuaZi/manxia
89c2685c6c6c626261ca8377e321c39cc4e26592
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/GyroAssistService.ets
arkts
getGyroStickValues
获取当前陀螺仪映射的摇杆值(调试用)
getGyroStickValues(): StickXY { const values: StickXY = { x: this.gyroStickX, y: this.gyroStickY }; return values; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getGyroStickValues 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 StickXY AST#identifier#Right AST#ERROR#Righ...
getGyroStickValues(): StickXY { const values: StickXY = { x: this.gyroStickX, y: this.gyroStickY }; return values; }
https://github.com/AlkaidLab/moonlight-harmony
9a53ad73057582189a1e30a1e480202e5b920b1c
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.List.ets
arkts
replaceAllElements
Replaces all elements in the List using a callback function that takes the value and index, and itself. @param callbackfn - The callback function taking the value, index, and the List as arguments.
public replaceAllElements(callbackfn: ListReplaceCb<T>): void { let currentNode: ListNode<T> | undefined = this.buffer.head let index: int = 0; while (currentNode !== undefined) { currentNode!.element = callbackfn(currentNode!.element, index++, this) currentNode = cur...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left replaceAllElements AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callbackfn AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instant...
public replaceAllElements(callbackfn: ListReplaceCb<T>): void { let currentNode: ListNode<T> | undefined = this.buffer.head let index: int = 0; while (currentNode !== undefined) { currentNode!.element = callbackfn(currentNode!.element, index++, this) currentNode = cur...
https://gitcode.com/iop123123/arkts-static-skills
7148577b5523b52c5341fd03ed625cf2896d5346
gitcode
aimilin6688/KeePassHO
entry/src/main/ets/workers/DatabaseLoad.ets
arkts
postErrorMessage
发送失败消息 @param message 消息
postErrorMessage(message: string, onErrorMessage?: (message: LoadMessage) => void) { if (onErrorMessage) { onErrorMessage(toLoadMessage(message)); } }
AST#program#Left AST#ERROR#Left AST#identifier#Left postErrorMessage AST#identifier#Right AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left message AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Right AST#binary_expression#Left ...
postErrorMessage(message: string, onErrorMessage?: (message: LoadMessage) => void) { if (onErrorMessage) { onErrorMessage(toLoadMessage(message)); } }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/workers/DatabaseLoad.ets#L72-L76
9e5db0aa13fb429b753714595cbf05149afede95
github
HunZiLei/ArkTS_PokePomodoro
entry/src/main/ets/common/database/TaskTable.ets
arkts
query
supports concrete index query_deprecated(task_name: string, callback: Function, isAll: boolean = true) { let predicates = new relationalStore.RdbPredicates(CommonConstants.TASK_TABLE_INIT.tableName) Logger.debug(`TaskTable predicates = ${JSON.stringify(predicates)}`) Logger.debug(`TaskTable taskname: ${task_name}`) if ...
query(task_name: string, callback: Function, isAll: boolean = true) { let submit: TaskData = new TaskData(); submit.task_name = task_name this.basic_query("task_name", submit, callback, isAll) // this.query_dup(task_name, callback, isAll) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left query AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left task_name AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left...
query(task_name: string, callback: Function, isAll: boolean = true) { let submit: TaskData = new TaskData(); submit.task_name = task_name this.basic_query("task_name", submit, callback, isAll) // this.query_dup(task_name, callback, isAll) }
https://github.com/HunZiLei/ArkTS_PokePomodoro
ba6cf1c4148d7e7253647c8d7cc0f67ec59ace3c
github
OMGCA/sakipay
sakipay_hmos/main/src/main/ets/models/EarningsCalculator.ets
arkts
isDayOff
Three-tier day-off determination: user override > holiday calendar > weekend check.
private isDayOff(date: Date): boolean { const month: number = date.getMonth() + 1 const day: number = date.getDate() // Tier 1: user override const ds: string = this.dateStringFromDate(date) const override: DayOverride | undefined = this.dayOverrides.get(ds) if (override !== undefined) { ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left isDayOff AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left date AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Date...
private isDayOff(date: Date): boolean { const month: number = date.getMonth() + 1 const day: number = date.getDate() // Tier 1: user override const ds: string = this.dateStringFromDate(date) const override: DayOverride | undefined = this.dayOverrides.get(ds) if (override !== undefined) { ...
https://github.com/OMGCA/sakipay
6f80af272712577476a6c78d28d0cb481391342e
github
Cool_foolisher1/ArkTSRepository
GraphicalCode/commons/src/main/ets/util/WindowUtil.ets
arkts
initialize
初始化 @param windowStage window.WindowStage
public static initialize(windowStage: window.WindowStage): void { try { WindowUtil.windowClass = windowStage.getMainWindowSync() const uiContext: UIContext = WindowUtil.windowClass.getUIContext() WindowUtil.uiContext = uiContext AppStorage.setOrCreate<UIContext>(StorageKeyEnum.UI_CONTEXT, ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left initialize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left windowStage AST#identifier#Right...
public static initialize(windowStage: window.WindowStage): void { try { WindowUtil.windowClass = windowStage.getMainWindowSync() const uiContext: UIContext = WindowUtil.windowClass.getUIContext() WindowUtil.uiContext = uiContext AppStorage.setOrCreate<UIContext>(StorageKeyEnum.UI_CONTEXT, ...
https://gitcode.com/Cool_foolisher1/ArkTSRepository
73ee5d494d656ca73700f7fcb29b3d3eafb4cebc
gitcode
Amaz1ny/HarmonyDO-public
entry/src/main/ets/services/auth/AuthService.ets
arkts
init
初始化认证状态(从存储中恢复)
async init(): Promise<void> { if (this.initialized) { return; } try { await PreferencesUtil.ensureInit(); this.isLoggedIn = await PreferencesUtil.getBoolean(AuthService.KEY_IS_LOGGED_IN, false); this.currentUsername = await PreferencesUtil.getString(AuthService.KEY_USERNAME, ''); ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left...
async init(): Promise<void> { if (this.initialized) { return; } try { await PreferencesUtil.ensureInit(); this.isLoggedIn = await PreferencesUtil.getBoolean(AuthService.KEY_IS_LOGGED_IN, false); this.currentUsername = await PreferencesUtil.getString(AuthService.KEY_USERNAME, ''); ...
https://github.com/Amaz1ny/HarmonyDO-public
c1ae119d127e4a865ac5cbd12768296f526de13a
github
arkui-x/samples
CodeLab/Cases/feature/addressrecognize/src/main/ets/view/ImageEdit.ets
arkts
moveClipCanvas
裁剪框位置和大小变化,初始位置为图片的初始坐标,移动的坐标 @param moveX @param moveY
moveClipCanvas(moveX: number, moveY: number) { let clipRect: RectPosition = { x: this.clipRect.x, y: this.clipRect.y, width: this.clipRect.width, height: this.clipRect.height } switch (this.actionType) { case ActionType.move: clipRect.x += moveX; clipRect.y +=...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left moveClipCanvas AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left moveX AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Rig...
moveClipCanvas(moveX: number, moveY: number) { let clipRect: RectPosition = { x: this.clipRect.x, y: this.clipRect.y, width: this.clipRect.width, height: this.clipRect.height } switch (this.actionType) { case ActionType.move: clipRect.x += moveX; clipRect.y +=...
https://gitcode.com/arkui-x/samples
5f84ace445ddaff4c0e82ba6812d9332e50ec733
gitcode
aimilin6688/KeePassHO
entry/src/main/ets/components/ColorPickerDialog.ets
arkts
hexToRgb
十六进制颜色转RGB
function hexToRgb(hex: string): number[] { const result: RegExpExecArray | null = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); if (result) { return [ parseInt(result[1], 16), parseInt(result[2], 16), parseInt(result[3], 16) ]; } return [0, 0, 0]; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left hexToRgb AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left hex AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AS...
function hexToRgb(hex: string): number[] { const result: RegExpExecArray | null = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); if (result) { return [ parseInt(result[1], 16), parseInt(result[2], 16), parseInt(result[3], 16) ]; } return [0, 0, 0]; }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/components/ColorPickerDialog.ets#L117-L127
5d3354ae168834e0f7ef741d88cc8d8e4802ff33
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test15_original_index.ets
arkts
testStringCompare
--- String lexicographic comparison ---
function testStringCompare(): string { let a: string = 'apple'; let b: string = 'banana'; let result: string = ''; if (a < b) { result = 'a<b'; } else if (a > b) { result = 'a>b'; } else { result = 'a=b'; } return result; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testStringCompare 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#predefine...
function testStringCompare(): string { let a: string = 'apple'; let b: string = 'banana'; let result: string = ''; if (a < b) { result = 'a<b'; } else if (a > b) { result = 'a>b'; } else { result = 'a=b'; } return result; }
https://github.com/miaochiahao/ark-ghidra
fd9abcd5345a7d82ded88513d16b1d7130a93e52
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Date.ets
arkts
getUTCSeconds
Returns the seconds in the specified date according to universal time. @returns the seconds in the specified date according to universal time.
public getUTCSeconds(): byte { return ecmaSecFromTime(this.ms); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getUTCSeconds 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 byte AST...
public getUTCSeconds(): byte { return ecmaSecFromTime(this.ms); }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
e8bfb634c2fbc99e7ba8375106b3a5aee747bec9
gitee
Joker-x-dev/HarmonyKit
core/data/src/main/ets/repository/DemoRepository.ets
arkts
deleteDemo
删除指定 ID 的 Demo 记录 @param {number} id - 记录主键 @returns {Promise<void>} Promise<void>
async deleteDemo(id: number): Promise<void> { return this.demoLocalDataSource.deleteById(id); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left deleteDemo AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#...
async deleteDemo(id: number): Promise<void> { return this.demoLocalDataSource.deleteById(id); }
https://github.com/Joker-x-dev/HarmonyKit
cf85ca4e3b4e68987d656a5f157d0d9a20936c50
github
LJ666-ui/harmony-health-care
entry/src/main/ets/ancientimage/ImagePreprocessor.ets
arkts
getPixel
获取像素值 @param imageData 图像数据 @param x X坐标 @param y Y坐标 @returns 像素数据
getPixel(imageData: ImageData, x: number, y: number): PixelData { const idx = (y * imageData.width + x) * 4; return { r: imageData.data[idx], g: imageData.data[idx + 1], b: imageData.data[idx + 2], a: imageData.data[idx + 3] }; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getPixel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left imageData AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ImageData AST#identifier#Right AST#,#Left ...
getPixel(imageData: ImageData, x: number, y: number): PixelData { const idx = (y * imageData.width + x) * 4; return { r: imageData.data[idx], g: imageData.data[idx + 1], b: imageData.data[idx + 2], a: imageData.data[idx + 3] }; }
https://github.com/LJ666-ui/harmony-health-care
92e51676d5ef270f079236b0880d41d1e965f0d4
github
Vincent-Leon/zotero-harmony
entry/src/main/ets/api/ZoteroClient.ets
arkts
isPlainObject
---------- structural helpers ----------
function isPlainObject(value: Object): boolean { return typeof value === 'object' && value !== null && !Array.isArray(value); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left isPlainObject AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left value AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#R...
function isPlainObject(value: Object): boolean { return typeof value === 'object' && value !== null && !Array.isArray(value); }
https://github.com/Vincent-Leon/zotero-harmony
cbb68a25ef30621783d5cb3854eeec5e47d94acd
github
CLMC2025/Vignette
entry/src/main/ets/context/ContextValidator.ets
arkts
cleanContext
清理语境(修复常见问题)
cleanContext(context: string): string { let cleaned = TextSanitizer.sanitizeContext(context); cleaned = cleaned.trim(); // 修复标点后空格 cleaned = cleaned.replace(/([.!?])([a-zA-Z])/g, '$1 $2'); // 确保句子以句号结尾 if (!cleaned.endsWith('.')) { cleaned += '.'; } // 首字母大写 cleaned = clea...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left cleanContext AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left context AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST#)#R...
cleanContext(context: string): string { let cleaned = TextSanitizer.sanitizeContext(context); cleaned = cleaned.trim(); // 修复标点后空格 cleaned = cleaned.replace(/([.!?])([a-zA-Z])/g, '$1 $2'); // 确保句子以句号结尾 if (!cleaned.endsWith('.')) { cleaned += '.'; } // 首字母大写 cleaned = clea...
https://github.com/CLMC2025/Vignette
86978029827d5be7376ff38a94ff9d3c38dd3b1a
github
openharmony/codelabs
ETSUI/SimpleCalculator/entry/src/main/ets/viewmodel/PresskeysViewModel.ets
arkts
getPressKeys
Key array data.
getPressKeys(): Array<Array<PressKeysItem>>{ return [ [ new PressKeysItem(0, '32vp', '32vp', 'clean', $r('app.media.ic_clean')), new PressKeysItem(1, '19vp', '43vp', '7'), new PressKeysItem(1, '19vp', '43vp', '4'), new PressKeysItem(1, '19vp', '43vp', '1'), new PressK...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getPressKeys AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifi...
getPressKeys(): Array<Array<PressKeysItem>>{ return [ [ new PressKeysItem(0, '32vp', '32vp', 'clean', $r('app.media.ic_clean')), new PressKeysItem(1, '19vp', '43vp', '7'), new PressKeysItem(1, '19vp', '43vp', '4'), new PressKeysItem(1, '19vp', '43vp', '1'), new PressK...
https://gitee.com/openharmony/codelabs.git
d1dcd7d8cecba55beb1d8bf7a152c282dca647a9
gitee
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/ComputerManager.ets
arkts
getComputers
═══════════════════════════════════════════════════════════ CRUD 操作 ═══════════════════════════════════════════════════════════ 获取所有电脑列表 返回深拷贝的对象,确保 ArkTS @State 能检测到变化
async getComputers(): Promise<ComputerInfo[]> { return Array.from(this.computers.values()).map(computer => ComputerPersistence.cloneComputer(computer)); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getComputers AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic...
async getComputers(): Promise<ComputerInfo[]> { return Array.from(this.computers.values()).map(computer => ComputerPersistence.cloneComputer(computer)); }
https://github.com/AlkaidLab/moonlight-harmony
ea833108b51516297f402895fd45cc8b27499d06
github
LJ666-ui/harmony-health-care
entry/src/main/ets/medicalimaging/ImagePreprocessor.ets
arkts
normalize
归一化像素值 将像素值从[0, 255]归一化到[0, 1] @param pixelMap 原始图像 @returns 归一化后的图像
async normalize(pixelMap: image.PixelMap): Promise<image.PixelMap> { try { // 注意: HarmonyOS PixelMap不直接支持像素值修改 // 这里我们返回原图,实际的归一化在转换为张量时进行 // 在convertToTensor方法中会将像素值除以255 return pixelMap; } catch (error) { console.error('ImagePreprocessor.normalize error:', error); ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left normalize AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left pixelMap AST#identifier#Right AST#type_annotation#Left AST#:#Left : A...
async normalize(pixelMap: image.PixelMap): Promise<image.PixelMap> { try { // 注意: HarmonyOS PixelMap不直接支持像素值修改 // 这里我们返回原图,实际的归一化在转换为张量时进行 // 在convertToTensor方法中会将像素值除以255 return pixelMap; } catch (error) { console.error('ImagePreprocessor.normalize error:', error); ...
https://github.com/LJ666-ui/harmony-health-care
bdc099560af70c9c3c3bbde906661a2a3260a762
github
erosTeam/NextE
shared/src/main/ets/settings/CookieJarSettings.ets
arkts
applyFromHeader
Apply a captured WebView cookie header (login) OR a persisted cookie string (restore) into the jar — preserving the COMPLETE cookie set, not just a known auth bundle. EH gates some galleries (ExHentai-only content shown as "removed or unavailable" on the e-hentai.org URL) on donor/permission cookies whose names we do n...
static applyFromHeader(header: string): boolean { const store: EhCookieStore = EhCookieStore.getInstance() const pairs: string[] = header.split(';') for (const pair of pairs) { const trimmed: string = pair.trim() const eq: number = trimmed.indexOf('=') if (eq <= 0) { continue ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left applyFromHeader AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left header AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
static applyFromHeader(header: string): boolean { const store: EhCookieStore = EhCookieStore.getInstance() const pairs: string[] = header.split(';') for (const pair of pairs) { const trimmed: string = pair.trim() const eq: number = trimmed.indexOf('=') if (eq <= 0) { continue ...
https://github.com/erosTeam/NextE
59cb01a00e227eb34c0977808ff599210b392e6a
github
fbinba3955/Flymby
common/src/main/ets/video/ControlPanelView.ets
arkts
toggleOperationLock
切换操作锁定状态
toggleOperationLock() { this.isOperationLocked = !this.isOperationLocked LogUtil.info(`操作锁定状态切换: ${this.isOperationLocked}`) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left toggleOperationLock 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_bloc...
toggleOperationLock() { this.isOperationLocked = !this.isOperationLocked LogUtil.info(`操作锁定状态切换: ${this.isOperationLocked}`) }
https://github.com/fbinba3955/Flymby
27a5b99f616f7e9bb56982d020166acfaf28454a
github
ZestBox-18/kitebook-frontend
commons/data_core/src/main/ets/services/CategoryManager.ets
arkts
getAllCategories
查询全部分类,供账单显示和导出等场景复用。
static async getAllCategories(): Promise<CategoryBean[]> { const predicates = new relationalStore.RdbPredicates(TABLE_NAME); predicates.orderByAsc('type'); predicates.orderByAsc('sort_order'); predicates.orderByAsc('id'); return new Promise<CategoryBean[]>((resolve, reject) => { dbManager.d...
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 getAllCategories AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST...
static async getAllCategories(): Promise<CategoryBean[]> { const predicates = new relationalStore.RdbPredicates(TABLE_NAME); predicates.orderByAsc('type'); predicates.orderByAsc('sort_order'); predicates.orderByAsc('id'); return new Promise<CategoryBean[]>((resolve, reject) => { dbManager.d...
https://github.com/ZestBox-18/kitebook-frontend
0cdfc905307fd9497688f03b662b8482f6d71092
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelSourceManager.ets
arkts
searchAllBatched
搜索书籍(分批并行,适用于大量书源) @param keyword 搜索关键词 @param page 页码 @param batchSize 每批并发数 @param onProgress 进度回调
async searchAllBatched( keyword: string, page: number = 1, batchSize: number = 5, onProgress?: (completed: number, total: number, results: NovelSearchResult[]) => void ): Promise<NovelSearchResult[]> { const enabledSources = this.getEnabledSources().filter(s => s.searchable); const allResu...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left searchAllBatched AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left keyword AST#identifier#Right AST#type_annotation#Left AST#:#Le...
async searchAllBatched( keyword: string, page: number = 1, batchSize: number = 5, onProgress?: (completed: number, total: number, results: NovelSearchResult[]) => void ): Promise<NovelSearchResult[]> { const enabledSources = this.getEnabledSources().filter(s => s.searchable); const allResu...
https://github.com/DaLongZhuaZi/manxia
ea7355729441cefaa00d7c6523e94a0775c2067e
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/EnhancedBackupManager.ets
arkts
exportNovelLibrary
导出小说库(包含所有书籍,不仅仅是收藏)
private async exportNovelLibrary(): Promise<NovelBackupItem[]> { try { // [修复] 直接从数据库导出所有书籍,而不仅仅是收藏的 const sql = 'SELECT * FROM novel_book ORDER BY lastReadTime DESC'; const results = await this.dbManager.querySql(sql); const backupItems: NovelBackupItem[] = []; for (const rec...
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 exportNovelLibrary AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ...
private async exportNovelLibrary(): Promise<NovelBackupItem[]> { try { // [修复] 直接从数据库导出所有书籍,而不仅仅是收藏的 const sql = 'SELECT * FROM novel_book ORDER BY lastReadTime DESC'; const results = await this.dbManager.querySql(sql); const backupItems: NovelBackupItem[] = []; for (const rec...
https://github.com/DaLongZhuaZi/manxia
1cbfe1894da478cd25612c4067535b22e1b5353b
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/SparseArray.ets
arkts
from
Creates a new `SparseArray` instance from a `ArrayLike<T> | Iterable<T>` and applies a mapping function to each element. @param { ArrayLike<T> | Iterable<T> } iterable The source primitive array. @param { function } mapfn A mapping function to call on every element of the array. @returns { SparseArray<U> } A new Sparse...
public static from<T, U>(iterable: ArrayLike<T> | Iterable<T>, mapfn: (v: T, k: int) => U): SparseArray<U> { const ret: SparseArray<U> = new SparseArray<U>() let idx: int = 0 iteratorForEach<T>(iterable.$_iterator(), (x: T): void => { ret.buffer.set(idx, mapfn(x, idx)) ...
AST#program#Left AST#expression_statement#Left AST#sequence_expression#Left AST#binary_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#from#Left from AST#from#Right AST#ERROR#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#ident...
public static from<T, U>(iterable: ArrayLike<T> | Iterable<T>, mapfn: (v: T, k: int) => U): SparseArray<U> { const ret: SparseArray<U> = new SparseArray<U>() let idx: int = 0 iteratorForEach<T>(iterable.$_iterator(), (x: T): void => { ret.buffer.set(idx, mapfn(x, idx)) ...
https://gitcode.com/iop123123/arkts-static-skills
03aea46a4900616047229cc7690d19a5b2b893df
gitcode
openharmony/codelabs
ETSUI/CoinNote/entry/src/main/ets/db/BillRdb.ets
arkts
queryAll
查询所有数据
queryAll(): Promise<BillItem[]> { if (this.isMock) { return Promise.resolve([...this.mockData]); } if (!this.rdbStore) return Promise.reject(new Error('Store not initialized')); let predicates = new relationalStore.RdbPredicates(this.tableName); predicates.orderByDesc('id'); r...
AST#program#Left AST#expression_statement#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left queryAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ident...
queryAll(): Promise<BillItem[]> { if (this.isMock) { return Promise.resolve([...this.mockData]); } if (!this.rdbStore) return Promise.reject(new Error('Store not initialized')); let predicates = new relationalStore.RdbPredicates(this.tableName); predicates.orderByDesc('id'); r...
https://gitcode.com/openharmony/codelabs
58781404f10d90f00fa77426376eb55bc8129363
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/EBookDataManager.ets
arkts
searchEBooks
搜索电子书 @param keyword 搜索关键词 @returns 匹配的电子书列表
public async searchEBooks(keyword: string): Promise<EBook[]> { try { const lowerKeyword = keyword.toLowerCase(); const sql = ` SELECT * FROM ebook_info WHERE LOWER(title) LIKE ? OR LOWER(author) LIKE ? OR LOWER(tags) LIKE ? ORDER BY lastUpdateTime DESC ...
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 searchEBooks AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left keyword AST#identifier#Right AST#ERROR#Left AST#:#Left : A...
public async searchEBooks(keyword: string): Promise<EBook[]> { try { const lowerKeyword = keyword.toLowerCase(); const sql = ` SELECT * FROM ebook_info WHERE LOWER(title) LIKE ? OR LOWER(author) LIKE ? OR LOWER(tags) LIKE ? ORDER BY lastUpdateTime DESC ...
https://github.com/DaLongZhuaZi/manxia
b9b5178e999f7b88c0e6d4b2b541410140620abc
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.uri.ets
arkts
equalsTo
Check whether this URI is equivalent to other URI objects. @param { URI } other - other other URI object to be compared @returns { boolean } boolean Tests whether this URI is equivalent to other URI objects.
equalsTo(other: URI): boolean { return this.uriEntry.equalsTo(other.uriEntry); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left equalsTo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left other AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left URI AST#identifier#Right AST#ERROR#Right AST#)#Left ) AST#)#Ri...
equalsTo(other: URI): boolean { return this.uriEntry.equalsTo(other.uriEntry); }
https://gitcode.com/iop123123/arkts-static-skills
17f2c0d0de4075cf1ca3517f985dd7d348da3d07
gitcode
openharmony/applications_app_samples
code/BasicFeature/Media/Image/photomodify/src/main/ets/components/feature/ComputeFeature.ets
arkts
onDragCenter
拖拽中心点
onDragCenter(dx: number, dy: number, callback: (x: number, y: number) => void): void { const minX: number = this.initX - this.imageWidth / 2 + this.materialWidth / 2; const maxX: number = this.initX + this.imageWidth / 2 - this.materialWidth / 2; const minY: number = this.initY - this.imageHeight / 2 + th...
AST#program#Left AST#ERROR#Left AST#identifier#Left onDragCenter AST#identifier#Right AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dx AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left , AST#,#Right AST#ERROR#Left AST#identifier#Left d...
onDragCenter(dx: number, dy: number, callback: (x: number, y: number) => void): void { const minX: number = this.initX - this.imageWidth / 2 + this.materialWidth / 2; const maxX: number = this.initX + this.imageWidth / 2 - this.materialWidth / 2; const minY: number = this.initY - this.imageHeight / 2 + th...
https://github.com/openharmony/applications_app_samples
0f03cf8866a4b00e246f69f24011de60c6a18586
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/String.ets
arkts
$_invoke
Creates a new instance of a String from boolean @param { boolean } value The value to be converted to a string. @returns { string } A new String instance @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
static $_invoke(value: boolean): string { return new String(value); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left $_invoke AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolea...
static $_invoke(value: boolean): string { return new String(value); }
https://gitcode.com/iop123123/arkts-static-skills
1e3d0f496387400385853acde4ced37872a5082e
gitcode
751496032/ZRouter
RouterApi/src/main/ets/model/NavDestBuilder.ets
arkts
setAnimate
是否启动动画 @param animated @returns
public setAnimate(animated: boolean): NavDestBuilder<T> { this.optionsImpl.animated = animated; return this; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setAnimate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left animated AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#...
public setAnimate(animated: boolean): NavDestBuilder<T> { this.optionsImpl.animated = animated; return this; }
https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/model/NavDestBuilder.ets#L52-L55
16f41f683a6e549b525426518771ccf7c215c15b
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/ThemeManager.ets
arkts
isLightTheme
判断是否为浅色主题(异步)
public async isLightTheme(): Promise<boolean> { return await this.getActualTheme() === ThemeType.LIGHT; }
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 isLightTheme AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L...
public async isLightTheme(): Promise<boolean> { return await this.getActualTheme() === ThemeType.LIGHT; }
https://github.com/DaLongZhuaZi/manxia
dcd4527ebfbdc3841828cb39460a30b1b29ba723
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/ContentFilterManager.ets
arkts
isNsfwScopeBookSourceEnabled
书源NSFW作用域是否启用
public isNsfwScopeBookSourceEnabled(): boolean { return this.nsfwScopeBookSourceEnabled; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isNsfwScopeBookSourceEnabled 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#L...
public isNsfwScopeBookSourceEnabled(): boolean { return this.nsfwScopeBookSourceEnabled; }
https://github.com/DaLongZhuaZi/manxia
d52eddf75c3c081ca395dbdc8e69c44bad674053
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Editor/FileEditorService.ets
arkts
getLanguageByExtension
根据文件扩展名获取语言类型
public getLanguageByExtension(extension: string): string { const ext = extension.toLowerCase(); switch (ext) { case 'js': case 'jsx': return 'javascript'; case 'ts': case 'tsx': case 'ets': case 'ark': return 'typescript'; case 'json': return '...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getLanguageByExtension AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left extension AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string A...
public getLanguageByExtension(extension: string): string { const ext = extension.toLowerCase(); switch (ext) { case 'js': case 'jsx': return 'javascript'; case 'ts': case 'tsx': case 'ets': case 'ark': return 'typescript'; case 'json': return '...
https://github.com/DaLongZhuaZi/manxia
7bbfa86d286dc80c976e8684e49e799137eaa698
github
Joker-x-dev/CoolMallArkTS
core/navigation/src/main/ets/auth/AuthNavigator.ets
arkts
toLogin
跳转到登录主页 @returns {void} 无返回值
static toLogin(): void { navigateTo(AuthRoutes.Login); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left toLogin AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_sta...
static toLogin(): void { navigateTo(AuthRoutes.Login); }
https://github.com/Joker-x-dev/CoolMallArkTS
2ded720497b3cfc4b28968c581c214e4cca9f0ee
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/RegExp.ets
arkts
indices
Get an array containing the start and end indices of each matching substring. @returns { Array<Array<int>> } Index array. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public get indices(): Array<Array<int>> { return this.indices_ }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left get AST#identifier#Right AST#call_expression#Left AST#identifier#Left indices AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : A...
public get indices(): Array<Array<int>> { return this.indices_ }
https://gitcode.com/iop123123/arkts-static-skills
7a2e2581039856caf3dbea9305595bc8153fb497
gitcode
Amaz1ny/HarmonyDO-public
entry/src/main/ets/services/network/HttpClient.ets
arkts
post
POST 请求
async post(path: string, body: string = ''): Promise<string> { await this.cookieStore.init(); await this.ensureCsrfToken(); const url: string = `${this.baseUrl}${path}`; hilog.info(0x0000, TAG, 'POST %{public}s', url); const headers: Record<string, string> = this.buildHeaders('application/json', '...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left post AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left path AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Righ...
async post(path: string, body: string = ''): Promise<string> { await this.cookieStore.init(); await this.ensureCsrfToken(); const url: string = `${this.baseUrl}${path}`; hilog.info(0x0000, TAG, 'POST %{public}s', url); const headers: Record<string, string> = this.buildHeaders('application/json', '...
https://github.com/Amaz1ny/HarmonyDO-public
c832353004883fb4d6a93cbe9326a4be9679fa52
github
LJ666-ui/harmony-health-care
entry/src/main/ets/utils/NavigationErrorHandler.ets
arkts
createNavigationFailedError
创建导航失败错误 @param url 路由路径 @param originalError 原始错误 @returns NavigationError
public static createNavigationFailedError(url: string, originalError?: Error): NavigationError { return new NavigationError( `Navigation failed: ${originalError?.message || 'unknown error'}`, NavigationErrorType.NAVIGATION_FAILED, url ); }
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 createNavigationFailedError AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AS...
public static createNavigationFailedError(url: string, originalError?: Error): NavigationError { return new NavigationError( `Navigation failed: ${originalError?.message || 'unknown error'}`, NavigationErrorType.NAVIGATION_FAILED, url ); }
https://github.com/LJ666-ui/harmony-health-care
48cb37892a8fcabb9aafe2978b640da66d5f1657
github
awaLiny2333/Renameow
honk/src/main/ets/hosts/meowNameBlock.ets
arkts
duplicate
Create a clone of a meowNameBlock object. @param from The meowNameBlock. @returns A new meowNameBlock.
static duplicate(from: meowNameBlock) { let clone = new meowNameBlock(from.type, from.textContent); clone.indexStart = from.indexStart; clone.indexStepLength = from.indexStepLength; clone.caseMode = from.caseMode; clone.dataMode = from.dataMode; clone.dataDecimalPlaces = from.dataDecimalPlaces...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left duplicate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left from AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left meowNa...
static duplicate(from: meowNameBlock) { let clone = new meowNameBlock(from.type, from.textContent); clone.indexStart = from.indexStart; clone.indexStepLength = from.indexStepLength; clone.caseMode = from.caseMode; clone.dataMode = from.dataMode; clone.dataDecimalPlaces = from.dataDecimalPlaces...
https://github.com/awaLiny2333/Renameow/blob/34617cc8dc8596061456d226ee717517ff41d25a/honk/src/main/ets/hosts/meowNameBlock.ets#L55-L67
130832e117f5b0f9ac0ba17ed9129fd6fcf23306
github
codelably/tuniao-ui
packages/main/src/main/ets/view/TnComponentsPage.ets
arkts
build
构建核心页面 @returns {void} 无返回值
build() { AppNavDestination({ title: $r("app.string.component"), viewModel: this.vm, paddingValue: { top: this.windowSafeAreaState.topInset, left: this.windowSafeAreaState.leftInset, right: this.windowSafeAreaState.rightInset, } }) { this.CoreContent(); ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c...
build() { AppNavDestination({ title: $r("app.string.component"), viewModel: this.vm, paddingValue: { top: this.windowSafeAreaState.topInset, left: this.windowSafeAreaState.leftInset, right: this.windowSafeAreaState.rightInset, } }) { this.CoreContent(); ...
https://github.com/codelably/tuniao-ui
afd3f84ecfa5f229b803e38466aa0852d1c24287
github
Cool_foolisher1/ArkTSRepository
GraphicalCode/commons/src/main/ets/util/AppLinkUtil.ets
arkts
getAppLinkList
获取AppLink集合 @returns AppLinkModel[]
public getAppLinkList(): AppLinkModel[] { return APP_LINK_LIST }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getAppLinkList 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 AppLink...
public getAppLinkList(): AppLinkModel[] { return APP_LINK_LIST }
https://gitcode.com/Cool_foolisher1/ArkTSRepository
c5833d0ca1a54492ce9045d44e0359acd54bb86c
gitcode