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
Amaz1ny/HarmonyDO-public
entry/src/main/ets/services/messagebus/PreloadedDataService.ets
arkts
ensureConfigLoaded
仅加载 MessageBus 配置(避免解析 data-preloaded 大 JSON 导致 UI/消息处理卡顿): - meta.shared_session_key - siteSettings.long_polling_base_url 启动策略:先从 Preferences 读取缓存并 configure(),再后台抓一次 HTML 刷新;若值变化则重新 configure() 触发轮询重启。
async ensureConfigLoaded(silent: boolean = false): Promise<void> { await this.configureBusFromCacheIfNeeded(); if (this.loaded) { this.configLoaded = true; try { MessageBusService.getInstance().configure(this.longPollingBaseUrl, this.sharedSessionKey); } catch (_) { } ret...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left ensureConfigLoaded AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left silent AST#identifier#Right AST#type_annotation#Left AST#:#L...
async ensureConfigLoaded(silent: boolean = false): Promise<void> { await this.configureBusFromCacheIfNeeded(); if (this.loaded) { this.configLoaded = true; try { MessageBusService.getInstance().configure(this.longPollingBaseUrl, this.sharedSessionKey); } catch (_) { } ret...
https://github.com/Amaz1ny/HarmonyDO-public
45bb4720bd694d41bfcb48b658f444a47fac9239
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
constructor
Creates an Uint8ClampedArray with respect to data accessed via Iterable<Number> interface @param { Iterable<Number> } elements - data initializer @syscap SystemCapability.Utils.Lang @FaAndStageModel
public constructor(elements: Iterable<Number>) { const items: Object = elements as Object if (items instanceof ArrayLike) { const arr = reflect.internals.Types.identity_cast<Number>(items as ArrayLike<Number>) this.byteLengthInt = arr.length * Uint8ClampedArray.BYTES_PER_ELEM...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left elements AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_ex...
public constructor(elements: Iterable<Number>) { const items: Object = elements as Object if (items instanceof ArrayLike) { const arr = reflect.internals.Types.identity_cast<Number>(items as ArrayLike<Number>) this.byteLengthInt = arr.length * Uint8ClampedArray.BYTES_PER_ELEM...
https://gitcode.com/iop123123/arkts-static-skills
03b9e59ecbd03e2cc06eff369565a0629ac82e95
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Intl.ets
arkts
segmentWith
Internal method to perform segmentation based on granularity @param doc The input text to segment @param granularity The type of segmentation to perform @returns An array of Cluster representing the segments @privateRemarks Defaults to grapheme segmentation if an unknown granularity is provided
private segmentWith(doc: string, granularity: 'grapheme' | 'word' | 'sentence'): Cluster[] { switch (granularity) { case 'word': return Array.from<Cluster>(Segmenter.wordClusters(doc, this._locale)) case 'sentence': return Array.from<Cluster>(S...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left segmentWith AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left doc AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left st...
private segmentWith(doc: string, granularity: 'grapheme' | 'word' | 'sentence'): Cluster[] { switch (granularity) { case 'word': return Array.from<Cluster>(Segmenter.wordClusters(doc, this._locale)) case 'sentence': return Array.from<Cluster>(S...
https://gitcode.com/iop123123/arkts-static-skills
70f15a634c5ca60681c867e0693ecb1adc0d2731
gitcode
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. @param { FixedArray<number> } items - a set of elements to include in the new array object. @returns { Int8Array } - a new Int8Array @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static of(...items: FixedArray<number>): Int8Array { let res = new Int8Array(items.length.toInt()) res.ofNumber(stub.toValueArray(items)) return res }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#of#Left of AST#of#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#ERROR...
public static of(...items: FixedArray<number>): Int8Array { let res = new Int8Array(items.length.toInt()) res.ofNumber(stub.toValueArray(items)) return res }
https://gitcode.com/iop123123/arkts-static-skills
7737d9890df571ee46a52b87459ceac6fedec0ea
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/prefix_increment/prefix_increment_char.ets
arkts
main
--- desc: check prefix increment for char operand ---
function main(): void { let value: char = {{v.value}} let result: char = ++value assert value == {{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 { let value: char = {{v.value}} let result: char = ++value assert value == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
f8cb34089f20a60c5f119b4b57a3fb21100dd79e
gitee
honjow/Next2V
shared/src/main/ets/utils/FoldScreenUtil.ets
arkts
isFoldedAndUseOuterScreen
Check if folded and using outer screen Core method, controls hideTitleArea
isFoldedAndUseOuterScreen(): boolean { return this.isFoldedAndOuterScreen }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isFoldedAndUseOuterScreen 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#Rig...
isFoldedAndUseOuterScreen(): boolean { return this.isFoldedAndOuterScreen }
https://github.com/honjow/Next2V
191d6b1a5ed237a3783db26853d3d42f3eea4a4b
github
terryma2024/happyword
harmonyos/entry/src/main/ets/services/CocosBattleBridge.ets
arkts
playSubmitAudio
── Audio (BattlePage cue moments) ─────────────────────────────────────────
private playSubmitAudio(outcome: AnswerOutcome): void { if (outcome.comboTriggered) { this.callbacks.playSfx(SoundKeys.HIT_CRIT); } else if (outcome.correct) { this.callbacks.playSfx(SoundKeys.HIT_NORMAL); } else { this.callbacks.playSfx(SoundKeys.ANSWER_WRONG); this.schedulePlayer...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left playSubmitAudio AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left outcome AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier...
private playSubmitAudio(outcome: AnswerOutcome): void { if (outcome.comboTriggered) { this.callbacks.playSfx(SoundKeys.HIT_CRIT); } else if (outcome.correct) { this.callbacks.playSfx(SoundKeys.HIT_NORMAL); } else { this.callbacks.playSfx(SoundKeys.ANSWER_WRONG); this.schedulePlayer...
https://github.com/terryma2024/happyword
f2df36c1ab4b902dd8a640ca7f95330cb4892721
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoUrlAnalyzer.ets
arkts
analyzeUrl
解析URL模板(同步版本,不执行JS)
analyzeUrl(urlTemplate: string, key?: string, page?: number): ParsedUrlRequest { // 保存参数 if (key !== undefined) { this.key = key; this.variables.set('key', key); this.variables.set('encodedKey', encodeURIComponent(key)); } if (page !== undefined) { this.page = page; this....
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left analyzeUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left urlTemplate AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , AST#,...
analyzeUrl(urlTemplate: string, key?: string, page?: number): ParsedUrlRequest { // 保存参数 if (key !== undefined) { this.key = key; this.variables.set('key', key); this.variables.set('encodedKey', encodeURIComponent(key)); } if (page !== undefined) { this.page = page; this....
https://github.com/DaLongZhuaZi/manxia
3951b082a97b268b5ec474b6febc9fec0c8a1bf6
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoJsExtensions.ets
arkts
toURL
==================== URL工具类 ==================== 创建URL解析对象
toURL(urlStr: string, baseUrl?: string): JsURL { return new JsURL(urlStr, baseUrl); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toURL AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left urlStr AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#R...
toURL(urlStr: string, baseUrl?: string): JsURL { return new JsURL(urlStr, baseUrl); }
https://github.com/DaLongZhuaZi/manxia
cb18008c16608fb5cb56c4d4ac39975a95b71a52
github
Joker-x-dev/CoolMallArkTS
feature/user/src/main/ets/viewmodel/AddressDetailViewModel.ets
arkts
updateIsDefaultAddress
更新默认地址状态 @param {boolean} value - 是否默认 @returns {void} 无返回值
updateIsDefaultAddress(value: boolean): void { this.isDefaultAddress = value; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateIsDefaultAddress 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 boolean AST#identifier#Right AST...
updateIsDefaultAddress(value: boolean): void { this.isDefaultAddress = value; }
https://github.com/Joker-x-dev/CoolMallArkTS
d36d2b9a4c0ac2649e80f36efa5d009604bf476e
github
HarmonyOS_Samples/accountkit-samplecode-clientdemo-arkts
entry/src/main/ets/pages/QuickLoginPage.ets
arkts
jumpToOtherLoginPage
Redirect to the screen for another way to sign in.
jumpToOtherLoginPage(isUserSelected: boolean = false) { // Redirect to the screen for another way to sign in. this.isUserSelected = isUserSelected; if (isUserSelected) { this.pageInfos?.pushPathByName('OtherLoginPage', null, true); } else { this.pageInfos?.replacePathByName('OtherLoginPage...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left jumpToOtherLoginPage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left isUserSelected AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left...
jumpToOtherLoginPage(isUserSelected: boolean = false) { // Redirect to the screen for another way to sign in. this.isUserSelected = isUserSelected; if (isUserSelected) { this.pageInfos?.pushPathByName('OtherLoginPage', null, true); } else { this.pageInfos?.replacePathByName('OtherLoginPage...
https://gitcode.com/HarmonyOS_Samples/accountkit-samplecode-clientdemo-arkts
c094df3cc19c6fe2aa3572d4e26892b6034c642b
gitcode
ASweetBite/HarmonyPulse
entry/src/main/ets/utils/services/MusicImportService.ets
arkts
saveSongs
函数一:持久化保存歌曲列表 将 SongItemType 数组序列化为 JSON 字符串存入首选项
static async saveSongs(context: common.Context, songs: SongItemType[]): Promise<void> { try { const pref = await preferences.getPreferences(context, PREF_NAME) await pref.put(KEY_SONG_LIST, JSON.stringify(songs)) await pref.flush() } catch (e) { console.error('Preferences 保存失败', e) ...
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 saveSongs AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#...
static async saveSongs(context: common.Context, songs: SongItemType[]): Promise<void> { try { const pref = await preferences.getPreferences(context, PREF_NAME) await pref.put(KEY_SONG_LIST, JSON.stringify(songs)) await pref.flush() } catch (e) { console.error('Preferences 保存失败', e) ...
https://github.com/ASweetBite/HarmonyPulse/blob/a7fcf153a20bafa29ac1fb8c25743dd5350dc54c/entry/src/main/ets/utils/services/MusicImportService.ets#L82-L90
1c5af8cd639fec4d5c2f1d861a32fb9d9010c966
github
LJ666-ui/harmony-health-care
entry/src/main/ets/xiaoyi/XiaoyiSkillManager.ets
arkts
initialize
初始化小艺Skill系统
async initialize(): Promise<boolean> { try { console.info('[Xiaoyi] 正在初始化Skill系统...'); // 注册所有Skill this.registerDefaultSkills(); // 声明MCP能力(向小艺平台注册) await this.declareMCPCapabilities(); this.isInitialized = true; console.info('[Xiaoyi] Skill系统初始化完成'); return tru...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left initialize AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_t...
async initialize(): Promise<boolean> { try { console.info('[Xiaoyi] 正在初始化Skill系统...'); // 注册所有Skill this.registerDefaultSkills(); // 声明MCP能力(向小艺平台注册) await this.declareMCPCapabilities(); this.isInitialized = true; console.info('[Xiaoyi] Skill系统初始化完成'); return tru...
https://github.com/LJ666-ui/harmony-health-care
44012f9b9f775ee85a780ffdd776bcef64ca5b7c
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/EventSourcingDAO.ets
arkts
insert
insert 方法别名(兼容性)
static async insert(snapshot: AggregateSnapshot): Promise<number> { return await AggregateSnapshotDAO.save(snapshot); }
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 insert AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left snapshot AST#identifier#Right AST#:#Left : AST#:#...
static async insert(snapshot: AggregateSnapshot): Promise<number> { return await AggregateSnapshotDAO.save(snapshot); }
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
1e963e550bfdb8bc31c19d1df71ecc2ac9103c32
github
openharmony/arkui_advanced_ui_component
atomicserviceweb/source/atomicserviceweb.ets
arkts
getAppId
获取appid
getAppId(): string | null { let bundleName: string = this.context.abilityInfo.bundleName; if (!bundleName) { return null; } let strArray: string[] = bundleName.split('.'); if (!strArray || strArray.length <= 0) { return null; } return strArray[strArray.length - 1]; }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getAppId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left ...
getAppId(): string | null { let bundleName: string = this.context.abilityInfo.bundleName; if (!bundleName) { return null; } let strArray: string[] = bundleName.split('.'); if (!strArray || strArray.length <= 0) { return null; } return strArray[strArray.length - 1]; }
https://gitee.com/openharmony/arkui_advanced_ui_component.git
b04cc1068aed187158cff9254a5e4780dcbc072e
gitee
arkui-x/samples
CodeLab/Cases/feature/customscan/src/main/ets/components/CommonTipsDialog.ets
arkts
openPermissionsInSystemSettings
拉起设置指定应用页面弹窗
openPermissionsInSystemSettings(): void { logger.info('Start to open permissions in system settings.'); let context = getContext(this) as common.UIAbilityContext; let wantInfo: Want = { bundleName: 'com.huawei.hmos.settings', abilityName: 'com.huawei.hmos.settings.MainAbility', uri: 'app...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left openPermissionsInSystemSettings 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 ...
openPermissionsInSystemSettings(): void { logger.info('Start to open permissions in system settings.'); let context = getContext(this) as common.UIAbilityContext; let wantInfo: Want = { bundleName: 'com.huawei.hmos.settings', abilityName: 'com.huawei.hmos.settings.MainAbility', uri: 'app...
https://gitcode.com/arkui-x/samples
96496f20f316898013ad90af8b045b3f9385b70f
gitcode
HarmonyOS_Samples/BestPracticeSnippets
ScreenFlickerSolution/entry/src/main/ets/pages/ClickRight.ets
arkts
build
Run counter
build() { Stack() { Stack() { Text('click') .fontSize(45) .fontColor(Color.White) } .borderRadius(50) .width(100) .height(100) .backgroundColor('#e6cfe6') .scale({ x: this.scaleValue, y: this.scaleValue }) .onClick(() => { // When...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST...
build() { Stack() { Stack() { Text('click') .fontSize(45) .fontColor(Color.White) } .borderRadius(50) .width(100) .height(100) .backgroundColor('#e6cfe6') .scale({ x: this.scaleValue, y: this.scaleValue }) .onClick(() => { // When...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
0a008a5a0fe903bd1078fe7050a199343e584a06
gitcode
Joker-x-dev/CoolMallArkTS
core/network/src/main/ets/datasource/order/OrderNetworkDataSourceImpl.ets
arkts
getOrderLogistics
查询订单物流信息 @param {number} orderId - 订单 ID @returns {Promise<NetworkResponse<Logistics>>} 物流详情
async getOrderLogistics(orderId: number): Promise<NetworkResponse<Logistics>> { const resp: AxiosResponse<NetworkResponse<Logistics>> = await NetworkClient.http.get("order/info/logistics", { params: { orderId } }); return resp.data; }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getOrderLogistics AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left orderId AST#identifier#Right AST#type_annotation#Left AST#:#L...
async getOrderLogistics(orderId: number): Promise<NetworkResponse<Logistics>> { const resp: AxiosResponse<NetworkResponse<Logistics>> = await NetworkClient.http.get("order/info/logistics", { params: { orderId } }); return resp.data; }
https://github.com/Joker-x-dev/CoolMallArkTS
6873950193fd69e240382a7c11f17deae32cbb14
github
AetheriumSimulator/qemu-hmos
entry/src/main/ets/components/DownloadManager.ets
arkts
generateTaskId
生成任务ID
private generateTaskId(): string { return `task_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left generateTaskId 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 A...
private generateTaskId(): string { return `task_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`; }
https://github.com/AetheriumSimulator/qemu-hmos
eaaf813947fde3bdc9ddd004a9dd749ab52ebbb2
github
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/hosts/app/tabs/classes/meowTabsBunch.ets
arkts
newTabBare
Create a new tab, doesn't check initialization. @param overwriteUrl A specific url to use? @param controller A pre-created controller to use? @returns The new meowTabInfo.
newTabBare(overwriteUrl?: string, controller?: WebviewController) { const newTab = new meowTabInfo(this.myUi); newTab.controller = controller || new webview.WebviewController(); if (overwriteUrl) { newTab.url = overwriteUrl; } const newNode = new TabNodeController(this.uiContext, newTab); ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left newTabBare AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left overwriteUrl AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string...
newTabBare(overwriteUrl?: string, controller?: WebviewController) { const newTab = new meowTabInfo(this.myUi); newTab.controller = controller || new webview.WebviewController(); if (overwriteUrl) { newTab.url = overwriteUrl; } const newNode = new TabNodeController(this.uiContext, newTab); ...
https://github.com/awaLiny2333/LinysBrowser_NEXT
9c366a152248ed7cf0b253b873ace4f4fb854935
github
cpdd5201314/harmonyOS-music-app
products/phone/src/main/ets/pages/MusicSearchService.ets
arkts
searchLocalMusic
本地音乐列表搜索
searchLocalMusic(musicList: MusicInfo[], searchText: string): MusicInfo[] { if (!searchText.trim()) return musicList const regex = new RegExp( searchText.split('') .map(char => char.replace(/[.*+?^${}()|[\]\\]/, '\\$&')) .join('.*') + '.*', 'i' ) const result: MusicInfo[]...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left searchLocalMusic AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left musicList AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left Musi...
searchLocalMusic(musicList: MusicInfo[], searchText: string): MusicInfo[] { if (!searchText.trim()) return musicList const regex = new RegExp( searchText.split('') .map(char => char.replace(/[.*+?^${}()|[\]\\]/, '\\$&')) .join('.*') + '.*', 'i' ) const result: MusicInfo[]...
https://github.com/cpdd5201314/harmonyOS-music-app
6e7108b3f08e75dba1775e7ba2bc728b1d0a4b4e
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Date.ets
arkts
UTC
Returns the number of milliseconds elapsed since the epoch, which is defined as the midnight at the beginning of January 1, 1970, UTC. @param year to be converted to milliseconds. @param month to be converted to milliseconds. @param day to be converted to milliseconds. @param hours to be converted to milliseconds. @par...
public static UTC(year: long, month: long, day: long, hours: long, minutes: long, seconds: long): long { return ecmaMakeDate(ecmaMakeDay(year, month, day), ecmaMakeTime(hours, minutes, seconds, 0 as long)) }
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#identifier#Left UTC AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left year AST#ide...
public static UTC(year: long, month: long, day: long, hours: long, minutes: long, seconds: long): long { return ecmaMakeDate(ecmaMakeDay(year, month, day), ecmaMakeTime(hours, minutes, seconds, 0 as long)) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
bf7a72c3f6a9a6a3813529c37d0ce66458140fa3
gitee
harmonyos/codelabs
HarmonyOS_NEXT/SimpleCalculator/entry/src/main/ets/pages/HomePage.ets
arkts
getSymbol
Get Operator. @param value. @return Operators.
getSymbol(value: string) { if (CheckEmptyUtil.isEmpty(value)) { return ''; } let symbol = ''; switch (value) { case Symbol.ADD: symbol = CommonConstants.ADD; break; case Symbol.MIN: symbol = CommonConstants.MIN; break; case Symbol.MUL: sy...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getSymbol 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 string AST#identifier#Right AS...
getSymbol(value: string) { if (CheckEmptyUtil.isEmpty(value)) { return ''; } let symbol = ''; switch (value) { case Symbol.ADD: symbol = CommonConstants.ADD; break; case Symbol.MIN: symbol = CommonConstants.MIN; break; case Symbol.MUL: sy...
https://gitee.com/harmonyos/codelabs.git
64228a032f88175954fc6e0622979ab937cdbe86
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Scraper/ScraperManager.ets
arkts
mergeMetadata
合并两个元数据对象
private mergeMetadata(existing: ScrapedMetadata, newItem: ScrapedMetadata): ScrapedMetadata { const merged: ScrapedMetadata = { id: existing.id, source: existing.source, externalId: existing.externalId, title: existing.title, titleNative: existing.titleNative || newItem.titleNative, ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left mergeMetadata AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left existing AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#...
private mergeMetadata(existing: ScrapedMetadata, newItem: ScrapedMetadata): ScrapedMetadata { const merged: ScrapedMetadata = { id: existing.id, source: existing.source, externalId: existing.externalId, title: existing.title, titleNative: existing.titleNative || newItem.titleNative, ...
https://github.com/DaLongZhuaZi/manxia
fe5dec8c52de51be917295d912c593f97c47e329
github
bhengubv/aether-protocol
harmonyos/teal/entry/src/main/ets/service/NearLinkTransportService.ets
arkts
sendAsync
── Bidirectional send ─────────────────────────────────────────────────── Transmit a raw Aether packet to all reachable peers. Dispatches through whichever roles are currently active: CLIENT active → client.writeProperty(WRITE_NO_RESPONSE) to connected server SERVER active → server.notifyPropertyChanged to every connec...
async sendAsync(data: Uint8Array): Promise<void> { this.assertAvailable('sendAsync'); const hasClientConnection = this._client !== undefined; const hasServerClients = this._server !== undefined && this._connectedClients.size > 0; if (!hasClientConnection && !hasServerClients) { throw new Error...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left sendAsync AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left data AST...
async sendAsync(data: Uint8Array): Promise<void> { this.assertAvailable('sendAsync'); const hasClientConnection = this._client !== undefined; const hasServerClients = this._server !== undefined && this._connectedClients.size > 0; if (!hasClientConnection && !hasServerClients) { throw new Error...
https://github.com/bhengubv/aether-protocol
df37e554dfd769b8883b02871cbd02caff278c59
github
DaLongZhuaZi/manxia
entry/src/main/ets/libs/htmlparser/HtmlParserLogger.ets
arkts
selectorQuery
选择器查询日志
static selectorQuery(selector: string, resultCount: number): void { if (HtmlParserLogger._enabled && HtmlParserLogger._debugEnabled) { logger.debug(TAG, `选择器查询: "${selector}",结果数: ${resultCount}`); } }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left selectorQuery AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left selector AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#...
static selectorQuery(selector: string, resultCount: number): void { if (HtmlParserLogger._enabled && HtmlParserLogger._debugEnabled) { logger.debug(TAG, `选择器查询: "${selector}",结果数: ${resultCount}`); } }
https://github.com/DaLongZhuaZi/manxia
0fdf33b1869f0a96c2b38caee1846dc46d95765f
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Jsonx.ets
arkts
_deepCopy
Creates a deep copy of a JsonElement. @param {JsonElement} source - The JsonElement to copy from @private
private _deepCopy(source: JsonElement): void { this.key = source.key this.maybeStringValue = source.maybeStringValue this.maybeDoubleValue = source.maybeDoubleValue this.maybeLongValue = source.maybeLongValue this.maybeBoolValue = source.maybeBoolValue...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left _deepCopy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left source AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left J...
private _deepCopy(source: JsonElement): void { this.key = source.key this.maybeStringValue = source.maybeStringValue this.maybeDoubleValue = source.maybeDoubleValue this.maybeLongValue = source.maybeLongValue this.maybeBoolValue = source.maybeBoolValue...
https://gitcode.com/iop123123/arkts-static-skills
2efe1ae38fbb55381a2585fba0c7d2928e3c7d49
gitcode
2763981847/Clock-Alarm
entry/src/main/ets/pages/StopwatchPage.ets
arkts
addFlag
添加标记点
addFlag() { this.flags.push(this.elapsedTime); this.listScroller.scrollToIndex(this.flags.length - 1); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addFlag AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST...
addFlag() { this.flags.push(this.elapsedTime); this.listScroller.scrollToIndex(this.flags.length - 1); }
https://github.com/2763981847/Clock-Alarm
2e613c67fb44b71321bc6231d1c6817dd74c9220
github
CLMC2025/Vignette
entry/src/main/ets/ui/Animations.ets
arkts
getAllStates
获取所有动画状态
getAllStates(): Map<string, AnimationState> { return new Map(this.animationStates); }
AST#program#Left AST#expression_statement#Left AST#sequence_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getAllStates 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#:#Le...
getAllStates(): Map<string, AnimationState> { return new Map(this.animationStates); }
https://github.com/CLMC2025/Vignette
e8e4851d24e913419862cd6d2c2826973757239d
github
tdcare/tdwebrtc
src/main/ets/utils/NetworkUtil.ets
arkts
getDefaultCellularDataSimId
获取默认移动数据的SIM卡ID。与SIM卡绑定,从1开始递增。 @returns
static getDefaultCellularDataSimId(): number { return data.getDefaultCellularDataSimId(); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getDefaultCellularDataSimId 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#Lef...
static getDefaultCellularDataSimId(): number { return data.getDefaultCellularDataSimId(); }
https://github.com/tdcare/tdwebrtc
50891962edcc475ab663d3c8abaf301ebfade195
github
LJ666-ui/harmony-health-care
entry/src/main/ets/parking/ParkingService.ets
arkts
getParkingLots
获取附近停车场列表
async getParkingLots(userLat: number, userLng: number): Promise<ParkingLot[]> { const parkingLots: ParkingLot[] = getMockParkingLots(); const lotsWithDistance: ParkingLot[] = []; for (let i = 0; i < parkingLots.length; i++) { const lot = parkingLots[i]; const distance: number = this.calculateD...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getParkingLots AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left userLat AST#identifier#Right AST#type_annotation#Left AST#:#Left...
async getParkingLots(userLat: number, userLng: number): Promise<ParkingLot[]> { const parkingLots: ParkingLot[] = getMockParkingLots(); const lotsWithDistance: ParkingLot[] = []; for (let i = 0; i < parkingLots.length; i++) { const lot = parkingLots[i]; const distance: number = this.calculateD...
https://github.com/LJ666-ui/harmony-health-care
33fb88a3df796b7f6304a2a44503b429f323bd74
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/common/utils/DAOHelper.ets
arkts
closeResultSet
安全关闭ResultSet @param resultSet 结果集
static closeResultSet(resultSet: relationalStore.ResultSet | null): void { try { resultSet?.close(); } catch (error) { console.warn('[DAOHelper] 关闭ResultSet失败:', error); } }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left closeResultSet AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resultSet AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expre...
static closeResultSet(resultSet: relationalStore.ResultSet | null): void { try { resultSet?.close(); } catch (error) { console.warn('[DAOHelper] 关闭ResultSet失败:', error); } }
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
75f10013b414eb3870bfdd593d97417347055114
github
Yebingiscn/SweetVideo
entry/src/main/ets/utils/AnimationUtil.ets
arkts
runWithAnimation
执行带动画效果的函数 @param fn 需要执行的函数 @param animate 是否启用动画,默认为true @param s1 弹簧动画的第一个参数,默认为0.4 @param s2 弹簧动画的第二个参数,默认为0.85
public static runWithAnimation( fn: Function, animate: boolean = true, s1: number = 0.4, s2: number = 0.85): void { if (animate) { // 使用弹簧动画执行函数 animateToImmediately({ curve: curves.springMotion(s1, s2) }, () => { fn() }) } else { // 不使用动画直接执行函数 fn() }...
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 runWithAnimation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left fn AST#identifier#Right AST#:#Left : A...
public static runWithAnimation( fn: Function, animate: boolean = true, s1: number = 0.4, s2: number = 0.85): void { if (animate) { // 使用弹簧动画执行函数 animateToImmediately({ curve: curves.springMotion(s1, s2) }, () => { fn() }) } else { // 不使用动画直接执行函数 fn() }...
https://github.com/Yebingiscn/SweetVideo
771af7496c18773d7e7625b06af1ae0f5687ca9b
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NativeJsEngine.ets
arkts
executeForString
执行JavaScript代码并返回字符串结果 @param code JavaScript代码 @param context 执行上下文 @returns 结果字符串,失败返回空字符串
async executeForString(code: string, context?: JsContext): Promise<string> { const result = await this.execute(code, context); return result.success ? result.result : ''; }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left executeForString AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left code AST#identifier#Right AST#type_annotation#Left AST#:#Left ...
async executeForString(code: string, context?: JsContext): Promise<string> { const result = await this.execute(code, context); return result.success ? result.result : ''; }
https://github.com/DaLongZhuaZi/manxia
26268d1698af7ad5dab102bba7abce158da2e139
github
Yebingiscn/SweetVideo
entry/src/main/ets/utils/ToolsUtil.ets
arkts
showToast
Toast设置
static showToast(text: string, duration: number = 3500) { try { window.getLastWindow(PathUtils.appContext!).then((windowClass: window.Window) => { windowClass.getUIContext().getPromptAction().showToast({ message: text, duration: duration, backgroundBlurStyle: BlurStyle....
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left showToast AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string...
static showToast(text: string, duration: number = 3500) { try { window.getLastWindow(PathUtils.appContext!).then((windowClass: window.Window) => { windowClass.getUIContext().getPromptAction().showToast({ message: text, duration: duration, backgroundBlurStyle: BlurStyle....
https://github.com/Yebingiscn/SweetVideo
647534d3c647e69a011b3c3c86e604cea8e2d97d
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/AsyncLockManager.ets
arkts
queryAllLocks
It is expected to be made private in future versions. Query information about all possible deadlocks. @returns { Array<AsyncLock> } Returns a array string info about possible deadlocks on all locks.
public queryAllLocks() : Array <AsyncLock> { let arr : Array<AsyncLock> = new Array<AsyncLock>(); ConcurrencyHelpers.mutexLock(this.mutex); this.locks.forEach((val) => { let a = val.deref(); if (a != undefined) { arr.push(a); } ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left queryAllLocks 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#expressi...
public queryAllLocks() : Array <AsyncLock> { let arr : Array<AsyncLock> = new Array<AsyncLock>(); ConcurrencyHelpers.mutexLock(this.mutex); this.locks.forEach((val) => { let a = val.deref(); if (a != undefined) { arr.push(a); } ...
https://gitcode.com/iop123123/arkts-static-skills
87ef9061367804919f9f01463cbc826419a513ee
gitcode
DaLongZhuaZi/NGF
ngf_framework/src/main/ets/i18n/facades/I18nManagerFacade.ets
arkts
isRtl
检测当前语言是否为 RTL(从右到左)布局语言 Phase F2:接口预埋,基于 locale 代码判断
isRtl(): boolean { const locale = this.getCurrentLocale(); const rtlLanguages: Array<string> = ['ar', 'he', 'fa', 'ur', 'ps', 'sd', 'ku', 'dv']; const langCode = locale.split('-')[0].toLowerCase(); for (let i = 0; i < rtlLanguages.length; i++) { if (rtlLanguages[i] === langCode) { logger...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isRtl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statement_blo...
isRtl(): boolean { const locale = this.getCurrentLocale(); const rtlLanguages: Array<string> = ['ar', 'he', 'fa', 'ur', 'ps', 'sd', 'ku', 'dv']; const langCode = locale.split('-')[0].toLowerCase(); for (let i = 0; i < rtlLanguages.length; i++) { if (rtlLanguages[i] === langCode) { logger...
https://github.com/DaLongZhuaZi/NGF
1a0d691561853f60331e379a3275ba7fc12134b1
github
openharmony-sig/fluttertpc_qr_code_scanner
ohos/ohos/src/main/ets/components/plugin/libs/PermissionsUtil.ets
arkts
checkAndRequestCameraPermission
检查权限 初始化相机 开始扫描
public static async checkAndRequestCameraPermission(context: Context): Promise<boolean> { let valid = false; const permissions: Array<Permissions> = ['ohos.permission.CAMERA']; let grantStatus = await PermissionsUtil.checkAccessToken(permissions[0]); if (grantStatus === abilityAccessCtrl.GrantStatus....
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left checkAndRequestCameraPermission AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#id...
public static async checkAndRequestCameraPermission(context: Context): Promise<boolean> { let valid = false; const permissions: Array<Permissions> = ['ohos.permission.CAMERA']; let grantStatus = await PermissionsUtil.checkAccessToken(permissions[0]); if (grantStatus === abilityAccessCtrl.GrantStatus....
https://gitee.com/openharmony-sig/fluttertpc_qr_code_scanner.git
2f48d6baf042f4078307800d399967cb32f0fa01
gitee
AlkaidLab/moonlight-harmony
entry/src/main/ets/viewmodel/AppViewModel.ets
arkts
setApps
设置应用列表(带图标 URL) @param entries 应用列表 @param nvHttp NvHttp 实例(用于生成图标 URL 和加载图标)
setApps(entries: AppEntry[], nvHttp?: NvHttp): void { // 取消之前的图标加载任务 this.iconLoadingCancelled = true; // 查找正在运行的应用 const runningApps = entries.filter(e => e.isRunning); console.info(`AppListViewModel: 加载 ${entries.length} 个应用, 正在运行: ${runningApps.map(a => `${a.name}(${a.id})`).join(', ') || '无'}...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setApps AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left entries AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left AppEntry AST#id...
setApps(entries: AppEntry[], nvHttp?: NvHttp): void { // 取消之前的图标加载任务 this.iconLoadingCancelled = true; // 查找正在运行的应用 const runningApps = entries.filter(e => e.isRunning); console.info(`AppListViewModel: 加载 ${entries.length} 个应用, 正在运行: ${runningApps.map(a => `${a.name}(${a.id})`).join(', ') || '无'}...
https://github.com/AlkaidLab/moonlight-harmony
0ac0968c0c8935adbc5df3037701d7f36ee0d683
github
terryma2024/happyword
harmonyos/entry/src/main/ets/services/CocosEngineHost.ets
arkts
setSceneMessageHandler
Task 0.3 bridge, scene -> ArkTS direction. The scene calls native.reflection.callStaticMethod(...); the engine resolves it through the 'executeMethodAsync' threadsafe function registered in ensureBooted, which runs CocosBridgeReceiver.onSceneMessage on the UI thread; that receiver forwards here. The handler therefore r...
setSceneMessageHandler(handler: (json: string) => void): void { this.sceneMessageHandler = handler; if (this.sceneReady) { handler('{"v":1,"type":"battle/ready","payload":{}}'); } }
AST#program#Left AST#ERROR#Left AST#identifier#Left setSceneMessageHandler AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left handler AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identi...
setSceneMessageHandler(handler: (json: string) => void): void { this.sceneMessageHandler = handler; if (this.sceneReady) { handler('{"v":1,"type":"battle/ready","payload":{}}'); } }
https://github.com/terryma2024/happyword
97d0697bf77e284fb69f9485a954e40634a10527
github
PollenWang6/HiXD
entry/src/main/ets/pages/MainPage.ets
arkts
onColorModeChange
── 主题弹窗 ──
onColorModeChange(): void { // @StorageProp + @Watch 确保 AppStorage 变化时 @State 自动同步 this.currentThemeLabel = this.buildThemeLabel(this.systemColorMode); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onColorModeChange 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_...
onColorModeChange(): void { // @StorageProp + @Watch 确保 AppStorage 变化时 @State 自动同步 this.currentThemeLabel = this.buildThemeLabel(this.systemColorMode); }
https://github.com/PollenWang6/HiXD
cd208e20ad45e102017df9f18b1209d3eb7d21fc
github
openharmony/applications_settings
product/phone/src/main/ets/pages/system/languageSettings/languageAndRegion/selectRegion.ets
arkts
getData
从数据源获取指定索引值的数据项 @param index 数据源索引值 @return 对应索引值的数据项
public getData(index: number): string { return this.regionArray[index]; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getData 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 ...
public getData(index: number): string { return this.regionArray[index]; }
https://gitee.com/openharmony/applications_settings.git
f0f22e0b2042759d8beefd1b733c5510d73364c8
gitee
OMGCA/sakipay
sakipay_hmos/main/src/main/ets/viewmodels/DashboardViewModel.ets
arkts
getVoluntaryOTWeeklyText
Formatted weekly voluntary OT earnings string, or empty string if zero.
public getVoluntaryOTWeeklyText(): string { if (this.voluntaryOTWeeklyEarnings <= 0) { return '' } return this.voluntaryOTWeeklyEarnings.toFixed(2) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getVoluntaryOTWeeklyText 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 s...
public getVoluntaryOTWeeklyText(): string { if (this.voluntaryOTWeeklyEarnings <= 0) { return '' } return this.voluntaryOTWeeklyEarnings.toFixed(2) }
https://github.com/OMGCA/sakipay
f63c6e7783eb8088ffe168dafece2c7ad66fe305
github
CLMC2025/Vignette
entry/src/main/ets/manager/UserStateManager.ets
arkts
isValidProgress
验证进度数据有效性
private isValidProgress(progress: object): boolean { const p: Record<string, object | string | number | string[]> = progress as Record<string, object | string | number | string[]>; const stateValues: string[] = USER_WORD_STATE_VALUES; return ( p !== null && typeof p.wordId === 'string' && ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left isValidProgress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left progress AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#object#Left object AST#ob...
private isValidProgress(progress: object): boolean { const p: Record<string, object | string | number | string[]> = progress as Record<string, object | string | number | string[]>; const stateValues: string[] = USER_WORD_STATE_VALUES; return ( p !== null && typeof p.wordId === 'string' && ...
https://github.com/CLMC2025/Vignette
62622ed7243bde95cf726e1bc85086ee6968229c
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/network/PairingManager.ets
arkts
buildPairUrl
构建配对请求 URL
private buildPairUrl(params: string): string { return `${this.baseUrl}/pair?uniqueid=${this.uniqueId}&clientname=${encodeURIComponent(this.clientName)}&${params}`; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildPairUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left params AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
private buildPairUrl(params: string): string { return `${this.baseUrl}/pair?uniqueid=${this.uniqueId}&clientname=${encodeURIComponent(this.clientName)}&${params}`; }
https://github.com/AlkaidLab/moonlight-harmony
747f84064037c1d34368478db09e72e15668b064
github
harmonyos/codelabs
CanvasComponent/entry/src/main/ets/viewmodel/FillArcData.ets
arkts
constructor
The constructor of FillArcData. @param x The x-axis coordinate of the center of the arc. @param y The y-axis coordinate of the center of the arc. @param radius Radius of the arc. @param startAngle The start point of the arc, in radians. @param endAngle The end point of the arc, in radians. @param fillColor The fill col...
constructor(x: number, y: number, radius: number, startAngle: number, endAngle: number) { this.x = x; this.y = y; this.radius = radius; this.startAngle = startAngle; this.endAngle = endAngle; }
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 x AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#...
constructor(x: number, y: number, radius: number, startAngle: number, endAngle: number) { this.x = x; this.y = y; this.radius = radius; this.startAngle = startAngle; this.endAngle = endAngle; }
https://gitee.com/harmonyos/codelabs.git
b2e760eff870294b03dfaa5b31081109034cbb9c
gitee
openharmony/applications_calendar_data
datamanager/src/main/ets/processor/DefaultProcessor.ets
arkts
doInsert
插入的公共方法 @param rdbStore rdb数据库 @param uri DataShare的uri @param values 插入的数据 @param callback 回调方法
doInsert(rdbStore: data_rdb.RdbStore, uri: string, values: data_rdb.ValuesBucket, callback: Function) { const table = getTableByUri(uri); rdbStore.insert(table, values, (err, rowId) => { Log.log(this.logTag, `insert ${table} before callback`); callback(err, rowId); if (hasNoError(err)) { ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left doInsert AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left rdbStore AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Left d...
doInsert(rdbStore: data_rdb.RdbStore, uri: string, values: data_rdb.ValuesBucket, callback: Function) { const table = getTableByUri(uri); rdbStore.insert(table, values, (err, rowId) => { Log.log(this.logTag, `insert ${table} before callback`); callback(err, rowId); if (hasNoError(err)) { ...
https://gitee.com/openharmony/applications_calendar_data.git
7059476b4a3b7299e79459d1e42887d80caa70d9
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Array.ets
arkts
length
Set the length of the array. @param { int } newLen The new length of the array. @returns { void } @syscap SystemCapability.Utils.Lang @FaAndStageModel
set length(newLen: int) { const len = newLen if (len < 0 || len > this.actualLength) { throw new RangeError("can't change length to bigger or negative") } if (len == 0) { this.buffer = new FixedArray<Any>(Array.INIT_CAPACITY) } else { const...
AST#program#Left AST#ERROR#Left AST#set#Left set AST#set#Right AST#call_expression#Left AST#identifier#Left length AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left newLen AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#Right AST#ERR...
set length(newLen: int) { const len = newLen if (len < 0 || len > this.actualLength) { throw new RangeError("can't change length to bigger or negative") } if (len == 0) { this.buffer = new FixedArray<Any>(Array.INIT_CAPACITY) } else { const...
https://gitcode.com/iop123123/arkts-static-skills
f8a501a64a966d15ea799231dbb136cf1381822f
gitcode
openharmony-sig/applications_calculator
feature/calculation/src/main/ets/calculator/OperationView.ets
arkts
checkInputIncludeInvalid
判断textInput里是否为"无效输入", 当为无效输入时,禁止复制和剪切操作 @param value: 输入值
checkInputIncludeInvalid(value: string): void { let text = this.context.resourceManager.getStringSync($r('app.string.invalid_input').id); if (text === this.displayExpression) { this.enableCopyOrCut = false; } else { this.enableCopyOrCut = true; } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left checkInputIncludeInvalid 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 string AST#identifier#Right AS...
checkInputIncludeInvalid(value: string): void { let text = this.context.resourceManager.getStringSync($r('app.string.invalid_input').id); if (text === this.displayExpression) { this.enableCopyOrCut = false; } else { this.enableCopyOrCut = true; } }
https://gitee.com/openharmony-sig/applications_calculator.git
c27bca675e3562ab473ffe89f2487024621faf34
gitee
richshaw2015/nds
ohos/entry/src/main/ets/pages/GameView.ets
arkts
onPageShow
页面重新显示时恢复全屏和屏幕常亮 对齐 Android EmulatorActivity.onResume(): 无活跃覆盖层时自动恢复模拟 Requirements: 8.4
onPageShow(): void { this.restoreFullscreen(); this.setKeepScreenOn(true); // 从设置页面返回时重新加载按键映射 this.loadInputMappings(); // 从设置页面返回时重新读取 FPS 计数器设置 this.setupFpsCounter(); // 从设置页面返回时同步倒带设置到 Native 层 this.applyRewindSettings(); // 从设置页面返回时重新加载输入设置 (透明度、触屏按键行为、触摸震动) this.loadInpu...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onPageShow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#L...
onPageShow(): void { this.restoreFullscreen(); this.setKeepScreenOn(true); // 从设置页面返回时重新加载按键映射 this.loadInputMappings(); // 从设置页面返回时重新读取 FPS 计数器设置 this.setupFpsCounter(); // 从设置页面返回时同步倒带设置到 Native 层 this.applyRewindSettings(); // 从设置页面返回时重新加载输入设置 (透明度、触屏按键行为、触摸震动) this.loadInpu...
https://github.com/richshaw2015/nds
545b472f669dc072cd4f01bf644420fcb6676fc4
github
Tianpei-Shi/MusicDash
src/services/CloudDBService.ets
arkts
initialize
初始化云数据库
async initialize(): Promise<boolean> { if (this.initialized) { return true; } try { // 暂时使用模拟实现 console.log('云数据库初始化成功(模拟)'); this.initialized = true; return true; } catch (error) { console.error('云数据库初始化失败:', error); return false; } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left initialize AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#...
async initialize(): Promise<boolean> { if (this.initialized) { return true; } try { // 暂时使用模拟实现 console.log('云数据库初始化成功(模拟)'); this.initialized = true; return true; } catch (error) { console.error('云数据库初始化失败:', error); return false; } }
https://github.com/Tianpei-Shi/MusicDash
7d4dcc63c53de566a33689df78c8c13f45fd2a98
github
mqxu/HarmonyOS_In_Action
examples/01_foundation/F001_hello_world/entry/src/main/ets/utils/StringUtil.ets
arkts
formatMessage
格式化消息文本 @param template 模板字符串 @param count 计数值 @returns 格式化后的字符串
static formatMessage(template: string, count: number): string { if (count === 0) { return template; } return `${template} ${count}`; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left formatMessage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left template AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#...
static formatMessage(template: string, count: number): string { if (count === 0) { return template; } return `${template} ${count}`; }
https://github.com/mqxu/HarmonyOS_In_Action
1ab6cea11ec3d28d50f612ae38d4ab27f7a1f8fe
github
qiuhaotc/Sunshine_HarmonyOS
entry/src/main/ets/pages/AboutPage.ets
arkts
openUrl
打开浏览器访问URL
private openUrl(url: string): void { try { const context = getContext(this) as common.UIAbilityContext; context.startAbility({ action: 'ohos.want.action.viewData', entities: ['entity.system.browsable'], uri: url }).then(() => { console.info('Successfully opened UR...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left openUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string...
private openUrl(url: string): void { try { const context = getContext(this) as common.UIAbilityContext; context.startAbility({ action: 'ohos.want.action.viewData', entities: ['entity.system.browsable'], uri: url }).then(() => { console.info('Successfully opened UR...
https://github.com/qiuhaotc/Sunshine_HarmonyOS
d168fd282c63a5038a57671a6d4e91368b54084d
github
CarGuo/GSYGithubAppOH
entry/src/main/ets/entryability/EntryAbility.ets
arkts
handleBootTabInjection
测试通道:want.parameters.bootTab=dynamic|trend|my, 通过 AppStorage 推送给 HomePage,绕开 uinput 在 navIndicator 区误触桌面的问题。
private handleBootTabInjection(want: Want): void { const params: Record<string, Object> | undefined = want.parameters as Record<string, Object> | undefined; if (!params) { return; } const raw: Object | undefined = params[PARAM_BOOT_TAB]; if (typeof raw !== 'string') { return; } ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleBootTabInjection 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#identi...
private handleBootTabInjection(want: Want): void { const params: Record<string, Object> | undefined = want.parameters as Record<string, Object> | undefined; if (!params) { return; } const raw: Object | undefined = params[PARAM_BOOT_TAB]; if (typeof raw !== 'string') { return; } ...
https://github.com/CarGuo/GSYGithubAppOH
0ec60753200db6f12750e254e907aa4662f55b2b
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/listener/BarLineChartTouchListener.ets
arkts
inverted
Returns true if the current touch situation should be interpreted as inverted, false if not. @return
private inverted(): boolean { return (this.mClosestDataSetToTouch == null && this.mChart.isAnyAxisInverted()) || (this.mClosestDataSetToTouch != null && this.mChart.isInverted(this.mClosestDataSetToTouch.getAxisDependency())); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left inverted 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#b...
private inverted(): boolean { return (this.mClosestDataSetToTouch == null && this.mChart.isAnyAxisInverted()) || (this.mClosestDataSetToTouch != null && this.mChart.isInverted(this.mClosestDataSetToTouch.getAxisDependency())); }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
e613b473be9cb4a8670bdcd490d3139fca66a74d
gitee
AlkaidLab/moonlight-harmony
entry/src/main/ets/utils/BackgroundImageUtil.ets
arkts
setDisclaimerAccepted
设置用户已同意背景图免责声明
async setDisclaimerAccepted(): Promise<void> { try { await PreferencesUtil.put(BACKGROUND_DISCLAIMER_ACCEPTED_KEY, true); } catch (err) { console.error('BackgroundImageUtil: 保存免责声明状态失败', err); } }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left setDisclaimerAccepted 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 AS...
async setDisclaimerAccepted(): Promise<void> { try { await PreferencesUtil.put(BACKGROUND_DISCLAIMER_ACCEPTED_KEY, true); } catch (err) { console.error('BackgroundImageUtil: 保存免责声明状态失败', err); } }
https://github.com/AlkaidLab/moonlight-harmony
c05dff168ed1e851298f85268dc91f83cf809b38
github
terryma2024/happyword
harmonyos/entry/src/main/ets/services/CocosBattleBridge.ets
arkts
handleSubmit
Mirrors BattlePage.onOptionTap / handleSpellSubmit around the engine.
private handleSubmit(option: string): void { if (this.holdActive) { // Duplicate tap racing the 650 ms feedback hold — drop it (BattlePage // parity: option buttons are disabled while feedbackTimer is pending). return; } const state: BattleState = this.engine.getState(); if (state.st...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleSubmit AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left option AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
private handleSubmit(option: string): void { if (this.holdActive) { // Duplicate tap racing the 650 ms feedback hold — drop it (BattlePage // parity: option buttons are disabled while feedbackTimer is pending). return; } const state: BattleState = this.engine.getState(); if (state.st...
https://github.com/terryma2024/happyword
3586a8b0f65a8e880f3423a21b5335efebecb26d
github
zgzm78/VMALL
entry/src/main/ets/common/utils/SearchHistoryManager.ets
arkts
addHistory
添加搜索历史记录 @param keyword 搜索关键词
public async addHistory(keyword: string): Promise<void> { if (!keyword || keyword.trim().length === 0) { return; } // 移除已存在的相同关键词 this.searchHistory = this.searchHistory.filter(item => item !== keyword); // 添加到历史记录开头 this.searchHistory.unshift(keyword); // 限制历史记录数量 if ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left addHistory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left keyword AST#identifier#Right AST#ERROR#Left AST#:#Left : AST...
public async addHistory(keyword: string): Promise<void> { if (!keyword || keyword.trim().length === 0) { return; } // 移除已存在的相同关键词 this.searchHistory = this.searchHistory.filter(item => item !== keyword); // 添加到历史记录开头 this.searchHistory.unshift(keyword); // 限制历史记录数量 if ...
https://github.com/zgzm78/VMALL
4f2eb7c23a5bf2fff4d98ca9f98fc21074dbb7f8
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/DataManager.ets
arkts
cleanDuplicateChapters
清理重复的章节 @param comicId 漫画ID @returns 删除的重复章节数量
async cleanDuplicateChapters(comicId: string): Promise<number> { try { logger.info(TAG, `开始清理漫画 ${comicId} 的重复章节`); let totalDeleted = 0; // [修复] 先尝试清理 online_chapter 表(WebView图源) try { const onlineSql = `SELECT id, externalId, title, \`index\`, createTime FROM online...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left cleanDuplicateChapters AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left comicId AST#identifier#Right AST#type_annotatio...
async cleanDuplicateChapters(comicId: string): Promise<number> { try { logger.info(TAG, `开始清理漫画 ${comicId} 的重复章节`); let totalDeleted = 0; // [修复] 先尝试清理 online_chapter 表(WebView图源) try { const onlineSql = `SELECT id, externalId, title, \`index\`, createTime FROM online...
https://github.com/DaLongZhuaZi/manxia
079bfa1e657bd4ca5c1a3aea5950fc177a7073fd
github
xblLab/HarmonyProjectTemplate
commons/lib_account/src/main/ets/services/AccountApi.ets
arkts
checkLogin
判断是否登录 @returns
public checkLogin(): boolean { return this.userInfoModel.isLogin; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left checkLogin 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#bo...
public checkLogin(): boolean { return this.userInfoModel.isLogin; }
https://github.com/xblLab/HarmonyProjectTemplate
1c28c3d6963ec64ea7b00ade7b4cb344ecc93d9d
github
Joker-x-dev/CoolMallArkTS
feature/order/src/main/ets/viewmodel/OrderConfirmViewModel.ets
arkts
convertSelectedGoodsToCartList
将已选商品列表转换为购物车列表 @param {SelectedGoods[]} goodsList 已选商品列表 @returns {Cart[]} 购物车列表
private convertSelectedGoodsToCartList(goodsList: SelectedGoods[]): Cart[] { // 按商品ID分组 const groupedMap = new Map<number, SelectedGoods[]>(); for (const goods of goodsList) { const existingList = groupedMap.get(goods.goodsId); if (existingList) { existingList.push(goods); } els...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left convertSelectedGoodsToCartList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left goodsList AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Rig...
private convertSelectedGoodsToCartList(goodsList: SelectedGoods[]): Cart[] { // 按商品ID分组 const groupedMap = new Map<number, SelectedGoods[]>(); for (const goods of goodsList) { const existingList = groupedMap.get(goods.goodsId); if (existingList) { existingList.push(goods); } els...
https://github.com/Joker-x-dev/CoolMallArkTS
c5a344454568d7a4f0a958ba36a69879b6d9ef21
github
AetheriumSimulator/qemu-hmos
entry/src/main/ets/utils/RDPInputHandler.ets
arkts
hide
隐藏虚拟键盘
hide() { this.isVisible = false }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hide AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#as...
hide() { this.isVisible = false }
https://github.com/AetheriumSimulator/qemu-hmos
579a6fac89855b34239026dea856d49cf624ce43
github
arkui-x/samples
CodeLab/Cases/feature/customscan/src/main/ets/components/ScanLine.ets
arkts
imageAnimation
扫描线动画参数
@Extend(Image) function imageAnimation(speed: number, linePosition: number, allAngle: number) { .position({ x: 0, y: -0.5 }) .width('100%') .height(130) .scale({ y: Math.max(speed, 0.007) }) .position({ x: 0, y: linePosition + '%' }) .rotate({ x: 1, angle: allAngle, centerX: 0, cen...
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#call_expression#Left AST#identifier#Left Extend AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left Image AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#...
@Extend(Image) function imageAnimation(speed: number, linePosition: number, allAngle: number) { .position({ x: 0, y: -0.5 }) .width('100%') .height(130) .scale({ y: Math.max(speed, 0.007) }) .position({ x: 0, y: linePosition + '%' }) .rotate({ x: 1, angle: allAngle, centerX: 0, cen...
https://gitcode.com/arkui-x/samples
43fdd82aa4a3322b665cf64b5f2e37b1808b74b8
gitcode
Joker-x-dev/CoolMallArkTS
feature/order/src/main/ets/viewmodel/OrderListViewModel.ets
arkts
toGoodsDetailForRebuy
跳转到指定商品详情页面(再次购买) @param {number} goodsId - 商品 ID @returns {void} 无返回值
toGoodsDetailForRebuy(goodsId: number): void { if (!goodsId) { return; } GoodsNavigator.toDetail(goodsId); this.hideRebuyModal(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toGoodsDetailForRebuy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left goodsId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ...
toGoodsDetailForRebuy(goodsId: number): void { if (!goodsId) { return; } GoodsNavigator.toDetail(goodsId); this.hideRebuyModal(); }
https://github.com/Joker-x-dev/CoolMallArkTS
132654227541580d0c22de83ee21b86331327155
github
apap6628114/nga_oh
entry/src/main/ets/parser/bbcode/lexer.ets
arkts
resolveMediaUrl
解析 [flash] / [flash=video] / [flash=audio] 标签内的媒体 URL。 与 AttachUrl.resolveAttachUrl(附件对象字段语义)不同:此处保留 BBCode 原有语义—— http 原样、`./mon_` / `/mon_` 拼 CDN、其余原样返回,不剥离后缀(视频/音频扩展名有意义)。 @param raw [flash] 标签原始内容 @returns 可访问的媒体 URL
function resolveMediaUrl(raw: string): string { if (raw.startsWith('http')) return raw if (raw.startsWith('./mon_') || raw.startsWith('/mon_')) { const path: string = raw.startsWith('./') ? raw.substring(1) : raw return NGA_CDN_BASE + path } return raw }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left resolveMediaUrl AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left raw AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#R...
function resolveMediaUrl(raw: string): string { if (raw.startsWith('http')) return raw if (raw.startsWith('./mon_') || raw.startsWith('/mon_')) { const path: string = raw.startsWith('./') ? raw.substring(1) : raw return NGA_CDN_BASE + path } return raw }
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/parser/bbcode/lexer.ets#L37-L44
040c34712d0e08928fe9c139ef06c034ecfb73fa
github
YDYm233/EasyRandom_HarmonyNextApp
product/wearable/src/main/ets/utils/WearScreenUtil.ets
arkts
mainImageWidth
主图/主元素宽度占比
static get mainImageWidth(): string { const screenSize = WearScreenUtil.screenSize; if (WearScreenUtil.isRoundScreen()) { if (screenSize === 'small') return '48%'; if (screenSize === 'large') return '60%'; // 暂无此设备,预留 return '55%'; // standard } if (screenSize === 'small') return ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left get AST#identifier#Right AST#call_expression#Left AST#identifier#Left mainImageWidth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L...
static get mainImageWidth(): string { const screenSize = WearScreenUtil.screenSize; if (WearScreenUtil.isRoundScreen()) { if (screenSize === 'small') return '48%'; if (screenSize === 'large') return '60%'; // 暂无此设备,预留 return '55%'; // standard } if (screenSize === 'small') return ...
https://github.com/YDYm233/EasyRandom_HarmonyNextApp
05697221aee18272bce5998b4399a12d85b95c8b
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/GamepadManager.ets
arkts
initializeDeviceListener
初始化设备监听
private initializeDeviceListener(): void { // 监听设备热插拔 inputDevice.on('change', (data) => { console.info(`[GAMEPAD] 系统输入设备变化: type=${data.type}, deviceId=${data.deviceId}`); if (data.type === 'add') { this.handleDeviceAdded(data.deviceId); // 同时刷新 USB 设备,因为新的 USB 手柄插入也会触发此事件 ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left initializeDeviceListener 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#Righ...
private initializeDeviceListener(): void { // 监听设备热插拔 inputDevice.on('change', (data) => { console.info(`[GAMEPAD] 系统输入设备变化: type=${data.type}, deviceId=${data.deviceId}`); if (data.type === 'add') { this.handleDeviceAdded(data.deviceId); // 同时刷新 USB 设备,因为新的 USB 手柄插入也会触发此事件 ...
https://github.com/AlkaidLab/moonlight-harmony
b7762ba4126ce6dcdeda974321634aa9ca1d0fc8
github
openharmony/xts_tools
sample/AppSampleD/entry/src/ohosTest/ets/test/Index.test.ets
arkts
checkAndClickById
根据id拿到组件并点击 @param id
async function checkAndClickById(id: string, log: string) { hilog.info(DOMAIN, TAG, BUNDLE + `${log} id:${id}`); await driver.assertComponentExist(ON.id(id)); let res = await driver.findComponent(ON.id(id)); await res.click(); }
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left checkAndClickById AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#typ...
async function checkAndClickById(id: string, log: string) { hilog.info(DOMAIN, TAG, BUNDLE + `${log} id:${id}`); await driver.assertComponentExist(ON.id(id)); let res = await driver.findComponent(ON.id(id)); await res.click(); }
https://gitee.com/openharmony/xts_tools.git
556118b6ff41ae2f9a248f5d971230ba2826b386
gitee
Joker-x-dev/CoolMallArkTS
core/designsystem/src/main/ets/component/Column.ets
arkts
build
渲染布局 @returns {void} 无返回值 @example ColumnCenterStart() { Text("Hi"); }
build(): void { ColumnBase({ options: this.options, justifyContent: FlexAlign.Center, alignItems: HorizontalAlign.Start, widthValue: this.widthValue, heightValue: this.heightValue, sizeValue: this.sizeValue, paddingValue: this.paddingValue, marginValue: this.marginV...
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 { ColumnBase({ options: this.options, justifyContent: FlexAlign.Center, alignItems: HorizontalAlign.Start, widthValue: this.widthValue, heightValue: this.heightValue, sizeValue: this.sizeValue, paddingValue: this.paddingValue, marginValue: this.marginV...
https://github.com/Joker-x-dev/CoolMallArkTS
412f6eca09f6e47a0182fcf2893b061764d86ab9
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
keys
Returns keys of the Int8Array @returns iterator over keys
public keys(): ValuesIterator<Int> { let ret: Int[] = new Int[this.length]; for (let i: int = 0; i < this.length; i++) { ret[i] = i; } return new ValuesIterator<Int>(ret); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left keys AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Righ...
public keys(): ValuesIterator<Int> { let ret: Int[] = new Int[this.length]; for (let i: int = 0; i < this.length; i++) { ret[i] = i; } return new ValuesIterator<Int>(ret); }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
e0abba7b57b4f6df20648693ad67f01a57339939
gitee
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/model/SharedLedger.ets
arkts
setAttachments
设置附件列表
setAttachments(attachments: string[]): void { this.attachmentsJson = JSON.stringify(attachments); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setAttachments AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left attachments AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#[#Left [ AST#[#Right AST#]...
setAttachments(attachments: string[]): void { this.attachmentsJson = JSON.stringify(attachments); }
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
219c94a24c56bf868c6189cc9c8b598ffeb30319
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/AsyncLinkedConcurrentQueue.ets
arkts
resumeProducersIfQueueWasFull
Wakes one waiting producer after a transition from full to non-full. This notification is performed after releasing the pop-side mutex. @param { int } previousSize The queue size before the dequeue. @returns { void } No return value. @syscap SystemCapability.Utils.Lang @FaAndStageModel
private resumeProducersIfQueueWasFull(previousSize: int): void { if (previousSize == this.actualCapacity) { this.resumePushQueue(); } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left resumeProducersIfQueueWasFull AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left previousSize AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identif...
private resumeProducersIfQueueWasFull(previousSize: int): void { if (previousSize == this.actualCapacity) { this.resumePushQueue(); } }
https://gitcode.com/iop123123/arkts-static-skills
4626aa247663d34d27ba92d5d3b04575f62820bb
gitcode
terryma2024/happyword
harmonyos/entry/src/main/ets/services/CloudWishlistService.ets
arkts
cachedItems
Returns the cloud-overlay items currently cached (last fetch).
cachedItems(): CloudWishlistItem[] { const out: CloudWishlistItem[] = []; for (let i = 0; i < this.cached.length; i++) { out.push(this.cached[i]); } return out; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left cachedItems 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 CloudWishlistItem AST#identifier#Right AST#[#Left ...
cachedItems(): CloudWishlistItem[] { const out: CloudWishlistItem[] = []; for (let i = 0; i < this.cached.length; i++) { out.push(this.cached[i]); } return out; }
https://github.com/terryma2024/happyword
381293b790517fbc311fcbdd1e25fd108a1a35bb
github
LJ666-ui/harmony-health-care
entry/src/main/ets/ar/VoiceGuide.ets
arkts
simulateSpeakDelay
模拟播报延迟
private async simulateSpeakDelay(text: string): Promise<void> { // 根据文本长度估算播报时间 const duration = text.length * 100; // 约100ms/字 await new Promise<void>((resolve: () => void) => { setTimeout(() => { resolve(); }, duration); }); }
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 simulateSpeakDelay AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Le...
private async simulateSpeakDelay(text: string): Promise<void> { // 根据文本长度估算播报时间 const duration = text.length * 100; // 约100ms/字 await new Promise<void>((resolve: () => void) => { setTimeout(() => { resolve(); }, duration); }); }
https://github.com/LJ666-ui/harmony-health-care
51bdc44b251aa783854b8e3648182557fb7c605a
github
openharmony/arkcompiler_taihe_ffi_gen
test/ani_tuple/user/main.ets
arkts
testSumIntPair
====== Test 2: IntPair - pass in and compute ======
function testSumIntPair() { let pair: TupleTest.IntPair = [3, 7]; let sum = TupleTest.sumIntPair(pair); console.log("sumIntPair: " + sum); arktest.assertEQ(sum, 10); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testSumIntPair AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#lexical_decl...
function testSumIntPair() { let pair: TupleTest.IntPair = [3, 7]; let sum = TupleTest.sumIntPair(pair); console.log("sumIntPair: " + sum); arktest.assertEQ(sum, 10); }
https://gitcode.com/openharmony/arkcompiler_taihe_ffi_gen
82ffd637d6dc60f17937238bfb84a6799cf3b20e
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/TrackpadGestureHandler.ets
arkts
handleEvent
==================== 事件入口 ====================
handleEvent(event: TouchEvent): void { const touches = event.touches; const changedTouches = event.changedTouches; switch (event.type) { case TouchType.Down: this.onDown(touches, changedTouches); break; case TouchType.Move: this.onMove(touches); break; cas...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left handleEvent 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 ...
handleEvent(event: TouchEvent): void { const touches = event.touches; const changedTouches = event.changedTouches; switch (event.type) { case TouchType.Down: this.onDown(touches, changedTouches); break; case TouchType.Move: this.onMove(touches); break; cas...
https://github.com/AlkaidLab/moonlight-harmony
5e3140c6cc206f9c3b8bfce9fa1db58989ca7b85
github
LZZLHY/hlib
entry/src/main/ets/viewmodel/DownloadVM.ets
arkts
markCompleted
流式下载完成:搬入历史 + 清状态。
private static markCompleted(dt: DownloadTask, written: number, total: number): void { const next: DownloadTask = DownloadRepository.cloneTask(dt); next.status = 'completed'; next.progress = 100; next.receivedBytes = written; next.totalBytes = total > 0 ? total : written; DownloadRepository.up...
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 markCompleted AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dt AST#identifier#Right AST#:#Left : A...
private static markCompleted(dt: DownloadTask, written: number, total: number): void { const next: DownloadTask = DownloadRepository.cloneTask(dt); next.status = 'completed'; next.progress = 100; next.receivedBytes = written; next.totalBytes = total > 0 ? total : written; DownloadRepository.up...
https://github.com/LZZLHY/hlib
b648d7a4be18b9b9b9357c7db5341e708c773286
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test20_original_index.ets
arkts
testArrayReduce
--- Array.reduce ---
function testArrayReduce(): string { let nums: number[] = [1, 2, 3, 4, 5]; let sum: number = 0; for (let i: number = 0; i < nums.length; i++) { sum = sum + nums[i]; } let product: number = 1; for (let i: number = 0; i < nums.length; i++) { product = product * nums[i]; } return String(sum) + ',' ...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testArrayReduce 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 testArrayReduce(): string { let nums: number[] = [1, 2, 3, 4, 5]; let sum: number = 0; for (let i: number = 0; i < nums.length; i++) { sum = sum + nums[i]; } let product: number = 1; for (let i: number = 0; i < nums.length; i++) { product = product * nums[i]; } return String(sum) + ',' ...
https://github.com/miaochiahao/ark-ghidra
8cbc517b2e8fb9f73d40459353afd2e493f88644
github
HarmonyOS_Samples/guide-snippets
Ability/ApplicationContextDemo/entry/src/main/ets/entrylifecycleability/EntryLifecycleAbility.ets
arkts
onWindowStageDestroy
当窗口被销毁时被调用
onWindowStageDestroy(uiAbility, windowStage: window.WindowStage) { hilog.info(DOMAIN_NUMBER, TAG, `onWindowStageDestroy uiAbility.launchWant: ${JSON.stringify(uiAbility.launchWant)}`); hilog.info(DOMAIN_NUMBER, TAG, `onWindowStageDestroy windowStage: ${JSON.stringify(windowStage)}`); },
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#identifier#Left uiAbility AST#identifier#Right AST#,#Left , AST#,#Right AST#member_expression#Left AST#identifier#Left windowStage AST#ide...
onWindowStageDestroy(uiAbility, windowStage: window.WindowStage) { hilog.info(DOMAIN_NUMBER, TAG, `onWindowStageDestroy uiAbility.launchWant: ${JSON.stringify(uiAbility.launchWant)}`); hilog.info(DOMAIN_NUMBER, TAG, `onWindowStageDestroy windowStage: ${JSON.stringify(windowStage)}`); },
https://gitcode.com/HarmonyOS_Samples/guide-snippets
1eb0c37adae06f0fdc33fd1c3a06dd532785f504
gitcode
Goway-Hui/harmonyos-next-dev
harmonyos-next-dev/assets/common-page-structure.ets
arkts
loadData
==================== 数据加载 ====================
loadData(): void { // 模拟网络请求 // ... }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left loadData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left A...
loadData(): void { // 模拟网络请求 // ... }
https://github.com/Goway-Hui/harmonyos-next-dev
35a626624ca80e44ec73cc9773e40fb762127e0e
github
Yebingiscn/SweetVideo
entry/src/main/ets/utils/IsoFileUtil.ets
arkts
getIsoInfo
获取ISO文件信息 @param isoPath ISO文件路径 @returns ISO文件信息
static async getIsoInfo(isoPath: string): Promise<IsoFileInfo | null> { try { const type = await IsoFileUtil.detectIsoType(isoPath); const playablePath = await IsoFileUtil.getPlayablePath(isoPath); // 从文件名提取标题 const fileName = isoPath.split('/').pop() || '' const title = fileName.re...
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 getIsoInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isoPath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST...
static async getIsoInfo(isoPath: string): Promise<IsoFileInfo | null> { try { const type = await IsoFileUtil.detectIsoType(isoPath); const playablePath = await IsoFileUtil.getPlayablePath(isoPath); // 从文件名提取标题 const fileName = isoPath.split('/').pop() || '' const title = fileName.re...
https://github.com/Yebingiscn/SweetVideo
2bbcec178bf0e536af7172d5823361d4c399f228
github
Tencent-RTC/TUIKit_Harmony
atomic_x/src/main/ets/basecomponent/language/LanguageState.ets
arkts
calculateLayoutDirection
Calculate layout direction based on language code
private calculateLayoutDirection(languageCode: string): LayoutDirection { const isRTL: boolean = LanguageState.RTL_LANGUAGES.some((lang: string): boolean => languageCode.startsWith(lang) ); return isRTL ? LayoutDirection.RTL : LayoutDirection.LTR; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left calculateLayoutDirection AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left languageCode AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left ...
private calculateLayoutDirection(languageCode: string): LayoutDirection { const isRTL: boolean = LanguageState.RTL_LANGUAGES.some((lang: string): boolean => languageCode.startsWith(lang) ); return isRTL ? LayoutDirection.RTL : LayoutDirection.LTR; }
https://github.com/Tencent-RTC/TUIKit_Harmony
183f874f9bbbad4d68b387cb15ac577750fd2d08
github
CLMC2025/Vignette
entry/src/main/ets/context/ContextValidator.ets
arkts
isSuitableForOffline
检查语境是否适合离线生成
isSuitableForOffline(context: string): boolean { // 检查词汇复杂度 const words = context.split(/\s+/); const avgWordLength = context.replace(/\s+/g, '').length / words.length; // 如果平均词长超过12,可能不适合离线模板 if (avgWordLength > 12) { return false; } return true; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isSuitableForOffline AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left context AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left )...
isSuitableForOffline(context: string): boolean { // 检查词汇复杂度 const words = context.split(/\s+/); const avgWordLength = context.replace(/\s+/g, '').length / words.length; // 如果平均词长超过12,可能不适合离线模板 if (avgWordLength > 12) { return false; } return true; }
https://github.com/CLMC2025/Vignette
7cfc97b0fac208100472fed827a105ed0f1f81b4
github
AetheriumSimulator/qemu-hmos
entry/src/main/ets/utils/StoragePaths.ets
arkts
requestMediaPermissions
检查并申请媒体读写权限
static async requestMediaPermissions(context: common.UIAbilityContext): Promise<boolean> { const permissionList: Permissions[] = [ 'ohos.permission.READ_MEDIA', 'ohos.permission.WRITE_MEDIA', // 鸿蒙公开下载目录专用权限 'ohos.permission.READ_WRITE_DOWNLOAD_DIRECTORY' ] try { const a...
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 requestMediaPermissions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST...
static async requestMediaPermissions(context: common.UIAbilityContext): Promise<boolean> { const permissionList: Permissions[] = [ 'ohos.permission.READ_MEDIA', 'ohos.permission.WRITE_MEDIA', // 鸿蒙公开下载目录专用权限 'ohos.permission.READ_WRITE_DOWNLOAD_DIRECTORY' ] try { const a...
https://github.com/AetheriumSimulator/qemu-hmos
6c5db51050c3c00b1a830752a88704e76abbc997
github
AGenUI/AGenUI
playground/harmony/entry/src/main/ets/stability/StabilityScenarioEngine.ets
arkts
executeInterruptRecover
S6: Begin stream, interrupt (destroy), recreate
private executeInterruptRecover(): string | null { let sm = new SurfaceManager(this.context); sm.beginTextStream(); sm.receiveTextChunk(this.buildCreateSurfaceJSON('interrupt')); this.sleepSync(20); sm.destroy(); // interrupt mid-stream this.sleepSync(50); sm = new SurfaceManager(this.con...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left executeInterruptRecover 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...
private executeInterruptRecover(): string | null { let sm = new SurfaceManager(this.context); sm.beginTextStream(); sm.receiveTextChunk(this.buildCreateSurfaceJSON('interrupt')); this.sleepSync(20); sm.destroy(); // interrupt mid-stream this.sleepSync(50); sm = new SurfaceManager(this.con...
https://github.com/AGenUI/AGenUI
b2d41a89b290cd262cac567ce66298f82a27cb97
github
YANGZX22/Voot
entry/src/main/ets/entryability/EntryAbility.ets
arkts
handleShortcutPage
处理快捷方式跳转参数
private handleShortcutPage(want: Want): void { if (want.parameters && want.parameters['page']) { const page = want.parameters['page'] as string; console.info('[EntryAbility] Shortcut page: ' + page); // 将目标页面存储到 AppStorage,由页面组件监听并跳转 if (page === 'TranslationPage' || page === 'Polis...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleShortcutPage 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 handleShortcutPage(want: Want): void { if (want.parameters && want.parameters['page']) { const page = want.parameters['page'] as string; console.info('[EntryAbility] Shortcut page: ' + page); // 将目标页面存储到 AppStorage,由页面组件监听并跳转 if (page === 'TranslationPage' || page === 'Polis...
https://github.com/YANGZX22/Voot
25a9ea317bc37d283a90fe4145db8a60c1263d90
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/OnlineImageLoader.ets
arkts
waitForLoading
[新增] 等待URL加载完成
private async waitForLoading( url: string, cacheKey: string, options: OnlineLoadOptions, flowId: string ): Promise<image.PixelMap | null> { const maxWaitTime = 30000; // 最多等待30秒 const checkInterval = 100; // 每100ms检查一次 const startTime = Date.now(); while (this.loadingKeys.has(ca...
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 waitForLoading AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : ...
private async waitForLoading( url: string, cacheKey: string, options: OnlineLoadOptions, flowId: string ): Promise<image.PixelMap | null> { const maxWaitTime = 30000; // 最多等待30秒 const checkInterval = 100; // 每100ms检查一次 const startTime = Date.now(); while (this.loadingKeys.has(ca...
https://github.com/DaLongZhuaZi/manxia
cf26b031504d6c54e3c14e9ebc237542027e1e81
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
filter
creates a new Uint8ClampedArray from current Uint8ClampedArray based on a condition fn @param fn the condition to apply for each element @returns a new Uint8ClampedArray with elements from current Uint8ClampedArray that satisfy condition fn
public filter(fn: (val: number, index: int) => boolean): Uint8ClampedArray { let newF: (val: number, index: int, array: Uint8ClampedArray) => boolean = (val: number, index: int, array: Uint8ClampedArray): boolean => { return fn(val, index) } return this.filter(newF) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left filter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#R...
public filter(fn: (val: number, index: int) => boolean): Uint8ClampedArray { let newF: (val: number, index: int, array: Uint8ClampedArray) => boolean = (val: number, index: int, array: Uint8ClampedArray): boolean => { return fn(val, index) } return this.filter(newF) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
98eb2423f83ad8f825c7d2c8a1e7a365781f2379
gitee
openharmony/arkui_ace_engine
advanced_ui_component_static/assembled_advanced_ui_component/@ohos.arkui.advanced.DialogV2.ets
arkts
resolveKeyEvent
resolve content area keyEvent @param event keyEvent @param controller the controller of content area @returns undefined
function resolveKeyEvent(event: KeyEvent, controller: Scroller) { if (event.type === IGNORE_KEY_EVENT_TYPE) { return; } if (event.keyCode === KEYCODE_UP) { controller.scrollPage({ next: false }); event.stopPropagation(); } else if (event.keyCode === KEYCODE_DOWN) { if (contr...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left resolveKeyEvent AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left event AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:...
function resolveKeyEvent(event: KeyEvent, controller: Scroller) { if (event.type === IGNORE_KEY_EVENT_TYPE) { return; } if (event.keyCode === KEYCODE_UP) { controller.scrollPage({ next: false }); event.stopPropagation(); } else if (event.keyCode === KEYCODE_DOWN) { if (contr...
https://gitcode.com/openharmony/arkui_ace_engine
d8d208682dc2d1721db83b85c977a1481cb9ed9b
gitcode
pangpang20/antennaPodHM
entry/src/main/ets/service/DatabaseService.ets
arkts
updateEpisodeDownloadStatus
更新Episode下载状态
async updateEpisodeDownloadStatus(episodeId: string, status: number, progress: number, localPath?: string, fileSize?: number): Promise<void> { if (!this.rdbStore) { console.error('[DatabaseService] rdbStore is null'); return; } try { const valueBucket: relationalStore.ValuesBucket = { ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left updateEpisodeDownloadStatus AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left episodeId AST#ide...
async updateEpisodeDownloadStatus(episodeId: string, status: number, progress: number, localPath?: string, fileSize?: number): Promise<void> { if (!this.rdbStore) { console.error('[DatabaseService] rdbStore is null'); return; } try { const valueBucket: relationalStore.ValuesBucket = { ...
https://github.com/pangpang20/antennaPodHM
ef8fac15abc640e19997d498a85a36a8e06cdc4c
github
LJ666-ui/harmony-health-care
entry/src/main/ets/utils/DeviceTypeUtil.ets
arkts
is2In1
判断是否为2in1设备
public is2In1(): boolean { return this.currentDeviceType === DeviceType.TWO_IN_ONE; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left is2In1 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#boolea...
public is2In1(): boolean { return this.currentDeviceType === DeviceType.TWO_IN_ONE; }
https://github.com/LJ666-ui/harmony-health-care
a4b3531146074945b05faecc36209ddca6af95be
github
openharmony/applications_notes
common/utils/src/main/ets/default/baseUtil/FolderUtil.ets
arkts
getCommonFolder
Get common FolderData @param folderDataArray - Folder data list @param selectedNoteArray - Selected note data list @return FolderData - return folder when note data list belong to the same folder, else return null
getCommonFolder(folderDataArray: FolderData[], selectedNoteArray: NoteData[]): FolderData | null { if (selectedNoteArray.length == 0) { return null } let folderData: FolderData = this.getFolderData(folderDataArray, selectedNoteArray[0].folder_uuid) let currentFolderData: string | null = null; ...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getCommonFolder AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left folderDataArray AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Fol...
getCommonFolder(folderDataArray: FolderData[], selectedNoteArray: NoteData[]): FolderData | null { if (selectedNoteArray.length == 0) { return null } let folderData: FolderData = this.getFolderData(folderDataArray, selectedNoteArray[0].folder_uuid) let currentFolderData: string | null = null; ...
https://gitee.com/openharmony/applications_notes.git
67570b0b57e4c08d42f3065a273fd6766c7f1d8c
gitee
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets
arkts
toNearest
Returns a new Decimal whose value is the nearest multiple of `n`. @param { Value } n {double | string | Decimal} @returns { Decimal } the Decimal type
public toNearest(n: Value): Decimal { return this.toNearest(n, Decimal.rounding); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toNearest AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left n AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Value AST...
public toNearest(n: Value): Decimal { return this.toNearest(n, Decimal.rounding); }
https://gitcode.com/iop123123/arkts-static-skills
d679a02eadcebbc1ec048aa2d3d89e072c23bbd8
gitcode
openharmony/applications_calendar_data
datamanager/src/main/ets/processor/events/EventsProcessor.ets
arkts
updateInstances
批量刷新Instances @param rdbStore rdb数据库 @param updatedIds 待刷新的eventId列表
async function updateInstances(rdbStore: data_rdb.RdbStore, updatedIds: Array<number>) { if (updatedIds === null || updatedIds === undefined || updatedIds.length === 0) { return; } // 1.先批量查询出全部Events数据 const eventsMap: Map<number, Events> = await queryEventsByIds(rdbStore, updatedIds); if (eventsMap ==...
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left updateInstances AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left rdbStore AST#identifier#Right AST...
async function updateInstances(rdbStore: data_rdb.RdbStore, updatedIds: Array<number>) { if (updatedIds === null || updatedIds === undefined || updatedIds.length === 0) { return; } // 1.先批量查询出全部Events数据 const eventsMap: Map<number, Events> = await queryEventsByIds(rdbStore, updatedIds); if (eventsMap ==...
https://gitee.com/openharmony/applications_calendar_data.git
e1d2ccb39867341cfb82556f992c116780b6e052
gitee
RoooyHe/toona-ohos
toona/src/main/ets/pages/components/MessageBubble.ets
arkts
aboutToDisappear
组件销毁时释放播放器
aboutToDisappear() { if (this.avPlayer) { this.avPlayer.release(); } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToDisappear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#L...
aboutToDisappear() { if (this.avPlayer) { this.avPlayer.release(); } }
https://github.com/RoooyHe/toona-ohos
cea1197f253019a221816d544a889b07f1535a20
github
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnCheckboxViewModel.ets
arkts
setCheckboxValues1
设置复选框组1的选中值集合 @param values 新的选中值数组
setCheckboxValues1(values: Array<string | number>): void { this.checkboxValues1 = values; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setCheckboxValues1 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left values AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identifier#Left A...
setCheckboxValues1(values: Array<string | number>): void { this.checkboxValues1 = values; }
https://github.com/codelably/tuniao-ui
e317cfb32d35d02f522fc92f4006279ac5dc0817
github
751496032/ZRouter
RouterApi/src/main/ets/api/Router.ets
arkts
getNavStackByName
根据栈名获取路由栈,【初次调用会创建一个实例,并入参到Navigation构造方法中】 @param stackName @returns
public static getNavStackByName(stackName: string): NavPathStack { return ZRouter.getRouterMgr().getNavStackByName(stackName) }
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 getNavStackByName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left stackName AST#identifier#Right AST#ERROR#Left AST#:#...
public static getNavStackByName(stackName: string): NavPathStack { return ZRouter.getRouterMgr().getNavStackByName(stackName) }
https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/api/Router.ets#L253-L255
82131ee1458a0dd0cd7aa81fd9c6f8cff9399a22
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/usbdriver/SwitchProController.ets
arkts
forceUSB
强制 USB 模式
private async forceUSB(): Promise<boolean> { return await this.sendCommand(0x04, true); }
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 forceUSB AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Le...
private async forceUSB(): Promise<boolean> { return await this.sendCommand(0x04, true); }
https://github.com/AlkaidLab/moonlight-harmony
d4cb7c7d571a5f58b6ef34f04f49e3a7397b0ea5
github
wuba/omni-ui
omni_component/src/main/ets/components/chart/OmniChart.ets
arkts
onCountUpdated
自定义组件
onCountUpdated(options: Options<ChartUnionData>): void { this.isTooltipShow = false this.drawViewModel && this.drawViewModel.draw(this.context, this.options, this.renderType) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onCountUpdated AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left options AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identifier#Left Opti...
onCountUpdated(options: Options<ChartUnionData>): void { this.isTooltipShow = false this.drawViewModel && this.drawViewModel.draw(this.context, this.options, this.renderType) }
https://github.com/wuba/omni-ui
25569be4f24fc790c588ce0040105714a43856c2
github
offlinecat-dev/OCNetORM
src/main/ets/mapping/EntityDataInput.ets
arkts
create
创建 EntityDataInput 实例的便捷方法 @returns 新的 EntityDataInput 实例
static create(): EntityDataInput { return new EntityDataInput() }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left create AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left EntityDataInput...
static create(): EntityDataInput { return new EntityDataInput() }
https://github.com/offlinecat-dev/OCNetORM
0a1df8bd3eb9a95a458f2a15ddfbc9d19d0cc90c
github