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
openharmony/xts_tools
sample/AppSampleD/entry/src/ohosTest/ets/test/Index.test.ets
arkts
checkAndClickPermission
根据Text验证对应权限 @param text @param log
async function checkAndClickPermission(text: string, log: string) { hilog.info(DOMAIN, TAG, BUNDLE + `${log} text:${text}`); await driver.assertComponentExist(ON.text(getString($r('app.string.whether')) + text, MatchPattern.CONTAINS)); let res = await driver.findComponent(ON.text(text, MatchPattern.EQUALS...
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left checkAndClickPermission AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left text AST#identifier#Right...
async function checkAndClickPermission(text: string, log: string) { hilog.info(DOMAIN, TAG, BUNDLE + `${log} text:${text}`); await driver.assertComponentExist(ON.text(getString($r('app.string.whether')) + text, MatchPattern.CONTAINS)); let res = await driver.findComponent(ON.text(text, MatchPattern.EQUALS...
https://gitee.com/openharmony/xts_tools.git
e39187a1e221d8a0e8974eea54dad855332c076e
gitee
751496032/ZRouter
features/hspC/src/main/ets/pages/Index.ets
arkts
aboutToAppear
@State pathStack: NavPathStack = ZRouter.getNavStack()
aboutToAppear(): void { // this.message = ZRouter.getParamByName('hspCIndex').toString() // let param = JSON.stringify(ZRouter.getParam() || '') // this.message = param // 获取当前页的装饰器上参数 console.debug('aboutToAppear: ', JSON.stringify(ZRouter.getAnnotationParam())) console.debug('aboutToAppear...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc...
aboutToAppear(): void { // this.message = ZRouter.getParamByName('hspCIndex').toString() // let param = JSON.stringify(ZRouter.getParam() || '') // this.message = param // 获取当前页的装饰器上参数 console.debug('aboutToAppear: ', JSON.stringify(ZRouter.getAnnotationParam())) console.debug('aboutToAppear...
https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/features/hspC/src/main/ets/pages/Index.ets#L11-L20
29cef19f3bf7d6556caec4dc27b0d377a50c400f
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test11_original_index.ets
arkts
testArrayAt
=== Round 11: Array.at(), String.match(), String.replaceAll(), Object.entries(), for-in loop, comma operator (multi-expression), Logical OR assignment (||=) pattern, Multiple constructor overloads via static === --- Array.at() and negative indexing ---
function testArrayAt(): string { let arr: string[] = ['a', 'b', 'c', 'd', 'e']; let first: string = arr[0]; let last: string = arr[arr.length - 1]; let idx2: string = arr[2]; return first + ',' + last + ',' + idx2; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testArrayAt 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...
function testArrayAt(): string { let arr: string[] = ['a', 'b', 'c', 'd', 'e']; let first: string = arr[0]; let last: string = arr[arr.length - 1]; let idx2: string = arr[2]; return first + ',' + last + ',' + idx2; }
https://github.com/miaochiahao/ark-ghidra
e17621662ae82cc869b81ca0b06dd4e9fee80ae5
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/customkey/CustomKeyManager.ets
arkts
handleAction
── 按键动作分发 ── 处理自定义按键动作(键盘/鼠标/手柄/组合) 由 CustomKeyOverlay 回调触发
handleAction(action: KeyAction, isDown: boolean): void { const session = this.host.getSession(); if (!session) return; switch (action.type) { case 'keyboard': { const kbAction = action as KeyboardAction; session.sendKeyboardInput(kbAction.vk, isDown ? 0x03 : 0x04); break; ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left handleAction AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left action AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left KeyAction AST#identifier#Right AST#,#Left...
handleAction(action: KeyAction, isDown: boolean): void { const session = this.host.getSession(); if (!session) return; switch (action.type) { case 'keyboard': { const kbAction = action as KeyboardAction; session.sendKeyboardInput(kbAction.vk, isDown ? 0x03 : 0x04); break; ...
https://github.com/AlkaidLab/moonlight-harmony
582d5514d7fda9607d8cbd6c87cf6342d5081f74
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/DataValidator.ets
arkts
validateRequiredFields
验证对象是否包含必需字段 @param obj - 要验证的对象 @param requiredFields - 必需字段列表 @param objectName - 对象名称 @returns 验证结果
static validateRequiredFields(obj: Record<string, Object> | undefined | null, requiredFields: string[], objectName: string = 'object'): ValidationResult { const errors: string[] = []; if (obj === null || obj === undefined) { errors.push(`${objectName} 不能为空`); return new ValidationResultImpl(f...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left validateRequiredFields AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_exp...
static validateRequiredFields(obj: Record<string, Object> | undefined | null, requiredFields: string[], objectName: string = 'object'): ValidationResult { const errors: string[] = []; if (obj === null || obj === undefined) { errors.push(`${objectName} 不能为空`); return new ValidationResultImpl(f...
https://github.com/DaLongZhuaZi/manxia
7946636387b8d8e6b0627688ba9315282ca8a95f
github
JackJiang2011/harmonychat
entry/src/main/ets/IMClientManager.ets
arkts
releaseMobileIMSDK
释放IM框架所占用的资源,在退出登陆时请务必调用本方法,否则重新登陆将不能正常实现(指APP进程不退出时切换账号这种情况)。
releaseMobileIMSDK(): void { // 释放IM核心库资源 ClientCoreSDK.getInstance().release(); // 重置本类的初始化标识 this.resetInitFlag(); // 取消注册事件监听 this.unregisterSocketEvent(); // 清空聊天数据 this.messageProvider.clear(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left releaseMobileIMSDK 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...
releaseMobileIMSDK(): void { // 释放IM核心库资源 ClientCoreSDK.getInstance().release(); // 重置本类的初始化标识 this.resetInitFlag(); // 取消注册事件监听 this.unregisterSocketEvent(); // 清空聊天数据 this.messageProvider.clear(); }
https://github.com/JackJiang2011/harmonychat
758308214c9b87e5d6164ff098138bf7a63fc9ca
github
Tencent-RTC/TUIKit_Harmony
call/src/main/ets/feature/IncomingNotificationFeature.ets
arkts
publish
No-op pre-init or when foreground. Avatar fetch is best-effort.
async publish(): Promise<void> { if (!this.context) { Logger.warn('IncomingNotificationFeature.publish: not initialized'); return; } if (!AppStateObserver().isBackground()) { Logger.info('IncomingNotificationFeature.publish: foreground, skip'); return; } const state = CallS...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left publish AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#L...
async publish(): Promise<void> { if (!this.context) { Logger.warn('IncomingNotificationFeature.publish: not initialized'); return; } if (!AppStateObserver().isBackground()) { Logger.info('IncomingNotificationFeature.publish: foreground, skip'); return; } const state = CallS...
https://github.com/Tencent-RTC/TUIKit_Harmony
390c9e429b132f95b1835ec2a1d6d3546e781b7f
github
darcycui/DarcyHarmonyNext
entry/src/main/ets/pages/entry/custom/styles/modifier/Modifiers.ets
arkts
initializeModifier
初始化时候调用
initializeModifier(instance: ButtonAttribute): void { instance.backgroundColor(Color.Black) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left initializeModifier AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left instance AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ButtonAttribute AST#identifier#Ri...
initializeModifier(instance: ButtonAttribute): void { instance.backgroundColor(Color.Black) }
https://github.com/darcycui/DarcyHarmonyNext/blob/241d0ee75929f6b3f9e1fe5b550acf6c9533c15c/entry/src/main/ets/pages/entry/custom/styles/modifier/Modifiers.ets#L30-L32
82c79496272d51f82abcb0306b7fd61533877f78
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelSettingsManager.ets
arkts
clearSearchHistory
清空搜索历史
async clearSearchHistory(): Promise<void> { this.searchHistory = []; await this.settingsManager.setJSON(NOVEL_SETTING_KEYS.SEARCH_HISTORY, []); }
AST#program#Left AST#expression_statement#Left AST#assignment_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left clearSearchHistory AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_param...
async clearSearchHistory(): Promise<void> { this.searchHistory = []; await this.settingsManager.setJSON(NOVEL_SETTING_KEYS.SEARCH_HISTORY, []); }
https://github.com/DaLongZhuaZi/manxia
9748d96430e88181a5ac0fd4b16c0f6259d84f8a
github
aimilin6688/KeePassHO
entry/src/main/ets/storage/cache/CacheConstants.ets
arkts
cacheExists
检查缓存文件是否存在 @param cachePath 缓存文件路径 @returns 是否存在
static async cacheExists(originalPath: string): Promise<boolean> { const cachePath: string = CacheConstants.getCacheFilePath(originalPath); try { const result: boolean = fs.accessSync(cachePath, fs.AccessModeType.EXIST); hilog.info(DOMAIN, TAG, `Cache exists: ${result}, path: ${cachePath}`); ...
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 cacheExists AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left originalPath AST#identifier#Right AST#ERROR#Left AST#:#Left...
static async cacheExists(originalPath: string): Promise<boolean> { const cachePath: string = CacheConstants.getCacheFilePath(originalPath); try { const result: boolean = fs.accessSync(cachePath, fs.AccessModeType.EXIST); hilog.info(DOMAIN, TAG, `Cache exists: ${result}, path: ${cachePath}`); ...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/cache/CacheConstants.ets#L82-L92
f42351d90bf87234ff0e700fb319cf0fd6ebd173
github
openharmony/arkui_ace_engine
advanced_ui_component_static/assembled_advanced_ui_component/@ohos.arkui.advanced.GridObjectSortComponent.ets
arkts
onDragMoveEvent
Drag and move triggering event
onDragMoveEvent(event: ItemDragInfo, itemIndex: int, insertIndex: int): void { if (!this.gridComState || (event.x < this.blockWidth / 3 && event.y < this.blockHeight / 3)) { return; } let targetIndex: int = insertIndex as int; if (targetIndex < 0) { targetIndex = this.selected.length - 1; ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onDragMoveEvent 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 ItemDragInfo AST#identifier#Right AST#,...
onDragMoveEvent(event: ItemDragInfo, itemIndex: int, insertIndex: int): void { if (!this.gridComState || (event.x < this.blockWidth / 3 && event.y < this.blockHeight / 3)) { return; } let targetIndex: int = insertIndex as int; if (targetIndex < 0) { targetIndex = this.selected.length - 1; ...
https://gitcode.com/openharmony/arkui_ace_engine
c8da8bcbca685d5ddab1e16ac5eab85672fa97d0
gitcode
YDYm233/EasyRandom_HarmonyNextApp
common/SystemUtils/src/main/ets/utils/VibratorManager.ets
arkts
vibrateSOS
SOS求救信号 — 三短三长三短 (··· −−− ···)
static vibrateSOS(): void { VibratorManager.logExecution('vibrateSOS'); VibratorManager.vibratePattern( [100, 100, 100, 100, 100, 300, 300, 100, 300, 100, 300, 300, 100, 100, 100, 100, 100], 1, VibrationUsage.ALARM ); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left vibrateSOS 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_...
static vibrateSOS(): void { VibratorManager.logExecution('vibrateSOS'); VibratorManager.vibratePattern( [100, 100, 100, 100, 100, 300, 300, 100, 300, 100, 300, 300, 100, 100, 100, 100, 100], 1, VibrationUsage.ALARM ); }
https://github.com/YDYm233/EasyRandom_HarmonyNextApp
afb0a56272c3094e402bb66c122365a8cd036aff
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.LightWeightSet.ets
arkts
has
Checks if a value is in the LightWeightSet @param v the value to find in the LightWeightSet @returns true if the value is in the LightWeightSet
has(key: T): boolean { return this.buckets.hasKey(key); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left has AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left key AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#Right AST#ERROR#Right AST#)#Left ) AST#)#Right AST#a...
has(key: T): boolean { return this.buckets.hasKey(key); }
https://gitcode.com/iop123123/arkts-static-skills
1b055252698f0a6453018ef249937577de1f7d6f
gitcode
Explore-In-HMOS-Wearable/how-to-use-weather-kit
entry/src/main/ets/components/TTSAnnouncementCard.ets
arkts
onTextChange
Update component when text changes
onTextChange() { this.computedWords = this.text.split(' ').filter(word => word.trim() !== ''); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onTextChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left ...
onTextChange() { this.computedWords = this.text.split(' ').filter(word => word.trim() !== ''); }
https://github.com/Explore-In-HMOS-Wearable/how-to-use-weather-kit
a36e46fc45c7e709c2dd9da2e6ea78411d3991b3
github
silence17/harmonydemo
common_lib/src/main/ets/common/components/BuiNavbar.ets
arkts
empty
这种所谓的全局,只在当前文件全局,如何定义App级的全局
@Builder function empty() { }
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Builder AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left empty AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AS...
@Builder function empty() { }
https://github.com/silence17/harmonydemo
38c92b69c22c55db9d9c1670f10ea4c0cf10475f
github
yangyongzhen/hmmovie
entry/src/main/ets/utils/HelperUtil.ets
arkts
showToast
提示信息 @param message @param t
static async showToast(message: string, t: number = 1000) { Prompt.showToast({ message: message, duration: 1000, }); }
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 showToast AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left message AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#...
static async showToast(message: string, t: number = 1000) { Prompt.showToast({ message: message, duration: 1000, }); }
https://github.com/yangyongzhen/hmmovie
ae80e1862fdac02c5c5d78625770b896ebc74967
github
chenchl/GMLogger-HarmonyOS
gmlogger/src/main/ets/components/security/logger/Logger.ets
arkts
init
初始化日志配置参数 @param context - 获取当前上下文对象,用于获取文件目录等 @param options 日志配置选项对象,包含以下可配置项: @param options.tag - 日志输出标识,用于分类日志信息 @param options.domain - 日志域标识符(数值类型),用于系统级日志分类 @param options.enable - 布尔值,控制是否关闭所有日志输出 @param options.isHilog - 布尔值,指定是否使用hilog系统进行日志记录 @param options.showLogLocation - 布尔值,控制是否显示日志调用位置信息 @param option...
init(context: common.UIAbilityContext, options: LogOptions) { const tag = options.tag //日志输出Tag const domain = options.domain //日志输出的域 const enable = options.enable //是否关闭日志 const isHilog = options.isHilog //是否是hilog打印 const showLogLocation = options.showLogLocation //是否展示日志位置 const logSize = ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left init AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Left common...
init(context: common.UIAbilityContext, options: LogOptions) { const tag = options.tag //日志输出Tag const domain = options.domain //日志输出的域 const enable = options.enable //是否关闭日志 const isHilog = options.isHilog //是否是hilog打印 const showLogLocation = options.showLogLocation //是否展示日志位置 const logSize = ...
https://github.com/chenchl/GMLogger-HarmonyOS
7b6444b25f3d01632998a3a5d448552a2936d7c7
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/02.floating-point_types_and_operations/greater_than/greater_than_float.ets
arkts
main
--- desc: check greater than operation for two floats ---
function main(): void { const a: float = {{v.left}} as float const b: float = {{v.right}} as float assert (a > b) == {{v.result}}
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A...
function main(): void { const a: float = {{v.left}} as float const b: float = {{v.right}} as float assert (a > b) == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
a9b6d0158bc6b31442c13fd48ead808d2de0f6e4
gitee
Joker-x-dev/CoolMallArkTS
core/data/src/main/ets/repository/GoodsRepository.ets
arkts
getGoodsCommentPage
分页查询商品评论 @param params 评论分页请求参数 @returns 评论分页数据
async getGoodsCommentPage(params: GoodsCommentPageRequest): Promise<NetworkResponse<NetworkPageData<Comment>>> { return this.networkDataSource.getGoodsCommentPage(params); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getGoodsCommentPage AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left params AST#identifier#Right AST#type_annotation#Left AST#:#...
async getGoodsCommentPage(params: GoodsCommentPageRequest): Promise<NetworkResponse<NetworkPageData<Comment>>> { return this.networkDataSource.getGoodsCommentPage(params); }
https://github.com/Joker-x-dev/CoolMallArkTS
1b03d1e6a1066d550cfe4c518c9ec964ee686873
github
arkui-x/samples
CodeLab/Cases/feature/bluetooth/src/main/ets/viewmodel/AdvertiserBluetoothViewModel.ets
arkts
getLocalName
获取蓝牙名称
getLocalName(): string { let localName = ''; try { localName = connection.getLocalName(); Log.showInfo(TAG, `getLocalName: localName = ${localName}`); } catch (err) { Log.showError(TAG, `getLocalName: err = ${err}`); } return localName; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getLocalName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement...
getLocalName(): string { let localName = ''; try { localName = connection.getLocalName(); Log.showInfo(TAG, `getLocalName: localName = ${localName}`); } catch (err) { Log.showError(TAG, `getLocalName: err = ${err}`); } return localName; }
https://gitcode.com/arkui-x/samples
ba265a2f6c36e60d85d64f775c3060ac8bed9274
gitcode
751496032/ZRouter
RouterApi/src/main/ets/api/RouterMgr.ets
arkts
push
页面跳转 @param name 是Route装饰器上的name属性值 @param param 携带的参数
public push<T>(name: string, param?: ObjectOrNull, animated: boolean = false, builder?: NavDestBuilder<T>):Promise<void> { return this.pushDestination<T>(name, param, undefined, builder) }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#binary_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left push AST#identifier#Right AST#ERROR#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right...
public push<T>(name: string, param?: ObjectOrNull, animated: boolean = false, builder?: NavDestBuilder<T>):Promise<void> { return this.pushDestination<T>(name, param, undefined, builder) }
https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/api/RouterMgr.ets#L203-L205
18a9766ed9902b25c3281790ef7220ef73e39d05
github
openharmony-sig/applications_clock
feature/worldclock/src/main/ets/manager/WorldClockManager.ets
arkts
removeWorldClock
delete world clock @param world clock object
async removeWorldClock(worldClockInfo: WorldClockInfo): Promise<void> { const rdbStore = await this.getRdbStore(); try { rdbStore.beginTransaction(); const predicates = new dataRdb.RdbPredicates(DATA_TABLE); if (worldClockInfo.id) { predicates.equalTo('ID', worldClockInfo.id); ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left removeWorldClock AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left worldClockInfo AST#identifier#Right AST#type_annotation#Left A...
async removeWorldClock(worldClockInfo: WorldClockInfo): Promise<void> { const rdbStore = await this.getRdbStore(); try { rdbStore.beginTransaction(); const predicates = new dataRdb.RdbPredicates(DATA_TABLE); if (worldClockInfo.id) { predicates.equalTo('ID', worldClockInfo.id); ...
https://gitee.com/openharmony-sig/applications_clock.git
467894dcf60b470b1fc75eb59d9053677008843f
gitee
CPF-ApplicationTPC/openharmony_tpc_samples
OhosVideoCache/library/src/main/ets/file/LruDiskUsage.ets
arkts
performFileCleanup
并发函数,用于在taskpool中执行文件删除操作
@Concurrent function performFileCleanup(filesToDelete: string[]): void { try { for (let i = 0; i < filesToDelete.length; i++) { let currentFile: string = filesToDelete[i]; try { if (fs.accessSync(currentFile)) { fs.unlinkSync(currentFile); } } catch (deleteError) { ...
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Concurrent AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left performFileCleanup AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right...
@Concurrent function performFileCleanup(filesToDelete: string[]): void { try { for (let i = 0; i < filesToDelete.length; i++) { let currentFile: string = filesToDelete[i]; try { if (fs.accessSync(currentFile)) { fs.unlinkSync(currentFile); } } catch (deleteError) { ...
https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples
06bf1540d8626410f427d6a029d02aa1a03b07c2
gitcode
erosTeam/NextE
shared/src/main/ets/state/UserTagStore.ets
arkts
anyHidden
True when ANY of a gallery's tags is one the user marked "hide" (eros_fe TagController.needHide).
anyHidden(tags: SimpleTag[]): boolean { return tags.some((t: SimpleTag) => this.isHidden(t.namespace, t.text)) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left anyHidden AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tags AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left SimpleTag AST#id...
anyHidden(tags: SimpleTag[]): boolean { return tags.some((t: SimpleTag) => this.isHidden(t.namespace, t.text)) }
https://github.com/erosTeam/NextE
824be57df50af4f38612d3840d8ea8021ae0ca45
github
fuhhhhhhhh/openharmony
entry/src/main/ets/data/DatabaseHelper.ets
arkts
initialize
初始化数据库和 Dao 层 应在应用启动时调用
public static async initialize(context?: common.BaseContext): Promise<void> { if (DatabaseHelper.isInitialized) { console.log('数据库已初始化,跳过'); return; } try { // 初始化数据库 DatabaseHelper.dbManager = DBManager.getInstance(context); await DatabaseHelper.dbManager.initDB(); /...
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 initialize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context...
public static async initialize(context?: common.BaseContext): Promise<void> { if (DatabaseHelper.isInitialized) { console.log('数据库已初始化,跳过'); return; } try { // 初始化数据库 DatabaseHelper.dbManager = DBManager.getInstance(context); await DatabaseHelper.dbManager.initDB(); /...
https://github.com/fuhhhhhhhh/openharmony
9545450776aae094abd9fc50fbc38376088ed88e
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets
arkts
toSignificantDigits
Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `significantDigits` significant digits. @param { double } significantDigits Significant digits. Integer, 1 to MAX_DIGITS inclusive. @returns { Decimal } the Decimal type @throws { BusinessError } 10200001 - The value of `significantDi...
public toSignificantDigits(significantDigits: double): Decimal { return this.toSignificantDigits(significantDigits, Decimal.rounding); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toSignificantDigits AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left significantDigits AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left...
public toSignificantDigits(significantDigits: double): Decimal { return this.toSignificantDigits(significantDigits, Decimal.rounding); }
https://gitcode.com/iop123123/arkts-static-skills
dcba6b0266780299206b5fb889f9ff81f26fbab1
gitcode
openharmony-sig/flutter_engine
shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/FlutterEngine.ets
arkts
constructor
需要初始化的工作: 1、初始化DartExecutor 2、初始化所有channel 3、初始化plugin 4、初始化flutterLoader 5、初始化flutterNapi 6、engineLifecycleListeners
constructor(context: common.Context, flutterLoader: FlutterLoader | null, flutterNapi: FlutterNapi | null, platformViewsController: PlatformViewsController | null) { const injector: FlutterInjector = FlutterInjector.getInstance(); if (flutterNapi == null) { flutterNapi = FlutterInjector.getInstance().ge...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Left...
constructor(context: common.Context, flutterLoader: FlutterLoader | null, flutterNapi: FlutterNapi | null, platformViewsController: PlatformViewsController | null) { const injector: FlutterInjector = FlutterInjector.getInstance(); if (flutterNapi == null) { flutterNapi = FlutterInjector.getInstance().ge...
https://gitee.com/openharmony-sig/flutter_engine.git
7a625d85a396db968153936cc5f0c14336b6c546
gitee
openharmony-sig/ohos_easyui
easyui/src/main/ets/common/components/NoticeBar.ets
arkts
build
滚动文本行数
build(){ Stack(){ //开头间隙 Row(){ } .backgroundColor("#FFFBE8") .height("100%") .width("6%") .margin(5) .zIndex(10) .position({x: "0%"}) //滚动文本 Row(){ Text(this.notice_text) .fontColor("#F06A0C") .fontSize(15) ....
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(){ //开头间隙 Row(){ } .backgroundColor("#FFFBE8") .height("100%") .width("6%") .margin(5) .zIndex(10) .position({x: "0%"}) //滚动文本 Row(){ Text(this.notice_text) .fontColor("#F06A0C") .fontSize(15) ....
https://gitee.com/openharmony-sig/ohos_easyui.git
0d0fc37a111c6efe5b9ab2129f41120569f62bcd
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/RhinoWasmExecutor.ets
arkts
executeSimple
同步执行简单脚本 用于不需要网络请求的简单计算
async executeSimple(script: string, context: RhinoContext = {}): Promise<string> { const result = await this.execute(script, context, 10000); return result.success ? result.result : ''; }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left executeSimple AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left script AST#identifier#Right AST#type_annotation#Left AST#:#Left :...
async executeSimple(script: string, context: RhinoContext = {}): Promise<string> { const result = await this.execute(script, context, 10000); return result.success ? result.result : ''; }
https://github.com/DaLongZhuaZi/manxia
f5ca02ca096ab9b9cec2a6aa23ecd79d04bd9545
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/utils/DevKeyVerifier.ets
arkts
getDeviceId
获取设备 ID(从 uniqueId 文件读取,与 NvHttp 共用) 返回前 8 位大写 hex 作为展示用 ID
static getDeviceId(context: common.Context): string { const uniqueIdPath = context.filesDir + '/unique_id.txt'; try { if (fileIo.accessSync(uniqueIdPath)) { const file = fileIo.openSync(uniqueIdPath, fileIo.OpenMode.READ_ONLY); const stat = fileIo.statSync(uniqueIdPath); const bu...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getDeviceId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression...
static getDeviceId(context: common.Context): string { const uniqueIdPath = context.filesDir + '/unique_id.txt'; try { if (fileIo.accessSync(uniqueIdPath)) { const file = fileIo.openSync(uniqueIdPath, fileIo.OpenMode.READ_ONLY); const stat = fileIo.statSync(uniqueIdPath); const bu...
https://github.com/AlkaidLab/moonlight-harmony
9d449dbd626e15551bbd446625e63ef5148a61a0
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/components/AxisBase.ets
arkts
isAxisMinCustom
Returns true if the axis min value has been customized (and is not calculated automatically) @return
public isAxisMinCustom(): boolean { return this.mCustomAxisMin; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isAxisMinCustom AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean A...
public isAxisMinCustom(): boolean { return this.mCustomAxisMin; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
bf0565965bf853d1650ff823d3982e1931bcf9e5
gitee
SMAT-Lab/PhantomRendering
example/entry/src/main/ets/pages/LikeInteractionPage.ets
arkts
aboutToAppear
用于模拟动画资源泄漏
aboutToAppear() { console.info('[LikeInteraction] Component aboutToAppear') // 强制停止所有定时器,防止页面复用导致的状态残留 this.stopAllTimers() // Receive mode parameters from home page const params = router.getParams() as Record<string, Object> if (params && typeof params['isEmptyFrameMode'] === 'boole...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left...
aboutToAppear() { console.info('[LikeInteraction] Component aboutToAppear') // 强制停止所有定时器,防止页面复用导致的状态残留 this.stopAllTimers() // Receive mode parameters from home page const params = router.getParams() as Record<string, Object> if (params && typeof params['isEmptyFrameMode'] === 'boole...
https://github.com/SMAT-Lab/PhantomRendering
990e7a5338c94772648c1fad22c4f631a539a9e4
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
sort
Sorts in-place according to the numeric ordering @returns sorted Uint8Array
public sort(): Uint8Array { let newF: (a: number, b: number) => number = (a: number, b: number): number => { throw new Error("not implemented") } return this.sort(newF) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left sort 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 sort(): Uint8Array { let newF: (a: number, b: number) => number = (a: number, b: number): number => { throw new Error("not implemented") } return this.sort(newF) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
d941dfc15b755a80fb3632d552301d490cc45caf
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoJsExtensions.ets
arkts
s2t
简体转繁体
s2t(text: string): string { return this.convertChinese(text, S2T_MAP); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left s2t 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 AST#identifier#Right AST#)#Left ) AST#)#Right...
s2t(text: string): string { return this.convertChinese(text, S2T_MAP); }
https://github.com/DaLongZhuaZi/manxia
4339bd2e280dbec2c3b1f47880fa1107287711fd
github
holg/eulumdat-rs
EulumdatHarmonyOS/Eulumdat/entry/src/main/ets/model/EulumdatEngine.ets
arkts
cartesianSvg
Generate cartesian diagram SVG @param width SVG width in pixels @param height SVG height in pixels @param maxCurves Maximum number of curves to display @param theme Light or Dark theme @returns SVG string
public cartesianSvg(width: number = 500, height: number = 300, maxCurves: number = 8, theme: SvgTheme = SvgTheme.Light): string { return eulumdat_napi.cartesianSvg(width, height, maxCurves, theme); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left cartesianSvg AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left width AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_express...
public cartesianSvg(width: number = 500, height: number = 300, maxCurves: number = 8, theme: SvgTheme = SvgTheme.Light): string { return eulumdat_napi.cartesianSvg(width, height, maxCurves, theme); }
https://github.com/holg/eulumdat-rs
2b2b4d9f29c9282a0e6c193a7894025af9e6064e
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.Deque.ets
arkts
$_iterator
Returns an iterator for the deque. @returns {IterableIterator<T>} An iterator for the deque.
public override $_iterator(): IterableIterator<T> { return new DequeValuesIterator_T<T>(this, this.front, this.rear, this.capacity, this.buffer); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left $_iterator AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#...
public override $_iterator(): IterableIterator<T> { return new DequeValuesIterator_T<T>(this, this.front, this.rear, this.capacity, this.buffer); }
https://gitcode.com/iop123123/arkts-static-skills
342e4eac4604ef4a9cb5f2869bd1ce28fedd9c42
gitcode
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/NotificationService.ets
arkts
push
推送新通知 @param type 通知类型 @param title 标题 @param content 内容
static async push(type: NotificationType, title: string, content: string): Promise<boolean> { const userId =await UserSessionService.getCurrentUserId(); if (!userId) { console.error('[NotificationService] 未登录,无法推送通知'); return false; } try { const notification = new Notification(0, u...
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 push AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#:#Right ...
static async push(type: NotificationType, title: string, content: string): Promise<boolean> { const userId =await UserSessionService.getCurrentUserId(); if (!userId) { console.error('[NotificationService] 未登录,无法推送通知'); return false; } try { const notification = new Notification(0, u...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
19bb78139c6e5b83eae708ddc1b17df8249bb133
github
openharmony-sig/online_event
solution_student_challenge/基于OpenHarmony的OpenGit_潘骏翔/OpenGit/entry/src/main/ets/MainAbility/pages/main/component/SideBar.ets
arkts
build
组件所在页面的viewModel对象
build() { Column() { //用户基本信息 Column() { //用户头像(url) Image(this.viewModel.myProfile.avatar) .width(70) .height(70) .margin({ top: 12, left: 16 }) //设置圆形裁剪 .clip(new Circle({ width: `100%`, height: `100%` })) //用户名 Tex...
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() { Column() { //用户基本信息 Column() { //用户头像(url) Image(this.viewModel.myProfile.avatar) .width(70) .height(70) .margin({ top: 12, left: 16 }) //设置圆形裁剪 .clip(new Circle({ width: `100%`, height: `100%` })) //用户名 Tex...
https://gitee.com/openharmony-sig/online_event.git
b6e4f8b7f615186bb829cfc899767458e3b0851a
gitee
xblLab/HarmonyProjectTemplate
commons/lib_common/src/main/ets/utils/SystemBarOperation.ets
arkts
setWindowSystemBarProp
设置顶部状态栏颜色
public static setWindowSystemBarProp(properties: window.SystemBarProperties) { const windowStage = AppStorage.get('windowStage') as window.WindowStage; const windowClass = windowStage.getMainWindowSync() windowClass.setWindowSystemBarProperties(properties) }
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 setWindowSystemBarProp AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left properties AST#ident...
public static setWindowSystemBarProp(properties: window.SystemBarProperties) { const windowStage = AppStorage.get('windowStage') as window.WindowStage; const windowClass = windowStage.getMainWindowSync() windowClass.setWindowSystemBarProperties(properties) }
https://github.com/xblLab/HarmonyProjectTemplate
3e19a5d690ad8ed9a76b65fd77a419fe7657867a
github
openharmony/codelabs
ETSUI/PositioningDemo/entry/src/main/ets/service/PlanService.ets
arkts
serializePlan
序列化计划
private serializePlan(plan: Plan): PlanData { return { id: plan.id, name: plan.name, description: plan.description, goal: plan.goal, startDate: plan.startDate, endDate: plan.endDate, dailyTasks: plan.dailyTasks.map((task): TaskData => ({ distanceTarget: task.dista...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left serializePlan AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left plan AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left...
private serializePlan(plan: Plan): PlanData { return { id: plan.id, name: plan.name, description: plan.description, goal: plan.goal, startDate: plan.startDate, endDate: plan.endDate, dailyTasks: plan.dailyTasks.map((task): TaskData => ({ distanceTarget: task.dista...
https://gitcode.com/openharmony/codelabs
bef21fe7427d32e2c66e8af311c34e14a005cede
gitcode
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/BinaryEncodingVisitor.ets
arkts
finish
========== 完成编码 ========== 完成编码,获取最终的二进制数据 @returns Protobuf wire format 二进制数据
finish(): Uint8Array { return this.writer.finish() }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left finish 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 Uint8Array AST#identifier#Right AST#ERROR#Right AST#sta...
finish(): Uint8Array { return this.writer.finish() }
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
62a3d703611aeed626f7dbd9730dea03626899e6
gitcode
LongLiveY96/chatcube
entry/src/main/ets/services/ToolExecutionService.ets
arkts
isToolAvailable
检查工具是否可用
isToolAvailable(functionName: string): boolean { const normalizedFunctionName = this.normalizeFunctionName(functionName) const toolId = this.resolveToolId(normalizedFunctionName) return toolId !== undefined }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isToolAvailable AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left functionName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left )...
isToolAvailable(functionName: string): boolean { const normalizedFunctionName = this.normalizeFunctionName(functionName) const toolId = this.resolveToolId(normalizedFunctionName) return toolId !== undefined }
https://github.com/LongLiveY96/chatcube
a4c25aab49f111e038f97b77016070c1f6feae03
github
Countly/countly-sdk-hos
library/src/ohosTest/ets/test/Configuration.test.ets
arkts
countCustomPropsOnWire
Count the custom (non-modifier) keys under user_details.custom, i.e. keys that don't start with `$`. Mirrors what `ModuleUserProfile.customSet` would have held just before the flush, which is the only externally observable proxy for the upcl-bounded custom cache size.
function countCustomPropsOnWire(data: string): number { const ud: Record<string, Object> = parseUserDetails(data); const custom: Record<string, Object> | undefined = ud['custom'] as Record<string, Object> | undefined; if (!custom) return 0; const keys: string[] = Object.keys(custom); let n: number = 0; for ...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left countCustomPropsOnWire AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left data AST#identifier#Right AST#type_annotation#Left AST#:#Left :...
function countCustomPropsOnWire(data: string): number { const ud: Record<string, Object> = parseUserDetails(data); const custom: Record<string, Object> | undefined = ud['custom'] as Record<string, Object> | undefined; if (!custom) return 0; const keys: string[] = Object.keys(custom); let n: number = 0; for ...
https://github.com/Countly/countly-sdk-hos
64f5aa909f9bef5bb9a517e79cc3daf5dc767d9a
github
2763981847/Accounting-app
entry/src/main/ets/pages/EntryPage.ets
arkts
accept
处理确认对话框的操作
accept(isInsert: boolean, newAccount: Account): void { if (isInsert) { // 插入新账户数据 Logger.info(`${CommonConstants.INDEX_TAG}`, `The account inserted is: ${JSON.stringify(newAccount)}`); this.accountTable.insertData(newAccount, () => { this.onAccountsChange() }); } else { ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left accept AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isInsert AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#,#Left , AST#,#Rig...
accept(isInsert: boolean, newAccount: Account): void { if (isInsert) { // 插入新账户数据 Logger.info(`${CommonConstants.INDEX_TAG}`, `The account inserted is: ${JSON.stringify(newAccount)}`); this.accountTable.insertData(newAccount, () => { this.onAccountsChange() }); } else { ...
https://github.com/2763981847/Accounting-app
e8f7a73f83fd150ffe3d1107d454a42870c9307c
github
PollenWang6/HiXD
entry/src/main/ets/services/CasLoginService.ets
arkts
randomString
随机字符串
private randomString(length: number): string { const chars: string = this.AES_CHARS; const result: string[] = []; for (let i: number = 0; i < length; i++) { const idx: number = Math.floor(Math.random() * chars.length); result.push(chars.charAt(idx)); } return result.join(''); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left randomString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left length AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
private randomString(length: number): string { const chars: string = this.AES_CHARS; const result: string[] = []; for (let i: number = 0; i < length; i++) { const idx: number = Math.floor(Math.random() * chars.length); result.push(chars.charAt(idx)); } return result.join(''); }
https://github.com/PollenWang6/HiXD
b97339d53c1ec7668b7ee0f36954ebed6f1dfa53
github
SMAT-Lab/PhantomRendering
Harmoney_Next-Tiktok/entry/src/main/ets/common/Function/commonFn.ets
arkts
getRandomCity
获取随机地名
getRandomCity() { const randomIndex = this.getRandom(cities.length) return cities[randomIndex] }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getRandomCity AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left...
getRandomCity() { const randomIndex = this.getRandom(cities.length) return cities[randomIndex] }
https://github.com/SMAT-Lab/PhantomRendering
1427c972c9aa0cd8e81550416e55ca4ab8aee035
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/DownloadDirManager.ets
arkts
getDownloadDirUri
获取下载目录 URI
public getDownloadDirUri(): string { return this.downloadDirUri; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getDownloadDirUri 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...
public getDownloadDirUri(): string { return this.downloadDirUri; }
https://github.com/richshaw2015/nds
bd4bebd043e67a28dae00515edc8a49a402ca224
github
arkui-x/samples
CodeLab/Cases/feature/customscan/src/main/ets/viewmodel/CustomScanViewModel.ets
arkts
setMainWindowImmersive
当前主窗口是否开启沉浸模式 @param {boolean} enable 是否开启 @returns {void}
setMainWindowImmersive(enable: boolean): void { this.windowModel.setMainWindowImmersive(enable); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setMainWindowImmersive AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enable AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right AS...
setMainWindowImmersive(enable: boolean): void { this.windowModel.setMainWindowImmersive(enable); }
https://gitcode.com/arkui-x/samples
ec9e877dbced8add807739e7b1e286d2005f0dca
gitcode
huaiminqin/TankWar-Master-with-Many-Tasks
game/src/main/ets/mission/MissionFactory.ets
arkts
createSurvivalMission
创建生存任务 - 在指定时间内存活
static createSurvivalMission(level: number): Mission { const mission = new Mission( `生存挑战 ${level}`, '在敌军猛攻下坚持到援军到达' ); const survivalTime = 60 + level * 30; // 秒 mission.addObjective({ type: MissionType.SURVIVAL, description: `坚持 ${survivalTime} 秒`, progress: 0, ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createSurvivalMission AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left level AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie...
static createSurvivalMission(level: number): Mission { const mission = new Mission( `生存挑战 ${level}`, '在敌军猛攻下坚持到援军到达' ); const survivalTime = 60 + level * 30; // 秒 mission.addObjective({ type: MissionType.SURVIVAL, description: `坚持 ${survivalTime} 秒`, progress: 0, ...
https://github.com/huaiminqin/TankWar-Master-with-Many-Tasks
139cc57691bb7cc5429d29f79ac4427dc2c0f4f1
github
Cool_foolisher1/ArkTSRepository
GraphicalCode/commons/src/main/ets/manager/PageContextManager.ets
arkts
replacePage
替换页面 @param data 路由参数 @param animated boolean
public replacePage(data: RouterParam, animated: boolean = true): void { try { this.pathStack.replacePath({ name: data.routerName, param: data.param, }, animated) } catch (error) { const businessError: BusinessError = error as BusinessError Logger.error(TAG, `打开 ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left replacePage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Rout...
public replacePage(data: RouterParam, animated: boolean = true): void { try { this.pathStack.replacePath({ name: data.routerName, param: data.param, }, animated) } catch (error) { const businessError: BusinessError = error as BusinessError Logger.error(TAG, `打开 ...
https://gitcode.com/Cool_foolisher1/ArkTSRepository
afeb7a024122fa5550c3b91c76fee1155e5b8535
gitcode
aimilin6688/KeePassHO
entry/src/main/ets/storage/onedrive/OneDriveConfig.ets
arkts
isTokenExpired
检查令牌是否过期 @returns 是否过期
public isTokenExpired(): boolean { if (!this.expiresAt) { return false; } // 提前5分钟认为令牌过期 return Date.now() > this.expiresAt - 5 * 60 * 1000; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isTokenExpired 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 AS...
public isTokenExpired(): boolean { if (!this.expiresAt) { return false; } // 提前5分钟认为令牌过期 return Date.now() > this.expiresAt - 5 * 60 * 1000; }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/onedrive/OneDriveConfig.ets#L109-L115
20b91b0e0aecc0d41f8e61bb2211578146fa235b
github
aimilin6688/KeePassHO
entry/src/main/ets/common/oauth2/OAuth2TokenStorageService.ets
arkts
deleteToken
删除OAuth2令牌 @param config 存储配置
public async deleteToken(config: OAuth2TokenStorageConfig): Promise<void> { this.init(); if (!this.preferences) { throw new Error('OAuth2TokenStorageService not initialized'); } try { // 生成令牌键名 const tokenKey = config.tokenKey || this.getDefaultTokenKey(config.provider); // 从...
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 deleteToken AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST...
public async deleteToken(config: OAuth2TokenStorageConfig): Promise<void> { this.init(); if (!this.preferences) { throw new Error('OAuth2TokenStorageService not initialized'); } try { // 生成令牌键名 const tokenKey = config.tokenKey || this.getDefaultTokenKey(config.provider); // 从...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/oauth2/OAuth2TokenStorageService.ets#L176-L194
3014a6c5e769baa3ce2b015a76f0d2d5bc620870
github
XHXYT/Pixark
entry/src/main/ets/viewmodel/RankViewModel.ets
arkts
fetchRanking
加载排行榜数据
async fetchRanking() { // 切换模式时,如果当前 mode 不再支持,自动回退 // 获取当前模式下的可用 modes (优先用用户自定义的,没有则用全量默认) const supportedModes = appSettings.novel_mode ? (appSettings.novel_rank_modes || Object.keys(FunctionConstants.NOVEL_RANK_MODES)) : (appSettings.rank_modes || Object.keys(FunctionConstants.ILLUST_RANK_...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left fetchRanking AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#R...
async fetchRanking() { // 切换模式时,如果当前 mode 不再支持,自动回退 // 获取当前模式下的可用 modes (优先用用户自定义的,没有则用全量默认) const supportedModes = appSettings.novel_mode ? (appSettings.novel_rank_modes || Object.keys(FunctionConstants.NOVEL_RANK_MODES)) : (appSettings.rank_modes || Object.keys(FunctionConstants.ILLUST_RANK_...
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/viewmodel/RankViewModel.ets#L69-L107
38c1d98080aaca2ef07bb997d26afd60ab79334e
github
Explore-In-HMOS-Wearable/currency-converter
entry/src/main/ets/viewmodel/CurrencyViewModel.ets
arkts
getCurrencyData
Get all currency data
getCurrencyData(): CurrencyData[] { return this.allCurrencyData; }
AST#program#Left AST#expression_statement#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getCurrencyData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ident...
getCurrencyData(): CurrencyData[] { return this.allCurrencyData; }
https://github.com/Explore-In-HMOS-Wearable/currency-converter
b06506de864b88acf9cd0ec8a2206167a3a19cab
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/GamepadManager.ets
arkts
handleGCAxisEvent
处理 Game Controller Kit 轴事件
private handleGCAxisEvent(deviceId: string, axisType: number, x: number, y: number): void { // 首次轴事件诊断日志(每设备仅一次) if (!this.gcAxisFirstEventLogged.has(deviceId)) { this.gcAxisFirstEventLogged.add(deviceId); const registered = this.gcDeviceIdToSlot.has(deviceId); const slot = this.getSlotForGC...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleGCAxisEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left deviceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#...
private handleGCAxisEvent(deviceId: string, axisType: number, x: number, y: number): void { // 首次轴事件诊断日志(每设备仅一次) if (!this.gcAxisFirstEventLogged.has(deviceId)) { this.gcAxisFirstEventLogged.add(deviceId); const registered = this.gcDeviceIdToSlot.has(deviceId); const slot = this.getSlotForGC...
https://github.com/AlkaidLab/moonlight-harmony
e197eb6481fa27946c154ddbda3fd2c2470df10e
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Array.ets
arkts
from
Creates a new `Array` instance from an iterable or array-like object. @param { ArrayLike<T> | Iterable<T> } iterable An iterable or array-like object to convert to an array. @returns { Array<T> } A new Array instance containing the elements from the iterable. @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static from<T>(iterable: ArrayLike<T> | Iterable<T>): Array<T> { const ret = new Array<T>() iteratorForEach<T>(iterable.$_iterator(), (x: T): void => { ret.push(x) }) return ret }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#from#Left from AST#from#Right AST#ERROR#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identif...
public static from<T>(iterable: ArrayLike<T> | Iterable<T>): Array<T> { const ret = new Array<T>() iteratorForEach<T>(iterable.$_iterator(), (x: T): void => { ret.push(x) }) return ret }
https://gitcode.com/iop123123/arkts-static-skills
a9993015fd8adccdd45c10eb3b6908a24dc77711
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/viewmodel/ComputerViewModel.ets
arkts
reloadData
重新加载所有数据
reloadData(data: ObservableComputer[]): void { this.dataArray = data; this.notifyDataReload(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left reloadData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left ObservableCompu...
reloadData(data: ObservableComputer[]): void { this.dataArray = data; this.notifyDataReload(); }
https://github.com/AlkaidLab/moonlight-harmony
d10f3e22d50741b38ff83337732333cf5a5e851e
github
tdcare/tdwebrtc
src/main/ets/MediaStream.ets
arkts
startPlaceholderTimer
============================================================ 摄像头关闭时 — 占位画面(显示当前时间) ============================================================ 启动占位画面定时器,每秒生成一帧带时间戳的黑色画面发送给远端
private startPlaceholderTimer(): void { this.stopPlaceholderTimer(); // 立即发送一帧 this.generateAndEncodePlaceholder(); // 每秒更新一次(时间精确到秒) this.placeholderTimerId = setInterval(() => { this.generateAndEncodePlaceholder(); }, 1000); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left startPlaceholderTimer 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 A...
private startPlaceholderTimer(): void { this.stopPlaceholderTimer(); // 立即发送一帧 this.generateAndEncodePlaceholder(); // 每秒更新一次(时间精确到秒) this.placeholderTimerId = setInterval(() => { this.generateAndEncodePlaceholder(); }, 1000); }
https://github.com/tdcare/tdwebrtc
a1732270c7d0e65e228ad895f7f849b10f50dbfd
github
harmonyos/codelabs
HarmonyOS_NEXT/Preferences/entry/src/main/ets/viewmodel/ButtonItemData.ets
arkts
constructor
The constructor of ButtonItemData. @param resource Button item resource. @param clickMethod Button item clickMethod.
constructor(resource: Resource, clickMethod: () => void) { this.resource = resource; this.clickMethod = clickMethod; }
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 resource AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Resource AST#identifier#R...
constructor(resource: Resource, clickMethod: () => void) { this.resource = resource; this.clickMethod = clickMethod; }
https://gitee.com/harmonyos/codelabs.git
72c4cc1fa0f764cc480e19d28c64f94b9ebbbe40
gitee
ibestservices/ibest-ui
library/src/main/ets/components/rate/index.ets
arkts
getContentWidth
获取组件容器宽度
getContentWidth(){ this.containerWidth = getComponentsInfo(this.context, `ibest_rate_${this.uniId}`).width this.iconWidth = getComponentsInfo(this.context, `ibest_rate_${this.uniId}_0`).width this.iconSpace = (this.containerWidth - this.iconWidth*this.count)/(this.count - 1) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getContentWidth 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#Le...
getContentWidth(){ this.containerWidth = getComponentsInfo(this.context, `ibest_rate_${this.uniId}`).width this.iconWidth = getComponentsInfo(this.context, `ibest_rate_${this.uniId}_0`).width this.iconSpace = (this.containerWidth - this.iconWidth*this.count)/(this.count - 1) }
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/rate/index.ets#L111-L115
dad58c1f79cf3b77b3e0c7ebf3ad30d5b9e616a5
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/usbdriver/Dualshock4Controller.ets
arkts
rumbleTriggers
扳机震动(DualShock 4 不支持)
rumbleTriggers(_leftTrigger: number, _rightTrigger: number): void { // DualShock 4 不支持扳机震动 }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left rumbleTriggers AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left _leftTrigger AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , ...
rumbleTriggers(_leftTrigger: number, _rightTrigger: number): void { // DualShock 4 不支持扳机震动 }
https://github.com/AlkaidLab/moonlight-harmony
23d22c90b9d05a37ba19b2fa4622cab3dcd8027f
github
egavrin/arkts_agent_kit
examples/fslib/src/tests/fslib.test.ets
arkts
testLargeFileStreaming
--- Large file streaming ---
function testLargeFileStreaming(): void { ensureSetup() let fs = new FileSystem() let fpath: string = TMPDIR + "/large.dat" let pattern: string = "0123456789ABCDEF" let total: int = 0 let target: int = 100 * 1024 let wf: FsFile = fs.openFile(fpath, FS_OPEN_WRITE | FS_OPEN_CREATE | FS_OPEN_TR...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testLargeFileStreaming 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#pred...
function testLargeFileStreaming(): void { ensureSetup() let fs = new FileSystem() let fpath: string = TMPDIR + "/large.dat" let pattern: string = "0123456789ABCDEF" let total: int = 0 let target: int = 100 * 1024 let wf: FsFile = fs.openFile(fpath, FS_OPEN_WRITE | FS_OPEN_CREATE | FS_OPEN_TR...
https://gitcode.com/egavrin/arkts_agent_kit
cf85462410e01cf887f3c8b916c0390eccd25e6f
gitcode
HarmonyOS_Samples/MusicHome
features/recommendation/src/main/ets/util/RecommendDataUtil.ets
arkts
mapTabDtoToUi
Maps a tab API DTO to {@link RecommendCategoryTabUi}. @param dto - Source category tab DTO. @returns Populated tab chip model.
private static mapTabDtoToUi(dto: TabApiDto): RecommendCategoryTabUi { const ui = new RecommendCategoryTabUi(); ui.title = dto.title; ui.iconSelected = dto.iconSelected; ui.iconUnselected = dto.iconUnselected; return ui; }
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 mapTabDtoToUi AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dto AST#identifier#Right AST#:#Left : ...
private static mapTabDtoToUi(dto: TabApiDto): RecommendCategoryTabUi { const ui = new RecommendCategoryTabUi(); ui.title = dto.title; ui.iconSelected = dto.iconSelected; ui.iconUnselected = dto.iconUnselected; return ui; }
https://gitcode.com/HarmonyOS_Samples/MusicHome
b3f7f2a9d97b0d283676846598247e1a600f5b39
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
findLastIndex
Finds an index of the last element in the Float64Array that satisfies the condition @param fn condition @returns the index of the last element that satisfies fn, -1 otherwise
public findLastIndex(fn: (val: double, index: int, array: Float64Array) => boolean): int { for (let i = this.length - 1; i >= 0; --i) { let val = this.at(i) if (fn(val, i, this)) { return i } } return -1 }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left findLastIndex 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 : ...
public findLastIndex(fn: (val: double, index: int, array: Float64Array) => boolean): int { for (let i = this.length - 1; i >= 0; --i) { let val = this.at(i) if (fn(val, i, this)) { return i } } return -1 }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
7ef3fad140c57a736f4c7d00b5d984008bdd9c7f
gitee
Joker-x-dev/CoolMallArkTS
feature/main/src/main/ets/viewmodel/MeViewModel.ets
arkts
onMainTabSelected
Tab 选中回调 @param {number} index - 当前 Tab 索引 @returns {void} 无返回值
onMainTabSelected(index: number): void { if (index === 3) { this.getUserOrderStatistics(); this.loadRecentFootprints(); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onMainTabSelected AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Lef...
onMainTabSelected(index: number): void { if (index === 3) { this.getUserOrderStatistics(); this.loadRecentFootprints(); } }
https://github.com/Joker-x-dev/CoolMallArkTS
242108ae4f95346e9a462acf1a4e4ae9b7128a00
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Debug/HidebugPerformanceCollector.ets
arkts
collectDebugInfo
收集调试信息
private async collectDebugInfo(): Promise<HidebugDebugInfo> { const debugInfo: HidebugDebugInfo = { isDebugState: false, gwpAsanState: 0 }; try { // 获取调试状态 debugInfo.isDebugState = hidebug.isDebugState(); // GWP-Asan状态当前不采集;如后续SDK暴露稳定方法,再在这里接入。 // try { //...
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 collectDebugInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right ...
private async collectDebugInfo(): Promise<HidebugDebugInfo> { const debugInfo: HidebugDebugInfo = { isDebugState: false, gwpAsanState: 0 }; try { // 获取调试状态 debugInfo.isDebugState = hidebug.isDebugState(); // GWP-Asan状态当前不采集;如后续SDK暴露稳定方法,再在这里接入。 // try { //...
https://github.com/DaLongZhuaZi/manxia
95447f46e8aa46f501eeb010b5ae592be908797c
github
azhu0001/localsend-harmony
entry/src/main/ets/pages/send/SendRequestPage.ets
arkts
aboutToDisappear
aboutToAppear(): void { const params = this.pages.getParamByName(Routers.SEND_REQUEST_PAGE) as Array<SendRequestParams> if (params && params.length != 0) { const param: SendRequestParams = params[0] this.files = param.files this.target = param.target this.geometryId = param.geometryId this.sendPrepareUpload() } else { ...
aboutToDisappear(): void { this.isComplete = true this.terminate?.terminate() }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToDisappear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_b...
aboutToDisappear(): void { this.isComplete = true this.terminate?.terminate() }
https://gitcode.com/azhu0001/localsend-harmony
d8d4af3e60a477b6719ce9fdddf6563becd41fc7
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Database/DatabaseManager.ets
arkts
getStore
获取数据库存储实例
private getStore(): relationalStore.RdbStore { if (!this.store) { throw new Error('数据库未初始化'); } return this.store; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getStore 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#member_expression#Left AST...
private getStore(): relationalStore.RdbStore { if (!this.store) { throw new Error('数据库未初始化'); } return this.store; }
https://github.com/DaLongZhuaZi/manxia
8d6dc6b86a20cb4ac18d71440ae790f452f6fe77
github
LZZLHY/hlib
entry/src/main/ets/utils/Layout.ets
arkts
breakpointOf
由屏宽(vp)派生断点字符串。
static breakpointOf(widthVp: number): Breakpoint { if (widthVp < 600) return 'sm'; if (widthVp < 840) return 'md'; if (widthVp < 1440) return 'lg'; return 'xl'; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left breakpointOf AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left widthVp AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Ri...
static breakpointOf(widthVp: number): Breakpoint { if (widthVp < 600) return 'sm'; if (widthVp < 840) return 'md'; if (widthVp < 1440) return 'lg'; return 'xl'; }
https://github.com/LZZLHY/hlib
1cfa585e7e0d64072d728a19097aa35741e2a712
github
openharmony/codelabs
ETSUI/LifeTrack/entry/src/main/ets/dao/EventDao.ets
arkts
updateEventInstanceCompletion
更新实例完成状态
async updateEventInstanceCompletion(instanceId: string, completed: boolean): Promise<boolean> { const rdbStore = await this.initDatabase(); try { await rdbStore.beginTransaction(); const valueBucket: relationalStore.ValuesBucket = { completed: completed ? 1 : 0, updated_time: Dat...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left updateEventInstanceCompletion AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left instanceId AST#identifier#Right AST#type_annotati...
async updateEventInstanceCompletion(instanceId: string, completed: boolean): Promise<boolean> { const rdbStore = await this.initDatabase(); try { await rdbStore.beginTransaction(); const valueBucket: relationalStore.ValuesBucket = { completed: completed ? 1 : 0, updated_time: Dat...
https://gitcode.com/openharmony/codelabs
1ee0715f4f1ba5cd10acd87f57f7411a41fbc490
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/GamepadManager.ets
arkts
copyState
创建状态副本 避免直接传递引用导致状态被意外修改
private copyState(state: GamepadState): GamepadState { return { buttons: state.buttons, leftStickX: state.leftStickX, leftStickY: state.leftStickY, rightStickX: state.rightStickX, rightStickY: state.rightStickY, leftTrigger: state.leftTrigger, rightTrigger: state.rightTri...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left copyState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left state AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Ga...
private copyState(state: GamepadState): GamepadState { return { buttons: state.buttons, leftStickX: state.leftStickX, leftStickY: state.leftStickY, rightStickX: state.rightStickX, rightStickY: state.rightStickY, leftTrigger: state.leftTrigger, rightTrigger: state.rightTri...
https://github.com/AlkaidLab/moonlight-harmony
0b83e888babf17c80751a1fe9693d644a346fb7c
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/AutoPageTurnController.ets
arkts
isPaused
是否已暂停
public isPaused(): boolean { return this.state === AutoPageTurnState.PAUSED; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isPaused AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#bool...
public isPaused(): boolean { return this.state === AutoPageTurnState.PAUSED; }
https://github.com/DaLongZhuaZi/manxia
8f59f3229e74d31487296d43ccdd27c74bedbcd7
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/ResponsiveLayout.ets
arkts
getMaxContentWidth
获取最大内容宽度(用于限制超宽屏幕的内容宽度)
public static getMaxContentWidth(): number { return ResponsiveLayoutHelper.getLayoutParams().maxCardWidth; }
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 getMaxContentWidth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right ...
public static getMaxContentWidth(): number { return ResponsiveLayoutHelper.getLayoutParams().maxCardWidth; }
https://github.com/DaLongZhuaZi/manxia
f70e37bb73fbdd139726d45956dba67c74dff769
github
ibestservices/ibest-ui
library/src/main/ets/components/tree/index.ets
arkts
getCheckedNodes
通过key获取选中的节点
getCheckedNodes(): IBestTreeData[]{ if(!this.selectType){ console.warn("请先设置selectType") return [] } const result: IBestTreeData[] = [] const traverse = (nodes: IBestTreeNodeData[]) => { for (const node of nodes) { if (this.selectTy...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCheckedNodes 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#identifier#Left IBestTreeData AST#identifier#Ri...
getCheckedNodes(): IBestTreeData[]{ if(!this.selectType){ console.warn("请先设置selectType") return [] } const result: IBestTreeData[] = [] const traverse = (nodes: IBestTreeNodeData[]) => { for (const node of nodes) { if (this.selectTy...
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/tree/index.ets#L189-L214
51e55b8c056750843ad1b20becd6e184b506618f
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
findIndex
Returns the index of the first element in the array where predicate is true, and -1 otherwise @param { function } predicate - find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, findIndex immediately returns that elem...
public findIndex(predicate: (value: number, index: int, obj: Uint8ClampedArray) => boolean): int { for (let i = 0; i < this.lengthInt; i++) { if (predicate(this.getUnsafe(i).toDouble(), i, this)) { return i } } return -1 }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left findIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left predicate AST#identifier#Right AST#ERROR#Left AST#:#Left...
public findIndex(predicate: (value: number, index: int, obj: Uint8ClampedArray) => boolean): int { for (let i = 0; i < this.lengthInt; i++) { if (predicate(this.getUnsafe(i).toDouble(), i, this)) { return i } } return -1 }
https://gitcode.com/iop123123/arkts-static-skills
244b0ad91a5d69e9504f99eb8c5375e4bae1e900
gitcode
LJ666-ui/harmony-health-care
entry/src/main/ets/core/DeviceManager.ets
arkts
subscribeStatusChange
订阅设备状态变化 @param deviceId 设备ID @param callback 状态变化回调函数 @returns string 订阅ID
public subscribeStatusChange(deviceId: string, callback: (status: DeviceStatus) => void): string { const callbacks = this.subscribers.get(deviceId) || []; callbacks.push(callback); this.subscribers.set(deviceId, callbacks); const subscriptionId = `${deviceId}_${Date.now()}`; console.log(`Subscrib...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left subscribeStatusChange AST#identifier#Right AST#(#Left ( AST#(#Right AST#identifier#Left deviceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , A...
public subscribeStatusChange(deviceId: string, callback: (status: DeviceStatus) => void): string { const callbacks = this.subscribers.get(deviceId) || []; callbacks.push(callback); this.subscribers.set(deviceId, callbacks); const subscriptionId = `${deviceId}_${Date.now()}`; console.log(`Subscrib...
https://github.com/LJ666-ui/harmony-health-care
252a1c38bce61be51ff6dbafd0534608a1cf6aef
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/DeviceAdaptationManager.ets
arkts
isLandscape
判断是否是横屏
public isLandscape(): boolean { return this.getDeviceInfo().isLandscape; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isLandscape 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...
public isLandscape(): boolean { return this.getDeviceInfo().isLandscape; }
https://github.com/DaLongZhuaZi/manxia
86b38b86bb131271fef2d96ab6a4026ef34b3e4d
github
the-wwyang/kids-learning-app
src/main/ets/storage/AchievementManager.ets
arkts
constructor
解锁时间戳
constructor( id: string, icon: string, name: string, description: string, type: AchievementType, unlocked: boolean = false, progress: number = 0, target: number = 1, reward: number = 10, unlockTime: number = 0 ) { this.id = id; this.icon = icon; this.name = name; ...
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 id AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST...
constructor( id: string, icon: string, name: string, description: string, type: AchievementType, unlocked: boolean = false, progress: number = 0, target: number = 1, reward: number = 10, unlockTime: number = 0 ) { this.id = id; this.icon = icon; this.name = name; ...
https://github.com/the-wwyang/kids-learning-app
5c2569f654c6279af00f577d9247d18c6201f97b
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/EnhancedBackupManager.ets
arkts
exportSearchHistory
导出搜索历史
private async exportSearchHistory(): Promise<SearchHistoryBackup[]> { const historyMap = new Map<string, SearchHistoryBackup>(); const now = Date.now(); try { const settingsHistory = this.novelSettingsManager.getSearchHistory(); settingsHistory.forEach((keyword: string, index: number) => ...
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 exportSearchHistory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Rig...
private async exportSearchHistory(): Promise<SearchHistoryBackup[]> { const historyMap = new Map<string, SearchHistoryBackup>(); const now = Date.now(); try { const settingsHistory = this.novelSettingsManager.getSearchHistory(); settingsHistory.forEach((keyword: string, index: number) => ...
https://github.com/DaLongZhuaZi/manxia
b26146d0c8aaf6bb66949a24ebda27a66a192250
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Array.ets
arkts
findLastIndex
Iterates the array in reverse order and returns the index of the first element that satisfies the provided testing function. If no elements satisfy the testing function, -1 is returned. @param fn testing function @returns index of first element satisfying to fn, -1 if no such element
public findLastIndex(fn: (element : T) => boolean): int { for(let i = this.data.length - 1; i >= 0; i--) { if (fn(this.data[i])) { return i } } return -1 }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left findLastIndex 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 : ...
public findLastIndex(fn: (element : T) => boolean): int { for(let i = this.data.length - 1; i >= 0; i--) { if (fn(this.data[i])) { return i } } return -1 }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
77803baea93dd61e0473c77305608f403ed1fa0d
gitee
HarmonyOS_Samples/hmosworld
HMOSWorld/Application/commons/audioplayer/src/main/ets/service/AudioPlayerService.ets
arkts
setListenerForMesFromController
Listening to Events of the Broadcast Control Center.
public setListenerForMesFromController() { this.session?.on('play', () => { this.play(); }); this.session?.on('pause', () => { this.pause(); }); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setListenerForMesFromController 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...
public setListenerForMesFromController() { this.session?.on('play', () => { this.play(); }); this.session?.on('pause', () => { this.pause(); }); }
https://gitcode.com/HarmonyOS_Samples/hmosworld
793d9de6411a3f03f49e6265aff91b5488d29a9e
gitcode
XHXYT/Pixark
entry/src/main/ets/common/utils/database/impl/DownloadRecordTable.ets
arkts
queryByTaskId
根据系统任务ID查询记录 (用于系统回调时更新数据库)
async queryByTaskId(task_id: string): Promise<DownloadRecordInfo | null> { const results = await this.query(this.getPredicates().equalTo('task_id', task_id)); return results.length > 0 ? results[0] : null; }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left queryByTaskId AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left task_id AST#identifier#Right AST#type_annotation#Left AST#:#Left ...
async queryByTaskId(task_id: string): Promise<DownloadRecordInfo | null> { const results = await this.query(this.getPredicates().equalTo('task_id', task_id)); return results.length > 0 ? results[0] : null; }
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/common/utils/database/impl/DownloadRecordTable.ets#L33-L36
2f4f6b7222823e26621994812db5f2ea3ae67e9f
github
openharmony/codelabs
ETSUI/MemoTime/entry/src/main/ets/pages/Index.ets
arkts
navigateToAddSchedule
跳转到新建日程页面
navigateToAddSchedule(): void { const params: ScheduleEditParams = { date: this.selectedDate.getTime() } router.pushUrl({ url: AppConstants.PAGE_SCHEDULE_EDIT, params: params }).catch((error: Error) => { Logger.error(TAG, `Navigation failed: ${error.message}`) }) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left navigateToAddSchedule AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statem...
navigateToAddSchedule(): void { const params: ScheduleEditParams = { date: this.selectedDate.getTime() } router.pushUrl({ url: AppConstants.PAGE_SCHEDULE_EDIT, params: params }).catch((error: Error) => { Logger.error(TAG, `Navigation failed: ${error.message}`) }) }
https://gitcode.com/openharmony/codelabs
8758e3a701524ea0f7245abca57a4d5c9b0ca4c1
gitcode
openharmony/web_webview
interfaces/kits/ani/webview/ets/@ohos.web.webview.ets
arkts
getSchemeFilter
Returns the scheme filter used for this rule. @returns { ProxySchemeFilter } The scheme filter used for this rule. @syscap SystemCapability.Web.Webview.Core @since 20
getSchemeFilter(): ProxySchemeFilter { return this.filter; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getSchemeFilter 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 ProxySchemeFilter AST#identifier#Right AST#ERR...
getSchemeFilter(): ProxySchemeFilter { return this.filter; }
https://gitee.com/openharmony/web_webview.git
4762fbd5c30e2620b6f1df006f94154ae72fc6a5
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/postfix_decrement/postfix_decrement_uint.ets
arkts
main
--- desc: check postfix decrement for unsigned int operand ---
function main(): void { let value: uint = {{v.value}} let result: uint = 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: uint = {{v.value}} let result: uint = value-- assert value == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
84b9a569e76c498721fa00cc80fdadb2bc6d339e
gitee
erosTeam/NextE
feature/home/src/main/ets/viewmodel/GalleryListViewModel.ets
arkts
isPopular
EH 'popular' is a single fixed snapshot with no cursor — it never pages (eros_fe popular tab).
private isPopular(): boolean { return this.source === 'popular' }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left isPopular 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#...
private isPopular(): boolean { return this.source === 'popular' }
https://github.com/erosTeam/NextE
a76c785c075dc8cb29ccc361c384cbde659daea6
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Diagnostics/StartupTest.ets
arkts
simulatePhase
模拟启动阶段
private async simulatePhase(phase: StartupPhase, duration: number): Promise<void> { await startupController.executePhase(phase, async () => { logger.debug('StartupTest', `模拟阶段: ${phase}`); await this.delay(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 simulatePhase AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left phase AST#identifier#Right AST#:#Left :...
private async simulatePhase(phase: StartupPhase, duration: number): Promise<void> { await startupController.executePhase(phase, async () => { logger.debug('StartupTest', `模拟阶段: ${phase}`); await this.delay(duration); }); }
https://github.com/DaLongZhuaZi/manxia
7c880101a06c5f06e0d11b59b9d943952f005fde
github
yongoe1024/RdbPlus
rdbplus/src/main/ets/core/Wrapper.ets
arkts
eq
等于 @param field 字段 @param value 值 @returns Wrapper
eq(field: string, value: relationalStore.ValueType, condition: boolean = true): Wrapper { if (condition) { this.whereList.push(`and ${field} = ?`) this.valueList.push(value) } return this }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left eq AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left field AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Right...
eq(field: string, value: relationalStore.ValueType, condition: boolean = true): Wrapper { if (condition) { this.whereList.push(`and ${field} = ?`) this.valueList.push(value) } return this }
https://github.com/yongoe1024/RdbPlus/blob/83f7347b7ac692941729d3464923155948e876bb/rdbplus/src/main/ets/core/Wrapper.ets#L40-L46
4e053291f5b80caa24005b722c23339ad1d24e13
github
Dabing-0x19d/berverage_HarmonyOS6.0
entry/src/main/ets/utils/ShareUtil.ets
arkts
sharePixelMapAsImageWithBg
分享PixelMap为图片(带纯色背景) @param pixelMap 图片像素映射 @param uiContext UI上下文 @param backgroundColor 背景颜色,默认为白色
static async sharePixelMapAsImageWithBg(pixelMap: PixelMap, uiContext: UIContext, backgroundColor: string = '#FFFFFF'): Promise<void> { try { console.info('ShareUtil: Starting sharePixelMapAsImageWithBg'); const context = uiContext.getHostContext() as common.UIAbilityContext; // 获取原图尺寸 co...
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 sharePixelMapAsImageWithBg AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pixelMap AST#identifier#Right...
static async sharePixelMapAsImageWithBg(pixelMap: PixelMap, uiContext: UIContext, backgroundColor: string = '#FFFFFF'): Promise<void> { try { console.info('ShareUtil: Starting sharePixelMapAsImageWithBg'); const context = uiContext.getHostContext() as common.UIAbilityContext; // 获取原图尺寸 co...
https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0
d671705cf81f462cba73f952fab6f3c8a3e616d7
github
honjow/Next2V
feature/detail/src/main/ets/model/TopicDetailScrollCoordinator.ets
arkts
verifiedFloor
Verify V2EX's notification anchor (targetFloor) against the reply text it claims to point at, and re-locate by content when they disagree. V2EX occasionally stamps a thanks/mention notification with the wrong #reply{N} floor (two notifications for the SAME reply can carry different anchors), so trusting the anchor blin...
static verifiedFloor(targetFloor: number, verifyReplyText: string, replies: V2exReply[]): number { const verify = (verifyReplyText || '').trim() if (!verify || !replies || replies.length === 0) { return targetFloor } if (targetFloor > 0) { for (let i = 0; i < replies.length; i++) { ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left verifiedFloor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left targetFloor AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#numb...
static verifiedFloor(targetFloor: number, verifyReplyText: string, replies: V2exReply[]): number { const verify = (verifyReplyText || '').trim() if (!verify || !replies || replies.length === 0) { return targetFloor } if (targetFloor > 0) { for (let i = 0; i < replies.length; i++) { ...
https://github.com/honjow/Next2V
3b56e4b0cb317c751f2a6cf485d70cf1035c0f17
github
yang-kun-long/HarmonyAccounting
entry/src/main/ets/pages/MainPage.ets
arkts
build
构建用户界面的主要函数
build() { // 初始化一个堆栈布局,用于组织和展示UI组件 Tabs({ barPosition: BarPosition.End, controller: this.tabsController }) { TabContent() { Stack() { // 使用列布局来安排UI组件,使其在垂直方向排列 Column() { // 使用行布局来安排UI组件,使其在水平方向排列 Row() { // 创建一个文本组件,显示主标题 ...
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() { // 初始化一个堆栈布局,用于组织和展示UI组件 Tabs({ barPosition: BarPosition.End, controller: this.tabsController }) { TabContent() { Stack() { // 使用列布局来安排UI组件,使其在垂直方向排列 Column() { // 使用行布局来安排UI组件,使其在水平方向排列 Row() { // 创建一个文本组件,显示主标题 ...
https://github.com/yang-kun-long/HarmonyAccounting
4c9eed79c830239233477c228cad3cee7d1c54e9
github
openharmony/applications_calendar_data
datamanager/src/main/ets/processor/instances/InstanceExpandHelper.ets
arkts
pushInstances
以syncIdKey为key,将Instances对应的ValuesBucket放入集合Map中 注:每个key对应一个Instances列表 @param syncIdKey Map集合分类的key @param values ValuesBucket数据,由此生成Instances实例
pushInstances(syncIdKey: string, values: data_rdb.ValuesBucket) { if (this.has(syncIdKey)) { this.instancesList = this.get(syncIdKey) as data_rdb.ValuesBucket[]; } if (this.instancesList === null || this.instancesList === undefined || this.instancesList?.length === 0) { this.instancesList = ne...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left pushInstances AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left syncIdKey AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AS...
pushInstances(syncIdKey: string, values: data_rdb.ValuesBucket) { if (this.has(syncIdKey)) { this.instancesList = this.get(syncIdKey) as data_rdb.ValuesBucket[]; } if (this.instancesList === null || this.instancesList === undefined || this.instancesList?.length === 0) { this.instancesList = ne...
https://gitee.com/openharmony/applications_calendar_data.git
0bb96211e1e556bc5cc6da51a588a0171931bf22
gitee
openharmony/applications_dlp_manager
entry/src/main/ets/OpenDlpFile/manager/OpeningDialogManager.ets
arkts
showOpeningDialogByTimeout
根据大小不需要弹框,但是调用penDLPFile接口超过500ms都没返回,拉起“正在打开”弹框
public async showOpeningDialogByTimeout(requestId: string): Promise<void> { const context: common.ServiceExtensionContext | undefined = AppStorage.get('viewContext'); if (!context) { HiLog.error(TAG, 'showOpeningDialogByTimeout viewContext null'); return; } const viewContext = context as c...
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 showOpeningDialogByTimeout AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left requestId AST#identifier#Right AST#ERROR#Lef...
public async showOpeningDialogByTimeout(requestId: string): Promise<void> { const context: common.ServiceExtensionContext | undefined = AppStorage.get('viewContext'); if (!context) { HiLog.error(TAG, 'showOpeningDialogByTimeout viewContext null'); return; } const viewContext = context as c...
https://gitee.com/openharmony/applications_dlp_manager.git
5b371e04c0939f7c2f2a29f6543bdc753f8a8be2
gitee
LZZLHY/hlib
entry/src/main/ets/viewmodel/DownloadVM.ets
arkts
shareFile
调起系统分享面板(ShareKit)。
static async shareFile(item: DownloadHistoryItem, ctx: common.UIAbilityContext): Promise<void> { const exists: boolean = await DownloadVM.fileExists(item.filePath); if (!exists) { throw new Error(I18n.ts('downloads_file_missing')); } const uri: string = fileUri.getUriFromPath(item.filePath); ...
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 shareFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left item AST#identifier#Right AST#:#Left : AST#:#R...
static async shareFile(item: DownloadHistoryItem, ctx: common.UIAbilityContext): Promise<void> { const exists: boolean = await DownloadVM.fileExists(item.filePath); if (!exists) { throw new Error(I18n.ts('downloads_file_missing')); } const uri: string = fileUri.getUriFromPath(item.filePath); ...
https://github.com/LZZLHY/hlib
674a705d7b0a03632ae7b2d64c925b1bb5cd38c6
github
openharmony/update_update_app
feature/ota/src/main/ets/manager/OtaUpdateManager.ets
arkts
setUpdateState
设置升级状态缓存数据 @param value 状态
setUpdateState(value): void { if (this._updateStatus !== Number(value) && value !== undefined && value !== null) { this._updateStatus = Number(value); AppStorage.Set('updateStatus', this._updateStatus); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setUpdateState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#...
setUpdateState(value): void { if (this._updateStatus !== Number(value) && value !== undefined && value !== null) { this._updateStatus = Number(value); AppStorage.Set('updateStatus', this._updateStatus); } }
https://gitee.com/openharmony/update_update_app.git
304ae97e1e63ca751f5a253636abd68d9be0e393
gitee
openharmony-sig/online_event
solution_student_challenge/基于OpenHarmony的OpenGit_潘骏翔/OpenGit/entry/src/main/ets/MainAbility/pages/profile/profile.ets
arkts
build
Profile页面的ViewModel对象
build() { Column() { //导航栏 TitleBar({ title: "个人主页" }) //用户基本信息组件:包含头像、名字、登录名 List() { //给每一项添加ListItem以确保页面实现滚动效果 ListItem() { BaseProfileComponent({ viewModel: $profileViewModel }) } ListItem() { //FIXME 界面结构有一点点乱与main里RepoHistory不统一 ...
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() { Column() { //导航栏 TitleBar({ title: "个人主页" }) //用户基本信息组件:包含头像、名字、登录名 List() { //给每一项添加ListItem以确保页面实现滚动效果 ListItem() { BaseProfileComponent({ viewModel: $profileViewModel }) } ListItem() { //FIXME 界面结构有一点点乱与main里RepoHistory不统一 ...
https://gitee.com/openharmony-sig/online_event.git
a9f473ab38c27970387552b4aa8974f2ebab8a30
gitee
HarmonyOS_Samples/scankit-samplecode-clientdemo-arkts
products/phone/src/main/ets/entryability/EntryAbility.ets
arkts
onCreate
Obtain the code value through the onCreate callback in cold launch scenarios.
onCreate(want: Want, __: AbilityConstant.LaunchParam): void { Logger.info(TAG, 'Ability onCreate'); try { DeviceService.isFolding = display.isFoldable(); } catch (error) { Logger.error(`Failed to invoke an API of isFoldable. Code: ${error?.code}`); } // Obtain the uri field from the wa...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onCreate 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#Left Want AST#identifier#Right AST#,#Left , AST#,#Ri...
onCreate(want: Want, __: AbilityConstant.LaunchParam): void { Logger.info(TAG, 'Ability onCreate'); try { DeviceService.isFolding = display.isFoldable(); } catch (error) { Logger.error(`Failed to invoke an API of isFoldable. Code: ${error?.code}`); } // Obtain the uri field from the wa...
https://gitcode.com/HarmonyOS_Samples/scankit-samplecode-clientdemo-arkts
50664ff1ad53ad4b8905e9e91d0fe078ee31414d
gitcode
openharmony/codelabs
Media/VideoPlayer/entry/src/main/ets/controller/VideoController.ets
arkts
createAVPlayer
Creates a videoPlayer object.
async createAVPlayer() { let avPlayer: media.AVPlayer = await media.createAVPlayer(); this.avPlayer = avPlayer; this.bindState(); }
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left createAVPlayer AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#{#Left { AST#{#Right AST#ERROR#Right AST#expre...
async createAVPlayer() { let avPlayer: media.AVPlayer = await media.createAVPlayer(); this.avPlayer = avPlayer; this.bindState(); }
https://gitee.com/openharmony/codelabs.git
fb454dd6dc0a738dce3c154c3b0cde40cc7fc622
gitee
openharmony-sig/ohos_checksum
library/src/main/ets/md5.ets
arkts
binl2rstr
Convert an array of little-endian words to a string
binl2rstr(input: number[]) :string { let output = ""; for (let i = 0; i < input.length * 32; i += 8) output += String.fromCharCode((input[i>>5] >>> (i % 32)) & 0xFF); return output; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left binl2rstr AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left input AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left number AST#iden...
binl2rstr(input: number[]) :string { let output = ""; for (let i = 0; i < input.length * 32; i += 8) output += String.fromCharCode((input[i>>5] >>> (i % 32)) & 0xFF); return output; }
https://gitee.com/openharmony-sig/ohos_checksum.git
66917e157d5f2fe455d185573ea7348dc9674e1d
gitee
Harrisonls2004/WaterFlow
entry/src/main/ets/common/network/ApiService.ets
arkts
getUserByUsername
根据用户名获取用户信息
static async getUserByUsername(username: string): Promise<UserResponse> { const response = await httpClient.get('/user/' + username); const result = parseJsonSafe(response.data); if (result) { const data = result as Record<string, Object>; const userResponse = new UserResponse(); us...
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 getUserByUsername AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left username AST#identifier#Right AST#ERROR#Left AST#:#Le...
static async getUserByUsername(username: string): Promise<UserResponse> { const response = await httpClient.get('/user/' + username); const result = parseJsonSafe(response.data); if (result) { const data = result as Record<string, Object>; const userResponse = new UserResponse(); us...
https://github.com/Harrisonls2004/WaterFlow
a0a59ae500a9497828a3838359a9c7181df66c1a
github