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
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
lastIndexOf
Returns the index of the last occurrence of a value in Int8Array. @param { number } searchElement - The value to locate in the array. @param { int | undefined } fromIndex - The array index at which to begin the search. If fromIndex is undefined, the search starts at index 0. @returns { int } - right-most index of searc...
public lastIndexOf(searchElement: number, fromIndex: int | undefined): int { return this.lastIndexOfImpl(searchElement, fromIndex ?? 0) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left lastIndexOf AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left searchElement AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#numb...
public lastIndexOf(searchElement: number, fromIndex: int | undefined): int { return this.lastIndexOfImpl(searchElement, fromIndex ?? 0) }
https://gitcode.com/iop123123/arkts-static-skills
de21c33dd4f39bd478194c8afde85a1ca2a36084
gitcode
openharmony/codelabs
Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets
arkts
reset
Reset.
reset(): void { Logger.debug(TAG, 'reset'); let limit = this.calcNewLimit(); this.cropShow.init(limit, this.imageRatio); this.initialize(); this.refresh(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left reset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left A...
reset(): void { Logger.debug(TAG, 'reset'); let limit = this.calcNewLimit(); this.cropShow.init(limit, this.imageRatio); this.initialize(); this.refresh(); }
https://gitee.com/openharmony/codelabs.git
75d07793947d942e2cd6f6379af73efc91eb2780
gitee
openharmony-tpc/ohos_coap
libcoap/src/main/ets/components/mainpage/CoapClient.ets
arkts
setMid
客户端自定义报文的message id @param mid:number数字型
setMid(mid: number) { this.coapClient.setMid(mid, this.classId); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setMid AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left mid AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#L...
setMid(mid: number) { this.coapClient.setMid(mid, this.classId); }
https://gitee.com/openharmony-tpc/ohos_coap.git
15282db5b61f2e198be8628ef25dfb40f62432ba
gitee
xblLab/HarmonyProjectTemplate
commons/lib_common/src/main/ets/utils/FileUtils.ets
arkts
clearCache
清除缓存 @param cacheDir
static clearCache() { const cacheDir = getContext().cacheDir; Logger.info(TAG, 'clear cache dir:' + cacheDir); fs.listFile(cacheDir).then((filenames) => { for (let i = 0; i < filenames.length; i++) { let dirPath = cacheDir + '/' + filenames[i]; Logger.info(TAG, 'dir path:' + dirPath)...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left clearCache 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 { AS...
static clearCache() { const cacheDir = getContext().cacheDir; Logger.info(TAG, 'clear cache dir:' + cacheDir); fs.listFile(cacheDir).then((filenames) => { for (let i = 0; i < filenames.length; i++) { let dirPath = cacheDir + '/' + filenames[i]; Logger.info(TAG, 'dir path:' + dirPath)...
https://github.com/xblLab/HarmonyProjectTemplate
193ba8a330abb624d2183aec45e705e72870d975
github
CsCesium/KantaiHomo
entry/src/main/ets/infra/fairy/service/FairyService.ets
arkts
getPositionPx
Current ball position in physical pixels.
getPositionPx(): Position { return { x: this.posXPx, y: this.posYPx }; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getPositionPx 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 Position AST#identifier#Right AST#ERROR#Right AS...
getPositionPx(): Position { return { x: this.posXPx, y: this.posYPx }; }
https://github.com/CsCesium/KantaiHomo
3d797a7fc6be11d1bb260e1e940a78bf6c6fe03b
github
LongLiveY96/chatcube
entry/src/main/ets/services/DatabaseService.ets
arkts
insertTokenUsageEvent
追加一条 token 用量账本事件(只追加,不更新/去重)。 调用方在流式收割点每轮写入一条,event.id 由上层用 generateId() 保证唯一。
async insertTokenUsageEvent(event: TokenUsageEvent): Promise<void> { await this.waitForInitialization() if (this.rdbStore === null) { return } const valueBucket: relationalStore.ValuesBucket = { id: event.id, session_id: event.sessionId, message_id: event.messageId, provi...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left insertTokenUsageEvent AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#L...
async insertTokenUsageEvent(event: TokenUsageEvent): Promise<void> { await this.waitForInitialization() if (this.rdbStore === null) { return } const valueBucket: relationalStore.ValuesBucket = { id: event.id, session_id: event.sessionId, message_id: event.messageId, provi...
https://github.com/LongLiveY96/chatcube
d71b007fe6b0abb16b956b725621e9b4b5fbf8e3
github
veaba/EsptouchForHarmony
entry/src/main/ets/esptouch/provision/APProvisioner.ets
arkts
startKeepalive
Send keepalive ping every 10s
private startKeepalive(): void { this.stopKeepalive(); this.keepaliveTimer = setInterval((): void => { if (this.tcpSocket != null) { let ping: PingCommand = new PingCommand(); let pingStr: string = JSON.stringify(ping); let encoder = new util.TextEncoder(); let data: Uint...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left startKeepalive AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expr...
private startKeepalive(): void { this.stopKeepalive(); this.keepaliveTimer = setInterval((): void => { if (this.tcpSocket != null) { let ping: PingCommand = new PingCommand(); let pingStr: string = JSON.stringify(ping); let encoder = new util.TextEncoder(); let data: Uint...
https://github.com/veaba/EsptouchForHarmony
4386828810ab032757f82bcd62d7a16cf132d020
github
darcycui/DarcyHarmonyNext
entry/src/main/ets/pages/entry/basepage/ColumnPage.ets
arkts
aboutToAppear
生命周期回调:页面即将显示 所有组件
aboutToAppear(): void { Log.info(TAG + "aboutToAppear"); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc...
aboutToAppear(): void { Log.info(TAG + "aboutToAppear"); }
https://github.com/darcycui/DarcyHarmonyNext/blob/241d0ee75929f6b3f9e1fe5b550acf6c9533c15c/entry/src/main/ets/pages/entry/basepage/ColumnPage.ets#L32-L34
ffa3716c5d249e81ef2850145c24c6002f2b7428
github
harmonyos/codelabs
HarmonyOS_NEXT/LoginDemo/entry/src/main/ets/common/utils/CommonUtils.ets
arkts
loginArkTS
ArkTS login account and password. @param {string} account account @param {string} password password
public loginArkTS(account: string, password: string): void { let check: Resource | string = this.loginCheckArkTS(account, password); if (CommonConstants.LOGIN_TEXT !== check) { Logger.error(CommonConstants.TAG_COMMON_UTILS, 'login account or password is empty'); this.showToastContent(check); ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left loginArkTS AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left account AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Righ...
public loginArkTS(account: string, password: string): void { let check: Resource | string = this.loginCheckArkTS(account, password); if (CommonConstants.LOGIN_TEXT !== check) { Logger.error(CommonConstants.TAG_COMMON_UTILS, 'login account or password is empty'); this.showToastContent(check); ...
https://gitee.com/harmonyos/codelabs.git
00c0330a370d4873e503f9a4928a2c19a946ee94
gitee
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnFormViewModel.ets
arkts
setSubjectName
设置学科名称 @param index 索引 @param value 名称
setSubjectName(index: number, value: string): void { this.dynamicForm.subjects[index].name = value; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setSubjectName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left ,...
setSubjectName(index: number, value: string): void { this.dynamicForm.subjects[index].name = value; }
https://github.com/codelably/tuniao-ui
be2fa395017881067a897400eb5fb0982b7a3f0d
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/bitwise_and/bitwise_and_long.ets
arkts
main
--- desc: check bitwise and operation for long operands ---
function main(): void { const a: long = {{v.left}} const b: long = {{v.right}} assert (a & b) == {{v.result}}
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A...
function main(): void { const a: long = {{v.left}} const b: long = {{v.right}} assert (a & b) == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
001fef1b96f2dc9d43b1cb655cce9ed10a8eff5c
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
forEach
Applies a function over all elements of Uint32Array @param fn function to apply @returns undefined
public forEach(fn: (val: number, index: int, array: Uint32Array) => number): void { for (let i = 0; i < this.length; ++i) { this.set(i, fn(this.at(i), i, this)) } throw new Error("Uint32Array.forEach: has to return undefined, but returns void for now") }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left forEach 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 forEach(fn: (val: number, index: int, array: Uint32Array) => number): void { for (let i = 0; i < this.length; ++i) { this.set(i, fn(this.at(i), i, this)) } throw new Error("Uint32Array.forEach: has to return undefined, but returns void for now") }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
f25324edd66b659a9705bd7cc1d1a5433ba9f4e8
gitee
openharmony-sig/flutter_engine
shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/ohos/FlutterAbilityAndEntryDelegate.ets
arkts
release
释放所有持有对象
release() { this.host = null; this.flutterEngine = null; this.platformPlugin = undefined; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left release AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST...
release() { this.host = null; this.flutterEngine = null; this.platformPlugin = undefined; }
https://gitee.com/openharmony-sig/flutter_engine.git
81a03032d7aec58949fe379e06a35999916d1ad4
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
set
Copies elements from an ArrayLike object to the BigInt64Array. @param { ArrayLike<BigInt> } array - An ArrayLike object containing the elements to copy. @param { int } [offset] - Optional. The offset into the target array at which to begin writing values from the source array. The default value is 0. @throws { RangeErr...
public set(array: ArrayLike<BigInt>, offset: int = 0): void { const insertPos = offset if (insertPos < 0 || insertPos + array.length > this.lengthInt) { throw new RangeError("offset is out of bounds") } for (let i = 0; i < array.length; ++i) { this.setUnsafe(i...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left array AST#identifier#Right AST#:#Left : AST#:#Right AST#ERRO...
public set(array: ArrayLike<BigInt>, offset: int = 0): void { const insertPos = offset if (insertPos < 0 || insertPos + array.length > this.lengthInt) { throw new RangeError("offset is out of bounds") } for (let i = 0; i < array.length; ++i) { this.setUnsafe(i...
https://gitcode.com/iop123123/arkts-static-skills
6b0a2d376989c765812d1ea353a446b959bfb572
gitcode
chendi126/harmonyOS-TCP
entry/src/main/ets/common/GlassStyles.ets
arkts
getTitleBarBackgroundColor
获取标题栏背景色
static getTitleBarBackgroundColor(): string { return 'rgba(255, 255, 255, 0.8)'; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getTitleBarBackgroundColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left...
static getTitleBarBackgroundColor(): string { return 'rgba(255, 255, 255, 0.8)'; }
https://github.com/chendi126/harmonyOS-TCP
45e80b826c60d239fec112b39c27442429dcf318
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/GameManager.ets
arkts
getRegionInfo
获取区域信息
public getRegionInfo(region: RomRegion): RegionInfo { return getRegionInfo(region); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getRegionInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left region AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ...
public getRegionInfo(region: RomRegion): RegionInfo { return getRegionInfo(region); }
https://github.com/richshaw2015/nds
96bf0382702cf3b944ccfb9c1fdfd614ec7e1ef9
github
SMAT-Lab/PhantomRendering
example/entry/src/main/ets/pages/CommentScrollPage.ets
arkts
loadMoreComments
自动加载更多方法
loadMoreComments() { if (this.isLoadingMore || this.allComments.length === 0 || this.isDebouncing) return // 防抖检查 const currentTime = Date.now() if (currentTime - this.lastLoadMoreTime < this.loadMoreDebounceDelay) { console.debug(`[CommentScroll] 自动加载更多防抖中,还需等待 ${this.loadMoreDebounceDelay...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left loadMoreComments 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#L...
loadMoreComments() { if (this.isLoadingMore || this.allComments.length === 0 || this.isDebouncing) return // 防抖检查 const currentTime = Date.now() if (currentTime - this.lastLoadMoreTime < this.loadMoreDebounceDelay) { console.debug(`[CommentScroll] 自动加载更多防抖中,还需等待 ${this.loadMoreDebounceDelay...
https://github.com/SMAT-Lab/PhantomRendering
c87703300b73443a99eb8a5e5d430ee2d7b4abad
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/07.expressions/22.relational_expressions/01.numerical_comparison_operators/integer_comparison.ets
arkts
main
--- desc: Integer comparison {{ic.xvalue}} {{ic.op}} {{ic.yvalue}} ---
function main(): void { let x: {{ic.xtype}} = {{ic.xvalue}};
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A...
function main(): void { let x: {{ic.xtype}} = {{ic.xvalue}};
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
3c4de626d89cb07a8e4fa8bebcfd551c9c16fe77
gitee
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.uri.ets
arkts
addEncodedSegment
Creates a new Uri by appending an already-encoded path segment to a base Uri. @param { string } encodedPathSegment - Encoded path segment to be added. @returns { URI } After adding, return the URI object.
addEncodedSegment(encodedPathSegment: string): URI { let uriStr = this.uriEntry.addSegment(encodedPathSegment); return new URI(uriStr); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addEncodedSegment AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left encodedPathSegment AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#...
addEncodedSegment(encodedPathSegment: string): URI { let uriStr = this.uriEntry.addSegment(encodedPathSegment); return new URI(uriStr); }
https://gitcode.com/iop123123/arkts-static-skills
3f1161b67da5a67be84fdf5dc4b31807a9216b82
gitcode
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/EventSourcingService.ets
arkts
checkAndCreateSnapshot
检查并创建快照(每隔N个版本创建一次)
private static async checkAndCreateSnapshot( aggregateType: string, aggregateId: number, currentVersion: number, snapshotInterval: number = 10 ): Promise<void> { try { if (currentVersion % snapshotInterval === 0) { await EventSourcingService.createSnapshot(aggregateType, aggregateI...
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 checkAndCreateSnapshot AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left aggrega...
private static async checkAndCreateSnapshot( aggregateType: string, aggregateId: number, currentVersion: number, snapshotInterval: number = 10 ): Promise<void> { try { if (currentVersion % snapshotInterval === 0) { await EventSourcingService.createSnapshot(aggregateType, aggregateI...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
44669f39930636b7477a51bceb2c098d8f7a52e3
github
CLMC2025/Vignette
entry/src/main/ets/vocabulary/SnowballSystem.ets
arkts
getBestSnowballContext
获取最佳滚雪球语境
getBestSnowballContext(results: SnowballResult[]): SnowballResult | null { if (results.length === 0) { return null; } // 根据支持词汇数量和关联强度评分 const scored: ScoredResult[] = results.map((result: SnowballResult): ScoredResult => { const score: number = result.supportWords.length * 10 + ...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getBestSnowballContext AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left results AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subs...
getBestSnowballContext(results: SnowballResult[]): SnowballResult | null { if (results.length === 0) { return null; } // 根据支持词汇数量和关联强度评分 const scored: ScoredResult[] = results.map((result: SnowballResult): ScoredResult => { const score: number = result.supportWords.length * 10 + ...
https://github.com/CLMC2025/Vignette
697d2b2fc36e6a6de4c74702bd40fbd9a33adf4c
github
Joker-x-dev/CoolMallArkTS
feature/auth/src/main/ets/viewmodel/RegisterViewModel.ets
arkts
register
注册按钮点击 @returns {void} 无返回值
register(): void { }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left register AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left A...
register(): void { }
https://github.com/Joker-x-dev/CoolMallArkTS
a76072b12d1b90e081fb0334424d031f8c8ea136
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets
arkts
hasClass
检查class属性是否包含指定的class
private hasClass(classAttr: string, className: string): boolean { const classes = classAttr.split(/\s+/); return classes.includes(className); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left hasClass AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left classAttr AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#R...
private hasClass(classAttr: string, className: string): boolean { const classes = classAttr.split(/\s+/); return classes.includes(className); }
https://github.com/DaLongZhuaZi/manxia
768f53da3d46e0468766933e2ab9ca46a769e86a
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelSourceExecutor.ets
arkts
hasRuleVariableToken
==================== 发现页功能 ==================== 获取发现分类列表
private hasRuleVariableToken(template: string, variableName: string): boolean { if (!template || !variableName) { return false; } const escapedVariable = this.escapeRegexLiteral(variableName); const javaGetPattern = new RegExp(`java\\.get\\s*\\(\\s*["']${escapedVariable}["']\\s*\\)`, 'i'); i...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left hasRuleVariableToken AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left template AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string A...
private hasRuleVariableToken(template: string, variableName: string): boolean { if (!template || !variableName) { return false; } const escapedVariable = this.escapeRegexLiteral(variableName); const javaGetPattern = new RegExp(`java\\.get\\s*\\(\\s*["']${escapedVariable}["']\\s*\\)`, 'i'); i...
https://github.com/DaLongZhuaZi/manxia
2468bd61cab1df1dbab843bf2197e297a02a01c9
github
erosTeam/NextE
shared/src/main/ets/constants/EhConstants.ets
arkts
compactNamespace
Full namespace → EH short query prefix (eros_fe `shortName` extension).
static compactNamespace(ns: string): string { const full: string = EhConstants.expandNamespace(ns) if (full === 'artist') { return 'a' } if (full === 'character') { return 'c' } if (full === 'female') { return 'f' } if (full === 'group') { return 'g' } i...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left compactNamespace AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ns AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left s...
static compactNamespace(ns: string): string { const full: string = EhConstants.expandNamespace(ns) if (full === 'artist') { return 'a' } if (full === 'character') { return 'c' } if (full === 'female') { return 'f' } if (full === 'group') { return 'g' } i...
https://github.com/erosTeam/NextE
8c67be932b3cfd386642fc77172f83b6655dcda9
github
openharmony-sig/ohos_video_trimmer
entry/src/main/ets/pages/FileUtils.ets
arkts
writeFile
向path写入content数据,覆盖旧数据
writeFile(path: string, content: ArrayBuffer | string) { try { let fd = fs.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE).fd fs.truncateSync(fd) fs.writeSync(fd, content) fs.fsyncSync(fd) fs.closeSync(fd) } catch (e) { console.log("FileUtils - Failed to writeFi...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left writeFile 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 string AST#identifier#Right AST...
writeFile(path: string, content: ArrayBuffer | string) { try { let fd = fs.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE).fd fs.truncateSync(fd) fs.writeSync(fd, content) fs.fsyncSync(fd) fs.closeSync(fd) } catch (e) { console.log("FileUtils - Failed to writeFi...
https://gitee.com/openharmony-sig/ohos_video_trimmer.git
9347b56c15f9cf065fe7bbdef577bbb3a5c930fd
gitee
2763981847/Clock-Alarm
entry/src/main/ets/view/Detail/dialog/RepeatDialog.ets
arkts
setSelectsByRepeatType
根据重复类型设置选择的重复天数
setSelectsByRepeatType(repeatType: RepeatType) { if (repeatType === RepeatType.NoRepeat) { this.selects = []; } else if (repeatType === RepeatType.Everyday) { this.selects = DetailConstants.WEEKDAY_DATA; } else if (repeatType === RepeatType.DoubleRest) { this.selects = [1, 2, 3, 4, 5]; ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setSelectsByRepeatType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left repeatType AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left RepeatType A...
setSelectsByRepeatType(repeatType: RepeatType) { if (repeatType === RepeatType.NoRepeat) { this.selects = []; } else if (repeatType === RepeatType.Everyday) { this.selects = DetailConstants.WEEKDAY_DATA; } else if (repeatType === RepeatType.DoubleRest) { this.selects = [1, 2, 3, 4, 5]; ...
https://github.com/2763981847/Clock-Alarm
f0b06729a3a70ff84e5b7d7be2c37db9133a3143
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
of
Returns a new array from a set of elements. @param { FixedArray<number> } items - a set of elements to include in the new array object. @returns { Uint8ClampedArray } - a new Uint8ClampedArray @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static of(...items: FixedArray<number>): Uint8ClampedArray { let res = new Uint8ClampedArray(items.length.toInt()) res.ofNumber(stub.toValueArray(items)) return res }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#of#Left of AST#of#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#ERROR...
public static of(...items: FixedArray<number>): Uint8ClampedArray { let res = new Uint8ClampedArray(items.length.toInt()) res.ofNumber(stub.toValueArray(items)) return res }
https://gitcode.com/iop123123/arkts-static-skills
e0b8b03e85c70015fd01a06a09b6c46c9fb89f32
gitcode
cpdd5201314/harmonyOS-music-app
products/phone/src/main/ets/pages/PlaylistManager.ets
arkts
removeFromFavorite
从收藏移除
removeFromFavorite(music: MusicInfo): boolean { const index = this.favoriteList.findIndex(item => item.id === music.id); if (index !== -1) { this.favoriteList.splice(index, 1); this.saveData(); return true; } return false; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left removeFromFavorite AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left music AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left MusicInfo AST#identifier#Right AST#)...
removeFromFavorite(music: MusicInfo): boolean { const index = this.favoriteList.findIndex(item => item.id === music.id); if (index !== -1) { this.favoriteList.splice(index, 1); this.saveData(); return true; } return false; }
https://github.com/cpdd5201314/harmonyOS-music-app
f19103228f915ccb797b0327a0bedfa22001b905
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Diagnostics/StartupRecovery.ets
arkts
getRecoveryStats
获取恢复统计信息
public getRecoveryStats(): RecoveryStats { const recoveryAttemptsRecord: Record<string, number> = {}; this.recoveryAttempts.forEach((value, key) => { recoveryAttemptsRecord[key] = value; }); const stats: RecoveryStats = { recoveryAttempts: recoveryAttemptsRecord, isRecovering: t...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getRecoveryStats 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 Recov...
public getRecoveryStats(): RecoveryStats { const recoveryAttemptsRecord: Record<string, number> = {}; this.recoveryAttempts.forEach((value, key) => { recoveryAttemptsRecord[key] = value; }); const stats: RecoveryStats = { recoveryAttempts: recoveryAttemptsRecord, isRecovering: t...
https://github.com/DaLongZhuaZi/manxia
fa904523a5cc42c87969f877f8f3b9d3e74c3299
github
AGenUI/AGenUI
platforms/harmony/agenui/src/main/ets/agenui/AGenUIContainer.ets
arkts
aboutToDisappear
Called before the component is destroyed Releases resources and tears down the node tree.
aboutToDisappear(): void { hilog.info(0x0000, 'agenui-ets', 'aboutToDisappear A2UI unbindSurface'); internal_a2ui.unbindSurface(this.resolvedInstanceId, this.surfaceId); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToDisappear 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_b...
aboutToDisappear(): void { hilog.info(0x0000, 'agenui-ets', 'aboutToDisappear A2UI unbindSurface'); internal_a2ui.unbindSurface(this.resolvedInstanceId, this.surfaceId); }
https://github.com/AGenUI/AGenUI
4ab6abf3defea489b09f3e44678e91eb6241ee28
github
erosTeam/NextE
shared/src/main/ets/settings/CustomProfilesSettings.ets
arkts
migrateSelected
Map the legacy HOME_SOURCE preference to a built-in uuid (''→default / popular / watched).
private static async migrateSelected(context: common.UIAbilityContext): Promise<string> { const store: preferences.Preferences = await preferences.getPreferences( context, StorageKeys.STORE_SETTINGS, ) const legacy: string = store.getSync(StorageKeys.HOME_SOURCE, '') as string if (legacy =...
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 migrateSelected AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left...
private static async migrateSelected(context: common.UIAbilityContext): Promise<string> { const store: preferences.Preferences = await preferences.getPreferences( context, StorageKeys.STORE_SETTINGS, ) const legacy: string = store.getSync(StorageKeys.HOME_SOURCE, '') as string if (legacy =...
https://github.com/erosTeam/NextE
2458278ec20ec77746b9050c4cd5f2a6c9e63341
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test35_original_index.ets
arkts
testFindIndex
--- Array.findIndex ---
function testFindIndex(): string { let arr: number[] = [10, 20, 30, 40, 50]; let idx: number = arr.findIndex((val: number): boolean => { return val > 25; }); return String(idx); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testFindIndex 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_ty...
function testFindIndex(): string { let arr: number[] = [10, 20, 30, 40, 50]; let idx: number = arr.findIndex((val: number): boolean => { return val > 25; }); return String(idx); }
https://github.com/miaochiahao/ark-ghidra
ddd4dcc62f3adbe7ce4228eaac23b917e052ef3f
github
openharmony/codelabs
Media/AudioPlayer/entry/src/main/ets/controller/AudioPlayerControllerl.ets
arkts
play
Play Audio. @param src Resource path. @param seekTo Playing position.
async play(src: media.AVFileDescriptor, seekTo: number) { Logger.info(TAG, 'audioPlayer play'); if (this.timeId === CommonConstants.DEFAULT_TIME_ID) { clearInterval(this.timeId); } // Enable a long-term task to allow long-term playback in the background. BackgroundTaskUtil.startContinuousTas...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left play AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left src AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS...
async play(src: media.AVFileDescriptor, seekTo: number) { Logger.info(TAG, 'audioPlayer play'); if (this.timeId === CommonConstants.DEFAULT_TIME_ID) { clearInterval(this.timeId); } // Enable a long-term task to allow long-term playback in the background. BackgroundTaskUtil.startContinuousTas...
https://gitee.com/openharmony/codelabs.git
e37ec469037e59b3cfd84fdf6fd0ac078e73a58f
gitee
openharmony/applications_permission_manager
permissionmanager/src/main/ets/GlobalExtAbility/GlobalDialogModel.ets
arkts
microphoneStatus
判断麦克风全局状态 return boolean
private microphoneStatus(): boolean { try { let audioManager = audio.getAudioManager(); let audioVolumeManager = audioManager.getVolumeManager(); let groupId = audio.DEFAULT_VOLUME_GROUP_ID; let audioVolumeGroupManager = audioVolumeManager.getVolumeGroupManagerSync(groupId); let mute...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left microphoneStatus 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 boole...
private microphoneStatus(): boolean { try { let audioManager = audio.getAudioManager(); let audioVolumeManager = audioManager.getVolumeManager(); let groupId = audio.DEFAULT_VOLUME_GROUP_ID; let audioVolumeGroupManager = audioVolumeManager.getVolumeGroupManagerSync(groupId); let mute...
https://gitee.com/openharmony/applications_permission_manager.git
852c44373e63b15962d2b1056fef11e1d28dd5bf
gitee
TDCQCX/ShiHuaMusic-Harmony
entry/src/main/ets/components/BottomNavigation.ets
arkts
aboutToAppear
监听页面变化
aboutToAppear(): void { // 获取当前路由 try { const state = router.getState(); const currentPath = state.path || ''; // 根据当前页面设置激活状态 if (currentPath.includes('/pages/Index/IndexPage')) { this.currentIndex = 0; } else if (currentPath.includes('/pages/Library/LibraryPage')...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc...
aboutToAppear(): void { // 获取当前路由 try { const state = router.getState(); const currentPath = state.path || ''; // 根据当前页面设置激活状态 if (currentPath.includes('/pages/Index/IndexPage')) { this.currentIndex = 0; } else if (currentPath.includes('/pages/Library/LibraryPage')...
https://github.com/TDCQCX/ShiHuaMusic-Harmony
24784ab918fcb9d46086f5acbd46ad97f7ec9fa3
github
aimilin6688/KeePassHO
entry/src/main/ets/components/loading/LoadingDialogUtils.ets
arkts
showError
显示 failure hud @param value 可不传
async showError(value: ResourceStr | LoadingSettings = ''): Promise<void> { await this.showDialog(new LoadingActionOptions(LoadingState.ERROR, value)) this.hideDialogDelay(LoadingState.ERROR, value) }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left showError AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left value AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#...
async showError(value: ResourceStr | LoadingSettings = ''): Promise<void> { await this.showDialog(new LoadingActionOptions(LoadingState.ERROR, value)) this.hideDialogDelay(LoadingState.ERROR, value) }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/components/loading/LoadingDialogUtils.ets#L65-L68
65e1faace6c33732e216a3119f0000839d00fcb7
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.LightWeightMap.ets
arkts
setAll
Sets all entries from another LightWeightMap into this LightWeightMap @param map the LightWeightMap to copy entries from
setAll(map: LightWeightMap<K, V>): void { map.forEach((value: V, key: K) => { this.set(key, value); }); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left map AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identifier#Left LightWeightMap A...
setAll(map: LightWeightMap<K, V>): void { map.forEach((value: V, key: K) => { this.set(key, value); }); }
https://gitcode.com/iop123123/arkts-static-skills
9323914acfd0904262620da1cbc9d9620b897a76
gitcode
CLMC2025/Vignette
entry/src/main/ets/context/ContextValidator.ets
arkts
validateTargetWordOccurrences
验证目标词汇出现次数
private validateTargetWordOccurrences( context: string, targetWord: string, minTargetOccurrences: number, maxTargetOccurrences: number, result: ValidationResult ): void { const count = this.countTargetWordOccurrences(context, targetWord); if (count <= 0) { result.addIssue(new Vali...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left validateTargetWordOccurrences AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left context AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left ...
private validateTargetWordOccurrences( context: string, targetWord: string, minTargetOccurrences: number, maxTargetOccurrences: number, result: ValidationResult ): void { const count = this.countTargetWordOccurrences(context, targetWord); if (count <= 0) { result.addIssue(new Vali...
https://github.com/CLMC2025/Vignette
df5148575cd5e812fcd372235ff894326300e057
github
Dabing-0x19d/berverage_HarmonyOS6.0
entry/src/main/ets/model/LoginStateManager.ets
arkts
getLoginState
获取当前登录状态
getLoginState(): LoginState { const state: LoginState = { isLoggedIn: this.loginState.isLoggedIn, unionId: this.loginState.unionId, openId: this.loginState.openId, nickName: this.loginState.nickName, avatarUrl: this.loginState.avatarUrl, phoneNumber: this.loginState.phoneNumber...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getLoginState 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 LoginState AST#identifier#Right AST#ERROR#Right ...
getLoginState(): LoginState { const state: LoginState = { isLoggedIn: this.loginState.isLoggedIn, unionId: this.loginState.unionId, openId: this.loginState.openId, nickName: this.loginState.nickName, avatarUrl: this.loginState.avatarUrl, phoneNumber: this.loginState.phoneNumber...
https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0
08148e93b75a549f4497c18e1de10e082f4635a2
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Diagnostics/StartupRecovery.ets
arkts
classifyFailure
分类启动失败类型
private classifyFailure(error: Error, failurePhase: string): StartupFailureType { const errorMessage = error.message.toLowerCase(); if (errorMessage.includes('globalcontext') || failurePhase.includes('GLOBAL_CONTEXT')) { return StartupFailureType.GLOBAL_CONTEXT_FAILURE; } if (errorMess...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left classifyFailure AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left error AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
private classifyFailure(error: Error, failurePhase: string): StartupFailureType { const errorMessage = error.message.toLowerCase(); if (errorMessage.includes('globalcontext') || failurePhase.includes('GLOBAL_CONTEXT')) { return StartupFailureType.GLOBAL_CONTEXT_FAILURE; } if (errorMess...
https://github.com/DaLongZhuaZi/manxia
8826880f9b3a77855c490b86f487e9b00bf5f6e1
github
openharmony/applications_dlp_manager
entry/src/main/ets/OpenDlpFile/manager/OpeningDialogManager.ets
arkts
getCanShowToast
判断是否需要show toast,这次不需要就等timeout的回调
public getCanShowToast(): boolean { this.printAllDecryptingMap(); const requestId = this.getDecryptingRequestIdByToast(); if (!requestId) { HiLog.error(TAG, 'no getDecryptingRequestIdByToast'); return true; } const decryptingState = this._decryptingMap.get(requestId); const dialogT...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCanShowToast 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 A...
public getCanShowToast(): boolean { this.printAllDecryptingMap(); const requestId = this.getDecryptingRequestIdByToast(); if (!requestId) { HiLog.error(TAG, 'no getDecryptingRequestIdByToast'); return true; } const decryptingState = this._decryptingMap.get(requestId); const dialogT...
https://gitee.com/openharmony/applications_dlp_manager.git
38544219a8f1cf73a69026d6b6959660f0789aa8
gitee
aimilin6688/KeePassHO
entry/src/main/ets/common/utils/CommonUtils.ets
arkts
showDeleteConfirm
确认删除弹框 @param context 上下文 @param cancel 取消回调 @param confirm 确定回调
public static showDeleteConfirm(context: UIContext, callback?: ConfirmCallback): void { CommonUtils.showConfirmDialog(context, $r('app.string.dialog_confirm_title'), $r('app.string.dialog_delete_confirm_message'), callback); }
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 showDeleteConfirm AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Le...
public static showDeleteConfirm(context: UIContext, callback?: ConfirmCallback): void { CommonUtils.showConfirmDialog(context, $r('app.string.dialog_confirm_title'), $r('app.string.dialog_delete_confirm_message'), callback); }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/CommonUtils.ets#L220-L222
c5f79a8b87f586e3cc835779c6366896bb37ee91
github
qiuhaotc/Sunshine_HarmonyOS
entry/src/main/ets/calculator/SimpleSunshineCalculator.ets
arkts
validateSunshineResult
验证日照结果是否符合标准 @param result 日照结果 @returns 是否符合标准
validateSunshineResult(result: HouseSunshineModel): boolean { // 房屋日照时间在大寒大于2小时,冬至大于1小时 return result.greatCold >= 120 && result.winterSolstice >= 60; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left validateSunshineResult AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left result AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left HouseSunshineModel AST#identifi...
validateSunshineResult(result: HouseSunshineModel): boolean { // 房屋日照时间在大寒大于2小时,冬至大于1小时 return result.greatCold >= 120 && result.winterSolstice >= 60; }
https://github.com/qiuhaotc/Sunshine_HarmonyOS
87cf2e45f74bcaffef3de185a3b6e0c15d4ec076
github
openharmony-sig/ohos_react_native
tester/harmony/react_native_openharmony/src/main/ets/RNOH/RNAbility.ets
arkts
onPrepareRNInstance
Override this method if you want to create an RNInstance, and load bundle here, rather than in an ArkUI component. RNAbility waits for the completion of this method before loading the content. This approach reduces a flash that can occur after a splash screen is hidden, and a RN application is ready.
protected async onPrepareRNInstance(rnohCoreContext: RNOHCoreContext) { }
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left onPrepareRNInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left rnohCoreContext AST#identif...
protected async onPrepareRNInstance(rnohCoreContext: RNOHCoreContext) { }
https://gitee.com/openharmony-sig/ohos_react_native.git
58e0b03ffa9341047d8feaf77a54fa7fdb37bf1f
gitee
apap6628114/nga_oh
entry/src/main/ets/store/BaseStore.ets
arkts
reset
子类 reset 完成后应调用 super.reset() 触发 generation++
reset(): void { this.generation++ }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left reset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left A...
reset(): void { this.generation++ }
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/store/BaseStore.ets#L47-L49
11d90fcc71483356e4f32f6e2e45cabd3292ea62
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.uri.ets
arkts
encodedUserInfo
Gets Obtains the encoded user information part of the URI. @returns { string | null }
get encodedUserInfo(): string | null { let s: string = this.uriEntry.getUserinfo(); return s == '' ? null : s; }
AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left encodedUserInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_stat...
get encodedUserInfo(): string | null { let s: string = this.uriEntry.getUserinfo(); return s == '' ? null : s; }
https://gitcode.com/iop123123/arkts-static-skills
e5bd6f407262009c1b56b4a4843db4b50e1a9b4c
gitcode
TDCQCX/ShiHuaMusic-Harmony
entry/src/main/ets/utils/HttpUtil.ets
arkts
delete
DELETE请求 @param url 请求URL
static async delete<T>(url: string): Promise<ApiResponse<T>> { return HttpUtil.request<T>({ url, method: 'DELETE' }); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#delete#Left delete AST#delete#Right AST#type_parameters#Left AST#<#Left < AST#<#Right AST#type_parameter#Left AST#type_identifier#Left T AST#type_identifier#Right AST#type_parameter#Right AST#>#Lef...
static async delete<T>(url: string): Promise<ApiResponse<T>> { return HttpUtil.request<T>({ url, method: 'DELETE' }); }
https://github.com/TDCQCX/ShiHuaMusic-Harmony
599ef7d7885835bbe4c48e294d391845640b8100
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/GameControllerService.ets
arkts
setAxisCallback
设置轴事件回调
setAxisCallback(callback: AxisCallback | null): void { this.axisCallback = callback; if (native) { native.setAxisCallback(callback); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setAxisCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#identifier#Left AxisCallb...
setAxisCallback(callback: AxisCallback | null): void { this.axisCallback = callback; if (native) { native.setAxisCallback(callback); } }
https://github.com/AlkaidLab/moonlight-harmony
466cb3c7695dee7f06866c7595d2c8958ea5f868
github
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/hosts/app/tabs/classes/meowTabInfo.ets
arkts
aboutToBeReceived
Called be the receipient window's meowTabsBunch. Includes some final stage preparations, before this.myUi is changed.
aboutToBeReceived() { clearTimeout(this.saveHistoryTimeoutId); clearTimeout(this.wsBackupReqTmId); this.deleteWebState(); // ↓ Modified from closeTab() in meowTabsBunch. if (this.isActive) { this.node?.detachWeb(); this.node?.rebuild(); } if (this == this.myUi.myTabs.current...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToBeReceived 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#...
aboutToBeReceived() { clearTimeout(this.saveHistoryTimeoutId); clearTimeout(this.wsBackupReqTmId); this.deleteWebState(); // ↓ Modified from closeTab() in meowTabsBunch. if (this.isActive) { this.node?.detachWeb(); this.node?.rebuild(); } if (this == this.myUi.myTabs.current...
https://github.com/awaLiny2333/LinysBrowser_NEXT
d85e4c0773928cd02a6356b5fab18064b035276e
github
azhu0001/localsend-harmony
serve/src/main/ets/http/ContentType.ets
arkts
tryUTF8
如果不存在编码,默认设置为charset=UTF-8。 @return this
public tryUTF8(): ContentType { if (!this.encoding) { return new ContentType(`${this.contentTypeHeader}; charset=UTF-8`); } return this; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left tryUTF8 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 ContentType AS...
public tryUTF8(): ContentType { if (!this.encoding) { return new ContentType(`${this.contentTypeHeader}; charset=UTF-8`); } return this; }
https://gitcode.com/azhu0001/localsend-harmony
400ec2a52f8124b5b8f432a96c15c1de8d90989e
gitcode
CLMC2025/Vignette
entry/src/main/ets/manager/PromptTemplateManager.ets
arkts
cleanup
清理过期数据
cleanup(): void { const now: number = Date.now(); const MAX_HISTORY_AGE: number = 30 * 24 * 60 * 60 * 1000; // 30天 // 清理旧的A/B测试分组 const keys: string[] = Array.from(this.abTestGroups.keys()); for (let i: number = 0; i < keys.length; i++) { const key: string = keys[i]; const parts: stri...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left cleanup AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left...
cleanup(): void { const now: number = Date.now(); const MAX_HISTORY_AGE: number = 30 * 24 * 60 * 60 * 1000; // 30天 // 清理旧的A/B测试分组 const keys: string[] = Array.from(this.abTestGroups.keys()); for (let i: number = 0; i < keys.length; i++) { const key: string = keys[i]; const parts: stri...
https://github.com/CLMC2025/Vignette
4ef9628a691f47d123396e6c8db44a964431cadf
github
OHPG/FinSdk
jellyfin/src/main/ets/api/SessionApi.ets
arkts
getSessions
getSessions @summary Gets a list of sessions. @param {SessionApiGetSessionsRequest} requestParameters Request parameters. @throws {RequiredError} @memberof SessionApi
public async getSessions(requestParameters: SessionApiGetSessionsRequest = {}): Promise<Array<SessionInfo>> { return this.apiClient.get({path: "/Sessions", 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 getSessions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right AST#:...
public async getSessions(requestParameters: SessionApiGetSessionsRequest = {}): Promise<Array<SessionInfo>> { return this.apiClient.get({path: "/Sessions", parameters: requestParameters}) }
https://github.com/OHPG/FinSdk
fd05b10c2fb1b136691d166c20fae669a220228a
github
openharmony-sig/flutter_engine
shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/FlutterEngineCache.ets
arkts
get
返回engineId对应的FlutterEngine
get(engineId: String) : FlutterEngine | null { return this.cachedEngines.get(engineId) || null; }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left get AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left engineId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left String AST#identifier#...
get(engineId: String) : FlutterEngine | null { return this.cachedEngines.get(engineId) || null; }
https://gitee.com/openharmony-sig/flutter_engine.git
2eb5adaa4b764f3d9c974cc1cac181c11bb273e3
gitee
YANGZX22/Voot
entry/src/main/ets/pages/WelcomePage.ets
arkts
onPageShow
地区名称获取方法已移除 private getRegionName(): string { ... }
onPageShow() { // 手机号认证页已移除,不需要此逻辑 }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onPageShow 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 AS...
onPageShow() { // 手机号认证页已移除,不需要此逻辑 }
https://github.com/YANGZX22/Voot
8bdef8e32ac295eee41aedb5ad84a83c64eb830d
github
LZZLHY/hlib
entry/src/main/ets/viewmodel/SpeedTestVM.ets
arkts
fastest
取最佳域名。无可用结果时返回 null。
static fastest(): DomainTestResult | null { const list: DomainTestResult[] = SpeedTestVM.getResults(); for (let i = 0; i < list.length; i++) { const ms: number | null = list[i].latencyMs; if (ms !== null && ms > 0) { return list[i]; } } return null; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left fastest 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#binary_expression#Left AST#ide...
static fastest(): DomainTestResult | null { const list: DomainTestResult[] = SpeedTestVM.getResults(); for (let i = 0; i < list.length; i++) { const ms: number | null = list[i].latencyMs; if (ms !== null && ms > 0) { return list[i]; } } return null; }
https://github.com/LZZLHY/hlib
8bd7fcf6485e4c904d2130b71f35f5b80c55fae2
github
DaLongZhuaZi/manxia
entry/src/main/ets/pages/MainMenuPage.ets
arkts
navigateToSuwayomi
根据配置导航到 Suwayomi 页面
private async navigateToSuwayomi(): Promise<void> { const tracker = getSuwayomiTracker(); await tracker.initialize(); const config = tracker.getConfig(); if (config.useBrowsePageAsEntry && config.serverUrl) { this.pathStack.pushPathByName('SuwayomiBrowsePage', null); } else { this.path...
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 navigateToSuwayomi AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ...
private async navigateToSuwayomi(): Promise<void> { const tracker = getSuwayomiTracker(); await tracker.initialize(); const config = tracker.getConfig(); if (config.useBrowsePageAsEntry && config.serverUrl) { this.pathStack.pushPathByName('SuwayomiBrowsePage', null); } else { this.path...
https://github.com/DaLongZhuaZi/manxia
7cd362a92c71462830a0a887abf917324c5b1f44
github
openharmony/codelabs
Media/ImageEdit/entry/src/main/ets/viewModel/CropShow.ets
arkts
fixRightBottomInFixedMode
In fixed mode, fix right bottom conner. @param offsetHypot @param isEnlarge
private fixRightBottomInFixedMode(offsetHypot: number, isEnlarge: boolean) { let crop = this.getCropRect(); let rate = this.ratio.getRate(); let rect = new RectF(); if (isEnlarge) { let limit = this.limitRect; let size = MathUtils.getMaxFixedRectSize(rate, limit.right - crop.left, limit.bo...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left fixRightBottomInFixedMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left offsetHypot AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left ...
private fixRightBottomInFixedMode(offsetHypot: number, isEnlarge: boolean) { let crop = this.getCropRect(); let rate = this.ratio.getRate(); let rect = new RectF(); if (isEnlarge) { let limit = this.limitRect; let size = MathUtils.getMaxFixedRectSize(rate, limit.right - crop.left, limit.bo...
https://gitee.com/openharmony/codelabs.git
aa5a3642f97fb47d6089f8bb9e169467dd3bf830
gitee
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.uri.ets
arkts
encodedPath
Gets the encoded path portion of the URI . @returns { string | null }
get encodedPath(): string | null { let s: string = this.uriEntry.getPath(); return s == '' ? null : s; }
AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left encodedPath 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_statemen...
get encodedPath(): string | null { let s: string = this.uriEntry.getPath(); return s == '' ? null : s; }
https://gitcode.com/iop123123/arkts-static-skills
317ab8ddb2742558c29239320b7544e23ff2a2f3
gitcode
aimilin6688/KeePassHO
entry/src/main/ets/storage/onedrive/OneDriveStorage.ets
arkts
updateConfig
更新存储配置 @param config OneDrive存储配置
public updateConfig(config: OneDriveStorageConfig): void { this.config = config; this.init(config); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left updateConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left O...
public updateConfig(config: OneDriveStorageConfig): void { this.config = config; this.init(config); }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/onedrive/OneDriveStorage.ets#L327-L330
5c65e9d5b83dcead603878f3d4530f29a86c7df6
github
AetheriumSimulator/qemu-hmos
entry/src/main/ets/utils/BreakpointSystem.ets
arkts
calculateBreakpointInfo
计算完整的断点信息
static calculateBreakpointInfo(windowWidth: number, windowHeight: number): BreakpointInfo { const breakpoint = BreakpointSystem.getBreakpoint(windowWidth) const layoutMode = BreakpointSystem.getLayoutMode(breakpoint) const isPortrait = windowHeight > windowWidth const isCompact = breakpoint === 'xs' |...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left calculateBreakpointInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left windowWidth AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left numbe...
static calculateBreakpointInfo(windowWidth: number, windowHeight: number): BreakpointInfo { const breakpoint = BreakpointSystem.getBreakpoint(windowWidth) const layoutMode = BreakpointSystem.getLayoutMode(breakpoint) const isPortrait = windowHeight > windowWidth const isCompact = breakpoint === 'xs' |...
https://github.com/AetheriumSimulator/qemu-hmos
448e8de39f19e2740bafd43f669778c823696485
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Loaders/MangaDetailLoader.ets
arkts
isLocalSourceId
判断是否为本地图源ID
private isLocalSourceId(sourceId: string): boolean { return sourceId === 'local_import' || sourceId === 'local_pdf' || sourceId === 'download_import' || sourceId === '0' || sourceId === ''; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left isLocalSourceId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#st...
private isLocalSourceId(sourceId: string): boolean { return sourceId === 'local_import' || sourceId === 'local_pdf' || sourceId === 'download_import' || sourceId === '0' || sourceId === ''; }
https://github.com/DaLongZhuaZi/manxia
4fafbd037305fa691970b4292a676557bfaba704
github
openharmony/update_update_app
feature/ota/src/main/ets/notify/NotificationHelper.ets
arkts
showUpgradeSuccess
弹安装成功通知 @param context 实上下文
async showUpgradeSuccess(versionName: string, context: common.Context): Promise<void> { let request = { content: { contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, normal: { title: await context.resourceManager.getString($r('app.string.install_success_message'...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left showUpgradeSuccess AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left versionName AST#identifier#Right AST#type_annotatio...
async showUpgradeSuccess(versionName: string, context: common.Context): Promise<void> { let request = { content: { contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT, normal: { title: await context.resourceManager.getString($r('app.string.install_success_message'...
https://gitee.com/openharmony/update_update_app.git
3b09a77a062906b9ffed097678d92a500ad7efbb
gitee
openharmony/codelabs
Data/DeviceHealth/entry/src/main/ets/manager/PreferenceManager.ets
arkts
saveValue
保存单个配置项(类型安全版) @param key 配置项键名 @param value 配置项值(明确的联合类型)
public async saveValue(key: string, value: SettingValue): Promise<void> { if (!this.dataPreferences) { console.error('[PreferenceManager] Preferences 未初始化'); return; } try { /** * 使用 preferences.ValueType 确保类型正确 * ValueType = number | string | boolean | Array<number> | Arr...
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 saveValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Ri...
public async saveValue(key: string, value: SettingValue): Promise<void> { if (!this.dataPreferences) { console.error('[PreferenceManager] Preferences 未初始化'); return; } try { /** * 使用 preferences.ValueType 确保类型正确 * ValueType = number | string | boolean | Array<number> | Arr...
https://gitcode.com/openharmony/codelabs
77cb4fe061d8c1f21c41cad327ebbaf83e06f2c4
gitcode
offlinecat-dev/OCNetORM
src/main/ets/query/PaginatedResult.ets
arkts
createEmpty
创建空的分页结果 @param page 当前页码 @param pageSize 每页数量 @returns 空的 PaginatedResult 实例
static createEmpty(page: number = 1, pageSize: number = 20): PaginatedResult { return new PaginatedResult([], 0, page, pageSize) }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createEmpty AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left page AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expressio...
static createEmpty(page: number = 1, pageSize: number = 20): PaginatedResult { return new PaginatedResult([], 0, page, pageSize) }
https://github.com/offlinecat-dev/OCNetORM
118c9471d64ce165c2b1598756820a47ac9c4763
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/WebViewSourceManager.ets
arkts
initializeSource
初始化源配置
initializeSource(sourceRecord: ComicSourceDatabaseRecord): void { try { logger.info(TAG, `初始化源配置: ${sourceRecord.name} (${sourceRecord.id})`); // 创建源配置 const config = WebViewConfigFactory.createFromDatabaseRecord(sourceRecord); this.sourceConfigs.set(sourceRecord.id, config); ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left initializeSource AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left sourceRecord AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ComicSourceDatabaseRecord AST#i...
initializeSource(sourceRecord: ComicSourceDatabaseRecord): void { try { logger.info(TAG, `初始化源配置: ${sourceRecord.name} (${sourceRecord.id})`); // 创建源配置 const config = WebViewConfigFactory.createFromDatabaseRecord(sourceRecord); this.sourceConfigs.set(sourceRecord.id, config); ...
https://github.com/DaLongZhuaZi/manxia
ee9396125d13167e97a01190f809c7c85b6a6cf9
github
Nekofox-POT/LinMusic
entry/src/main/ets/package/files_manager/download_manager.ets
arkts
load_data
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 初始化 // //////// 载入数据 //
load_data() { // 载入数据 // // 载入元数据缓存 this.meta_cache = load_map_cust_a(download_manager_path + 'meta_cache.json') // 载入 所有歌曲 for (const i of load_array(download_manager_path + 'all_songs.json')) { // 检查有效性 try { fs.openSync(i) this.all_songs_list.push(i) } catch {...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left load_data 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...
load_data() { // 载入数据 // // 载入元数据缓存 this.meta_cache = load_map_cust_a(download_manager_path + 'meta_cache.json') // 载入 所有歌曲 for (const i of load_array(download_manager_path + 'all_songs.json')) { // 检查有效性 try { fs.openSync(i) this.all_songs_list.push(i) } catch {...
https://github.com/Nekofox-POT/LinMusic
7bdfff8d50e347ada1da22c17af3f95fbfc2b311
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/model/EventSourcing.ets
arkts
createEmptyStats
创建空的事件存储统计
static createEmptyStats(): EventStoreStats { const result: EventStoreStats = { totalEvents: 0, eventsByType: [], eventsByAggregate: [], eventsToday: 0, eventsThisWeek: 0, eventsThisMonth: 0, averageEventsPerDay: 0, oldestEventDate: '', newestEventDate: '' ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createEmptyStats 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 Event...
static createEmptyStats(): EventStoreStats { const result: EventStoreStats = { totalEvents: 0, eventsByType: [], eventsByAggregate: [], eventsToday: 0, eventsThisWeek: 0, eventsThisMonth: 0, averageEventsPerDay: 0, oldestEventDate: '', newestEventDate: '' ...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
88e75a5dd2e973b5e798570be4df8d7d517e59c4
github
HarmonyOS_Samples/BestPracticeSnippets
WaterFlowSample/entry/src/main/ets/pages/DataUpdateAndAnimationPage.ets
arkts
refresh
5、Pull down to refresh the data update logic.
refresh(): void { this.currentItem = -1; setTimeout(() => { // Add new data. this.dataSource.dataArray = []; let value: number = Math.floor(Math.random() * 100); for (let i: number = 0; i < 100; i++) { this.dataSource.dataArray.push(i + value); this.dataSource.notifyDat...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left refresh AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left...
refresh(): void { this.currentItem = -1; setTimeout(() => { // Add new data. this.dataSource.dataArray = []; let value: number = Math.floor(Math.random() * 100); for (let i: number = 0; i < 100; i++) { this.dataSource.dataArray.push(i + value); this.dataSource.notifyDat...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
88ab9265f9bf5028d14e5e82a93ddb2b445ae59d
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/viewmodel/ComputerViewModel.ets
arkts
updateComputerList
更新电脑列表
private updateComputerList(infos: ComputerInfo[]): void { // 更新现有项或添加新项 const existingUuids = new Set(this.computers.map(c => c.uuid)); const newUuids = new Set(infos.map(i => i.uuid)); // 更新现有电脑 for (const computer of this.computers) { const info = infos.find(i => i.uuid === computer.uuid)...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left updateComputerList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left infos AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript...
private updateComputerList(infos: ComputerInfo[]): void { // 更新现有项或添加新项 const existingUuids = new Set(this.computers.map(c => c.uuid)); const newUuids = new Set(infos.map(i => i.uuid)); // 更新现有电脑 for (const computer of this.computers) { const info = infos.find(i => i.uuid === computer.uuid)...
https://github.com/AlkaidLab/moonlight-harmony
560f02617206ee525219fcabe980c013b7e7197d
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Storage/SandboxManager.ets
arkts
cleanupDirectoryByAge
按年龄清理目录
private async cleanupDirectoryByAge(path: string, maxAge: number): Promise<void> { try { if (!await this.exists(path)) { return; } const files = await this.listDirectory(path); for (const file of files) { const filePath = `${path}/${file}`; const stat = awai...
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 cleanupDirectoryByAge AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:...
private async cleanupDirectoryByAge(path: string, maxAge: number): Promise<void> { try { if (!await this.exists(path)) { return; } const files = await this.listDirectory(path); for (const file of files) { const filePath = `${path}/${file}`; const stat = awai...
https://github.com/DaLongZhuaZi/manxia
46c383163fff62bb86aa9a311322c5ade2b6ba97
github
Joker-x-dev/CoolMallArkTS
core/data/src/main/ets/repository/CustomerServiceRepository.ets
arkts
getSessionDetail
获取会话详情 @returns 会话详情
async getSessionDetail(): Promise<NetworkResponse<CsSession>> { return this.networkDataSource.getSessionDetail(); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getSessionDetail 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#gen...
async getSessionDetail(): Promise<NetworkResponse<CsSession>> { return this.networkDataSource.getSessionDetail(); }
https://github.com/Joker-x-dev/CoolMallArkTS
bfb645093dd11891bedae01ed54e44d62f156446
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/database/CacheManager.ets
arkts
cleanExpired
清理过期缓存 @returns 清理的缓存数量 建议:定期调用此方法清理过期缓存,释放内存
static cleanExpired(): number { const now = Date.now(); let count = 0; const keysToDelete: string[] = []; CacheManager.cache.forEach((entry: CacheEntry<Object>, key: string) => { if (now > entry.expireAt) { keysToDelete.push(key); } }); keysToDelete.forEach(key => { ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left cleanExpired AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#nu...
static cleanExpired(): number { const now = Date.now(); let count = 0; const keysToDelete: string[] = []; CacheManager.cache.forEach((entry: CacheEntry<Object>, key: string) => { if (now > entry.expireAt) { keysToDelete.push(key); } }); keysToDelete.forEach(key => { ...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
ff2d42da2eb526f118c67adfbcefe4baa0a8d228
github
Joker-x-dev/CoolMallArkTS
core/ui/src/main/ets/component/icon/ArrowLeftIcon.ets
arkts
build
构建左箭头图标 @returns {void} 无返回值
build(): void { CommonIcon({ icon: $r("app.media.ic_left"), iconSize: this.iconSize, tintColor: this.tintColor, onTap: this.onTap }); }
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#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#...
build(): void { CommonIcon({ icon: $r("app.media.ic_left"), iconSize: this.iconSize, tintColor: this.tintColor, onTap: this.onTap }); }
https://github.com/Joker-x-dev/CoolMallArkTS
dedf5d60b97f6849bb3de6760efda2e7eeaeeb8b
github
AGenUI/AGenUI
platforms/harmony/agenui/src/main/ets/agenui/AGenEngineUI.ets
arkts
receiveTextChunk
Receives an A2UI protocol chunk
public receiveTextChunk(dataString: string): void { this._surfaceBridge.receiveTextChunk(dataString); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left receiveTextChunk AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left dataString AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#st...
public receiveTextChunk(dataString: string): void { this._surfaceBridge.receiveTextChunk(dataString); }
https://github.com/AGenUI/AGenUI
f28b294c1cda5a26d766c0bbffab0ef0b80fc030
github
HarmonyOS_Samples/BestPracticeSnippets
LoadPerformanceInWeb/entry/src/main/ets/pages/ByteCodeCache.ets
arkts
build
[End about_to_appear]
build() { Column() { // [Start byte_code_cache_web] Web({ src: $rawfile('index.html'), controller: this.webController }) .fileAccess(true) .javaScriptAccess(true) .width('100%') .height('100%') .onConsole((event) => { hilog.info(D...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#object#Left AST#{#Left { AST#{#Right AST#method_def...
build() { Column() { // [Start byte_code_cache_web] Web({ src: $rawfile('index.html'), controller: this.webController }) .fileAccess(true) .javaScriptAccess(true) .width('100%') .height('100%') .onConsole((event) => { hilog.info(D...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
f38917e963413081a500f887ddd73a5a56ff52a4
gitcode
OMGCA/sakipay
sakipay_hmos/main/src/main/ets/models/EarningsCalculator.ets
arkts
isCrossMidnight
True when the work day crosses midnight (e.g. 22:00–06:00).
public get isCrossMidnight(): boolean { return this.workEndMinutes <= this.workStartMinutes }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left get AST#identifier#Right AST#call_expression#Left AST#identifier#Left isCrossMidnight AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#...
public get isCrossMidnight(): boolean { return this.workEndMinutes <= this.workStartMinutes }
https://github.com/OMGCA/sakipay
bdfd1edbe94046c14e058d41369dac5dc4b5fdf6
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/NotificationManager.ets
arkts
requestPermission
请求通知权限 应在应用首次启动时调用
public async requestPermission(context: common.UIAbilityContext): Promise<boolean> { try { // 先检查是否已有权限 const hasPermission = await this.checkPermission(); if (hasPermission) { logger.info(TAG, '已有通知权限,无需请求'); return true; } // 请求通知权限 logger.info(TAG, '请求通知权限')...
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 requestPermission AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Lef...
public async requestPermission(context: common.UIAbilityContext): Promise<boolean> { try { // 先检查是否已有权限 const hasPermission = await this.checkPermission(); if (hasPermission) { logger.info(TAG, '已有通知权限,无需请求'); return true; } // 请求通知权限 logger.info(TAG, '请求通知权限')...
https://github.com/DaLongZhuaZi/manxia
af848d91be78811c6039132eb32b2038fb1aad4d
github
DaLongZhuaZi/manxia
entry/src/main/ets/components/BookTransitionOverlay.ets
arkts
onCancelComplete
取消动画渐隐完成
public onCancelComplete(): void { logger.info(TAG, '取消动画渐隐完成'); this.isCancelling = false; this.clearOpenReadyHideTimer(); this.currentState = new GlobalTransitionState(); if (this.onCancelCallback) { this.onCancelCallback(); this.onCancelCallback = null; } this.notif...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left onCancelComplete 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#expre...
public onCancelComplete(): void { logger.info(TAG, '取消动画渐隐完成'); this.isCancelling = false; this.clearOpenReadyHideTimer(); this.currentState = new GlobalTransitionState(); if (this.onCancelCallback) { this.onCancelCallback(); this.onCancelCallback = null; } this.notif...
https://github.com/DaLongZhuaZi/manxia
46f63e58ba3b2214222825380689322988bd4791
github
openharmony/applications_app_samples
code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example1/DataType.ets
arkts
notifyDataMove
通知LazyForEach组件将from索引和to索引处的子组件进行交换 @param {number} from - 起始值。 @param {number} to - 终点值。
notifyDataMove(from: double, to: double): void { this.listeners.forEach(listener => { listener.onDataMove(from, to); }) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left notifyDataMove AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left from AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left double AST#identifier#Right AST#,#Left , ...
notifyDataMove(from: double, to: double): void { this.listeners.forEach(listener => { listener.onDataMove(from, to); }) }
https://github.com/openharmony/applications_app_samples
6de20a5ffb72c9c7065682278c911b76dc54cf5a
github
LJ666-ui/harmony-health-care
entry/src/main/ets/aiagent/EnhancedRAGRetriever.ets
arkts
addDocument
添加知识文档
async addDocument(document: KnowledgeDocument): Promise<void> { // 添加到向量数据库 await this.vectorDBClient.insert(document); // 添加到混合检索器 await this.hybridRetriever.addDocument(document.id, document.content); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left addDocument AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left document AST#identifier#Right AST#type_annotation#Left AST#:#Left :...
async addDocument(document: KnowledgeDocument): Promise<void> { // 添加到向量数据库 await this.vectorDBClient.insert(document); // 添加到混合检索器 await this.hybridRetriever.addDocument(document.id, document.content); }
https://github.com/LJ666-ui/harmony-health-care
285e610f4e305e245d43fe61eadd2c499254ea80
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Map.ets
arkts
getKeyByIdx
Replace with reciver (like getBucketsIdxLength) here and later after issue 31223
function getKeyByIdx<K>(data: DataArrType, idx: int): K { return data[idx + Const.KEY_DATA_OFS] as K }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getKeyByIdx AST#identifier#Right AST#type_parameters#Left AST#<#Left < AST#<#Right AST#type_parameter#Left AST#type_identifier#Left K AST#type_identifier#Right AST#type_parameter#Right AST#>#Left > AST#>#Rig...
function getKeyByIdx<K>(data: DataArrType, idx: int): K { return data[idx + Const.KEY_DATA_OFS] as K }
https://gitcode.com/iop123123/arkts-static-skills
68d95224c0e62b2c6095df6fe9d1ca35308c4cc5
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Loaders/MangaDetailLoader.ets
arkts
loadMangaDetailWithProgress
分阶段加载漫画详情(支持回调) 先返回基本信息,然后异步加载章节和页面
public async loadMangaDetailWithProgress( params: MangaDetailLoadParams, callback: MangaLoadProgressCallback ): Promise<MangaDetailLoadResult> { const result: MangaDetailLoadResult = { success: false, manga: null, chapters: [], isFavorite: false, isLocalManga: false, ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left loadMangaDetailWithProgress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left params AST#identifier#Right ...
public async loadMangaDetailWithProgress( params: MangaDetailLoadParams, callback: MangaLoadProgressCallback ): Promise<MangaDetailLoadResult> { const result: MangaDetailLoadResult = { success: false, manga: null, chapters: [], isFavorite: false, isLocalManga: false, ...
https://github.com/DaLongZhuaZi/manxia
aad26f97539c35e19bd2efa34646e5da73c732ea
github
erosTeam/NextE
shared/src/main/ets/network/EhApiPhpService.ets
arkts
tagSuggest
Search matching EH tags for the last typed token (eros_fe Api.tagSuggest). The response is a map keyed by opaque ids; each value carries namespace (`ns`) and tag name (`tn`).
static async tagSuggest(base: string, text: string): Promise<EhTagSuggestion[]> { const q: string = text.trim() if (q.length === 0) { return [] } const req: TagSuggestRequest = new TagSuggestRequest() req.text = q const resp: EhTextResponse = await EhHttpClient.getInstance().postJson( ...
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 tagSuggest AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left base AST#identifier#Right AST#:#Left : AST#:#...
static async tagSuggest(base: string, text: string): Promise<EhTagSuggestion[]> { const q: string = text.trim() if (q.length === 0) { return [] } const req: TagSuggestRequest = new TagSuggestRequest() req.text = q const resp: EhTextResponse = await EhHttpClient.getInstance().postJson( ...
https://github.com/erosTeam/NextE
eb0ba930996a4b31ca04b0da9841c001aababb4f
github
aimilin6688/KeePassHO
entry/src/main/ets/entryability/EntryAbility.ets
arkts
initNonEssentialServices
非核心服务延迟初始化
private async initNonEssentialServices(): Promise<void> { // 初始化加解密KEY Sm4Utils.init(); // 初始化分布式同步服务 await SyncSettingsService.initSync(this.context); // 初始化崩溃日志服务 CrashLogService.getInstance().init(this.context); // 初始化弹框 DialogHelper.setDefaultConfig((config) => { config.uiAbi...
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 initNonEssentialServices AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expressio...
private async initNonEssentialServices(): Promise<void> { // 初始化加解密KEY Sm4Utils.init(); // 初始化分布式同步服务 await SyncSettingsService.initSync(this.context); // 初始化崩溃日志服务 CrashLogService.getInstance().init(this.context); // 初始化弹框 DialogHelper.setDefaultConfig((config) => { config.uiAbi...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/entryability/EntryAbility.ets#L102-L113
2c723a647152e2acf5266c276e0bee5419deee06
github
LZZLHY/hlib
entry/src/main/ets/viewmodel/FavoritesVM.ets
arkts
persistBooksCache
将 Book 列表写入本地缓存(异步,不阻塞调用方)。
private static persistBooksCache(books: Book[]): void { PreferencesStore.putObject<Book[]>('settings', BOOKS_CACHE_KEY, books).catch((e: Error): void => { Logger.w(TAG, `persistBooksCache failed: ${e.message}`); }); }
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 persistBooksCache AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left books AST#identifier#Right AST#:#L...
private static persistBooksCache(books: Book[]): void { PreferencesStore.putObject<Book[]>('settings', BOOKS_CACHE_KEY, books).catch((e: Error): void => { Logger.w(TAG, `persistBooksCache failed: ${e.message}`); }); }
https://github.com/LZZLHY/hlib
a6941bb76c2d57f6e3514a8b558e5adf9d8884ee
github
richshaw2015/nds
ohos/entry/src/test/AxisDeadZoneProperty.test.ets
arkts
expectedDirection
Determine the expected direction for a given axis value and dead zone. Returns -1 (negative), 0 (neutral), or 1 (positive).
function expectedDirection(value: number, deadZone: number): number { if (value >= deadZone) { return 1; } else if (value <= -deadZone) { return -1; } return 0; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left expectedDirection AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left value AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST...
function expectedDirection(value: number, deadZone: number): number { if (value >= deadZone) { return 1; } else if (value <= -deadZone) { return -1; } return 0; }
https://github.com/richshaw2015/nds
e68d5feef2cabad27533d320f9ae7867df7aba7f
github
openharmony/applications_notes
common/utils/src/main/ets/default/baseUtil/NoteUtil.ets
arkts
getFirstNoteData
Get First Note in note array @param allNoteDataArray @param folderUuid @return NoteData
getFirstNoteData(allNoteDataArray: NoteData[], folderUuid: string): NoteData | undefined { let noteDataArray: NoteData[] = this.getNoteDataArray(allNoteDataArray, folderUuid); LogUtil.info(TAG, "get noteDataArray size " + noteDataArray.length.toString()); if (noteDataArray.length == 0) { LogUtil.inf...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getFirstNoteData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left allNoteDataArray AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left N...
getFirstNoteData(allNoteDataArray: NoteData[], folderUuid: string): NoteData | undefined { let noteDataArray: NoteData[] = this.getNoteDataArray(allNoteDataArray, folderUuid); LogUtil.info(TAG, "get noteDataArray size " + noteDataArray.length.toString()); if (noteDataArray.length == 0) { LogUtil.inf...
https://gitee.com/openharmony/applications_notes.git
0cb832b72c3df2dd7b98f5f3862d12ab4bdfaf7d
gitee
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/GamepadManager.ets
arkts
isUsingGameControllerKit
检查当前是否使用 Game Controller Kit @returns true 表示使用 Game Controller Kit,false 表示使用 USB 驱动
isUsingGameControllerKit(): boolean { return this.useGameControllerKit; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isUsingGameControllerKit AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Righ...
isUsingGameControllerKit(): boolean { return this.useGameControllerKit; }
https://github.com/AlkaidLab/moonlight-harmony
eac10e70dcf80f5bcddf1f94ba6e6adc46606bfb
github
terryma2024/happyword
harmonyos/entry/src/main/ets/services/BattleQuestionScheduler.ets
arkts
scanIntroWords
@param requireUnserved when true (intro pass), only (word, kind) pairs not yet served; when false (sustain), allow reuse of words but prefer kinds still unserved for that word.
private scanIntroWords( lastWordId: string | undefined, canServe: WordKindSupportFn, requireUnserved: boolean, ): BattleQuestionPick { const out: BattleQuestionPick = new BattleQuestionPick(); const order: string[] = this.shuffledWordIds.length > 0 ? this.shuffledWordIds : this.planW...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left scanIntroWords AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#identifier#Left lastWordId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right A...
private scanIntroWords( lastWordId: string | undefined, canServe: WordKindSupportFn, requireUnserved: boolean, ): BattleQuestionPick { const out: BattleQuestionPick = new BattleQuestionPick(); const order: string[] = this.shuffledWordIds.length > 0 ? this.shuffledWordIds : this.planW...
https://github.com/terryma2024/happyword
bca538d87be9e89f76ab9e9f95a7a0b044d78073
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Loaders/MangaDetailLoader.ets
arkts
loadOnlineMangaFromInfoWithProgress
从OnlineComicInfo加载(带进度回调)
private async loadOnlineMangaFromInfoWithProgress( onlineComic: OnlineComicInfo, params: MangaDetailLoadParams, callback: MangaLoadProgressCallback ): Promise<MangaDetailLoadResult> { const result: MangaDetailLoadResult = { success: false, manga: null, chapters: [], isFavorit...
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 loadOnlineMangaFromInfoWithProgress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left onlineComic AST#i...
private async loadOnlineMangaFromInfoWithProgress( onlineComic: OnlineComicInfo, params: MangaDetailLoadParams, callback: MangaLoadProgressCallback ): Promise<MangaDetailLoadResult> { const result: MangaDetailLoadResult = { success: false, manga: null, chapters: [], isFavorit...
https://github.com/DaLongZhuaZi/manxia
45ef88ec5c9e7fe584cab06f7d30d50527ac9e7e
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelDictRuleManager.ets
arkts
searchWithRule
使用指定规则搜索词语
async searchWithRule(rule: DictRule, word: string): Promise<DictSearchResult> { const result: DictSearchResult = { word: word, content: '', source: rule.name, success: false }; try { const url = this.buildSearchUrl(rule, word); logger.info(TAG, `字典查询: ${rule.name} - ${...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left searchWithRule AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left rule AST#identifier#Right AST#type_annotation#Left AST#:#Left : ...
async searchWithRule(rule: DictRule, word: string): Promise<DictSearchResult> { const result: DictSearchResult = { word: word, content: '', source: rule.name, success: false }; try { const url = this.buildSearchUrl(rule, word); logger.info(TAG, `字典查询: ${rule.name} - ${...
https://github.com/DaLongZhuaZi/manxia
dae1d7e967fa0bc7093238bffc7e9157c721bab8
github
openharmony/codelabs
ETSUI/MemoTime/entry/src/main/ets/service/NotificationService.ets
arkts
checkAndSendPendingReminders
检查并发送待触发的提醒
async checkAndSendPendingReminders(): Promise<void> { try { const now = Date.now() // 获取所有未触发的提醒 const pendingReminders = await dataService.getPendingReminders() for (const reminder of pendingReminders) { // 检查是否应该触发(触发时间已到或在1分钟内) if (reminder.triggerTime <= now + 60 * 10...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left checkAndSendPendingReminders 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#:#R...
async checkAndSendPendingReminders(): Promise<void> { try { const now = Date.now() // 获取所有未触发的提醒 const pendingReminders = await dataService.getPendingReminders() for (const reminder of pendingReminders) { // 检查是否应该触发(触发时间已到或在1分钟内) if (reminder.triggerTime <= now + 60 * 10...
https://gitcode.com/openharmony/codelabs
cec0dc72e30bcae4882b95cc6d388f4df0d0fcc1
gitcode
iHongRen/harmony-study-demo
entry/src/main/ets/pages/router/XRouter.ets
arkts
isExistRouteName
路由栈中是否存在某个路由
public static isExistRouteName(routeName: string): boolean { const indexs = XRouter.getRouter().getIndexByName(routeName) return indexs.length > 0 }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left isExistRouteName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left routeName AST#identifier#Right AST#ERROR#Left AST#:#L...
public static isExistRouteName(routeName: string): boolean { const indexs = XRouter.getRouter().getIndexByName(routeName) return indexs.length > 0 }
https://github.com/iHongRen/harmony-study-demo
3fa47cc1d991626c2385755dac5d26de8a05c5f7
github
eclipse-oniro4openharmony/f-oh
entry/src/main/ets/components/AppListItem.ets
arkts
installApp
安装应用 或 更新应用
installApp(hapPath: string) { let hapFilePaths = [hapPath]; let installParam: InstallParams = { userId: 100, isKeepData: false, installFlag: 1, }; try { installer.getBundleInstaller().then(data => { data.install(hapFilePaths, installParam, err => { this.insta...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left installApp AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left hapPath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#L...
installApp(hapPath: string) { let hapFilePaths = [hapPath]; let installParam: InstallParams = { userId: 100, isKeepData: false, installFlag: 1, }; try { installer.getBundleInstaller().then(data => { data.install(hapFilePaths, installParam, err => { this.insta...
https://github.com/eclipse-oniro4openharmony/f-oh
064056c9e070bc17e64d3670ca8796461d53f206
github
the-wwyang/kids-learning-app
src/main/ets/services/QuestionGenerator.ets
arkts
generateCalculation
生成计算题 @param difficulty 难度等级 @returns 计算题对象
static generateCalculation(difficulty: Difficulty): MathQuestion { const config = QuestionGenerator.getCalculationConfig(difficulty); const operator = ArrayUtils.randomPick(config.operators)!; let num1 = Math.floor(Math.random() * config.maxNum) + 1; let num2 = Math.floor(Math.random() * config.maxNum...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left generateCalculation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left difficulty AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi...
static generateCalculation(difficulty: Difficulty): MathQuestion { const config = QuestionGenerator.getCalculationConfig(difficulty); const operator = ArrayUtils.randomPick(config.operators)!; let num1 = Math.floor(Math.random() * config.maxNum) + 1; let num2 = Math.floor(Math.random() * config.maxNum...
https://github.com/the-wwyang/kids-learning-app
e3c2121b3d9a1e5cd5a62cb2967392fd6e2dc284
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
reverse
Creates a new Int8Array using reversed data from the current one @returns a new Int8Array using reversed data from the current one
public reverse(): Int8Array { let res = new Int8Array(this) for (let i = 0; i < this.length; ++i) { res.set(this.length - 1 - i, this.at(i)) } return res }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left reverse 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 Int8Array AST#...
public reverse(): Int8Array { let res = new Int8Array(this) for (let i = 0; i < this.length; ++i) { res.set(this.length - 1 - i, this.at(i)) } return res }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
b6137c032e104b5342e186976bce99f88ba96eb9
gitee
harmonyos/codelabs
HarmonyOS_NEXT/TargetManagement/entry/src/main/ets/view/TargetList.ets
arkts
isSelectAll
Whether to select all.
isSelectAll(): boolean { if (this.selectArray.length === 0) { return false; } let deSelectCount: Length = this.selectArray.filter((selected: boolean) => selected === false).length; if (deSelectCount === 0) { this.selectAll = true; return true; } this.selectAll = false; re...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isSelectAll 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#stateme...
isSelectAll(): boolean { if (this.selectArray.length === 0) { return false; } let deSelectCount: Length = this.selectArray.filter((selected: boolean) => selected === false).length; if (deSelectCount === 0) { this.selectAll = true; return true; } this.selectAll = false; re...
https://gitee.com/harmonyos/codelabs.git
a7900a5ae45eb61494e6a1bd02e389a7ba171307
gitee
offlinecat-dev/OCNetORM
src/main/ets/core/MetadataStorage.ets
arkts
getInstance
获取单例实例 @returns MetadataStorage 实例
static getInstance(): MetadataStorage { return MetadataStorage.instance }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getInstance 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 MetadataSt...
static getInstance(): MetadataStorage { return MetadataStorage.instance }
https://github.com/offlinecat-dev/OCNetORM
6f8ab139f5f39df07f7dc0d19c0ea508bd4cf9f8
github
LJ666-ui/harmony-health-care
entry/src/main/ets/store/AppStore.ets
arkts
addReminder
Action: 添加提醒
public addReminder(reminder: Omit<Reminder, 'id' | 'createdAt' | 'updatedAt'>): void { const newReminder: Reminder = { title: reminder.title, time: reminder.time, type: reminder.type, enabled: reminder.enabled, id: 'reminder_' + Date.now(), createdAt: Date.now(), updatedA...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addReminder AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left reminder AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AS...
public addReminder(reminder: Omit<Reminder, 'id' | 'createdAt' | 'updatedAt'>): void { const newReminder: Reminder = { title: reminder.title, time: reminder.time, type: reminder.type, enabled: reminder.enabled, id: 'reminder_' + Date.now(), createdAt: Date.now(), updatedA...
https://github.com/LJ666-ui/harmony-health-care
301c349691495f9139117881c3bc25f7c4ca95b8
github