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
heeh02/superconnect
harmony/entry/src/main/ets/input/TrackpadHandler.ets
arkts
onTouch
Trackpad contact (sourceTool=7): recover click / drag-lock at the CURSOR.
onTouch(event: TouchEvent): void { switch (event.type) { case TouchType.Down: if (!this.tpHeld) { this.tpHeld = true; this.tpDownMs = Date.now(); this.tpFingers = event.touches.length; } else { this.tpFingers = Math.max(this.tpFingers, event.touches.length); // 2nd finge...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onTouch AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left TouchEvent AST#identifier#Right AST#)#Left ) AS...
onTouch(event: TouchEvent): void { switch (event.type) { case TouchType.Down: if (!this.tpHeld) { this.tpHeld = true; this.tpDownMs = Date.now(); this.tpFingers = event.touches.length; } else { this.tpFingers = Math.max(this.tpFingers, event.touches.length); // 2nd finge...
https://github.com/heeh02/superconnect
830b9a61a96da23be3ae1ade5793a53f77e08370
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
of
Returns a new array from a set of elements. @returns { Float64Array } - a new Float64Array @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static of(): Float64Array { return new Float64Array(0) }
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#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression...
public static of(): Float64Array { return new Float64Array(0) }
https://gitcode.com/iop123123/arkts-static-skills
30813643e0665779ab6a52f9836743f991efa153
gitcode
CLMC2025/Vignette
entry/src/main/ets/vocabulary/VocabularyTracker.ets
arkts
addOrUpdateRecord
添加或更新词汇记录
addOrUpdateRecord(record: VocabularyRecord): void { const lowerWord = record.word.toLowerCase(); this.vocabulary.set(lowerWord, record); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addOrUpdateRecord AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left record AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left VocabularyRecord AST#identifier#Righ...
addOrUpdateRecord(record: VocabularyRecord): void { const lowerWord = record.word.toLowerCase(); this.vocabulary.set(lowerWord, record); }
https://github.com/CLMC2025/Vignette
62b7c98281f3e13002364ef2db33fea28d0e6a54
github
darcycui/DarcyHarmonyNext
entry/src/main/ets/learn/Person.ets
arkts
getName
get/set方法
getName(): string { // TODO:注意这里的this不能省略 return this.name }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement_bloc...
getName(): string { // TODO:注意这里的this不能省略 return this.name }
https://github.com/darcycui/DarcyHarmonyNext/blob/241d0ee75929f6b3f9e1fe5b550acf6c9533c15c/entry/src/main/ets/learn/Person.ets#L38-L41
ae498eb8d972166485e7181e7001541993edd5af
github
LongLiveY96/chatcube
entry/src/main/ets/services/ModelCapabilityMatcher.ets
arkts
recordModelLogo
记录模型图标映射并节流持久化
recordModelLogo(modelId: string, logoUrl: string): void { if (modelId === '' || logoUrl === '') { return } const aliases = this.buildModelIdAliases(modelId) let changed = false for (let i = 0; i < aliases.length; i++) { const alias = aliases[i] const existing = this.persistedLogo...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left recordModelLogo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left modelId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , AST#...
recordModelLogo(modelId: string, logoUrl: string): void { if (modelId === '' || logoUrl === '') { return } const aliases = this.buildModelIdAliases(modelId) let changed = false for (let i = 0; i < aliases.length; i++) { const alias = aliases[i] const existing = this.persistedLogo...
https://github.com/LongLiveY96/chatcube
e049c080135d7856d9fe60775cd10498e774b527
github
LJ666-ui/harmony-health-care
entry/src/main/ets/service/ChartService.ets
arkts
setCacheTTL
设置缓存TTL
public setCacheTTL(ttl: number): void { this.cacheTTL = ttl; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setCacheTTL AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ttl AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left numbe...
public setCacheTTL(ttl: number): void { this.cacheTTL = ttl; }
https://github.com/LJ666-ui/harmony-health-care
75db7092c8098637c93e2302a324e7415de37dac
github
erosTeam/NextE
feature/home/src/main/ets/viewmodel/GalleryListViewModel.ets
arkts
sourceForListType
Map a profile listType to the existing GalleryListQuery.source vocabulary.
private static sourceForListType(listType: string): string { if (listType === PROFILE_TYPE_POPULAR) { return 'popular' } if (listType === PROFILE_TYPE_WATCHED) { return 'watched' } if (listType === PROFILE_TYPE_TOPLIST) { return 'toplist' } if (listType === PROFILE_TYPE_F...
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 sourceForListType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left listType AST#identifier#Right AST#ERROR#Left AST#...
private static sourceForListType(listType: string): string { if (listType === PROFILE_TYPE_POPULAR) { return 'popular' } if (listType === PROFILE_TYPE_WATCHED) { return 'watched' } if (listType === PROFILE_TYPE_TOPLIST) { return 'toplist' } if (listType === PROFILE_TYPE_F...
https://github.com/erosTeam/NextE
bcb94055431cbb49d590fd75a3461c0ae0e75a4e
github
erosTeam/NextE
shared/src/main/ets/settings/CookieJarSettings.ets
arkts
applyFromSetCookie
Capture auth cookies from a response Set-Cookie blob (HttpResponse.cookies). Regex-extracts each known auth cookie by name — robust against the comma/newline-joined multi-Set-Cookie string HarmonyOS returns — and skips the `mystery` igneous placeholder. Does NOT persist; the caller saves.
static applyFromSetCookie(setCookie: string): void { if (setCookie.length === 0) { return } const store: EhCookieStore = EhCookieStore.getInstance() const names: string[] = [ EhConstants.COOKIE_MEMBER_ID, EhConstants.COOKIE_PASS_HASH, EhConstants.COOKIE_IGNEOUS, EhConstan...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left applyFromSetCookie AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left setCookie AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#s...
static applyFromSetCookie(setCookie: string): void { if (setCookie.length === 0) { return } const store: EhCookieStore = EhCookieStore.getInstance() const names: string[] = [ EhConstants.COOKIE_MEMBER_ID, EhConstants.COOKIE_PASS_HASH, EhConstants.COOKIE_IGNEOUS, EhConstan...
https://github.com/erosTeam/NextE
af0652b0a269c50a6810f01c9396f02357cb324d
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Scraper/ScraperManager.ets
arkts
searchAnime
搜索动画(多源)
public async searchAnime(keyword: string, sources?: ScraperSource[]): Promise<MultiSourceSearchResult> { return this.searchMultipleSources(keyword, ScraperContentType.ANIME, sources); }
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 searchAnime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left keyword AST#identifier#Right AST#ERROR#Left AST#:#Left : AS...
public async searchAnime(keyword: string, sources?: ScraperSource[]): Promise<MultiSourceSearchResult> { return this.searchMultipleSources(keyword, ScraperContentType.ANIME, sources); }
https://github.com/DaLongZhuaZi/manxia
6b8488ead11338e22c8cba5f68f69f8c1ec0d5ba
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoWebViewExecutor.ets
arkts
isWebViewReady
检查WebView是否就绪
isWebViewReady(): boolean { return this.isReady && this.webviewController !== null; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isWebViewReady 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#stat...
isWebViewReady(): boolean { return this.isReady && this.webviewController !== null; }
https://github.com/DaLongZhuaZi/manxia
997e2bb5ed9c18c09136e1a974241332947d4fb6
github
JackJiang2011/harmonychat
entry/src/main/ets/pages/model/MessagesDataSource.ets
arkts
messageItemKey
在List中使用LazyForEach时,响应式ui需要key变化才会更新,本方法就是按可变的内容计算key,从而在DataSource更新时, 能让ui感知到,不然UI是不会刷新显示的。 @param m 消息对象 @returns 计算出的key
static messageItemKey(m: Message) { // 优化点:给更新的消息对象加个最近更新时间戳,这应该是个更通用的key计算项,不然一旦变更内容多了,这个key的计算就不那么优雅了 return m.msgType + '-' + m.fingerPrintOfProtocal + '-' + m.sendStatus; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left messageItemKey AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left m AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Mess...
static messageItemKey(m: Message) { // 优化点:给更新的消息对象加个最近更新时间戳,这应该是个更通用的key计算项,不然一旦变更内容多了,这个key的计算就不那么优雅了 return m.msgType + '-' + m.fingerPrintOfProtocal + '-' + m.sendStatus; }
https://github.com/JackJiang2011/harmonychat
d334ab5836bb3145cccb82f9d7c4838aff03b38f
github
Joker-x-dev/CoolMallArkTS
core/ui/src/main/ets/component/card/CardTitleCell.ets
arkts
build
构建卡片标题单元格 @returns {void} 无返回值
build(): void { IBestCellGroup({ inset: true, radius: $r("app.float.radius_medium"), outerMargin: 0 }) { IBestCell({ leftIcon: this.leftIcon, leftIconColor: this.leftIconColor, title: this.title, value: this.value, isLink: this.isLink, ha...
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 { IBestCellGroup({ inset: true, radius: $r("app.float.radius_medium"), outerMargin: 0 }) { IBestCell({ leftIcon: this.leftIcon, leftIconColor: this.leftIconColor, title: this.title, value: this.value, isLink: this.isLink, ha...
https://github.com/Joker-x-dev/CoolMallArkTS
c96ea8c14d77c35f9da884b7e086b6a7a689d91b
github
terryma2024/happyword
harmonyos/entry/src/ohosTest/ets/test/ParentAdminFlow.ui.test.ets
arkts
ensureLessonImportFixtureOnDevice
Materialise the lesson-import fixture into the app sandbox. The fixture is bundled into the ohosTest module at `entry/src/ohosTest/resources/rawfile/lesson_import_fixture.jpg` so the bytes are part of the test HAP — there is no host-side copy step at runtime. We can NOT use `hdc file send` to drop the file at a known p...
async function ensureLessonImportFixtureOnDevice(): Promise<string> { try { const ability = await DELEGATOR.getCurrentTopAbility(); const appCtx: common.UIAbilityContext = ability.context as common.UIAbilityContext; const dest: string = `${appCtx.tempDir}/lesson_import_fixture.jpg`; // Idempote...
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left ensureLessonImportFixtureOnDevice AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_a...
async function ensureLessonImportFixtureOnDevice(): Promise<string> { try { const ability = await DELEGATOR.getCurrentTopAbility(); const appCtx: common.UIAbilityContext = ability.context as common.UIAbilityContext; const dest: string = `${appCtx.tempDir}/lesson_import_fixture.jpg`; // Idempote...
https://github.com/terryma2024/happyword
265bda8bd5539ff0775230d9d650d27475588de2
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/BigInt.ets
arkts
getULong
Return current value clipped to unsigned long @returns { long } The unsigned long value. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public getULong(): long { return BigInt.asUint64(this).getLong() }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getULong AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left long AST#iden...
public getULong(): long { return BigInt.asUint64(this).getLong() }
https://gitcode.com/iop123123/arkts-static-skills
070cbc19d9ff9e6216ac21687e6cebba2497ca20
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Byte.ets
arkts
div
Performs integral division of this instance with provided one, returns the result as new instance @param { Byte } other Right hand side of the division @returns { Byte } @syscap SystemCapability.Utils.Lang @FaAndStageModel
public div(other: Byte): Byte { return (this.value / other.toByte()).toByte() }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left div AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left other AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#iden...
public div(other: Byte): Byte { return (this.value / other.toByte()).toByte() }
https://gitcode.com/iop123123/arkts-static-skills
4a8a74006aa28b20c0d0d3319663905359141664
gitcode
openharmony-sig/ohos_subsampling_scale_image_view
library/src/main/ets/components/MainPage/SubsamplingScaleImageView.ets
arkts
setMaximumDpi
This is a screen density aware alternative to {@link #setMinScale(float)}; it allows you to express the minimum allowed scale in terms of the maximum pixel density. @param dpi Source image pixel density at minimum zoom.
public setMaximumDpi(dpi: number): Model { let screen = display.getDefaultDisplaySync() let averageDpi: number = (screen.xDPI + screen.yDPI) / 2 this.setMinScale(averageDpi / dpi); return this; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setMaximumDpi AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dpi AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left num...
public setMaximumDpi(dpi: number): Model { let screen = display.getDefaultDisplaySync() let averageDpi: number = (screen.xDPI + screen.yDPI) / 2 this.setMinScale(averageDpi / dpi); return this; }
https://gitee.com/openharmony-sig/ohos_subsampling_scale_image_view.git
8494533bdbe621485cdf4d32a40879dbd95e3fc4
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/ArrayAsListInt.ets
arkts
popBack
Pops a value from the end of the List @returns popped value
public override popBack(): Int { if (this.curSize === 0) { throw new RangeError("No data to popBack from ArrayAsList!") } --this.curSize; return this.data[this.curSize]; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left popBack AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Lef...
public override popBack(): Int { if (this.curSize === 0) { throw new RangeError("No data to popBack from ArrayAsList!") } --this.curSize; return this.data[this.curSize]; }
https://gitcode.com/iop123123/arkts-static-skills
2be59931e3a3e70c2ade19b285dd7a7584941ea8
gitcode
youyeyejie/ZhiXing_ActHub
entry/src/main/ets/core/services/FocusTimerEngine.ets
arkts
stop
停止当前专注并保存记录
stop(saveRecord: boolean = true): void { this.cleanupTimer(); if (saveRecord && this.state === FocusState.WORKING) { this.saveCurrentSegment(); } this.resetState(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left stop AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left saveRecord AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#identifier#Left boolean AST#id...
stop(saveRecord: boolean = true): void { this.cleanupTimer(); if (saveRecord && this.state === FocusState.WORKING) { this.saveCurrentSegment(); } this.resetState(); }
https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/core/services/FocusTimerEngine.ets#L85-L91
0a70f19a45945bdf1fc94d20730de319ab8de672
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
reduceRight
Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. @param { function } callbackfn - A function that accepts four arguments. The reduceR...
public reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: int, array: Uint32Array) => number): number { if (this.lengthInt == 0) { throw new TypeError("Reduce of empty array with no initial value") } let accumulatedValue: number = this.$_get(this...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left reduceRight AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left callbackfn AST#identifier#Right AST#ERROR#Left AST#:#L...
public reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: int, array: Uint32Array) => number): number { if (this.lengthInt == 0) { throw new TypeError("Reduce of empty array with no initial value") } let accumulatedValue: number = this.$_get(this...
https://gitcode.com/iop123123/arkts-static-skills
285ff25fa5a786acda1bd53c6ad1ccd635901571
gitcode
TDCQCX/ShiHuaMusic-Harmony
entry/src/main/ets/utils/HttpUtil.ets
arkts
checkNetworkStatus
检查网络状态
private static checkNetworkStatus(): boolean { try { const connectionConfig = connection.getConnectionPropertiesSync(); return connectionConfig !== null; } catch (error) { console.warn('网络状态检查失败:', error); return true; // 默认假设网络可用 } }
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 checkNetworkStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Rig...
private static checkNetworkStatus(): boolean { try { const connectionConfig = connection.getConnectionPropertiesSync(); return connectionConfig !== null; } catch (error) { console.warn('网络状态检查失败:', error); return true; // 默认假设网络可用 } }
https://github.com/TDCQCX/ShiHuaMusic-Harmony
8cd32a31fdeea92937e1e17d4b31d6dbec4f7076
github
openharmony/applications_dlp_manager
entry/src/main/ets/OpenDlpFile/manager/OpeningDialogManager.ets
arkts
hideOpeningDialogByFailed
zip格式提前调用后因为各种原因失败
public async hideOpeningDialogByFailed(requestId: string): Promise<void> { this.printAllDecryptingMap(); const isDecrypting = this._decryptingMap.has(requestId); HiLog.info(TAG, `hideOpeningDialogByFailed requestId ${requestId}, isDecrypting ${isDecrypting}`); if (!isDecrypting) { HiLog.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 hideOpeningDialogByFailed AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left requestId AST#identifier#Right AST#ERROR#Left...
public async hideOpeningDialogByFailed(requestId: string): Promise<void> { this.printAllDecryptingMap(); const isDecrypting = this._decryptingMap.has(requestId); HiLog.info(TAG, `hideOpeningDialogByFailed requestId ${requestId}, isDecrypting ${isDecrypting}`); if (!isDecrypting) { HiLog.info(TAG...
https://gitee.com/openharmony/applications_dlp_manager.git
400a40acb74c14791d1069470f4b4bb461882c2a
gitee
Joker-x-dev/CoolMallArkTS
core/model/src/main/ets/entity/CategoryTree.ets
arkts
buildTree
将分类列表转换为树形结构 @param {Category[]} categories - 原始分类列表 @returns {CategoryTree[]} 树形结构的分类列表
static buildTree(categories: Category[]): CategoryTree[] { if (!categories || categories.length === 0) { return []; } const nestedTrees: CategoryTree[] = CategoryTree.tryBuildTreeFromNested(categories); if (nestedTrees.length > 0) { return nestedTrees; } const sortedList: Categor...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left buildTree AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left categories AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Category AST#ide...
static buildTree(categories: Category[]): CategoryTree[] { if (!categories || categories.length === 0) { return []; } const nestedTrees: CategoryTree[] = CategoryTree.tryBuildTreeFromNested(categories); if (nestedTrees.length > 0) { return nestedTrees; } const sortedList: Categor...
https://github.com/Joker-x-dev/CoolMallArkTS
3fe9bc4132f12f7360f61f46cf620048f6899d23
github
openharmony/applications_app_samples
code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example1/DataType.ets
arkts
addData
改变单个数据。 @param {number} index - 索引值。 @param {CustomDataType} data - 修改后的值。
public addData(index: double, data: CustomDataType): void { this.dataArray.splice(index, 0, data); this.notifyDataAdd(index); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addData 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 double ...
public addData(index: double, data: CustomDataType): void { this.dataArray.splice(index, 0, data); this.notifyDataAdd(index); }
https://github.com/openharmony/applications_app_samples
36faad808cacc8ccae8bc588aa21692f9fde3d4a
github
YANGZX22/Voot
entry/src/main/ets/storage/OnboardingStorage.ets
arkts
isNumberVerified
检查号码是否已验证 @param ctx UI Ability Context @returns true 表示已验证
static async isNumberVerified(ctx: common.UIAbilityContext): Promise<boolean> { const prefs = await OnboardingStorage.getPrefs(ctx); return (await prefs.get(OnboardingStorage.KEY_NUMBER_VERIFIED, false)) as boolean; }
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 isNumberVerified AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ctx AST#identifier#Right AST#:#Left : A...
static async isNumberVerified(ctx: common.UIAbilityContext): Promise<boolean> { const prefs = await OnboardingStorage.getPrefs(ctx); return (await prefs.get(OnboardingStorage.KEY_NUMBER_VERIFIED, false)) as boolean; }
https://github.com/YANGZX22/Voot
6668d6f4e9f594caa061b171d1778fb60ae04a62
github
CPF-ApplicationTPC/openharmony_tpc_samples
SwipeMenuListView/entry/src/main/ets/pages/ComprehensiveDemo.ets
arkts
handleMenuItemClick
处理菜单项点击
handleMenuItemClick(position: number, menu: SwipeMenu, menuIndex: number): boolean { const contact = this.contactList[position]; const clickedMenuItem = menu.getMenuItem(menuIndex); const menuItemId = clickedMenuItem?.getId(); const viewType = menu.getViewType(); switch (menuItemId) { case...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left handleMenuItemClick AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left position AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left ,...
handleMenuItemClick(position: number, menu: SwipeMenu, menuIndex: number): boolean { const contact = this.contactList[position]; const clickedMenuItem = menu.getMenuItem(menuIndex); const menuItemId = clickedMenuItem?.getId(); const viewType = menu.getViewType(); switch (menuItemId) { case...
https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples
c8060ef03854cd0494d6dc53fa11d4ed9293ab5a
gitcode
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/BaseDataSet.ets
arkts
addColor
Adds a new color to the colors array of the DataSet. @param color
public addColor(color: number): void { if (this.mColors == null) { this.mColors = new JArrayList<Number>(); } this.mColors.add(color); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left color AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number...
public addColor(color: number): void { if (this.mColors == null) { this.mColors = new JArrayList<Number>(); } this.mColors.add(color); }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
7946578ad460c438f7b72fc215c5662f97b30fa3
gitee
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/BinaryEncodingVisitor.ets
arkts
visitMapInt32Message
访问 map<int32, message> 字段
visitMapInt32Message(value: Map<number, Message>, fieldNumber: number): void { value.forEach((v, k) => { const entryWriter = this.writer.fork() entryWriter.tag(1, 0).int32(k) const nestedVisitor = new BinaryEncodingVisitor() nestedVisitor.recursionDepth = this.recursionDepth + 1 if ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitMapInt32Message AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Map AST#identifi...
visitMapInt32Message(value: Map<number, Message>, fieldNumber: number): void { value.forEach((v, k) => { const entryWriter = this.writer.fork() entryWriter.tag(1, 0).int32(k) const nestedVisitor = new BinaryEncodingVisitor() nestedVisitor.recursionDepth = this.recursionDepth + 1 if ...
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
b549a57447c9f20887b8c1ce9a06f1796842e3e9
gitcode
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/model/AnomalyDetection.ets
arkts
detectBillAnomaly
检测单个账单是否异常 @param bill 待检测账单 @param baseline 用户消费基线 @param algorithm 检测算法
static detectBillAnomaly( bill: Bill, baseline: UserSpendingBaseline, algorithm: string = ALGORITHM_ENSEMBLE ): AnomalyDetectionResult { // 只检测支出类型 if (bill.type !== 'expense') { const noAnomaly: AnomalyDetectionResult = { isAnomaly: false, anomalyType: '', severity...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left detectBillAnomaly AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bill AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
static detectBillAnomaly( bill: Bill, baseline: UserSpendingBaseline, algorithm: string = ALGORITHM_ENSEMBLE ): AnomalyDetectionResult { // 只检测支出类型 if (bill.type !== 'expense') { const noAnomaly: AnomalyDetectionResult = { isAnomaly: false, anomalyType: '', severity...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
97f9729b15ff0a25f3cfe4b29d6559e27d94fd76
github
FinalScave/SweetEditor
platform/OHOS/sweeteditor/src/main/ets/core/EditorCore.ets
arkts
setAutoIndentMode
==================== Auto Indent ====================
setAutoIndentMode(mode: AutoIndentMode): EditorActionResult { return CoreProtocol.decodeEditorActionResult(native.editorSetAutoIndentMode(this.handle, mode as number)); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setAutoIndentMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left mode AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left AutoIndentMode AST#identifier#Right AS...
setAutoIndentMode(mode: AutoIndentMode): EditorActionResult { return CoreProtocol.decodeEditorActionResult(native.editorSetAutoIndentMode(this.handle, mode as number)); }
https://github.com/FinalScave/SweetEditor
72b02326390364368564695fee6802f918d509bf
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test19_original_index.ets
arkts
testArrayFlatten
--- Array.flat (manual flatten) ---
function testArrayFlatten(): string { let nested: number[][] = [[1, 2], [3, 4], [5]]; let flat: number[] = []; for (let i: number = 0; i < nested.length; i++) { let inner: number[] = nested[i]; for (let j: number = 0; j < inner.length; j++) { flat.push(inner[j]); } } return String(flat.lengt...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testArrayFlatten AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined...
function testArrayFlatten(): string { let nested: number[][] = [[1, 2], [3, 4], [5]]; let flat: number[] = []; for (let i: number = 0; i < nested.length; i++) { let inner: number[] = nested[i]; for (let j: number = 0; j < inner.length; j++) { flat.push(inner[j]); } } return String(flat.lengt...
https://github.com/miaochiahao/ark-ghidra
5248168529cc0ee0261e208942b0fdb026245984
github
CLMC2025/Vignette
entry/src/main/ets/sync/DataSyncManager.ets
arkts
getLastBackupTime
实现缺失的方法
getLastBackupTime(): number { // 查找最新备份时间 if (this.backups.length === 0) { return 0; // 表示从未备份 } let latestTime = 0; for (const backup of this.backups) { if (backup.timestamp > latestTime) { latestTime = backup.timestamp; } } return latestTime; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getLastBackupTime 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#number#Right AST#ERROR#Right AST#stat...
getLastBackupTime(): number { // 查找最新备份时间 if (this.backups.length === 0) { return 0; // 表示从未备份 } let latestTime = 0; for (const backup of this.backups) { if (backup.timestamp > latestTime) { latestTime = backup.timestamp; } } return latestTime; }
https://github.com/CLMC2025/Vignette
b357e5265ea9f157087d734ffbd66c23cec0ce9e
github
AGenUI/AGenUI
platforms/harmony/agenui/src/main/ets/agenui/bridge/AGenUIEngineBridge.ets
arkts
getInstance
Returns the global singleton.
static getInstance(): AGenUIEngineBridge { if (AGenUIEngineBridge._instance === null) { AGenUIEngineBridge._instance = new AGenUIEngineBridge(); } return AGenUIEngineBridge._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 AGenUIEngi...
static getInstance(): AGenUIEngineBridge { if (AGenUIEngineBridge._instance === null) { AGenUIEngineBridge._instance = new AGenUIEngineBridge(); } return AGenUIEngineBridge._instance; }
https://github.com/AGenUI/AGenUI
a34e6e2ed4ec76e44f4c264a5992535006e92630
github
Joker-x-dev/CoolMallArkTS
core/designsystem/src/main/ets/component/Row.ets
arkts
build
渲染布局 @returns {void} 无返回值 @example RowStartTop() { Text("Hi"); }
build(): void { RowBase({ options: this.options, justifyContent: FlexAlign.Start, alignItems: VerticalAlign.Top, widthValue: this.widthValue, heightValue: this.heightValue, sizeValue: this.sizeValue, paddingValue: this.paddingValue, marginValue: this.marginValue, ...
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 { RowBase({ options: this.options, justifyContent: FlexAlign.Start, alignItems: VerticalAlign.Top, widthValue: this.widthValue, heightValue: this.heightValue, sizeValue: this.sizeValue, paddingValue: this.paddingValue, marginValue: this.marginValue, ...
https://github.com/Joker-x-dev/CoolMallArkTS
a9649477c0df909c20a0238ffc10f6a68998ef61
github
openharmony/codelabs
Media/ImageEdit/entry/src/main/ets/utils/MathUtils.ets
arkts
formulaAngle
Calculate radian value. @param angle @returns
static formulaAngle(angle: number): number { return angle * Math.PI / CropAngle.HALF_CIRCLE_ANGLE; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left formulaAngle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left angle AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left nu...
static formulaAngle(angle: number): number { return angle * Math.PI / CropAngle.HALF_CIRCLE_ANGLE; }
https://gitee.com/openharmony/codelabs.git
ce81d8f6e16e3edf532ff282de860135aa61fb01
gitee
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnDateTimePickerViewModel.ets
arkts
toggleTimePicker
切换时间选择器弹出层显示状态
toggleTimePicker(): void { this.timePickerOpen = !this.timePickerOpen; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toggleTimePicker 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...
toggleTimePicker(): void { this.timePickerOpen = !this.timePickerOpen; }
https://github.com/codelably/tuniao-ui
287ee89bbe9c9b1902ec0e54e48ccdfd70bb2176
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/String.ets
arkts
charCodeAt
The charCodeAt() method returns an integer between 0 and 65535 representing the UTF-16 code unit at the given index.
public charCodeAt(index: number): number { return this.charAt(index as int); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left charCodeAt 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 numb...
public charCodeAt(index: number): number { return this.charAt(index as int); }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
5ef8d0176fba26b58f1b3f3954d8e3e2a1c14fef
gitee
HarmonyOS_Samples/BestPracticeSnippets
OptimizationAppMemoryUsage/entry/src/main/ets/entryability/EntryAbility.ets
arkts
onMemoryLevel
Monitor the changes in memory
onMemoryLevel(level: AbilityConstant.MemoryLevel): void { // Execute memory management policies according to changes in memory if (level === AbilityConstant.MemoryLevel.MEMORY_LEVEL_CRITICAL) { console.log('The memory of device is critical, release memory.'); if (!LRUCacheUtil.getInstance().isEmpt...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onMemoryLevel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left level AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Left AbilityConstan...
onMemoryLevel(level: AbilityConstant.MemoryLevel): void { // Execute memory management policies according to changes in memory if (level === AbilityConstant.MemoryLevel.MEMORY_LEVEL_CRITICAL) { console.log('The memory of device is critical, release memory.'); if (!LRUCacheUtil.getInstance().isEmpt...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
95d2bad78648eb5bc7f5e1c49f7c8e8b13ac1823
gitcode
heeh02/superconnect
harmony/entry/src/main/ets/session/Session.ets
arkts
localCaps
Advertise this tablet's panel (resolution, refresh) + HW-decodable codecs so the Mac adapts its output — the adaptation interface for any tablet.
private localCaps(): HelloAckCaps { let sw: number = 2560; let sh: number = 1600; let scale: number = 2; let refresh: number = 60; try { const d: display.Display = display.getDefaultDisplaySync(); // Derive the VISUAL (oriented) dims from long/short edge + orientation, so rotation is ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left localCaps 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 HelloAckC...
private localCaps(): HelloAckCaps { let sw: number = 2560; let sh: number = 1600; let scale: number = 2; let refresh: number = 60; try { const d: display.Display = display.getDefaultDisplaySync(); // Derive the VISUAL (oriented) dims from long/short edge + orientation, so rotation is ...
https://github.com/heeh02/superconnect
021c1ff07941caf75075dfd0d6ee05b53a552ad6
github
YANGZX22/Voot
entry/src/main/ets/pages/ScanPage.ets
arkts
if
侧边悬浮按钮 - 有扫描结果时显示三个按钮
if ((this.isLeftHand || this.isRightHand) && this.recognizedText.length > 0 && !this.isHandPopupDismissed) { Column({ space: 16 }) { // 重新扫描按钮 Button({ type: ButtonType.Circle }) { SymbolGlyph($r('sys.symbol.camera')) .fontSize(24) .fontColor((...
AST#program#Left AST#if_statement#Left AST#if#Left if AST#if#Right AST#parenthesized_expression#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#binary_expression#Left AST#parenthesized_expression#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#member_expression#Left AST#this#Left this AST#this...
if ((this.isLeftHand || this.isRightHand) && this.recognizedText.length > 0 && !this.isHandPopupDismissed) { Column({ space: 16 }) { // 重新扫描按钮 Button({ type: ButtonType.Circle }) { SymbolGlyph($r('sys.symbol.camera')) .fontSize(24) .fontColor((...
https://github.com/YANGZX22/Voot
d500c050f807a66dc486ca25130f4387a1acf0b5
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test61_original_index.ets
arkts
generateSubsets
--- Backtracking: generate all subsets ---
function generateSubsets(elements: string[]): string[][] { let result: string[][] = []; let current: string[] = []; backtrackSubsets(elements, 0, current, result); return result; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left generateSubsets AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left elements AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS...
function generateSubsets(elements: string[]): string[][] { let result: string[][] = []; let current: string[] = []; backtrackSubsets(elements, 0, current, result); return result; }
https://github.com/miaochiahao/ark-ghidra
1f7d4102913e218d8e23360a49e903bb8b70382e
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets
arkts
add
Return a new Decimal whose value is the sum of `x` and `y`, rounded to `precision` significant digits using rounding mode `rounding`. @param { Value } x {double | string | Decimal} @param { Value } y {double | string | Decimal} @returns { Decimal } the Decimal type
static add(x: Value, y: Value): Decimal { return new Decimal(x).add(y); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left add AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left x AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Ri...
static add(x: Value, y: Value): Decimal { return new Decimal(x).add(y); }
https://gitcode.com/iop123123/arkts-static-skills
bc964f4b5eeccbd617a88f4d9d5473210cbebcb2
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/Char.ets
arkts
toLowerCase
toLowerCase() converts the underlying char to a lower case if it is in upper case, otherwise the char unchanged.
public toLowerCase(): void { this.value = Char.toLowerCase(this.value); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toLowerCase 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...
public toLowerCase(): void { this.value = Char.toLowerCase(this.value); }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
f1ad9d849cd777e75d7b18c63e71f01abea22c7a
gitee
openharmony-sig/ohos_circle_indicator
library/src/main/ets/components/MagicScrollTabsIndicator.ets
arkts
scrollExtra
计算滑动偏移
scrollExtra(index: number, onOffset: boolean = false): number { let sum = 0 for (let i = 0; i < index; i++) { sum += this.model.getTextModel().getTextWidthList()[i] + this.model.getInterval() } if (this.model.getSelectedTextSize()) { sum += ((this.model.getTextModel().getTextWidthList()[in...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left scrollExtra 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 , AS...
scrollExtra(index: number, onOffset: boolean = false): number { let sum = 0 for (let i = 0; i < index; i++) { sum += this.model.getTextModel().getTextWidthList()[i] + this.model.getInterval() } if (this.model.getSelectedTextSize()) { sum += ((this.model.getTextModel().getTextWidthList()[in...
https://gitee.com/openharmony-sig/ohos_circle_indicator.git
9cc0fdf7b6d1c5f4dbb008d6d33238fdaf8de8c1
gitee
openharmony/codelabs
Security/StringCipherArkTS/entry/src/main/ets/common/utils/DataTransformUtil.ets
arkts
uint8ArrayToBase64
Convert uint8Array to base64. @param content Uint8Array data. @returns Base64 data.
uint8ArrayToBase64(content: Uint8Array): string { let base64Data: string = (this.base64Helper as util.Base64Helper).encodeToStringSync(content); return base64Data; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left uint8ArrayToBase64 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left content AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Uint8Array AST#identifier#Right AS...
uint8ArrayToBase64(content: Uint8Array): string { let base64Data: string = (this.base64Helper as util.Base64Helper).encodeToStringSync(content); return base64Data; }
https://gitee.com/openharmony/codelabs.git
ab27eb9aead3e2acb918471c89fb91a9743beb7e
gitee
offlinecat-dev/OCNetORM
src/main/ets/query/QueryBuilder.ets
arkts
hasLazyRelations
检查是否有延迟加载的关联关系
hasLazyRelations(): boolean { return this.lazyRelationNames.length > 0 }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasLazyRelations 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#st...
hasLazyRelations(): boolean { return this.lazyRelationNames.length > 0 }
https://github.com/offlinecat-dev/OCNetORM
06aba2bfb7e34a15b0221eeee5c65ffeba77dc49
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Preload/ChapterPreloadManager.ets
arkts
isChapterPreloaded
检查章节是否已预加载
public isChapterPreloaded(chapterId: string): boolean { const task = this.tasks.get(chapterId); return task?.status === PreloadStatus.COMPLETED && task.preloadedPages > 0; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isChapterPreloaded AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left chapterId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#s...
public isChapterPreloaded(chapterId: string): boolean { const task = this.tasks.get(chapterId); return task?.status === PreloadStatus.COMPLETED && task.preloadedPages > 0; }
https://github.com/DaLongZhuaZi/manxia
57c797c4574e553e63b158f3c26f52ccd6e876f0
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelLoginManager.ets
arkts
executeButtonAction
执行按钮action(JS函数调用) @param source 书源 @param action 要执行的JS函数名,如 "login(true)" 或 "register()" @param formData 表单数据,会作为result变量传入JS环境
async executeButtonAction(source: LegadoBookSource, action: string, formData: Record<string, string>): Promise<LoginResult> { if (!action) { return { success: false, message: '未指定操作' }; } try { logger.info(TAG, `执行按钮操作: ${action}, 书源: ${source.bookSourceName}`); const jsEngine = ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left executeButtonAction AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left source AST#identifier#Rig...
async executeButtonAction(source: LegadoBookSource, action: string, formData: Record<string, string>): Promise<LoginResult> { if (!action) { return { success: false, message: '未指定操作' }; } try { logger.info(TAG, `执行按钮操作: ${action}, 书源: ${source.bookSourceName}`); const jsEngine = ...
https://github.com/DaLongZhuaZi/manxia
4dcdcd90473d63f7dfd6cd2ed3fadcaefde5aa31
github
openharmony-sig/applications_clock
feature/alarmclock/src/main/ets/utils/NotificationUtil.ets
arkts
publishAlarmSnooze
Send notification after delay
static async publishAlarmSnooze(alarmId: number | string, nextAlertTime: number, snoozeDuration: number, alarmTitle: string): Promise<void> { if (!alarmId || !nextAlertTime || !alarmTitle) { LogUtil.error(TAG, 'Execute method publishAlarmSnooze failed, params is incorrect.'...
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 publishAlarmSnooze AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left alarmId AST#identifier#Right AST#:#Le...
static async publishAlarmSnooze(alarmId: number | string, nextAlertTime: number, snoozeDuration: number, alarmTitle: string): Promise<void> { if (!alarmId || !nextAlertTime || !alarmTitle) { LogUtil.error(TAG, 'Execute method publishAlarmSnooze failed, params is incorrect.'...
https://gitee.com/openharmony-sig/applications_clock.git
9443523f26705aa0b108ae698d64f65486c04a8c
gitee
aimilin6688/KeePassHO
entry/src/main/ets/storage/cache/CacheConstants.ets
arkts
getCacheFileName
根据原始文件路径生成缓存文件名 @param originalPath 原始文件路径 @returns 缓存文件名
private static getCacheFileName(originalPath: string): string { // 使用原始路径的哈希值作为缓存文件名,避免文件名过长或包含非法字符 const hash: number = CacheConstants.hashString(originalPath); return hash.toString(16) + CacheConstants.CACHE_FILE_SUFFIX; }
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 getCacheFileName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left originalPath AST#identifier#Right AST#ERROR#Left A...
private static getCacheFileName(originalPath: string): string { // 使用原始路径的哈希值作为缓存文件名,避免文件名过长或包含非法字符 const hash: number = CacheConstants.hashString(originalPath); return hash.toString(16) + CacheConstants.CACHE_FILE_SUFFIX; }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/cache/CacheConstants.ets#L55-L59
2fd46ac4b47a50b9a0e266e862baf78e52352ae5
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets
arkts
setSeconds
Sets the seconds for a specified date according to local time. @param { int } value new seconds @returns { long } get new date value @syscap SystemCapability.Utils.Lang @FaAndStageModel
public setSeconds(value: int): long { let sec = ecmaSecFromTime(this.ms - this.TZOffset * 60 * msPerSecond); this.ms -= sec * msPerSecond; this.ms += value * msPerSecond; return this.ms; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setSeconds AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#R...
public setSeconds(value: int): long { let sec = ecmaSecFromTime(this.ms - this.TZOffset * 60 * msPerSecond); this.ms -= sec * msPerSecond; this.ms += value * msPerSecond; return this.ms; }
https://gitcode.com/iop123123/arkts-static-skills
ceca002723e491ce3378322c606204fd57afed98
gitcode
encorexin/WordPressCMS
harmonyos/entry/src/main/ets/services/crypto/CryptoService.ets
arkts
hashPassword
===== 密码哈希(PBKDF2 + SHA-256) ===== 对用户密码做 PBKDF2 哈希,返回 "salt:hash" 格式字符串
static async hashPassword(password: string): Promise<string> { const salt = CryptoService.randomBytes(SALT_LENGTH) const hash = await CryptoService.pbkdf2(password, salt) const saltB64 = CryptoService.uint8ArrayToBase64(salt) const hashB64 = CryptoService.uint8ArrayToBase64(hash) return `${saltB64...
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 hashPassword AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left password AST#identifier#Right AST#ERROR#Left AST#:#Left : ...
static async hashPassword(password: string): Promise<string> { const salt = CryptoService.randomBytes(SALT_LENGTH) const hash = await CryptoService.pbkdf2(password, salt) const saltB64 = CryptoService.uint8ArrayToBase64(salt) const hashB64 = CryptoService.uint8ArrayToBase64(hash) return `${saltB64...
https://github.com/encorexin/WordPressCMS
25d140e742fb8f588a44b32d1b242a38c185993f
github
pangpang20/antennaPodHM
entry/src/main/ets/pages/MainPage.ets
arkts
stopSubscriptionUpdateTimer
停止订阅更新定时器
stopSubscriptionUpdateTimer() { if (this.subscriptionUpdateTimer !== -1) { clearInterval(this.subscriptionUpdateTimer); this.subscriptionUpdateTimer = -1; } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left stopSubscriptionUpdateTimer 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#statem...
stopSubscriptionUpdateTimer() { if (this.subscriptionUpdateTimer !== -1) { clearInterval(this.subscriptionUpdateTimer); this.subscriptionUpdateTimer = -1; } }
https://github.com/pangpang20/antennaPodHM
0393d5663f5c0ef472b2ce5144fd730923eb82e4
github
Yebingiscn/SweetVideo
entry/src/main/ets/utils/BaseEventUtil.ets
arkts
clear
清除所有事件监听器
clear(): void { this.dataEvents.clear() }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left A...
clear(): void { this.dataEvents.clear() }
https://github.com/Yebingiscn/SweetVideo
4af8aa75c6badeef91a16d8e7feba506db3eb9e0
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/model/EventSourcing.ets
arkts
calculateStats
计算事件存储统计
static calculateStats(events: DomainEvent[]): EventStoreStats { const now = new Date(); const todayStart = new Date(now.getFullYear(), now.getMonth(), now.getDate()); const weekStart = new Date(todayStart.getTime() - 7 * 24 * 60 * 60 * 1000); const monthStart = new Date(now.getFullYear(), now.getMonth...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left calculateStats AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left events AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expre...
static calculateStats(events: DomainEvent[]): EventStoreStats { const now = new Date(); const todayStart = new Date(now.getFullYear(), now.getMonth(), now.getDate()); const weekStart = new Date(todayStart.getTime() - 7 * 24 * 60 * 60 * 1000); const monthStart = new Date(now.getFullYear(), now.getMonth...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
5605ad1f010d88bfd4bb2d9a17d3e08e0e0aae6d
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Process.ets
arkts
setErrorHandler
This method updates handler that is applied to uncaught error right before abnormal program termination @param { EventListener } listener user-provided handler
function setErrorHandler(listener: UncaughtErrorListener) : void { errorHandler.reset(listener); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left setErrorHandler AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left listener AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS...
function setErrorHandler(listener: UncaughtErrorListener) : void { errorHandler.reset(listener); }
https://gitcode.com/iop123123/arkts-static-skills
5b3cfd4e86e7d6ec0be9de0ad191ac23103635a3
gitcode
the-wwyang/kids-learning-app
src/main/ets/services/ParentalControlService.ets
arkts
getDefaultTimeLimitConfig
获取默认时间限制配置
private getDefaultTimeLimitConfig(): TimeLimitConfig { return { enabled: false, dailyLimitMinutes: 60, // 默认每天60分钟 sessionLimitMinutes: 30, // 默认单次30分钟 restRequiredMinutes: 10, // 默认休息10分钟 allowedTimeRanges: [ { startHour: 8, startMinute: 0, endHour: 20, endM...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getDefaultTimeLimitConfig 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#identifie...
private getDefaultTimeLimitConfig(): TimeLimitConfig { return { enabled: false, dailyLimitMinutes: 60, // 默认每天60分钟 sessionLimitMinutes: 30, // 默认单次30分钟 restRequiredMinutes: 10, // 默认休息10分钟 allowedTimeRanges: [ { startHour: 8, startMinute: 0, endHour: 20, endM...
https://github.com/the-wwyang/kids-learning-app
bb11549efc41e728f98435d0c8695ba408e8e7dd
github
openharmony-sig/flutter_engine
shell/platform/ohos/flutter_embedding/flutter/src/main/ets/util/ByteBuffer.ets
arkts
readBigInt64
Reads the next signed long. @param littleEndian If the value is little endian. @returns The value.
readBigInt64(littleEndian?: boolean): bigint { const value = this.getBigInt64(this.mByteOffset, littleEndian) this.mByteOffset += 8 return value }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left readBigInt64 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left littleEndian AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST...
readBigInt64(littleEndian?: boolean): bigint { const value = this.getBigInt64(this.mByteOffset, littleEndian) this.mByteOffset += 8 return value }
https://gitee.com/openharmony-sig/flutter_engine.git
a5acdecdfb552e846962c9aa2b42660dcf10bb6c
gitee
CLMC2025/Vignette
entry/src/main/ets/sync/DataExportImport.ets
arkts
generateExportFileName
生成導出文件名
generateExportFileName(): string { const date = new Date(); const year = date.getFullYear(); const month = String(date.getMonth() + 1).padStart(2, '0'); const day = String(date.getDate()).padStart(2, '0'); const hours = String(date.getHours()).padStart(2, '0'); const minutes = String(date.getM...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left generateExportFileName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST...
generateExportFileName(): string { const date = new Date(); const year = date.getFullYear(); const month = String(date.getMonth() + 1).padStart(2, '0'); const day = String(date.getDate()).padStart(2, '0'); const hours = String(date.getHours()).padStart(2, '0'); const minutes = String(date.getM...
https://github.com/CLMC2025/Vignette
9fc8a7de7e6727f2b30f1ace346375c377df4dbf
github
openharmony-sig/ohos_highlightguide
library/src/main/ets/highlightguide/core/Controller.ets
arkts
constructor
Controller构造类 @param context 用于存储显示次数的上下文 @param guideBuilder 组件初始化配置
constructor(context: Context, guideBuilder: HighLightGuideBuilder) { this.observedMaskVisibleState = new ObservedMaskVisibleState(); this.observedPageIndex = new ObservedPageIndex(); this.builder = guideBuilder; this.createPreferences(context); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Context AST#identifier#Rig...
constructor(context: Context, guideBuilder: HighLightGuideBuilder) { this.observedMaskVisibleState = new ObservedMaskVisibleState(); this.observedPageIndex = new ObservedPageIndex(); this.builder = guideBuilder; this.createPreferences(context); }
https://gitee.com/openharmony-sig/ohos_highlightguide.git
1d5983df8cfa90c6be13bcde18894feb963d8bbf
gitee
JackJiang2011/harmonychat
entry/src/main/ets/pages/utils/ToolKits.ets
arkts
hideSoftInputMethod
收起软键盘。 @param context 上下文对象
static hideSoftInputMethod(context: UIContext) { // 收起软键盘,官方资料:https://developer.huawei.com/consumer/cn/doc/best-practices-V5/bpta-keyboard-layout-adapt-V5#section19809195110316 context.getFocusController().clearFocus(); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left hideSoftInputMethod AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie...
static hideSoftInputMethod(context: UIContext) { // 收起软键盘,官方资料:https://developer.huawei.com/consumer/cn/doc/best-practices-V5/bpta-keyboard-layout-adapt-V5#section19809195110316 context.getFocusController().clearFocus(); }
https://github.com/JackJiang2011/harmonychat
55d94c82be91531e92d3a5b6e2236ec89c1e3238
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/less_or_equal/less_or_equal_int.ets
arkts
main
--- desc: check less or equal operation for integer ---
function main(): void { const a: int = {{v.left}} const b: int = {{v.right}} assert (a <= b) == {{v.result}}
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A...
function main(): void { const a: int = {{v.left}} const b: int = {{v.right}} assert (a <= b) == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
f5338aaf521e250b6636c2c73440d7a57138226a
gitee
XJTUWYD/ArkDiff
entry/src/main/ets/entryability/EntryAbility.ets
arkts
extractSharedText
从分享 Want 中提取文本(不同来源 key 不一,做防御性扫描)
private extractSharedText(want: Want): string { const params = want.parameters as Record<string, Object> | undefined; if (!params) return ''; const keys = ['content', 'text', 'shareText', 'sharedText', 'rawText', 'android.intent.extra.TEXT']; for (const k of keys) { const v = params[k]; if...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left extractSharedText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#...
private extractSharedText(want: Want): string { const params = want.parameters as Record<string, Object> | undefined; if (!params) return ''; const keys = ['content', 'text', 'shareText', 'sharedText', 'rawText', 'android.intent.extra.TEXT']; for (const k of keys) { const v = params[k]; if...
https://github.com/XJTUWYD/ArkDiff
3483f74d1a58a465d1b13fd3ef515df5038ba4be
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/PermanentImageCacheManager.ets
arkts
collectFiles
收集目录下所有文件
private async collectFiles( dirPath: string, files: Array<FileInfo> ): Promise<void> { try { if (!SafeFileUtils.accessSync(dirPath)) { return; } const items = SafeFileUtils.listFileSync(dirPath); for (const item of items) { const itemPath = `${dirPat...
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 collectFiles AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left dirPath AST#identifier#Right AST#ERROR#Left AST#:#Left ...
private async collectFiles( dirPath: string, files: Array<FileInfo> ): Promise<void> { try { if (!SafeFileUtils.accessSync(dirPath)) { return; } const items = SafeFileUtils.listFileSync(dirPath); for (const item of items) { const itemPath = `${dirPat...
https://github.com/DaLongZhuaZi/manxia
3cf4a0efdc5ba3751adb2d86ae15f4bdd11cd5a4
github
openharmony-sig/commons-cli
library/src/main/ets/components/cli/JMap.ets
arkts
get
获取指定KEY的元素值VALUE,失败返回NULL
get(_key: T1): T2 | null { try { for (let i = 0; i < this.elements.length; i++) { if (this.elements[i].key == _key) { return this.elements[i].value; } } } catch (e) { return null; } return 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 _key AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T1 AST#identifier#Right AS...
get(_key: T1): T2 | null { try { for (let i = 0; i < this.elements.length; i++) { if (this.elements[i].key == _key) { return this.elements[i].value; } } } catch (e) { return null; } return null; }
https://gitee.com/openharmony-sig/commons-cli.git
f5381cd8700d38bf47a4e4a39b24be14b742f196
gitee
openharmony/arkui_ace_engine
examples/DrawableDescriptor/entry/src/main/ets/pages/drawableDescriptorStaticTest.ets
arkts
testLayeredConstructorWithParams
===================== LayeredDrawableDescriptor 测试 =====================
testLayeredConstructorWithParams() { this.addLog('=== Test: LayeredDrawableDescriptor constructor(fg, bg, mask) ==='); try { const fg = new PixelMapDrawableDescriptor(); const bg = new PixelMapDrawableDescriptor(); const mask = new PixelMapDrawableDescriptor(); const layered = new Laye...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left testLayeredConstructorWithParams 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#s...
testLayeredConstructorWithParams() { this.addLog('=== Test: LayeredDrawableDescriptor constructor(fg, bg, mask) ==='); try { const fg = new PixelMapDrawableDescriptor(); const bg = new PixelMapDrawableDescriptor(); const mask = new PixelMapDrawableDescriptor(); const layered = new Laye...
https://gitcode.com/openharmony/arkui_ace_engine
9209fa8725665bb259e36365dd4dc0bb459fe8ec
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Tracking/trackers/AniListTracker.ets
arkts
saveAuthState
保存认证状态
protected async saveAuthState(): Promise<void> { try { const stateJson = JSON.stringify({ isLoggedIn: this.authState.isLoggedIn, username: this.authState.username, userId: this.authState.userId, accessToken: this.authState.accessToken, refreshToken: this.authState.ref...
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 saveAuthState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Rig...
protected async saveAuthState(): Promise<void> { try { const stateJson = JSON.stringify({ isLoggedIn: this.authState.isLoggedIn, username: this.authState.username, userId: this.authState.userId, accessToken: this.authState.accessToken, refreshToken: this.authState.ref...
https://github.com/DaLongZhuaZi/manxia
1182b5ea340d565850711736458e494dfe5d6102
github
openharmony-tpc/XmlGraphicsBatik
library/src/main/ets/batik/SVGXMLChecker.ets
arkts
check
验证SVG文档是否符合规范 @param xml XML字符串 @param onSuccess 校验成功回调,失败则抛出异常
public check(xml: string, onSuccess: () => void): void { // 创建文件阅读器实例 this._svgStringReader = new StringReader(this._normalizeXmlString(xml)); // 处理Prolog:xml声明 @see https://www.w3.org/TR/xml "2.8 Prolog 文档类型声明" this._readProlog(); // 读取元素节点 if (!this._readElement()) { this._error('Roo...
AST#program#Left AST#expression_statement#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left check AST#identifier#Right AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left xml AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identi...
public check(xml: string, onSuccess: () => void): void { // 创建文件阅读器实例 this._svgStringReader = new StringReader(this._normalizeXmlString(xml)); // 处理Prolog:xml声明 @see https://www.w3.org/TR/xml "2.8 Prolog 文档类型声明" this._readProlog(); // 读取元素节点 if (!this._readElement()) { this._error('Roo...
https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git
c4a4871ff2138808421fe30985f4873b0403c907
gitee
darcycui/DarcyHarmonyNext
entry/src/main/ets/pages/background_task/ShortTaskPage.ets
arkts
getRemainingTime
获取剩余时间 @param id 短时任务ID
async function getRemainingTime(id: number) { backgroundTaskManager.getRemainingDelayTime(id).then((res: number) => { remainTime = res; Log.info(`获取剩余时间成功 time=${res}`); }).catch((err: BusinessError) => { Log.error(`获取剩余时间失败. Code: ${err.code}, message: ${err.message}`); }) }
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left getRemainingTime AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type...
async function getRemainingTime(id: number) { backgroundTaskManager.getRemainingDelayTime(id).then((res: number) => { remainTime = res; Log.info(`获取剩余时间成功 time=${res}`); }).catch((err: BusinessError) => { Log.error(`获取剩余时间失败. Code: ${err.code}, message: ${err.message}`); }) }
https://github.com/darcycui/DarcyHarmonyNext/blob/241d0ee75929f6b3f9e1fe5b550acf6c9533c15c/entry/src/main/ets/pages/background_task/ShortTaskPage.ets#L69-L76
99277407e6ae3d9a9b1381da091c37966b1d6b5e
github
2763981847/Accounting-app
entry/src/main/ets/common/beans/ClassifiedStatistic.ets
arkts
constructor
构造函数,用于创建 ClassifiedStatistic 类的实例
constructor(typeText: string, accountType: number, amount: number = 0, count: number = 0) { // 将传入的参数赋值给实例的各个属性 this.typeText = typeText; this.accountType = accountType; this.amount = amount; this.count = count; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left typeText AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,...
constructor(typeText: string, accountType: number, amount: number = 0, count: number = 0) { // 将传入的参数赋值给实例的各个属性 this.typeText = typeText; this.accountType = accountType; this.amount = amount; this.count = count; }
https://github.com/2763981847/Accounting-app
146e6726066cdb68577e2f0ad533d1d61f00faf6
github
DaLongZhuaZi/NGF
ngf_framework/src/main/ets/uiTheme/facades/ComponentThemeOverrideFacade.ets
arkts
removeOverride
移除具名主题覆盖
removeOverride(name: string): void { this.overrides.delete(name); logger.debug(TAG, '移除主题覆盖: name=' + name); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left removeOverride AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) ...
removeOverride(name: string): void { this.overrides.delete(name); logger.debug(TAG, '移除主题覆盖: name=' + name); }
https://github.com/DaLongZhuaZi/NGF
860b4f6173fce5ba8e0d30b7dd8dea6b2def2f59
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/database/QueryHelper.ets
arkts
queryBillsByCategory
按分类查询账单(包含子分类) @param userId 用户ID @param categoryId 分类ID @param includeChildren 是否包含子分类 @param startDate 开始日期 @param endDate 结束日期 @returns 账单列表
static async queryBillsByCategory( userId: number, categoryId: number, includeChildren: boolean, startDate: string, endDate: string ): Promise<Bill[]> { const store = DatabaseManager.getDatabase(); let sql: string; let params: (number | string)[]; if (includeChildren) {...
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 queryBillsByCategory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#L...
static async queryBillsByCategory( userId: number, categoryId: number, includeChildren: boolean, startDate: string, endDate: string ): Promise<Bill[]> { const store = DatabaseManager.getDatabase(); let sql: string; let params: (number | string)[]; if (includeChildren) {...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
f8a783f62ca004373e932ba4cf75e785fa9a1168
github
yanglfree/CopoHub-Multi
flutter/ohos/entry/src/main/ets/plugins/IapPlugin.ets
arkts
queryProducts
── queryProducts ────────────────────────────────────────────────────────────
private async queryProducts(call: MethodCall, result: MethodResult): Promise<void> { const context = this.context; if (!context) { result.error('NO_CONTEXT', 'Context is not available', null); return; } try { const productIds = (call.argument('productIds') as string[] | null) || [ ...
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 queryProducts AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left call AST#identifier#Right AST#:#Left : ...
private async queryProducts(call: MethodCall, result: MethodResult): Promise<void> { const context = this.context; if (!context) { result.error('NO_CONTEXT', 'Context is not available', null); return; } try { const productIds = (call.argument('productIds') as string[] | null) || [ ...
https://github.com/yanglfree/CopoHub-Multi
d56f598e61c1276e5b4814786271d1dd1761a407
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Process.ets
arkts
getOutput
Get child process's output to stdout @returns { Promise<Uint8Array> } Promise containing bytes read from child process's stdout in Uint8Array
getOutput(): Promise<Uint8Array> { this.readOutput(); return Promise.resolve < Uint8Array > (new Uint8Array(this.outBuffer, 0, this.outBytesRead)); }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getOutput AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : ...
getOutput(): Promise<Uint8Array> { this.readOutput(); return Promise.resolve < Uint8Array > (new Uint8Array(this.outBuffer, 0, this.outBytesRead)); }
https://gitcode.com/iop123123/arkts-static-skills
53a3bb9637ea01c7cee4d9fec9caff04b090e1c0
gitcode
openharmony/applications_print_spooler
entry/src/main/ets/pages/PrintPage.ets
arkts
checkMaxPages
检查传入图片数量,大于100时不与加载
checkMaxPages(fileList: Array<string>): Array<string>{ let returnList: Array<string>; if (fileList.length > Constants.MAX_PAGES) { returnList = fileList.slice(0,Constants.MAX_PAGES); setTimeout(() => {//延迟弹窗,否则会概率弹窗失败 this.showToast($r('app.string.toast_max_copies')); }, Constants....
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left checkMaxPages AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left fileList AST#identifier#Right AST#ERROR#L...
checkMaxPages(fileList: Array<string>): Array<string>{ let returnList: Array<string>; if (fileList.length > Constants.MAX_PAGES) { returnList = fileList.slice(0,Constants.MAX_PAGES); setTimeout(() => {//延迟弹窗,否则会概率弹窗失败 this.showToast($r('app.string.toast_max_copies')); }, Constants....
https://gitee.com/openharmony/applications_print_spooler.git
e554e33a08cbd91a2c16ea59a12d26675157e059
gitee
openharmony/applications_app_samples
code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example1/DataType.ets
arkts
notifyDataDelete
通知LazyForEach组件需要在index对应索引处删除该子组件 @param {number} index - 索引值。
notifyDataDelete(index: double): void { this.listeners.forEach(listener => { listener.onDataDelete(index); }) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left notifyDataDelete 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 double AST#identifier#Right AST#)#Left...
notifyDataDelete(index: double): void { this.listeners.forEach(listener => { listener.onDataDelete(index); }) }
https://github.com/openharmony/applications_app_samples
85376580082e50feb8df52d88ac42a78a22eb5ce
github
dingzhilin1990/zhilinclaw
src/skills/SkillRegistry.ets
arkts
getSkill
获取技能 @param name 技能名称
public getSkill<T extends Skill>(name: string): T | undefined { const wrapper = this.skills.get(name); return wrapper?.skill as T; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left getSkill AST#identifier#Right AST#<#Left < AST#<#Right AST#type_identifier#Left T AST#type_identifier#Right AST#extends#Left extends AST#extends#Right AST#ERROR#Left AST#type_identifier#Left Skill AST#type_identifier#Right AST#>...
public getSkill<T extends Skill>(name: string): T | undefined { const wrapper = this.skills.get(name); return wrapper?.skill as T; }
https://github.com/dingzhilin1990/zhilinclaw
0dd8ab380a8970762aa45f9fc06ce13c550d8d47
github
zcg741/chengyu-game
entry/src/main/ets/viewmodel/GameViewModel.ets
arkts
canContinue
检查是否还能继续(闯关模式答错处理)
canContinue(): boolean { if (this.session.mode === GAME_MODE.CHALLENGE) { const current: GameRecord | null = this.getCurrentQuestion(); if (current && !current.isCorrect && current.errorCount >= GAME_CONFIG.MAX_ERROR_COUNT) { return false; } } return !this.session.isGameOver; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left canContinue 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...
canContinue(): boolean { if (this.session.mode === GAME_MODE.CHALLENGE) { const current: GameRecord | null = this.getCurrentQuestion(); if (current && !current.isCorrect && current.errorCount >= GAME_CONFIG.MAX_ERROR_COUNT) { return false; } } return !this.session.isGameOver; }
https://github.com/zcg741/chengyu-game
80b91808f0599a3bc8fa9a0f4178efdf6cdae327
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/GC.ets
arkts
startGC
The function triggers specific GC @param cause cause of requested GC @throws IllegalArgumentException if cause of GC is invalid or current GC does not support requested cause @throws UnsupportedOperationException if current GC does not support requested cause @throws IllegalStateException if try to run threshold GC col...
public static startGC(cause: int): long throws { return GC.startGCImpl(cause, null); }
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 startGC AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left cause AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#R...
public static startGC(cause: int): long throws { return GC.startGCImpl(cause, null); }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
098669d1fc69007ecd609fbe7b758b8207e9326c
gitee
openharmony/codelabs
ETSUI/TargetManagement/entry/src/main/ets/pages/MainPage.ets
arkts
onProgressChanged
Listening targetData.
onProgressChanged() { this.totalTasksNumber = this.targetData.length; this.completedTasksNumber = this.targetData.filter((item: TaskItemViewModel) => { return item.progressValue === CommonConstants.SLIDER_MAX_VALUE; }).length; this.latestUpdateDate = getCurrentTime(); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onProgressChanged 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#...
onProgressChanged() { this.totalTasksNumber = this.targetData.length; this.completedTasksNumber = this.targetData.filter((item: TaskItemViewModel) => { return item.progressValue === CommonConstants.SLIDER_MAX_VALUE; }).length; this.latestUpdateDate = getCurrentTime(); }
https://gitee.com/openharmony/codelabs.git
4491c308f0e14f76fb54e497e1b443793a190554
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Loading/LoadingStateManager.ets
arkts
notifyStateChange
通知状态变更
private notifyStateChange(event: LoadingStateChangeEvent): void { // 通知内部监听器 const listenersSnapshot: Array<(event: LoadingStateChangeEvent) => void> = this.stateChangeListeners.slice(); listenersSnapshot.forEach(listener => { try { listener(event); } catch (error) { logger.err...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left notifyStateChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier...
private notifyStateChange(event: LoadingStateChangeEvent): void { // 通知内部监听器 const listenersSnapshot: Array<(event: LoadingStateChangeEvent) => void> = this.stateChangeListeners.slice(); listenersSnapshot.forEach(listener => { try { listener(event); } catch (error) { logger.err...
https://github.com/DaLongZhuaZi/manxia
6388ee6f052ffe8ab044908a5631eb87705e9630
github
ibestservices/ibest-ui
library/src/main/ets/components/picker/index.ets
arkts
resetColumnOptions
重置列表数据
resetColumnOptions(columnIndex: number, i: number){ this.columns.forEach((_, index, arr) => { if(index > columnIndex){ this.offsetList[index] = 0 this.indexArr[index] = 0 if(columnIndex == 0){ if(index - 1 == columnIndex){ arr[index] = (this.options as IBestPickerOption[])[i].children || []...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left resetColumnOptions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left columnIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#R...
resetColumnOptions(columnIndex: number, i: number){ this.columns.forEach((_, index, arr) => { if(index > columnIndex){ this.offsetList[index] = 0 this.indexArr[index] = 0 if(columnIndex == 0){ if(index - 1 == columnIndex){ arr[index] = (this.options as IBestPickerOption[])[i].children || []...
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/picker/index.ets#L480-L496
61bc1c2b5040d074ae412c720db50184c65ad0b8
github
HarmonyOS_Samples/BestPracticeSnippets
JSCrash/entry/src/main/ets/pages/utils.ets
arkts
showWarn
Outputs warning-level logs. @param tag Identifies the log tag. @param format Indicates the log format string. @param args Indicates the log parameters. @since 7
static showWarn(tag: string, format: string, ...args: string[]): void { if (Log.isLoggable(tag, hilog.LogLevel.WARN)) { hilog.warn(DOMAIN, TAG, tag + SYMBOL + format, args); } }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left showWarn AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tag AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string A...
static showWarn(tag: string, format: string, ...args: string[]): void { if (Log.isLoggable(tag, hilog.LogLevel.WARN)) { hilog.warn(DOMAIN, TAG, tag + SYMBOL + format, args); } }
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
691f1950b07b49049f8e93659de6596bdcae0b93
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Lifecycle/CancellablePromise.ets
arkts
delay
延迟执行(可取消)
static delay(ms: number): CancellablePromise<void> { return new CancellablePromise<void>((resolve, reject, signal) => { const timerId = setTimeout(() => { if (!signal.aborted) { resolve(); } }, ms); signal.addEventListener('abort', () => { clearTimeout(ti...
AST#program#Left AST#expression_statement#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left delay AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ms AST#id...
static delay(ms: number): CancellablePromise<void> { return new CancellablePromise<void>((resolve, reject, signal) => { const timerId = setTimeout(() => { if (!signal.aborted) { resolve(); } }, ms); signal.addEventListener('abort', () => { clearTimeout(ti...
https://github.com/DaLongZhuaZi/manxia
ba617dea83ba395f46ec80f402ff3f5909969224
github
Yebingiscn/SweetVideo
entry/src/main/ets/utils/DataUtil.ets
arkts
updateItem
增量更新单个项
updateItem(index: number, newItem: T): void { if (index >= 0 && index < this.data.length) { this.data[index] = newItem this.notifyDataChange(index) } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateItem 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 , AST...
updateItem(index: number, newItem: T): void { if (index >= 0 && index < this.data.length) { this.data[index] = newItem this.notifyDataChange(index) } }
https://github.com/Yebingiscn/SweetVideo
fca0d29e70f255af9731016f9ec66d45b453fc97
github
openharmony/applications_photos
feature/browser/src/main/ets/default/view/album/AlbumSetPage.ets
arkts
onLocalAlbumSetActive
Callback when the local albums' page is in the foreground
onLocalAlbumSetActive() { if (this.currentIndex == Constants.LOCAL_TAB_INDEX) { Log.info(TAG, 'Local album set is on active'); this.albums && this.albums.onActive(); } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onLocalAlbumSetActive 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_bl...
onLocalAlbumSetActive() { if (this.currentIndex == Constants.LOCAL_TAB_INDEX) { Log.info(TAG, 'Local album set is on active'); this.albums && this.albums.onActive(); } }
https://gitee.com/openharmony/applications_photos.git
ad11f560b3fa751a2020ec718f663e8a63596f80
gitee
LZZLHY/hlib
entry/src/main/ets/viewmodel/FavoritesVM.ets
arkts
remove
取消收藏。
static async remove(bookId: number): Promise<void> { // 先查 hash(unsave 端点需要),在从列表移除之前 const current: Book[] | undefined = AppStorage.get<Book[]>(AppStorageKeys.FAVORITE_BOOKS); let hash: string | undefined = undefined; if (current !== undefined) { for (let i = 0; i < current.length; i++) { ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left remove AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bookId AST#identifier#Right AST#:#Left : AST#:#Ri...
static async remove(bookId: number): Promise<void> { // 先查 hash(unsave 端点需要),在从列表移除之前 const current: Book[] | undefined = AppStorage.get<Book[]>(AppStorageKeys.FAVORITE_BOOKS); let hash: string | undefined = undefined; if (current !== undefined) { for (let i = 0; i < current.length; i++) { ...
https://github.com/LZZLHY/hlib
57e1fa736d59ce4753b4fcac55b1ae0293a2f861
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/StreamWindowManager.ets
arkts
restoreWindow
恢复窗口设置(串流结束时调用)
async restoreWindow(): Promise<void> { try { const win = await window.getLastWindow(this.context); this.unregisterWindowSizeListener(win); win.setWindowKeepScreenOn(false); await this.exitImmersiveFullscreen(win); // 恢复全屏布局:重新显示系统栏后系统可能收回了全屏布局, // 导致内容区缩进出现黑边,此处再次设为 true 使内容延伸...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left restoreWindow AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generi...
async restoreWindow(): Promise<void> { try { const win = await window.getLastWindow(this.context); this.unregisterWindowSizeListener(win); win.setWindowKeepScreenOn(false); await this.exitImmersiveFullscreen(win); // 恢复全屏布局:重新显示系统栏后系统可能收回了全屏布局, // 导致内容区缩进出现黑边,此处再次设为 true 使内容延伸...
https://github.com/AlkaidLab/moonlight-harmony
a9166263e24f8328d6630bd9c590be794f314ca2
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<int> } 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<int>): Uint8ClampedArray { let res = new Uint8ClampedArray(items.length.toInt()) res.ofInt(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<int>): Uint8ClampedArray { let res = new Uint8ClampedArray(items.length.toInt()) res.ofInt(stub.toValueArray(items)) return res }
https://gitcode.com/iop123123/arkts-static-skills
3f668299ad76ce1d7c7686c3e83fa39a3f040950
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Parsers/EBookParser.ets
arkts
parseEpubSpineItems
直接解析已解压 EPUB 的 OPF 文件,返回 spine 章节列表 供阅读器在 Reader Kit catalog 章节缺少资源路径时作为兜底
public static parseEpubSpineItems(extractedRoot: string): EBookChapter[] { if (!extractedRoot || extractedRoot.trim().length === 0) { return []; } const parser = new ReaderKitEBookParser('', EBookFormat.EPUB); return parser.parseSpineFromOpf(extractedRoot); }
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 parseEpubSpineItems AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left extractedRoot AST#identifier#Right AST#ERROR#Left ...
public static parseEpubSpineItems(extractedRoot: string): EBookChapter[] { if (!extractedRoot || extractedRoot.trim().length === 0) { return []; } const parser = new ReaderKitEBookParser('', EBookFormat.EPUB); return parser.parseSpineFromOpf(extractedRoot); }
https://github.com/DaLongZhuaZi/manxia
18a9e7ba4ddb33349262ba96ac026841dcfadb92
github
aimilin6688/KeePassHO
entry/src/main/ets/common/utils/KdbxUtils.ets
arkts
isPinned
检查条目或分组是否置顶 @param item 条目或分组 @returns 是否置顶
public static isPinned(item: KdbxEntry | KdbxGroup): boolean { return item.tags && item.tags.includes(KdbxUtils.PINNED_TAG); }
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 isPinned AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left item AST#identifier#Right AST#:#Left : AST#:#R...
public static isPinned(item: KdbxEntry | KdbxGroup): boolean { return item.tags && item.tags.includes(KdbxUtils.PINNED_TAG); }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/KdbxUtils.ets#L418-L420
1685c51c8a88de61fc9cff3086991c7f7c69d75d
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Animation/GlobalAnimationSystem.ets
arkts
triggerCallback
触发动画回调
public triggerCallback(animationId: string, event: 'start' | 'update' | 'complete' | 'cancel' | 'pause' | 'resume' | 'repeat', data?: number | string | boolean): void { const callbacks = this.animationCallbacks.get(animationId); if (!callbacks) return; try { switch (event) { case 'start': ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left triggerCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left animationId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#st...
public triggerCallback(animationId: string, event: 'start' | 'update' | 'complete' | 'cancel' | 'pause' | 'resume' | 'repeat', data?: number | string | boolean): void { const callbacks = this.animationCallbacks.get(animationId); if (!callbacks) return; try { switch (event) { case 'start': ...
https://github.com/DaLongZhuaZi/manxia
a941b6d9f2f636f6020374ae34e9a1805c25b355
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Date.ets
arkts
getTime
Returns the number of milliseconds since the epoch, which is defined as the midnight at the beginning of January 1, 1970, UTC. @see ECMA-262, 21.4.4.10 @returns A number representing the milliseconds elapsed between 1 January 1970 00:00:00 UTC and the given date.
public getTime(): long throws { return this.valueOf(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left long AST#ident...
public getTime(): long throws { return this.valueOf(); }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
408caee9313dfe1d0fff95c0fd8e484fe7aef4b8
gitee
zcg741/chengyu-game
entry/src/main/ets/service/ChengyuService.ets
arkts
utf8ArrayToString
手动 UTF-8 解码(ArkTS 不支持 TextDecoder) 将 Uint8Array(UTF-8 字节)正确解码为字符串
function utf8ArrayToString(uint8Array: Uint8Array): string { let result = ''; let i = 0; while (i < uint8Array.length) { const c = uint8Array[i]; if (c < 0x80) { // 1字节 ASCII (0x00-0x7F) result += String.fromCharCode(c); i++; } else if (c < 0xE0) { // 2字节序列 (0xC0-0xDF) co...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left utf8ArrayToString AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left uint8Array AST#identifier#Right AST#type_annotation#Left AST#:#Left ...
function utf8ArrayToString(uint8Array: Uint8Array): string { let result = ''; let i = 0; while (i < uint8Array.length) { const c = uint8Array[i]; if (c < 0x80) { // 1字节 ASCII (0x00-0x7F) result += String.fromCharCode(c); i++; } else if (c < 0xE0) { // 2字节序列 (0xC0-0xDF) co...
https://github.com/zcg741/chengyu-game
c213be6924625652d930a225fbd0d0573fceec29
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Short.ets
arkts
toShort
Returns the primitive as short value @param { short } value value to cast @returns { short } casted value @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static toShort(value: short): short { return value; }
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 toShort AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#R...
public static toShort(value: short): short { return value; }
https://gitcode.com/iop123123/arkts-static-skills
30dcee9bf5659e74d573269c0d78235372b23171
gitcode
tdcare/tdwebrtc
src/main/ets/utils/PermissionUtil.ets
arkts
checkRequestPermissions
校验是否授权后并申请授权。 @param permissions 需要授权的权限 @returns true表示授权成功继续业务操作,false表示用户拒绝授权
static async checkRequestPermissions(permissions: Permissions): Promise<boolean> { let checkStatus = await PermissionUtil.checkPermissions(permissions); if (checkStatus) { return checkStatus; } else { return PermissionUtil.requestPermissions(permissions); } }
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 checkRequestPermissions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left permissions AST#identifier#Right...
static async checkRequestPermissions(permissions: Permissions): Promise<boolean> { let checkStatus = await PermissionUtil.checkPermissions(permissions); if (checkStatus) { return checkStatus; } else { return PermissionUtil.requestPermissions(permissions); } }
https://github.com/tdcare/tdwebrtc
779dcc564ae78f448d57e194ffb85ebf0ac73e5a
github
wuba/omni-ui
omni_component/src/main/ets/components/guide/core/Controller.ets
arkts
_onAnimationRunning
私有方法,不建议用户使用:用于组件通知Controller控制器当前动画状态 @param isAnimationRunning 动画状态:正在播放/播放完成
_onAnimationRunning(isAnimationRunning: boolean): void { hilog.info(0x0000, GlobalContext.HILOG_TAG, '%{public}s', 'Animation running state: ' + isAnimationRunning) this.animationRunning = isAnimationRunning; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left _onAnimationRunning AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isAnimationRunning AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right...
_onAnimationRunning(isAnimationRunning: boolean): void { hilog.info(0x0000, GlobalContext.HILOG_TAG, '%{public}s', 'Animation running state: ' + isAnimationRunning) this.animationRunning = isAnimationRunning; }
https://github.com/wuba/omni-ui
67bcf42cf694187d5869355e5eb2b880ce51831b
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets
arkts
splitSelectorWithJs
智能分割包含<js>标签的选择器 避免分割<js>...</js>内部的@符号
private splitSelectorWithJs(selector: string): string[] { const parts: string[] = []; let current = ''; let inJs = false; for (let i = 0; i < selector.length; i++) { const char = selector[i]; // 检查是否进入<js>标签 if (selector.substring(i, i + 4).toLowerCase() === '<js>') { ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left splitSelectorWithJs AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left selector AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AS...
private splitSelectorWithJs(selector: string): string[] { const parts: string[] = []; let current = ''; let inJs = false; for (let i = 0; i < selector.length; i++) { const char = selector[i]; // 检查是否进入<js>标签 if (selector.substring(i, i + 4).toLowerCase() === '<js>') { ...
https://github.com/DaLongZhuaZi/manxia
76dd402831f0ad9c790d4f751742cee686d64bb0
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ets
arkts
isTypedArray
Check whether the entered value is a type contained in typedarray. @param { Object } value - A TypedArray instance value @returns { boolean } Returns true if the value is a built-in TypedArray instance.
isTypedArray(value: Object): boolean { return this.isInt8Array(value) || this.isUint8Array(value) || this.isUint8ClampedArray(value) || this.isInt16Array(value) || this.isUint16Array(value) || this.isInt32Array(value) ||...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isTypedArray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Object AST#identifier#Right AST#)#Left ) A...
isTypedArray(value: Object): boolean { return this.isInt8Array(value) || this.isUint8Array(value) || this.isUint8ClampedArray(value) || this.isInt16Array(value) || this.isUint16Array(value) || this.isInt32Array(value) ||...
https://gitcode.com/iop123123/arkts-static-skills
0ac2b4b24565d76d79fdf4bf47802bacd323fc8d
gitcode
HarmonyOS_Samples/MusicHome
products/default/src/main/ets/entryability/EntryAbility.ets
arkts
onWindowStageDestroy
Called when the main window stage is destroyed.
onWindowStageDestroy() { // Main window is destroyed, release UI related resources Logger.info('EntryAbility: Ability onWindowStageDestroy'); try { MediaService.getInstance().release(); } catch (error) { Logger.error(`MediaService release ${JSON.stringify(error)}`); } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onWindowStageDestroy 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_blo...
onWindowStageDestroy() { // Main window is destroyed, release UI related resources Logger.info('EntryAbility: Ability onWindowStageDestroy'); try { MediaService.getInstance().release(); } catch (error) { Logger.error(`MediaService release ${JSON.stringify(error)}`); } }
https://gitcode.com/HarmonyOS_Samples/MusicHome
9bfce8e7d4e38a922607903c86d74ab26b62126e
gitcode
Tlntin/home-cloud-shield
entry/src/main/ets/serviceextability/MyVpnExtAbility.ets
arkts
updateStatsNotification
Recompute the notification text from the live native counters and republish when it changed (and the refresh interval has elapsed). Dedup-on-text means an idle device with no new queries causes no flash/CPU wakeups.
private updateStatsNotification(force: boolean): void { if (this.tunFd < 0) { return; } if (!this.notificationEnabled) { if (this.notificationActive) { this.cancelStatsNotification(); } return; } const now: number = Date.now(); if (!force && now - this.lastNotif...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left updateStatsNotification AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left force AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#iden...
private updateStatsNotification(force: boolean): void { if (this.tunFd < 0) { return; } if (!this.notificationEnabled) { if (this.notificationActive) { this.cancelStatsNotification(); } return; } const now: number = Date.now(); if (!force && now - this.lastNotif...
https://github.com/Tlntin/home-cloud-shield/blob/bfd8d549ccb3e55bdfc30fa7687b31d52e4c1cc0/entry/src/main/ets/serviceextability/MyVpnExtAbility.ets#L1082-L1116
8269b7da81901afc1588c8efe2604c32099b4596
github