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
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Tracking/TrackingManager.ets
arkts
getTrackRecord
获取特定跟踪服务的记录
public async getTrackRecord(contentId: string, trackerId: TrackerId): Promise<TrackRecord | null> { try { const sql = 'SELECT * FROM track_record WHERE contentId = ? AND trackerId = ?'; const results = await this.dbManager.querySql(sql, [contentId, trackerId]); const records = this.parseTrackRec...
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 getTrackRecord AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left contentId AST#identifier#Right AST#ERROR#Left AST#:#Left...
public async getTrackRecord(contentId: string, trackerId: TrackerId): Promise<TrackRecord | null> { try { const sql = 'SELECT * FROM track_record WHERE contentId = ? AND trackerId = ?'; const results = await this.dbManager.querySql(sql, [contentId, trackerId]); const records = this.parseTrackRec...
https://github.com/DaLongZhuaZi/manxia
3cfc42f327b65153ea8bbb59065bf674083cf6bd
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/GamepadManager.ets
arkts
notifyStateChange
通知监听器状态变化
private notifyStateChange(deviceId: number, state: GamepadState): void { const slot = this.getControllerSlot(deviceId); const copy = this.copyState(state); // 鼠标模拟拦截 if (this.interceptForMouseEmulation(slot, copy)) { return; } this.listener?.onGamepadInput(slot, copy); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left notifyStateChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left deviceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#...
private notifyStateChange(deviceId: number, state: GamepadState): void { const slot = this.getControllerSlot(deviceId); const copy = this.copyState(state); // 鼠标模拟拦截 if (this.interceptForMouseEmulation(slot, copy)) { return; } this.listener?.onGamepadInput(slot, copy); }
https://github.com/AlkaidLab/moonlight-harmony
acecbad6921c58570e38ad23fca56e69cf971ac9
github
HarmonyOS_Samples/BestPracticeSnippets
PerformanceAnalysis/BptaDelayAnalysis/entry/src/main/ets/components/AudioPlayerService.ets
arkts
releaseAudioPlayer
Release audio resources
public releaseAudioPlayer(): Promise<void> { return new Promise((resolve, reject) => { resolve(); }); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left releaseAudioPlayer 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#instantiation_expre...
public releaseAudioPlayer(): Promise<void> { return new Promise((resolve, reject) => { resolve(); }); }
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
9553d617028832d9af27389bf764216d9d4bf9ad
gitcode
openharmony-sig/commons-cli
library/src/main/ets/components/cli/HelpFormatter.ets
arkts
renderOptions
Render the specified Options and return the rendered Options in a StringBuffer. @param sb The StringBuffer to place the rendered Options into. @param width The number of characters to display per line @param options The command line Options @param leftPad the number of characters of padding to be prefixed to each line ...
protected renderOptions(width: number, options: Options, leftPad: number, descPad: number): string []{ let lpad = this.createPadding(leftPad); let dpad = this.createPadding(descPad); let sb: string[] = new Array(); // first create list containing only <lpad>-a,--aaa where // -a is opt and --aaa is...
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left renderOptions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left width AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi...
protected renderOptions(width: number, options: Options, leftPad: number, descPad: number): string []{ let lpad = this.createPadding(leftPad); let dpad = this.createPadding(descPad); let sb: string[] = new Array(); // first create list containing only <lpad>-a,--aaa where // -a is opt and --aaa is...
https://gitee.com/openharmony-sig/commons-cli.git
75f18eb00d1eeb05614bb5c1ac08fe909d96d835
gitee
HarmonyOS_Samples/HarmonyOSComponentUXExamples
products/pc/src/main/ets/components/presentation/datapanel/components/PercentageTypeDataPanel.ets
arkts
buildSolidDataPanel
Custom ContentModifier: for pure blue single-segment linear progress bar @param config DataPanelConfiguration used by dataPanel content modifier
@Builder function buildSolidDataPanel(config: DataPanelConfiguration) { Stack({ alignContent: Alignment.Start }) { // Background track Row() { } .width(SizeToken.SIZE_PERCENT_100) .height(SizeToken.SIZE_PERCENT_100) .backgroundColor('#4D46B1E3') .borderRadius(SizeToken.SIZE_NUM_10) //...
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Builder AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left buildSolidDataPanel AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right A...
@Builder function buildSolidDataPanel(config: DataPanelConfiguration) { Stack({ alignContent: Alignment.Start }) { // Background track Row() { } .width(SizeToken.SIZE_PERCENT_100) .height(SizeToken.SIZE_PERCENT_100) .backgroundColor('#4D46B1E3') .borderRadius(SizeToken.SIZE_NUM_10) //...
https://gitcode.com/HarmonyOS_Samples/HarmonyOSComponentUXExamples
c2d03a326102867d621cb030640e8a4bb12170c1
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
from
Creates an array from an object of std.core.Array<number>. @param { Array<number> } arr - An instance of the std.core.Array type to convert to an array. @returns { Float64Array } - A new Float64Array @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static from(arr: Array<number>): Float64Array { let result = new Float64Array(arr.length) result.set(arr) return result }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#from#Left from AST#from#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#identifier#Righ...
public static from(arr: Array<number>): Float64Array { let result = new Float64Array(arr.length) result.set(arr) return result }
https://gitcode.com/iop123123/arkts-static-skills
0d59d46b01fb1c58adeed55592bd7913518f60c7
gitcode
HarmonyOS_Samples/guide-snippets
Ability/AgentExtensionAbility/entry/src/main/ets/agentextability/AgentExtAbility.ets
arkts
onDestroy
[StartExclude ability_agent_service_three] 销毁
onDestroy() { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onDestroy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AST...
onDestroy() { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); }
https://gitcode.com/HarmonyOS_Samples/guide-snippets
7dacd91dbbd25d8f382ed698de5d2bfd056ebbca
gitcode
terryma2024/happyword
harmonyos/entry/src/main/ets/services/GameConfigPersistence.ets
arkts
sanitizeTimer
V0.6.7.7: clamp persisted seconds into the legal custom range [TIMER_CUSTOM_MIN, TIMER_CUSTOM_MAX] rather than snapping to the nearest TIMER_CHOICES preset. Pre-V0.6.7.7 we forced rehydrated values onto one of the seven preset chips (3 / 15 / 30 / 60 / 120 / 300 / 600); after V0.6.7.7 the 自定义 dialog can persist arbitra...
function sanitizeTimer(seconds: number): number { if (seconds < TIMER_CUSTOM_MIN) { return TIMER_CUSTOM_MIN; } if (seconds > TIMER_CUSTOM_MAX) { return TIMER_CUSTOM_MAX; } return seconds; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left sanitizeTimer AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left seconds AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:...
function sanitizeTimer(seconds: number): number { if (seconds < TIMER_CUSTOM_MIN) { return TIMER_CUSTOM_MIN; } if (seconds > TIMER_CUSTOM_MAX) { return TIMER_CUSTOM_MAX; } return seconds; }
https://github.com/terryma2024/happyword
27ae9ceb15fff536ea0ea30664f41ef35e237b0e
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelTxtTocRuleManager.ets
arkts
parseChaptersWithPattern
使用指定正则表达式解析章节 添加安全机制:最大章节数限制和进度日志
private parseChaptersWithPattern(content: string, pattern: RegExp | null): TxtChapter[] { const chapters: TxtChapter[] = []; // 安全限制:最大章节数量,防止无限循环 const MAX_CHAPTERS = 10000; if (!pattern) { // 没有规则,按固定长度分割 return this.splitByLength(content, 10000); } let match: RegExpEx...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseChaptersWithPattern AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left content AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left strin...
private parseChaptersWithPattern(content: string, pattern: RegExp | null): TxtChapter[] { const chapters: TxtChapter[] = []; // 安全限制:最大章节数量,防止无限循环 const MAX_CHAPTERS = 10000; if (!pattern) { // 没有规则,按固定长度分割 return this.splitByLength(content, 10000); } let match: RegExpEx...
https://github.com/DaLongZhuaZi/manxia
095c67e3aa10d65eb09864a4324a690f1efa3c2b
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/StreamingSession.ets
arkts
resolveComputer
--------------------------------------------------------------------------- 内部 — 启动流程子步骤 ---------------------------------------------------------------------------
private async resolveComputer(computerId: string, context?: common.UIAbilityContext): Promise<void> { const computerManager = ComputerManager.getInstance(); const computerResult = computerManager.getComputer(computerId); if (!computerResult) throw new Error(`找不到电脑: ${computerId}`); this.computer = com...
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 resolveComputer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left computerId AST#identifier#Right AST#ERROR#Left AST#:...
private async resolveComputer(computerId: string, context?: common.UIAbilityContext): Promise<void> { const computerManager = ComputerManager.getInstance(); const computerResult = computerManager.getComputer(computerId); if (!computerResult) throw new Error(`找不到电脑: ${computerId}`); this.computer = com...
https://github.com/AlkaidLab/moonlight-harmony
3ae76ad3f8711a8235633a711935bbdddac84b49
github
FinalScave/SweetLine
platform/OHOS/sweetline/src/main/ets/Index.ets
arkts
analyzeBracketPairs
Perform bracket pair analysis on the managed document @returns Bracket pair analysis result
public analyzeBracketPairs(): BracketPairResult { if (this.nativeHandle == 0) { return new BracketPairResult(); } let buffer: Int32Array = lib.DocumentAnalyzer_AnalyzeBracketPairs(this.nativeHandle); return NativeBufferPack.readBracketPairResult(buffer); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left analyzeBracketPairs 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 Br...
public analyzeBracketPairs(): BracketPairResult { if (this.nativeHandle == 0) { return new BracketPairResult(); } let buffer: Int32Array = lib.DocumentAnalyzer_AnalyzeBracketPairs(this.nativeHandle); return NativeBufferPack.readBracketPairResult(buffer); }
https://github.com/FinalScave/SweetLine
4a85606fbb2417b680dc079ddf08f2366e4c81d2
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
toLocaleString
Converts BigUint64Array to a string with respect to locale @param locales @param options @returns string representation
public toLocaleString(locales: Object, options: Object): string { throw new Error("BigUint64Array.toLocaleString: not implemented") }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toLocaleString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left locales AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Object AST#ide...
public toLocaleString(locales: Object, options: Object): string { throw new Error("BigUint64Array.toLocaleString: not implemented") }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
f80370243b3ab82e7d049dbce4e6503ef4a239b9
gitee
OHPG/FinSdk
jellyfin/src/main/ets/api/LibraryApi.ets
arkts
getSimilarItems
@summary Gets similar items. @param {LibraryApiGetSimilarItemsRequest} requestParameters Request parameters. @param {*} [options] Override http request option. @throws {RequiredError} @memberof LibraryApi
public async getSimilarItems(requestParameters: LibraryApiGetSimilarItemsRequest): Promise<BaseItemDtoQueryResult> { this.assertParam(requestParameters.itemId) return this.apiClient.get({path: `/Items/${requestParameters.itemId}/Similar`, parameters: requestParameters}) }
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 getSimilarItems AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right A...
public async getSimilarItems(requestParameters: LibraryApiGetSimilarItemsRequest): Promise<BaseItemDtoQueryResult> { this.assertParam(requestParameters.itemId) return this.apiClient.get({path: `/Items/${requestParameters.itemId}/Similar`, parameters: requestParameters}) }
https://github.com/OHPG/FinSdk
c25f20fcd4cab4a35625e84d2d01a63b48ca5cbb
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Map.ets
arkts
keys
Returns elements from the Map as an keys Iterator @returns ValueIterator with map keys
keys(): ValuesIterator<K> { let en = treeToArray(this.tree); let ret = new K[en.length]; for (let i: int = 0; i < ret.length; i++) { ret[i] = en[i].key; } return new ValuesIterator<K>(ret); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left keys 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#binary_expression#Left AST#...
keys(): ValuesIterator<K> { let en = treeToArray(this.tree); let ret = new K[en.length]; for (let i: int = 0; i < ret.length; i++) { ret[i] = en[i].key; } return new ValuesIterator<K>(ret); }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
1fd074bfb0796aee4b6e3b62901ff6ec4c5345ef
gitee
openharmony-sig/flutter_engine
shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/dart/DartExecutor.ets
arkts
executeDartEntrypoint
Starts executing Dart code based on the given {@code dartEntrypoint} and the {@code dartEntrypointArgs}. <p>See {@link DartEntrypoint} for configuration options. @param dartEntrypoint specifies which Dart function to run, and where to find it @param dartEntrypointArgs Arguments passed as a list of string to Dart's entr...
executeDartEntrypoint(dartEntrypoint: DartEntrypoint, dartEntrypointArgs?: string[]): void { if (this.isApplicationRunning) { Log.w(TAG, "Attempted to run a DartExecutor that is already running."); return; } let traceId: number = TraceSection.begin("DartExecutor#executeDartEntrypoint"); t...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left executeDartEntrypoint AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dartEntrypoint AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left DartEntrypoint AST#ident...
executeDartEntrypoint(dartEntrypoint: DartEntrypoint, dartEntrypointArgs?: string[]): void { if (this.isApplicationRunning) { Log.w(TAG, "Attempted to run a DartExecutor that is already running."); return; } let traceId: number = TraceSection.begin("DartExecutor#executeDartEntrypoint"); t...
https://gitee.com/openharmony-sig/flutter_engine.git
a82c1737ea7f4ac836cfe311950887d7917d1bdf
gitee
aimilin6688/KeePassHO
entry/src/main/ets/common/utils/WebDavClient.ets
arkts
getChildrenCount
获取目录下的所有文件, 记录总数 @param path 目录 @returns 结果
private async getChildrenCount(path: string): Promise<number> { const body = `<?xml version="1.0"?> <d:propfind xmlns:d="DAV:"> <d:prop> <d:resourcetype/> </d:prop> </d:propfind>`; const req = new rcp.Request(path, "PROPFIND", { "Depth": "1" }, body); const rr = await...
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 getChildrenCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left...
private async getChildrenCount(path: string): Promise<number> { const body = `<?xml version="1.0"?> <d:propfind xmlns:d="DAV:"> <d:prop> <d:resourcetype/> </d:prop> </d:propfind>`; const req = new rcp.Request(path, "PROPFIND", { "Depth": "1" }, body); const rr = await...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/WebDavClient.ets#L273-L289
dddb3d18cd6ca44a341f75d32f16f8885f763cd6
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Jsonx.ets
arkts
setArray
Sets a current JsonElement to an array value. @param {Array<JsonElement>} value - The array value to set
setArray(value: Array<JsonElement>): void { this.setUndefined() this.maybeArrayValues = value }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setArray 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#instantiation_expression#Left AST#identifier#Left Array AST#id...
setArray(value: Array<JsonElement>): void { this.setUndefined() this.maybeArrayValues = value }
https://gitcode.com/iop123123/arkts-static-skills
f8064ab8abc10a700bf8371e1d81ba0fcf50442f
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
findLast
Finds the last element in the Int8Array that satisfies the condition @param fn condition @returns the last element that satisfies fn
public findLast(fn: (val: byte) => boolean): byte { let newF: (val: byte, index: int, array: Int8Array) => boolean = (val: byte, index: int, array: Int8Array): boolean => { return fn(val) } return this.findLast(newF) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left findLast AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:...
public findLast(fn: (val: byte) => boolean): byte { let newF: (val: byte, index: int, array: Int8Array) => boolean = (val: byte, index: int, array: Int8Array): boolean => { return fn(val) } return this.findLast(newF) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
e24711bf535239728d397d1850b965c4eaa249f0
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
from
Creates an array from a set of type std.core.Set<BigInt>. @param { Set<BigInt> } set - A set object to convert to an array. @returns { BigUint64Array } - A new BigUint64Array @throws { RangeError } - Input parameter error. @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static from(set: Set<BigInt>): BigUint64Array { const length = set.size; const result = new BigUint64Array(length) let iter = set.$_iterator() for (let i:int = 0; i < length; ++i) { const x = iter.next() if (x.done) { throw new RangeErro...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#from#Left from AST#from#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Righ...
public static from(set: Set<BigInt>): BigUint64Array { const length = set.size; const result = new BigUint64Array(length) let iter = set.$_iterator() for (let i:int = 0; i < length; ++i) { const x = iter.next() if (x.done) { throw new RangeErro...
https://gitcode.com/iop123123/arkts-static-skills
b91f737c477a87c406b1c64a11757c066bbc9e98
gitcode
jjjjjjava/ffmpeg_tools
src/main/ets/ffmpeg/FFmpegManager.ets
arkts
getPriorityValue
获取优先级数值
private getPriorityValue(priority: TaskPriority): number { switch (priority) { case TaskPriority.HIGH: return 3; case TaskPriority.NORMAL: return 2; case TaskPriority.LOW: return 1; default: return 2; } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getPriorityValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left priority AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi...
private getPriorityValue(priority: TaskPriority): number { switch (priority) { case TaskPriority.HIGH: return 3; case TaskPriority.NORMAL: return 2; case TaskPriority.LOW: return 1; default: return 2; } }
https://github.com/jjjjjjava/ffmpeg_tools
f2d2786193bd53987a60cc08e75f46eff31c2f39
github
openharmony/codelabs
ETSUI/LifeTrack/entry/src/main/ets/services/RepeatService.ets
arkts
saveEventInstances
保存事件实例(这里需要根据你的数据库实现来完善)
private async saveEventInstances(originalEventId: string, instances: EventInstance[]): Promise<void> { if (instances.length === 0) { return; } try { // 使用 EventDao 的批量保存方法 const success = await this.eventDao.saveEventInstances(instances); if (success) { console.info(`成功保存...
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 saveEventInstances AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left originalEventId AST#identifier#Right AST#ERROR#Le...
private async saveEventInstances(originalEventId: string, instances: EventInstance[]): Promise<void> { if (instances.length === 0) { return; } try { // 使用 EventDao 的批量保存方法 const success = await this.eventDao.saveEventInstances(instances); if (success) { console.info(`成功保存...
https://gitcode.com/openharmony/codelabs
7c441e34a9abe8e9f6cbc7de3b3035ee094faaba
gitcode
Goway-Hui/harmonyos-next-dev
harmonyos-next-dev/assets/network-request-template.ets
arkts
buildHeaders
==================== 构建请求头 ====================
private buildHeaders(): Record<string, string> { let headers: Record<string, string> = { 'Content-Type': 'application/json', 'Accept': 'application/json' }; if (this.token) { headers['Authorization'] = `Bearer ${this.token}`; } return headers; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildHeaders 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...
private buildHeaders(): Record<string, string> { let headers: Record<string, string> = { 'Content-Type': 'application/json', 'Accept': 'application/json' }; if (this.token) { headers['Authorization'] = `Bearer ${this.token}`; } return headers; }
https://github.com/Goway-Hui/harmonyos-next-dev
067b0ab65d357713c2ef595e8cd4c9033f3a9e2b
github
openharmony/xts_tools
sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/test/model/snapShot.ets
arkts
snapShot
获取窗口结合&文件保存 入参必填 ability的context snapShot save:设备端保存路径:/data/app/el2/100/base/{bundle_name}/haps/entry_test/files/IMG_test.webp 查看命令:hdc_st shell ,cd
async snapShot(pageName?: string) { //获取窗口 Logger.info(TAG, 'start snapshot') if (Settings.windowClass == undefined) { Logger.info(TAG, 'getWindowClass error') return; } Logger.info(TAG, 'find window success') Logger.info(TAG, 'find window success, snapShot pageName is: ',pageName)...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left snapShot AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#optional_parameter#Left AST#identifier#Left pageName AST#identifier#Right AST#?#Left ? AST#?#Right AST#ty...
async snapShot(pageName?: string) { //获取窗口 Logger.info(TAG, 'start snapshot') if (Settings.windowClass == undefined) { Logger.info(TAG, 'getWindowClass error') return; } Logger.info(TAG, 'find window success') Logger.info(TAG, 'find window success, snapShot pageName is: ',pageName)...
https://gitee.com/openharmony/xts_tools.git
b197173fedb620d8691aaddb1a23d83ccdc5b329
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
with
Creates a copy with replaced value on index @param { int } index - index to change @param { number } value - value to set @returns { Uint32Array } - an Uint32Array with replaced value on index @throws { RangeError } - If the index exceeds the array range, throw an exception @syscap SystemCapability.Utils.Lang @FaAndSta...
public with(index: int, value: number): Uint32Array { let res = new Uint32Array(this) res.setUnsafeClamp(index, value.toLong()) return res }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#ERROR#Right AST#with_statement#Left AST#with#Left with AST#with#Right AST#parenthesized_expression#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST...
public with(index: int, value: number): Uint32Array { let res = new Uint32Array(this) res.setUnsafeClamp(index, value.toLong()) return res }
https://gitcode.com/iop123123/arkts-static-skills
41752b413f4b7adb79a2a894cf0f0093b5efdcaa
gitcode
Joker-x-dev/CoolMallArkTS
feature/user/src/main/ets/viewmodel/AddressDetailViewModel.ets
arkts
updateFormData
回填表单数据 @param {Address} address - 地址数据 @returns {void} 无返回值
private updateFormData(address: Address): void { this.contactName = address.contact ?? ""; this.phone = address.phone ?? ""; this.province = address.province ?? ""; this.city = address.city ?? ""; this.district = address.district ?? ""; this.detailAddress = address.address ?? ""; this.isDe...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left updateFormData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left address AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#...
private updateFormData(address: Address): void { this.contactName = address.contact ?? ""; this.phone = address.phone ?? ""; this.province = address.province ?? ""; this.city = address.city ?? ""; this.district = address.district ?? ""; this.detailAddress = address.address ?? ""; this.isDe...
https://github.com/Joker-x-dev/CoolMallArkTS
21330410e8c92d1548b14b9853ad1a4d0aa12957
github
HarmonyOS_Codelabs/arkts-basic-syntax-demo
entry/src/main/ets/pages/BasicPage.ets
arkts
showSwitchStatements
switch语句
function showSwitchStatements() { let day = 6; switch (day) { case 1: console.log('Monday'); break; case 2: console.log('Tuesday'); break; case 3: console.log('Wednesday'); break; case 4: console.log('Thursday'); break; case 5: console.log('F...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left showSwitchStatements AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#lexica...
function showSwitchStatements() { let day = 6; switch (day) { case 1: console.log('Monday'); break; case 2: console.log('Tuesday'); break; case 3: console.log('Wednesday'); break; case 4: console.log('Thursday'); break; case 5: console.log('F...
https://gitcode.com/HarmonyOS_Codelabs/arkts-basic-syntax-demo
8503b4f51553a95b43093ed9d3ffbad9116cc04e
gitcode
richshaw2015/nds
ohos/entry/src/main/ets/utils/FileManagerHelper.ets
arkts
formatUri
格式化目录 URI 确保 URI 以 file:// 开头,并且以 / 结尾(表示目录)
private formatUri(uri: string): string { let formattedUri = uri; // 确保以 file:// 开头 if (!formattedUri.startsWith('file://')) { if (formattedUri.startsWith('/')) { formattedUri = `file://${formattedUri}`; } } // 确保目录 URI 以 / 结尾,这样系统才能识别为目录而非文件 if (!formattedUri.endsWith('/'...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left formatUri AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uri AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left stri...
private formatUri(uri: string): string { let formattedUri = uri; // 确保以 file:// 开头 if (!formattedUri.startsWith('file://')) { if (formattedUri.startsWith('/')) { formattedUri = `file://${formattedUri}`; } } // 确保目录 URI 以 / 结尾,这样系统才能识别为目录而非文件 if (!formattedUri.endsWith('/'...
https://github.com/richshaw2015/nds
006dc8eee6608d692995b735c7b110702ff74190
github
terryma2024/happyword
harmonyos/entry/src/main/ets/services/BattleEngine.ets
arkts
rememberWord
Dedupe guard — learnedWordIds is conceptually a Set.
private rememberWord(wordId: string): void { const ids: string[] = this.state_.learnedWordIds; for (let i = 0; i < ids.length; i++) { if (ids[i] === wordId) { return; } } ids.push(wordId); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left rememberWord AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left wordId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
private rememberWord(wordId: string): void { const ids: string[] = this.state_.learnedWordIds; for (let i = 0; i < ids.length; i++) { if (ids[i] === wordId) { return; } } ids.push(wordId); }
https://github.com/terryma2024/happyword
5f0f135d992ec3fcd80f8e1af2e1fc36dc92c893
github
tdcare/tdwebrtc
src/main/ets/utils/NetworkUtil.ets
arkts
getSignalInformation
获取指定SIM卡槽对应的注册网络信号强度信息列表。 @param slotId 卡槽ID,如果不指定slotId,默认主卡。 @returns
static async getSignalInformation(slotId?: number): Promise<Array<radio.SignalInformation>> { slotId = slotId ?? await NetworkUtil.getPrimarySlotId(); //获取主卡所在卡槽的索引号。 let signalInfo: Array<radio.SignalInformation> = await radio.getSignalInformation(slotId); return signalInfo; }
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 getSignalInformation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left slotId AST#identifier#Right AST#?#L...
static async getSignalInformation(slotId?: number): Promise<Array<radio.SignalInformation>> { slotId = slotId ?? await NetworkUtil.getPrimarySlotId(); //获取主卡所在卡槽的索引号。 let signalInfo: Array<radio.SignalInformation> = await radio.getSignalInformation(slotId); return signalInfo; }
https://github.com/tdcare/tdwebrtc
c02a52c711df4677f40dc9deb10492b9fd0a12c6
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test8_original_index.ets
arkts
testWhileBreak
--- While loop with break/continue ---
function testWhileBreak(): number { let sum: number = 0; let i: number = 0; while (i < 100) { if (i % 2 === 0) { i = i + 1; continue; } if (i > 10) { break; } sum = sum + i; i = i + 1; } return sum; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testWhileBreak AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_t...
function testWhileBreak(): number { let sum: number = 0; let i: number = 0; while (i < 100) { if (i % 2 === 0) { i = i + 1; continue; } if (i > 10) { break; } sum = sum + i; i = i + 1; } return sum; }
https://github.com/miaochiahao/ark-ghidra
7da4aa1d6f960967271182c761a3b412ca27182d
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Download/UnifiedDownloadManager.ets
arkts
notifyComplete
通知任务完成
private notifyComplete(task: UnifiedDownloadTask): void { this.lastProgressNotifyAtByTaskId.delete(task.id); this.recordTaskFlowEvent( task, DownloadCacheFlowEventType.CALLBACK_NOTIFIED, DownloadCacheFlowStage.TASK, 'unified_notify_complete', true, '', 0 ); co...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left notifyComplete AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left task AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
private notifyComplete(task: UnifiedDownloadTask): void { this.lastProgressNotifyAtByTaskId.delete(task.id); this.recordTaskFlowEvent( task, DownloadCacheFlowEventType.CALLBACK_NOTIFIED, DownloadCacheFlowStage.TASK, 'unified_notify_complete', true, '', 0 ); co...
https://github.com/DaLongZhuaZi/manxia
2319ebaf51249316ad6fb64348310e3c6306c736
github
DaLongZhuaZi/manxia
entry/src/main/ets/pages/NovelDictRulePage.ets
arkts
showImportOptions
显示导入选项菜单
showImportOptions(): void { this.getUIContext().getPromptAction().showActionMenu({ title: '选择导入方式', buttons: [ { text: '从剪贴板导入', color: $r('sys.color.ohos_id_color_text_primary') }, { text: '从本地文件导入', color: $r('sys.color.ohos_id_color_text_primary') }, { text: '取消', color: $r(...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left showImportOptions 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_...
showImportOptions(): void { this.getUIContext().getPromptAction().showActionMenu({ title: '选择导入方式', buttons: [ { text: '从剪贴板导入', color: $r('sys.color.ohos_id_color_text_primary') }, { text: '从本地文件导入', color: $r('sys.color.ohos_id_color_text_primary') }, { text: '取消', color: $r(...
https://github.com/DaLongZhuaZi/manxia
9019b63c45a8c34bd37e2bf978ed3c2a3f8765a9
github
openharmony/codelabs
ETSUI/LifeTrack/entry/src/main/ets/pages/DataManager.ets
arkts
deleteEventInstanceReminders
删除事件的所有实例提醒
async deleteEventInstanceReminders(eventId: string): Promise<boolean> { try { if (!eventId) { return false; } // 获取该事件的所有实例 const instances = await this.eventDao.getEventInstancesByOriginalId(eventId); if (instances.length === 0) { return true; // 没有实例,直接返回成功 ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left deleteEventInstanceReminders AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left eventId AST#identifier#Right AST#type_annotation#L...
async deleteEventInstanceReminders(eventId: string): Promise<boolean> { try { if (!eventId) { return false; } // 获取该事件的所有实例 const instances = await this.eventDao.getEventInstancesByOriginalId(eventId); if (instances.length === 0) { return true; // 没有实例,直接返回成功 ...
https://gitcode.com/openharmony/codelabs
6ee8303fdc6b14986c6da565ffca7d97a9acb1f7
gitcode
Delsin-Yu/JustPDF
entry/src/main/ets/pages/pdfview/PDFAnnotationController.ets
arkts
discardUnsavedStrokes
丢弃内存中的未保存笔画(不写入 PDF 文件)。
discardUnsavedStrokes(): void { this.dependencies.pageDataSource.clearAllStrokes(); this.dependencies.pageDataSource.clearImportedPdfPolylineTracking(); this.clearHistory(); this.hasUnsavedStrokes = false; this.importedPolylinePrepared = false; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left discardUnsavedStrokes 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#statem...
discardUnsavedStrokes(): void { this.dependencies.pageDataSource.clearAllStrokes(); this.dependencies.pageDataSource.clearImportedPdfPolylineTracking(); this.clearHistory(); this.hasUnsavedStrokes = false; this.importedPolylinePrepared = false; }
https://github.com/Delsin-Yu/JustPDF/blob/07d9dd917e7592f584d67821fb06a7369bd3f15b/entry/src/main/ets/pages/pdfview/PDFAnnotationController.ets#L247-L253
f1201e71b99da2f92b8e8e88f8b44a90bd7c9189
github
LJ666-ui/harmony-health-care
entry/src/main/ets/services/MedicalService.ets
arkts
getMedicalRecord
获取患者病历
async getMedicalRecord(patientId: string): Promise<MedicalRecord | null> { try { const response = await HttpUtil.get<MedicalRecord>(`/medical/records/${patientId}`); if (response.success && response.data) { return response.data; } return null; } catch (error) { console.er...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getMedicalRecord AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left patientId AST#identifier#Right AST#type_annotation#Left AST#:#...
async getMedicalRecord(patientId: string): Promise<MedicalRecord | null> { try { const response = await HttpUtil.get<MedicalRecord>(`/medical/records/${patientId}`); if (response.success && response.data) { return response.data; } return null; } catch (error) { console.er...
https://github.com/LJ666-ui/harmony-health-care
d9332494208c7ba98c3174f9318c7f8db87f8fb8
github
youyeyejie/ZhiXing_ActHub
entry/src/main/ets/core/services/HitokotoService.ets
arkts
fetchSentence
获取一言句子。 优先请求网络接口,失败时回退到本地句库。 @returns 一句推荐文案
async fetchSentence(): Promise<string> { try { const response = await this.requestFromApi(); if (response && response.length > 0) { return response; } } catch (_error) { // 网络失败,使用本地句库 } return this.getRandomFallback(); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left fetchSentence AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generi...
async fetchSentence(): Promise<string> { try { const response = await this.requestFromApi(); if (response && response.length > 0) { return response; } } catch (_error) { // 网络失败,使用本地句库 } return this.getRandomFallback(); }
https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/core/services/HitokotoService.ets#L37-L47
5f8ec9baef20c13b45e3adda28d4092ce938b487
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Double.ets
arkts
toDouble
Returns value of this instance @returns { double } return the current value convert double value @syscap SystemCapability.Utils.Lang @FaAndStageModel
public override toDouble(): double { return this.value; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left toDouble AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Le...
public override toDouble(): double { return this.value; }
https://gitcode.com/iop123123/arkts-static-skills
f4b930c14bc89de849418ffb1d406cd32e41c771
gitcode
openharmony-sig/ohos_danmaku_flame_master
library/src/main/ets/components/common/master/flame/danmaku/danmaku/model/ohos/DanmakuContext.ets
arkts
setMaximumVisibleSizeInScreen
����ͬ����Ļ�ܶ� -1�Զ� 0������ @param maxSize @return
public setMaximumVisibleSizeInScreen(maxSize: number): DanmakuContext { this.maximumNumsInScreen = maxSize; // ������ if (maxSize == 0) { this.mDanmakuFilters.unregisterFilter({ tag: DanmakuFilters.TAG_QUANTITY_DANMAKU_FILTER }); this.mDanmakuFilters.unregisterFilter({ tag: DanmakuFilters.TAG_...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setMaximumVisibleSizeInScreen AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left maxSize AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left num...
public setMaximumVisibleSizeInScreen(maxSize: number): DanmakuContext { this.maximumNumsInScreen = maxSize; // ������ if (maxSize == 0) { this.mDanmakuFilters.unregisterFilter({ tag: DanmakuFilters.TAG_QUANTITY_DANMAKU_FILTER }); this.mDanmakuFilters.unregisterFilter({ tag: DanmakuFilters.TAG_...
https://gitee.com/openharmony-sig/ohos_danmaku_flame_master.git
65e3c288e91a0ead2e75dc81c5405c520903ab4c
gitee
aimilin6688/KeePassHO
entry/src/main/ets/services/template/TemplateService.ets
arkts
isTemplatesGroup
判断分组是否为模板分组
isTemplatesGroup(group: KdbxGroup, kdbx: Kdbx): boolean { // 检查UUID匹配 if (kdbx.meta && kdbx.meta.entryTemplatesGroup) { if (group.uuid.equals(kdbx.meta.entryTemplatesGroup)) { return true; } } // 检查名称匹配 return group.name === TemplateService.TEMPLATES_GROUP_NAME; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isTemplatesGroup 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#Left KdbxGroup AST#identifier#Right AST#,#L...
isTemplatesGroup(group: KdbxGroup, kdbx: Kdbx): boolean { // 检查UUID匹配 if (kdbx.meta && kdbx.meta.entryTemplatesGroup) { if (group.uuid.equals(kdbx.meta.entryTemplatesGroup)) { return true; } } // 检查名称匹配 return group.name === TemplateService.TEMPLATES_GROUP_NAME; }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/template/TemplateService.ets#L328-L338
adc2ca824cbb57f88899c4505911412b33b91158
github
HarmonyOS_Samples/MusicHome
features/player/src/main/ets/model/MediaService.ets
arkts
constructor
Creates service, builds SongItemBuilder, and starts async AVPlayer creation.
public constructor() { this.songItemBuilder = new SongItemBuilder(); this.initAudioPlayer(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { A...
public constructor() { this.songItemBuilder = new SongItemBuilder(); this.initAudioPlayer(); }
https://gitcode.com/HarmonyOS_Samples/MusicHome
9b836da02ba5cefdcb53b66b3ce390b302b1c9dd
gitcode
HarmonyOS_Samples/HarmonyOSComponentUXExamples
commons/componentuxexamplesbase/src/main/ets/utils/CryptoUtil.ets
arkts
generateRangeRandomSync
Synchronously generates a secure random integer within the specified range [min, max] @param min Minimum value (inclusive) @param max Maximum value (inclusive) @returns number Generated random integer. Returns -1 in exceptional cases. @throws Error When min is greater than max (invalid range)
public static generateRangeRandomSync(min: number, max: number): number { // Basic validation if (min > max) { throw new Error(`Invalid range: min (${min}) cannot be greater than max (${max})`); } if (min === max) { return min; } try { // Instance reuse: call singleton getter...
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 generateRangeRandomSync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left min AST#identifier#Right AST#:#...
public static generateRangeRandomSync(min: number, max: number): number { // Basic validation if (min > max) { throw new Error(`Invalid range: min (${min}) cannot be greater than max (${max})`); } if (min === max) { return min; } try { // Instance reuse: call singleton getter...
https://gitcode.com/HarmonyOS_Samples/HarmonyOSComponentUXExamples
7f0b951e4c6a238f704cd434c657f4e83df4b081
gitcode
lidaixian999/Smart_Car
entry/src/main/ets/model/SmartCommandExecutor.ets
arkts
isSystemReady
检查系统连接状态
isSystemReady(): boolean { return this.ssapManager !== undefined && this.tcpData !== undefined; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isSystemReady 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#state...
isSystemReady(): boolean { return this.ssapManager !== undefined && this.tcpData !== undefined; }
https://github.com/lidaixian999/Smart_Car
3be583dc6e154782df6398e806442bf1450d2631
github
terryma2024/happyword
harmonyos/entry/src/ohosTest/ets/test/PackManagerFlow.ui.test.ets
arkts
preparePackManagerWithTenActive
Sync globals into the library, seed a 10-active selection blob, leave the page stack, and re-open PackManager so prefs + prune run on a fresh loadHomeIntegration (V0.8.3 cap / auto-rotate tests).
async function preparePackManagerWithTenActive( driver: Driver, pinnedIds: string[], ): Promise<void> { try { await clearGlobalPackCacheForUiTest(); await openPackManagerFromHome(driver); await tapPackSyncAndWaitForToast(driver); await seedPackSelectionBlob(driver, buildTenActiveSelectionBlob(pinn...
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left preparePackManagerWithTenActive AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left driver AST#identi...
async function preparePackManagerWithTenActive( driver: Driver, pinnedIds: string[], ): Promise<void> { try { await clearGlobalPackCacheForUiTest(); await openPackManagerFromHome(driver); await tapPackSyncAndWaitForToast(driver); await seedPackSelectionBlob(driver, buildTenActiveSelectionBlob(pinn...
https://github.com/terryma2024/happyword
e47e8443bf713fc3ce524e0dc0e2ab5cf674d056
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ets
arkts
getNumerator
Gets the numerator of the current RationalNumber object. @returns { long } returns the numerator.
public getNumerator(): long { return this.mnum; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getNumerator 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 long AST#...
public getNumerator(): long { return this.mnum; }
https://gitcode.com/iop123123/arkts-static-skills
483c1e909284e58c09e757ea46d3ec271d7ca04c
gitcode
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.HashMap.ets
arkts
set
Sets the value for the key in the HashMap @param key the key to set in the HashMap @param value the value to set for the key @returns the HashMap object
set(key: K, value: V): Object { if (key === undefined) { throw new BusinessError(typeErrorCodeId, new Error('BusinessError', `The type of \"key\" must be Key of JS. Received value is: ${key}`, undefined)) } this.buckets.set(key, value); return this; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left set AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left key AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left K AST#identifier#Right AST#ERROR#Right AST#,#Left , AST#,#Right AST#i...
set(key: K, value: V): Object { if (key === undefined) { throw new BusinessError(typeErrorCodeId, new Error('BusinessError', `The type of \"key\" must be Key of JS. Received value is: ${key}`, undefined)) } this.buckets.set(key, value); return this; }
https://gitcode.com/iop123123/arkts-static-skills
a6e9c175e6725e453371a5ccdb8072d4b50eae03
gitcode
LJ666-ui/harmony-health-care
entry/src/main/ets/common/accessibility/AccessibilityConfig.ets
arkts
addListener
添加配置变更监听器 @param listener 监听器函数
public addListener(listener: ConfigChangeListener): void { if (!this.listeners.includes(listener)) { this.listeners.push(listener); } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left listener AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ...
public addListener(listener: ConfigChangeListener): void { if (!this.listeners.includes(listener)) { this.listeners.push(listener); } }
https://github.com/LJ666-ui/harmony-health-care
23532c1f4ffbc38cf85f6871e4b6b8c5fbf575a8
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Box.ets
arkts
constructor
Creates a new ByteBox instance with an initial value of 0. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public constructor() { this.value = 0; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { A...
public constructor() { this.value = 0; }
https://gitcode.com/iop123123/arkts-static-skills
c27c952b225aa42f4b74c46313781ebcf7e93a3c
gitcode
offlinecat-dev/OCNetORM
src/main/ets/database/DatabaseConfig.ets
arkts
setHealthCheckInterval
设置健康检查间隔 @param intervalMs 间隔时间(毫秒),0 表示禁用 @returns this(支持链式调用)
setHealthCheckInterval(intervalMs: number): DatabaseConfig { this.healthCheckIntervalMs = intervalMs return this }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setHealthCheckInterval AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left intervalMs AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#L...
setHealthCheckInterval(intervalMs: number): DatabaseConfig { this.healthCheckIntervalMs = intervalMs return this }
https://github.com/offlinecat-dev/OCNetORM
ab0f067ee8b825c8e1586a1ccd245d6a05812ec8
github
openharmony-tpc/VCard
library/src/main/ets/components/VCardBuilder.ets
arkts
tryConstructPostalStruct
@return null when there's no information available to construct the data.
private tryConstructPostalStruct(potalAddress: contact.PostalAddress): PostalStruct | null { // adr-value = 0*6(text-value ";") text-value // ; PO Box, Extended Address, Street, Locality, Region, Postal // ; Code, Country Name let rawPoBox = potalAddress....
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left tryConstructPostalStruct AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left potalAddress AST#identifier#Right AST#ERROR#Left AST#:#Left : A...
private tryConstructPostalStruct(potalAddress: contact.PostalAddress): PostalStruct | null { // adr-value = 0*6(text-value ";") text-value // ; PO Box, Extended Address, Street, Locality, Region, Postal // ; Code, Country Name let rawPoBox = potalAddress....
https://gitee.com/openharmony-tpc/VCard.git
9c528b608cfa9f3c43e519ac90b9fa51800e76fd
gitee
openharmony-sig/applications_calculator
common/src/main/ets/util/CommonUtil.ets
arkts
displayIndexToExpIndex
将页面显示的光标位置转换为表达式的光标位置. @param displayExp 页面展示的表达式. @param displayIndex 页面显示的光标位置 @returns 实际表达式的光标位置.
public static displayIndexToExpIndex(displayExp: string, displayIndex: number): number { let expIndex: number = displayIndex; for (let i = 0; i < displayIndex; i++) { if (displayExp.charAt(i) === ',') { expIndex--; } } return expIndex; }
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 displayIndexToExpIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left displayExp AST#identifier#Right AST#ERROR#Left ...
public static displayIndexToExpIndex(displayExp: string, displayIndex: number): number { let expIndex: number = displayIndex; for (let i = 0; i < displayIndex; i++) { if (displayExp.charAt(i) === ',') { expIndex--; } } return expIndex; }
https://gitee.com/openharmony-sig/applications_calculator.git
9dd28db583cc1a1d4b44db821aca01b775a9e950
gitee
richshaw2015/nds
ohos/entry/src/main/ets/utils/GameManager.ets
arkts
clearRecentGames
清空最近游戏列表
public async clearRecentGames(): Promise<void> { this.recentGames = []; await this.saveRecentGames(); }
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 clearRecentGames AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST...
public async clearRecentGames(): Promise<void> { this.recentGames = []; await this.saveRecentGames(); }
https://github.com/richshaw2015/nds
c9ba9556e3fb4c56270df94830be206cd762d878
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/CloudSyncService.ets
arkts
importCloudData
导入云端数据到本地
private static async importCloudData(dataPackage: CloudDataPackage, userId: number): Promise<number> { let recordCount: number = 0; const conflicts: ConflictInfo[] = []; await DatabaseManager.transaction(async () => { // 导入账户(支持更新) if (dataPackage.accounts && dataPackage.accounts.length > 0) ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left importCloudData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left...
private static async importCloudData(dataPackage: CloudDataPackage, userId: number): Promise<number> { let recordCount: number = 0; const conflicts: ConflictInfo[] = []; await DatabaseManager.transaction(async () => { // 导入账户(支持更新) if (dataPackage.accounts && dataPackage.accounts.length > 0) ...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
b3f9047a6f00437bbee4a88d7ab07206a403cec6
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets
arkts
comparedTo
Return 1 if the value of this Decimal is greater than the value of `n`, -1 if the value of this Decimal is less than the value of `n`, 0 if they have the same value, NaN if the value of either Decimal is NaN. @param { Value } n {double | string | Decimal} @returns { double } the number type
public comparedTo(n: Value): double { let y = new Decimal(n); let xd = this.d; let yd = y.d; let xs = this.s; let ys = y.s; if (!xd || !yd) { return (!xs || !ys) ? NaN : (xs !== ys) ? xs : (xd === yd) ? 0 : (!xd ^ xs < 0) ? 1 : -1; } if (...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left comparedTo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left n AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Value AS...
public comparedTo(n: Value): double { let y = new Decimal(n); let xd = this.d; let yd = y.d; let xs = this.s; let ys = y.s; if (!xd || !yd) { return (!xs || !ys) ? NaN : (xs !== ys) ? xs : (xd === yd) ? 0 : (!xd ^ xs < 0) ? 1 : -1; } if (...
https://gitcode.com/iop123123/arkts-static-skills
3421b2bf2db775f7f25a423140f98c49e24cdb5f
gitcode
openharmony-tpc/mp4parser
library/src/main/ets/mp4parser/MP4Parser.ets
arkts
setDataSource
set video source @param path @param callBack
static setDataSource(path: string, callBack: ICallBack) { mp4parser_napi.setDataSource(path).then((res: number) => { callBack.callBackResult(res) }); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setDataSource AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left st...
static setDataSource(path: string, callBack: ICallBack) { mp4parser_napi.setDataSource(path).then((res: number) => { callBack.callBackResult(res) }); }
https://gitee.com/openharmony-tpc/mp4parser.git
debfdead2c9b136b847189322e9356c526996706
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Double.ets
arkts
isFinite
isFinite() checks if the underlying double is a floating point value (not a NaN or infinity) @returns { boolean } true if the underlying double is a floating point value @syscap SystemCapability.Utils.Lang @FaAndStageModel
public isFinite(): boolean { return Double.isFinite(this.value); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isFinite AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#bool...
public isFinite(): boolean { return Double.isFinite(this.value); }
https://gitcode.com/iop123123/arkts-static-skills
014eadda247dd50d3f7d1a8b459ed89989463c6c
gitcode
openharmony-sig/ohos_highlightguide
library/src/main/ets/highlightguide/model/RectF.ets
arkts
check
检测矩形区域坐标数据的有效性 @param left 左上角的X坐标 @param top 左上角的Y坐标 @param right 右下角的X坐标 @param bottom 右下角的Y坐标
private check(left: number | null | undefined, top: number | null | undefined, right: number | null | undefined, bottom: number | null | undefined): void { if (left == null || left == undefined || top == null || top == undefined || right == null || right == undefined || bottom == null || bottom ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left private AST#identifier#Right AST#ERROR#Left AST#identifier#Left check AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left left AST#identifier#Right AST#:#Left : AST#:#Right AST#ER...
private check(left: number | null | undefined, top: number | null | undefined, right: number | null | undefined, bottom: number | null | undefined): void { if (left == null || left == undefined || top == null || top == undefined || right == null || right == undefined || bottom == null || bottom ...
https://gitee.com/openharmony-sig/ohos_highlightguide.git
87aea0ba3ff9a7d59f1c0cb7ade2cd048ab25fc7
gitee
openharmony/applications_contacts
entry/src/main/ets/presenter/contact/detail/DetailPresenter.ets
arkts
deleteContact
Deleting a contact
deleteContact() { AlertDialog.show({ message: $r('app.string.delete_contact_sure'), alignment: EnvironmentProp.isTablet() ? DialogAlignment.Center : DialogAlignment.Bottom, autoCancel: true, primaryButton: { value: $r('app.string.dialog_cancel'), action: () => { } }, secondar...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left deleteContact AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left...
deleteContact() { AlertDialog.show({ message: $r('app.string.delete_contact_sure'), alignment: EnvironmentProp.isTablet() ? DialogAlignment.Center : DialogAlignment.Bottom, autoCancel: true, primaryButton: { value: $r('app.string.dialog_cancel'), action: () => { } }, secondar...
https://gitee.com/openharmony/applications_contacts.git
21f4939e49fc747499a66709520b28f05d0b889d
gitee
arkui-x/samples
CodeLab/Cases/feature/bluetooth/src/main/ets/pages/BluetoothAdvertiser.ets
arkts
reqPermissionsFromUser
TODO 知识点: 获取蓝牙相关权限
function reqPermissionsFromUser(permissions: Array<Permissions>, context: common.UIAbilityContext): void { const atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager(); atManager.requestPermissionsFromUser(context, permissions).then((data) => { const granStatus: Array<number> = data.authRe...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left reqPermissionsFromUser AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left permissions AST#identifier#Right AST#type_annotation#Left AST#:...
function reqPermissionsFromUser(permissions: Array<Permissions>, context: common.UIAbilityContext): void { const atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager(); atManager.requestPermissionsFromUser(context, permissions).then((data) => { const granStatus: Array<number> = data.authRe...
https://gitcode.com/arkui-x/samples
a8f995ee74e3652d546b842baa52826371d51584
gitcode
YDYm233/EasyRandom_HarmonyNextApp
product/wearable/src/main/ets/utils/WearScreenUtil.ets
arkts
screenHeight
获取屏幕高度 (vp)
static get screenHeight(): number { WearScreenUtil._initDimensions(); return WearScreenUtil._screenHeight; }
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 screenHeight AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Lef...
static get screenHeight(): number { WearScreenUtil._initDimensions(); return WearScreenUtil._screenHeight; }
https://github.com/YDYm233/EasyRandom_HarmonyNextApp
212969bd714b1cd43060064530a6f5863d7a6153
github
LJ666-ui/harmony-health-care
entry/src/main/ets/mock/smartwardMock.ets
arkts
generateCareTasks
生成护理任务
public generateCareTasks(count: number, roomIds: string[]): CareTask[] { const tasks: CareTask[] = []; const taskNames = [ '测量血压', '测量体温', '输液更换', '协助翻身', '晨间护理', '晚间护理', '给药', '查房' ]; const taskTypes = ['VITAL_SIGNS', 'MEDICATION', 'CARE', 'ROUND']; ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left generateCareTasks AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left count AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le...
public generateCareTasks(count: number, roomIds: string[]): CareTask[] { const tasks: CareTask[] = []; const taskNames = [ '测量血压', '测量体温', '输液更换', '协助翻身', '晨间护理', '晚间护理', '给药', '查房' ]; const taskTypes = ['VITAL_SIGNS', 'MEDICATION', 'CARE', 'ROUND']; ...
https://github.com/LJ666-ui/harmony-health-care
2faf3b98e34a2c7ada4344d78f52e4b594db5b15
github
openharmony/arkcompiler_taihe_ffi_gen
test/ani_optional/user/main.ets
arkts
func_primitive_bool
布尔类型测试函数
function func_primitive_bool() { let instance: optionalTest.ExampleInterface = optionalTest.getInterface(); instance.funcPrimitiveBool(true) }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left func_primitive_bool AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#lexical...
function func_primitive_bool() { let instance: optionalTest.ExampleInterface = optionalTest.getInterface(); instance.funcPrimitiveBool(true) }
https://gitcode.com/openharmony/arkcompiler_taihe_ffi_gen
e615b8faaf00d8c2f7b3c84bae918b4cdececb09
gitcode
LJ666-ui/harmony-health-care
entry/src/main/ets/ancientimage/ImageRestorationEngine.ets
arkts
estimateRemainingTime
估算剩余时间
private estimateRemainingTime( startTime: number, completed: number, total: number ): number { if (completed === 0) return 0; const elapsed = Date.now() - startTime; const avgTimePerItem = elapsed / completed; const remaining = total - completed; return Math.round((avgTimePerItem * ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left estimateRemainingTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left startTime AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number...
private estimateRemainingTime( startTime: number, completed: number, total: number ): number { if (completed === 0) return 0; const elapsed = Date.now() - startTime; const avgTimePerItem = elapsed / completed; const remaining = total - completed; return Math.round((avgTimePerItem * ...
https://github.com/LJ666-ui/harmony-health-care
5d8a4e2c957546c4660b7e9497d4ca61f225f66f
github
CLMC2025/Vignette
entry/src/main/ets/sync/WebDavSyncManager.ets
arkts
parseEventsJsonl
解析 JSON Lines
private parseEventsJsonl(jsonl: string): ReviewEventRow[] { const lines = jsonl.split(/\r?\n/); const out: ReviewEventRow[] = []; for (const line of lines) { const s = line.trim(); if (s.length === 0) continue; try { const obj = JSON.parse(s) as Record<string, string | number>; ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseEventsJsonl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left jsonl AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#...
private parseEventsJsonl(jsonl: string): ReviewEventRow[] { const lines = jsonl.split(/\r?\n/); const out: ReviewEventRow[] = []; for (const line of lines) { const s = line.trim(); if (s.length === 0) continue; try { const obj = JSON.parse(s) as Record<string, string | number>; ...
https://github.com/CLMC2025/Vignette
36eec055e19de91c792dd8c3ea9a3c0fd91f4e4b
github
openharmony/codelabs
Data/DeviceHealth/entry/src/main/ets/services/EventHubManager.ets
arkts
unSubscribeAll
取消监听,防止内存泄漏
public unSubscribeAll(): void { if (EventHubManager.ctx) { EventHubManager.ctx.eventHub.off(EventHubManager.EVENT_LOW_BATTERY); EventHubManager.ctx.eventHub.off(EventHubManager.EVENT_LOW_STORAGE); } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left unSubscribeAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#express...
public unSubscribeAll(): void { if (EventHubManager.ctx) { EventHubManager.ctx.eventHub.off(EventHubManager.EVENT_LOW_BATTERY); EventHubManager.ctx.eventHub.off(EventHubManager.EVENT_LOW_STORAGE); } }
https://gitcode.com/openharmony/codelabs
bc65a3c6cbdff68f27aa44615d3ae9992ae756fa
gitcode
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.stream.ets
arkts
setEncoding
Sets the encoding format of the input binary data.Default: utf8. @param { string } [encoding] - Original Data Encoding Type. @returns { boolean } Setting successful returns true, setting failed returns false. @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; ...
setEncoding(encoding?: string): boolean { let res: boolean = true; if (!encoding) { encoding = DEFAULT_ENCODING; res = false; } if (encoding.toLowerCase() === 'utf8') { encoding = DEFAULT_ENCODING; } ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setEncoding AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left encoding AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#R...
setEncoding(encoding?: string): boolean { let res: boolean = true; if (!encoding) { encoding = DEFAULT_ENCODING; res = false; } if (encoding.toLowerCase() === 'utf8') { encoding = DEFAULT_ENCODING; } ...
https://gitcode.com/iop123123/arkts-static-skills
88e5bf9e0a60f69f12d890fbd911d5b94ca7f656
gitcode
ZHCOOL520/HarmonyOS-AUTOcall
entry/src/main/ets/utils/AutoCallUtils.ets
arkts
startListening
开始监听通话状态
startListening(callback: (state: CallState, number?: string) => void): void { if (this.isListening) { return; } try { observer.on('callStateChange', (data: object) => { console.log(`通话状态变化: ${JSON.stringify(data)}`); const callData = data as Record<string, Object> ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left startListening AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#...
startListening(callback: (state: CallState, number?: string) => void): void { if (this.isListening) { return; } try { observer.on('callStateChange', (data: object) => { console.log(`通话状态变化: ${JSON.stringify(data)}`); const callData = data as Record<string, Object> ...
https://github.com/ZHCOOL520/HarmonyOS-AUTOcall
dd0ac519554f1d6b5210041874efe85a93500954
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/NdsRomCache.ets
arkts
getMaxCacheSize
获取最大缓存大小设置 Requirements: 2.4
async getMaxCacheSize(): Promise<SizeUnit> { const sizeIndex = await this.settingsManager.get<number>('rom_cache_max_size', 3); const bytes = romCacheSizeToBytes(sizeIndex); return SizeUnit.bytes(bytes); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getMaxCacheSize AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#gene...
async getMaxCacheSize(): Promise<SizeUnit> { const sizeIndex = await this.settingsManager.get<number>('rom_cache_max_size', 3); const bytes = romCacheSizeToBytes(sizeIndex); return SizeUnit.bytes(bytes); }
https://github.com/richshaw2015/nds
58d017c4b118188a96d1adece1244196d22e6779
github
openharmony-sig/ohos_react_native
tester/harmony/react_native_openharmony/src/main/ets/RNOH/RNAbility.ets
arkts
getRNOHWorkerScriptUrl
Override to specify the worker script URL and enable the RNOHWorker thread and WorkerTurboModules. @example return "entry/ets/workers/RNOHWorker.ets" RNOHWorker.ets calls `setupRNOHWorker` which can be imported from RNOH in the following way: import { setupRNOHWorker } from "@rnoh/react-native-openharmony/src/main/ets/...
protected getRNOHWorkerScriptUrl(): string | undefined { return undefined }
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left getRNOHWorkerScriptUrl 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#...
protected getRNOHWorkerScriptUrl(): string | undefined { return undefined }
https://gitee.com/openharmony-sig/ohos_react_native.git
20feb5b0a10fdfd0432467c8edd6c263813c7522
gitee
queueit/harmony-sdk
queueit_sdk/src/main/ets/view/QueueItViewManager.ets
arkts
handleUrlIntercept
--- Handler methods called FROM the <Web> component's events --- Handles URL loading interception logic. Called by <Web onUrlLoadIntercept={...}>. @param url The URL being loaded. @returns True to prevent default loading, False to allow it.
public handleUrlIntercept(url: string | undefined | null): boolean { if (!url) { Logger.warn(QueueItViewManager.TAG, "handleUrlIntercept called without URL."); return false; // Allow default handling if URL is missing } Logger.debug(QueueItViewManager.TAG, `handleUrlI...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left handleUrlIntercept 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#binary_express...
public handleUrlIntercept(url: string | undefined | null): boolean { if (!url) { Logger.warn(QueueItViewManager.TAG, "handleUrlIntercept called without URL."); return false; // Allow default handling if URL is missing } Logger.debug(QueueItViewManager.TAG, `handleUrlI...
https://github.com/queueit/harmony-sdk
bdd844b3eaa1e147d96d330bf1deb21f01351e60
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelChapterCacheManager.ets
arkts
getChapterCache
获取章节缓存内容(从txt文件读取) @param bookIdOrChapterId 可以是bookId或旧格式的chapterId @param chapterIndex 章节索引(如果第一个参数是bookId)
async getChapterCache(bookIdOrChapterId: string, chapterIndex?: number): Promise<string | null> { try { // 确保缓存目录已初始化 await this.ensureInitialized(); let bookId: string; let index: number; if (chapterIndex !== undefined) { // 新格式:bookId + chapterIndex bo...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getChapterCache AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left bookIdOrChapterId AST#identifier#Right AST#type_annotation#Left...
async getChapterCache(bookIdOrChapterId: string, chapterIndex?: number): Promise<string | null> { try { // 确保缓存目录已初始化 await this.ensureInitialized(); let bookId: string; let index: number; if (chapterIndex !== undefined) { // 新格式:bookId + chapterIndex bo...
https://github.com/DaLongZhuaZi/manxia
c71fecbc11f811a33775da232b2e10e4493992b1
github
Joker-x-dev/CoolMallArkTS
core/network/src/main/ets/datasource/goods/GoodsNetworkDataSourceImpl.ets
arkts
submitGoodsComment
提交商品评论 @param params 评论提交请求参数 @returns 提交结果响应
async submitGoodsComment(params: GoodsCommentSubmitRequest): Promise<NetworkResponse<boolean>> { const resp: AxiosResponse<NetworkResponse<boolean>> = await NetworkClient.http.post("goods/comment/submit", params); return resp.data; }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left submitGoodsComment AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left params AST#identifier#Right AST#type_annotation#Left AST#:#L...
async submitGoodsComment(params: GoodsCommentSubmitRequest): Promise<NetworkResponse<boolean>> { const resp: AxiosResponse<NetworkResponse<boolean>> = await NetworkClient.http.post("goods/comment/submit", params); return resp.data; }
https://github.com/Joker-x-dev/CoolMallArkTS
0e4638bad0910397479296842684376a769b1cc7
github
qiuhaotc/Sunshine_HarmonyOS
entry/src/main/ets/calculator/AdvancedSunshineCalculator.ets
arkts
computeDaySunshineMinutes
计算某一天的日照时间(分钟)
private computeDaySunshineMinutes( buildings: BuildingModel[], targetBuilding: BuildingModel, unitPoint: Point3D, pointZ: number, latitude: number, longitude: number, dayOfYear: number, timeZone: number, minutesStep: number ): number { // 计算日照长度(小时) const dayLengthHours =...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left computeDaySunshineMinutes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left buildings AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AS...
private computeDaySunshineMinutes( buildings: BuildingModel[], targetBuilding: BuildingModel, unitPoint: Point3D, pointZ: number, latitude: number, longitude: number, dayOfYear: number, timeZone: number, minutesStep: number ): number { // 计算日照长度(小时) const dayLengthHours =...
https://github.com/qiuhaotc/Sunshine_HarmonyOS
0952dfe87a57dcfff9660b47a138fc863f2880bb
github
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnSwitchViewModel.ets
arkts
clearLoadingTimer
清除加载定时器
private clearLoadingTimer(): void { if (this.loadingTimerId !== -1) { clearTimeout(this.loadingTimerId); this.loadingTimerId = -1; this.isLoading = false; } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left clearLoadingTimer 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...
private clearLoadingTimer(): void { if (this.loadingTimerId !== -1) { clearTimeout(this.loadingTimerId); this.loadingTimerId = -1; this.isLoading = false; } }
https://github.com/codelably/tuniao-ui
e208bb9ae01032a11720010a9474d5e4570d8727
github
the-wwyang/kids-learning-app
src/main/ets/services/AchievementService.ets
arkts
getAchievementSummary
获取成就摘要信息 @param achievements 成就列表 @returns 摘要信息
static getAchievementSummary(achievements: Achievement[]): AchievementSummary { const total = achievements.length; const unlocked = achievements.filter(a => a.isUnlocked).length; const progress = total > 0 ? Math.round((unlocked / total) * 100) : 0; const totalStarsEarned = achievements .filter(...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getAchievementSummary AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left achievements AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#su...
static getAchievementSummary(achievements: Achievement[]): AchievementSummary { const total = achievements.length; const unlocked = achievements.filter(a => a.isUnlocked).length; const progress = total > 0 ? Math.round((unlocked / total) * 100) : 0; const totalStarsEarned = achievements .filter(...
https://github.com/the-wwyang/kids-learning-app
c11879ffe40a802dc55be01a3d4023ab5659d5ae
github
openharmony/xts_tools
sample/AppSampleE/entry/src/main/ets/pages/Index.ets
arkts
getLocation
获取定位服务
getLocation(): void { let locationChange = (err: BusinessError, location: geoLocationManager.Location) => { if (err) { console.log('locationChanger: err=' + JSON.stringify(err)); } if (location) { this.latitude = location.latitude.toString(); this.longitude = location.lon...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getLocation 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#...
getLocation(): void { let locationChange = (err: BusinessError, location: geoLocationManager.Location) => { if (err) { console.log('locationChanger: err=' + JSON.stringify(err)); } if (location) { this.latitude = location.latitude.toString(); this.longitude = location.lon...
https://gitee.com/openharmony/xts_tools.git
6d88a7c5d99c37abeb6e0a6f896670f8c8702837
gitee
wuba/omni-ui
omni_component/src/main/ets/components/calendar/OmniCalendar.ets
arkts
_setListOfWeekDate
设置周日期列表
_setListOfWeekDate(weekDate: Date) { this.dateList = []; let tmpDateList: Date[] = []; let previousDay = weekDate.getDay() % 7; for (let i = 0; i < weekDate.getDay(); i++) { tmpDateList.push(new Date(weekDate.getTime() - ((previousDay - i) * 24 * 60 * 60 * 1000))); } let preCount = tmpDa...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left _setListOfWeekDate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left weekDate AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Date AST#identifier#Right AST#ERRO...
_setListOfWeekDate(weekDate: Date) { this.dateList = []; let tmpDateList: Date[] = []; let previousDay = weekDate.getDay() % 7; for (let i = 0; i < weekDate.getDay(); i++) { tmpDateList.push(new Date(weekDate.getTime() - ((previousDay - i) * 24 * 60 * 60 * 1000))); } let preCount = tmpDa...
https://github.com/wuba/omni-ui
81d5a12eec690e94813d8c4fcbb0ee4e75f33a58
github
offlinecat-dev/OCNetORM
src/main/ets/query/PaginationParams.ets
arkts
createDefault
创建默认分页参数 @returns 默认的 PaginationParams 实例(page=1, pageSize=20)
static createDefault(): PaginationParams { return new PaginationParams() }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createDefault 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 Paginati...
static createDefault(): PaginationParams { return new PaginationParams() }
https://github.com/offlinecat-dev/OCNetORM
1c3d4521ed1d07ad030da2d398dc11576c18c8f9
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
constructor
Creates a copy of Float32Array. @param other data initializer
public constructor(other: Float32Array) { this.buffer = other.buffer.sliceInternal(0, other.byteLength) this.byteLength = other.byteLength this.length = other.length }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Flo...
public constructor(other: Float32Array) { this.buffer = other.buffer.sliceInternal(0, other.byteLength) this.byteLength = other.byteLength this.length = other.length }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
8aa0004242e8dcfb7c78002f70fde0594546e4c9
gitee
harmonyos/codelabs
AlarmClock/entry/src/main/ets/common/utils/DimensionUtil.ets
arkts
getFp
Obtains the screen horizontal adaptation fp. @return number
static getFp(value: Resource): number { let beforeFp = context.resourceManager.getNumber(value.id); return px2fp(DimensionUtil.adaptDimension(beforeFp)); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left getFp 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#ER...
static getFp(value: Resource): number { let beforeFp = context.resourceManager.getNumber(value.id); return px2fp(DimensionUtil.adaptDimension(beforeFp)); }
https://gitee.com/harmonyos/codelabs.git
a69902b1071a3b61113a87c7053f06a68fe272ee
gitee
TDCQCX/ShiHuaMusic-Harmony
entry/src/main/ets/utils/StyleUtil.ets
arkts
getChipStyle
获取标签样式
static getChipStyle(selected: boolean = false) { const theme = ThemeUtil.getCurrentThemeConfig(); const spacing = theme.spacing; const borderRadius = theme.borderRadius; return { backgroundColor: selected ? theme.colors.primary : 'transparent', color: selected ? theme.colors.onPrimary...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getChipStyle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left selected AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expr...
static getChipStyle(selected: boolean = false) { const theme = ThemeUtil.getCurrentThemeConfig(); const spacing = theme.spacing; const borderRadius = theme.borderRadius; return { backgroundColor: selected ? theme.colors.primary : 'transparent', color: selected ? theme.colors.onPrimary...
https://github.com/TDCQCX/ShiHuaMusic-Harmony
cd70371d342494166cb0ad3d635aeb3a63eea0f8
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets
arkts
ecmaDateFromTime
@see ECMA-262, 21.4.1.5 @returns Date number (within month).
function ecmaDateFromTime(time: long): byte { let year = ecmaYearFromTime(time); let dayWithinYear = ecmaDayFromTime(time) - ecmaDayFromYear(year); let inLeapYear = ecmaInLeapYear(year); let month: byte = 11; for (let i = 1; i < 12; i++) { if (dayWithinYear < getFirstDayInMonth(inLeapYear,...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left ecmaDateFromTime AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left time AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:...
function ecmaDateFromTime(time: long): byte { let year = ecmaYearFromTime(time); let dayWithinYear = ecmaDayFromTime(time) - ecmaDayFromYear(year); let inLeapYear = ecmaInLeapYear(year); let month: byte = 11; for (let i = 1; i < 12; i++) { if (dayWithinYear < getFirstDayInMonth(inLeapYear,...
https://gitcode.com/iop123123/arkts-static-skills
cb5831c82dcbeac70e59cd72f4669ae9f1a9c6e3
gitcode
offlinecat-dev/OCNetORM
src/main/ets/query/PredicateBuilder.ets
arkts
applyCondition
应用单个条件到 RdbPredicates @param predicates RdbPredicates 实例 @param condition 条件 @returns 条件描述
private static applyCondition(predicates: relationalStore.RdbPredicates, condition: WhereCondition): string { const column = condition.column const value = condition.value switch (condition.operator) { case ConditionOperator.EQUAL: predicates.equalTo(column, PredicateBuilder.singleValueToPr...
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 applyCondition AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left predicates AST#identifier#Right AST#:...
private static applyCondition(predicates: relationalStore.RdbPredicates, condition: WhereCondition): string { const column = condition.column const value = condition.value switch (condition.operator) { case ConditionOperator.EQUAL: predicates.equalTo(column, PredicateBuilder.singleValueToPr...
https://github.com/offlinecat-dev/OCNetORM
fc870692b30ccf9c87ac16f2668a9d443b2800a9
github
arkui-x/samples
CodeLab/Cases/feature/databaseupgrade/src/main/ets/utils/DBUtils.ets
arkts
createTable
创建表 @param tableName 表名 @param columnTypeMap 字段名与其类型
async createTable(tableName: string, columnTypeMap: string[][]): Promise<void> { if (store === undefined) { return; } let fieldStatements: string = Constants.EMPTY_STRING; columnTypeMap.forEach(columnType => { fieldStatements += Constants.COMMA + columnType[0] + Constants.SPACE + columnTyp...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left createTable AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left tableName AST#identifier#Right AS...
async createTable(tableName: string, columnTypeMap: string[][]): Promise<void> { if (store === undefined) { return; } let fieldStatements: string = Constants.EMPTY_STRING; columnTypeMap.forEach(columnType => { fieldStatements += Constants.COMMA + columnType[0] + Constants.SPACE + columnTyp...
https://gitcode.com/arkui-x/samples
56a79714e1184bd226c7a804003052adf849fd3d
gitcode
Yebingiscn/SweetVideo
entry/src/main/ets/utils/FileProcessorUtil.ets
arkts
getLock
获取互斥锁
static getLock(key: string): MutexLock { if (!ConcurrencyManagerUtil.locks.has(key)) { ConcurrencyManagerUtil.locks.set(key, new MutexLock()) } return ConcurrencyManagerUtil.locks.get(key)! }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getLock AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AS...
static getLock(key: string): MutexLock { if (!ConcurrencyManagerUtil.locks.has(key)) { ConcurrencyManagerUtil.locks.set(key, new MutexLock()) } return ConcurrencyManagerUtil.locks.get(key)! }
https://github.com/Yebingiscn/SweetVideo
8b775e6b688d1d2a17bc13236f62d2f8198a1807
github
aimilin6688/KeePassHO
entry/src/main/ets/services/template/TemplateBuilder.ets
arkts
create
创建构建器实例 @param group 目标分组 @returns 构建器实例
static create(group: KdbxGroup): TemplateBuilder { const meta = FileService.getInstance().getDbFileParam().database.meta; return new TemplateBuilder(group, meta); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left create 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#Left KdbxGrou...
static create(group: KdbxGroup): TemplateBuilder { const meta = FileService.getInstance().getDbFileParam().database.meta; return new TemplateBuilder(group, meta); }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/template/TemplateBuilder.ets#L40-L43
d02612835dee34de2686ce50af7b7e4729920277
github
Eklps/harmony-mall-perf
entry/src/main/ets/view/TabBarsComponent.ets
arkts
putDownRefresh
下拉刷新逻辑 @param event
putDownRefresh(event?: TouchEvent): void { if (event === undefined) { return; } switch (event.type) { case TouchType.Down: this.currentOffsetY = event.touches[0].y; break; case TouchType.Move: // 只有在未刷新状态下才检测下拉 if (!this.refreshStatus) { const of...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left putDownRefresh AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left TouchEvent AST#...
putDownRefresh(event?: TouchEvent): void { if (event === undefined) { return; } switch (event.type) { case TouchType.Down: this.currentOffsetY = event.touches[0].y; break; case TouchType.Move: // 只有在未刷新状态下才检测下拉 if (!this.refreshStatus) { const of...
https://github.com/Eklps/harmony-mall-perf
436c7acad8f9e8e698c17e357af9ad80be2f50e3
github
terryma2024/happyword
harmonyos/entry/src/main/ets/services/BattleResultEnricher.ets
arkts
applyTodayAdventureRewards
Compute today-adventure coin awards, mark today as completed for the home-page badge, and write the result into the SessionResult. Coin awards are clamped to the daily cap inside CoinAccount.earn — `dailyCapHit` mirrors that state. V0.8.6 — reward formula is defeated monster level score: Σ count(level) × levelValue. St...
function applyTodayAdventureRewards( ctx: common.UIAbilityContext, result: SessionResult, plan: TodaySessionPlan, activePack: Pack | undefined, ): void { const coinAccount: CoinAccount = getCoinAccount(); const checkInStore: CheckInStore = getCheckInStore(); const now: number = Date.now(); coinAccount.b...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left applyTodayAdventureRewards AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left ctx AST#identifier#Right AST#type_annotation#Left AST#:#Lef...
function applyTodayAdventureRewards( ctx: common.UIAbilityContext, result: SessionResult, plan: TodaySessionPlan, activePack: Pack | undefined, ): void { const coinAccount: CoinAccount = getCoinAccount(); const checkInStore: CheckInStore = getCheckInStore(); const now: number = Date.now(); coinAccount.b...
https://github.com/terryma2024/happyword
7e4a2ce4f8134d5c7a5f407e4256fee216c89a8f
github
Joker-x-dev/CoolMallArkTS
core/model/src/main/ets/request/GoodsSearchRequest.ets
arkts
constructor
@param {Partial<GoodsSearchRequest>} init - 初始化数据
constructor(init?: Partial<GoodsSearchRequest>) { if (!init) { return; } this.page = init.page ?? this.page; this.size = init.size ?? this.size; this.typeId = init.typeId ?? this.typeId; this.minPrice = init.minPrice ?? this.minPrice; this.maxPrice = init.maxPrice ?? this.maxPrice; ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expres...
constructor(init?: Partial<GoodsSearchRequest>) { if (!init) { return; } this.page = init.page ?? this.page; this.size = init.size ?? this.size; this.typeId = init.typeId ?? this.typeId; this.minPrice = init.minPrice ?? this.minPrice; this.maxPrice = init.maxPrice ?? this.maxPrice; ...
https://github.com/Joker-x-dev/CoolMallArkTS
0accf116646a86bf3ba9beec69def26a1150bc7e
github
webabcd/HarmonyDemo
entry/src/main/ets/pages/network/WebSocketDemo.ets
arkts
constructWebSocketFrame
构造 WebSocket 帧
function constructWebSocketFrame(payload: string): ArrayBuffer { // 构造帧头 const fin = 0x80; // FIN=1(1 << 7) const opcode = 0x01; // 文本帧 const firstByte = fin | opcode; const mask = 0x00; // 不用掩码 let payloadLength = buffer.byteLength(payload); let secondByte = mask | payloadLength; // 有效载荷的长度 ...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left constructWebSocketFrame AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left payload AST#identifier#Right AST#type_annotation#Left AST#:#Le...
function constructWebSocketFrame(payload: string): ArrayBuffer { // 构造帧头 const fin = 0x80; // FIN=1(1 << 7) const opcode = 0x01; // 文本帧 const firstByte = fin | opcode; const mask = 0x00; // 不用掩码 let payloadLength = buffer.byteLength(payload); let secondByte = mask | payloadLength; // 有效载荷的长度 ...
https://github.com/webabcd/HarmonyDemo
7600aaccb3b1508d4264262b861ad58567a43344
github
openharmony/arkui_ace_engine
examples/ComponentSnapshot/entry/src/main/ets/view/ScrollSnapshot.ets
arkts
build
[EndExclude scroll_snapshot]
build() { // [StartExclude scroll_snapshot] NavDestination() { Column() { // [EndExclude scroll_snapshot] Stack() { // [StartExclude scroll_snapshot] // The masking layer of the screenshot process prevents users from noticing the screen swiping quickly // and ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#object#Left AST#{#Left { AST#{#Right AST#comment#Le...
build() { // [StartExclude scroll_snapshot] NavDestination() { Column() { // [EndExclude scroll_snapshot] Stack() { // [StartExclude scroll_snapshot] // The masking layer of the screenshot process prevents users from noticing the screen swiping quickly // and ...
https://gitcode.com/openharmony/arkui_ace_engine
920028308c04494b68ae60367e84573e3f937147
gitcode
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test9_original_index.ets
arkts
fibonacci
--- Recursive function ---
function fibonacci(n: number): number { if (n <= 1) { return n; } return fibonacci(n - 1) + fibonacci(n - 2); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left fibonacci AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left n AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST...
function fibonacci(n: number): number { if (n <= 1) { return n; } return fibonacci(n - 1) + fibonacci(n - 2); }
https://github.com/miaochiahao/ark-ghidra
e04dc1fb79dcd4efc5e840992597b8215b44b12d
github
Joker-x-dev/CoolMallArkTS
feature/auth/src/main/ets/viewmodel/RegisterViewModel.ets
arkts
onSendVerificationCode
发送验证码 @returns {void} 无返回值
onSendVerificationCode(): void { }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onSendVerificationCode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_exp...
onSendVerificationCode(): void { }
https://github.com/Joker-x-dev/CoolMallArkTS
ce977ea18afa9735d505005450e84bd36ddb340b
github
seagazer/cclyric
lib/src/main/ets/CcLyricController.ets
arkts
setLineSpace
Set the space between lyric line, must set before bind the CcLyricView. @param space The space value, the unit is vp.
public setLineSpace(space: number): CcLyricController { this._lineSpace = space this.resize() return this }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setLineSpace AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left space AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left nu...
public setLineSpace(space: number): CcLyricController { this._lineSpace = space this.resize() return this }
https://github.com/seagazer/cclyric
4de54721ed0b85c7cc1421f746fe6edc08b8e3e3
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/EBookDataManager.ets
arkts
deleteEBook
删除电子书
public async deleteEBook(bookId: string): Promise<void> { try { // 先获取电子书信息,用于删除文件 const ebook = await this.getEBookById(bookId); // 删除章节 await this.dbManager.executeSql(`DELETE FROM ebook_chapter WHERE bookId = ?`, [bookId]); // 删除阅读进度 await this.dbManager.execut...
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 deleteEBook AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bookId AST#identifier#Right AST#:#Left : AST...
public async deleteEBook(bookId: string): Promise<void> { try { // 先获取电子书信息,用于删除文件 const ebook = await this.getEBookById(bookId); // 删除章节 await this.dbManager.executeSql(`DELETE FROM ebook_chapter WHERE bookId = ?`, [bookId]); // 删除阅读进度 await this.dbManager.execut...
https://github.com/DaLongZhuaZi/manxia
8b9d002482e14a84d63eb00e5f75a4a7667bf1c2
github
openharmony/codelabs
ETSUI/ItemManagerAPP/entry/src/main/ets/store/ItemStore.ets
arkts
clearAllItems
清空所有物品数据
async clearAllItems(): Promise<void> { try { await ItemRdb.clearAll(); console.info('ItemStore: 数据库清空成功'); this.setItemCount(0); // 直接设置为0,触发监听 // 新增:触发清空数据事件 this.notifyClearListeners(); } catch (error) { console.error('ItemStore: 清空数据库失败:', error); if (error instan...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left clearAllItems AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generi...
async clearAllItems(): Promise<void> { try { await ItemRdb.clearAll(); console.info('ItemStore: 数据库清空成功'); this.setItemCount(0); // 直接设置为0,触发监听 // 新增:触发清空数据事件 this.notifyClearListeners(); } catch (error) { console.error('ItemStore: 清空数据库失败:', error); if (error instan...
https://gitcode.com/openharmony/codelabs
50cef8c22d61c6282683abad2cccf388fa724ecb
gitcode
terryma2024/happyword
harmonyos/entry/src/main/ets/services/BattleResultEnricher.ets
arkts
recordPerfectAdventure
V0.6.5.1 — fire-and-forget perfect-adventure recorder. Runs asynchronously after the synchronous result-page navigation has already been posted, so the player never waits on the prefs write. Errors are logged but never block.
function recordPerfectAdventure(ctx: common.UIAbilityContext, packId: string): void { (async (): Promise<void> => { try { const lib: PackLibrary = await WordPackBootstrapper.bootstrapPackLibrary(ctx); const sel: PackSelectionService = new PackSelectionService(); await sel.init(ctx, lib.builtinId...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left recordPerfectAdventure AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left ctx AST#identifier#Right AST#type_annotation#Left AST#:#Left : ...
function recordPerfectAdventure(ctx: common.UIAbilityContext, packId: string): void { (async (): Promise<void> => { try { const lib: PackLibrary = await WordPackBootstrapper.bootstrapPackLibrary(ctx); const sel: PackSelectionService = new PackSelectionService(); await sel.init(ctx, lib.builtinId...
https://github.com/terryma2024/happyword
fe989c11d14c51553d9cc8c49cba7740398ac951
github
zcg741/chengyu-game
entry/src/main/ets/service/ChengyuService.ets
arkts
loadChengyuFromRawFile
从 rawfile/chengyu_data.json 加载成语数据
async function loadChengyuFromRawFile(): Promise<Chengyu[]> { const context = getAppContext(); if (!context) { console.error('ChengyuService: 无法获取上下文'); return getBuiltInFallbackData(); } try { const fileData: Uint8Array = await context.resourceManager.getRawFileContent('chengyu_data.json'); //...
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left loadChengyuFromRawFile AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#L...
async function loadChengyuFromRawFile(): Promise<Chengyu[]> { const context = getAppContext(); if (!context) { console.error('ChengyuService: 无法获取上下文'); return getBuiltInFallbackData(); } try { const fileData: Uint8Array = await context.resourceManager.getRawFileContent('chengyu_data.json'); //...
https://github.com/zcg741/chengyu-game
6ec3bcfcc8d51ae9057e4fbe05f2be0d98f923dc
github
openharmony/codelabs
ETSUI/MemoTime/entry/src/main/ets/model/Recording.ets
arkts
fromDbObject
从数据库对象创建 Recording 实例
static fromDbObject(obj: relationalStore.ValuesBucket): Recording { const recording = new Recording() recording.id = obj['id'] as string recording.scheduleId = obj['scheduleId'] as string recording.filePath = obj['filePath'] as string recording.fileName = obj['fileName'] as string recording.du...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left fromDbObject 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#member_expression#Le...
static fromDbObject(obj: relationalStore.ValuesBucket): Recording { const recording = new Recording() recording.id = obj['id'] as string recording.scheduleId = obj['scheduleId'] as string recording.filePath = obj['filePath'] as string recording.fileName = obj['fileName'] as string recording.du...
https://gitcode.com/openharmony/codelabs
aa996f344fc0b21a8926304b83e600238a18ad90
gitcode
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/ChartModel.ets
arkts
getDragDecelerationFrictionCoef
Returns drag deceleration friction coefficient @return
public getDragDecelerationFrictionCoef(): number { return this.mDragDecelerationFrictionCoef; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getDragDecelerationFrictionCoef 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...
public getDragDecelerationFrictionCoef(): number { return this.mDragDecelerationFrictionCoef; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
0c46f52c721187bdf805e557cb8ddd3c02d2b082
gitee
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/usbdriver/XboxOneController.ets
arkts
processButtons
处理按钮数据
private processButtons(buffer: Uint8Array, offset: number): void { let b = buffer[offset++]; this.setButtonFlag(ButtonFlags.PLAY_FLAG, b & 0x04); this.setButtonFlag(ButtonFlags.BACK_FLAG, b & 0x08); this.setButtonFlag(ButtonFlags.A_FLAG, b & 0x10); this.setButtonFlag(ButtonFlags.B_FLAG, b & 0...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left processButtons AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left buffer AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
private processButtons(buffer: Uint8Array, offset: number): void { let b = buffer[offset++]; this.setButtonFlag(ButtonFlags.PLAY_FLAG, b & 0x04); this.setButtonFlag(ButtonFlags.BACK_FLAG, b & 0x08); this.setButtonFlag(ButtonFlags.A_FLAG, b & 0x10); this.setButtonFlag(ButtonFlags.B_FLAG, b & 0...
https://github.com/AlkaidLab/moonlight-harmony
ba0e064f23635838de734bd99897d89392f7c2a9
github