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
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/pages/Index.ets
arkts
onDragEnterAnyArea
Drag drop ANY area
onDragEnterAnyArea() { clearTimeout(this.myUi.dropHoverFlipTimeoutId); this.myUi.dropHoverFlipTimeoutId = setTimeout(() => { animateToImmediately(defaultAnimation(), () => { this.myUi.dropHover = true; }); }, 10); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onDragEnterAnyArea 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...
onDragEnterAnyArea() { clearTimeout(this.myUi.dropHoverFlipTimeoutId); this.myUi.dropHoverFlipTimeoutId = setTimeout(() => { animateToImmediately(defaultAnimation(), () => { this.myUi.dropHover = true; }); }, 10); }
https://github.com/awaLiny2333/LinysBrowser_NEXT
b22c8f168242966479d4de126a4e9f56151357f4
github
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnImageUploadViewModel.ets
arkts
deleteUploadDemoFile
删除模拟上传列表中的指定文件 @param index 待删除文件的索引
deleteUploadDemoFile(index: number): void { this.uploadDemoFileList = this.uploadDemoFileList.filter((_item: TnUploadFile, i: number) => i !== index); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left deleteUploadDemoFile 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#)#...
deleteUploadDemoFile(index: number): void { this.uploadDemoFileList = this.uploadDemoFileList.filter((_item: TnUploadFile, i: number) => i !== index); }
https://github.com/codelably/tuniao-ui
8be71c3b5cfc6dab74d3d64ed01f7624d7691b98
github
CarGuo/GSYGithubAppOH
entry/src/main/ets/net/NetworkMonitor.ets
arkts
emit
仅供测试 / 内部模拟使用:人工触发一次状态变化。
emit(online: boolean): void { this.handleChange(online); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left emit AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left online AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right AST#)#Left ) AST#)#R...
emit(online: boolean): void { this.handleChange(online); }
https://github.com/CarGuo/GSYGithubAppOH
2b3cceeff044dd77db50c79906a19d700a604f2a
github
CLMC2025/Vignette
entry/src/main/ets/manager/UserStateManager.ets
arkts
updateWordState
更新用户单词状态
updateWordState(wordId: string, newState: UserWordState, userBookId: string = ''): void { const oldProgress = this.userProgress.get(wordId); const oldState = oldProgress?.state ?? UserWordState.UNADDED; const now = Date.now(); const progress: UserWordProgress = { wordId, state: newSta...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateWordState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left wordId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left...
updateWordState(wordId: string, newState: UserWordState, userBookId: string = ''): void { const oldProgress = this.userProgress.get(wordId); const oldState = oldProgress?.state ?? UserWordState.UNADDED; const now = Date.now(); const progress: UserWordProgress = { wordId, state: newSta...
https://github.com/CLMC2025/Vignette
692270ab8e14086d59cd95094d0874d3369cc4c8
github
killetom/ktretrofit
ktretrofit/src/main/ets/retrofit/Retrofit.ets
arkts
addHeaders
Add multiple default headers to all requests.
addHeaders(headers: Record<string, string>): RetrofitBuilder { this.defaultHeaders = { ...this.defaultHeaders, ...headers }; return this; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addHeaders AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left headers AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identifier#Left Record A...
addHeaders(headers: Record<string, string>): RetrofitBuilder { this.defaultHeaders = { ...this.defaultHeaders, ...headers }; return this; }
https://github.com/killetom/ktretrofit
15e0c8cd2a99f68cc10608b9e5b663e2f52333f8
github
openharmony/arkui_ace_engine
advanced_ui_component/treeview/source/treeview.ets
arkts
buildDone
After the initialization is complete by calling the addNode interface, call this interface to complete initialization. This interface must be called when you finish initializing the ListTreeView by addNode. @syscap SystemCapability.ArkUI.ArkUI.Full @since 10 After the initialization is complete by calling the addNode i...
public buildDone(): void { this.listNodeDataSource.initSection(); this.listNodeDataSource.delayInit(); this.listNodeDataSource.updateAllChildNum(); delaySortNodeIdList(this.nodeIdList); this.initBuild = false; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left buildDone 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_s...
public buildDone(): void { this.listNodeDataSource.initSection(); this.listNodeDataSource.delayInit(); this.listNodeDataSource.updateAllChildNum(); delaySortNodeIdList(this.nodeIdList); this.initBuild = false; }
https://gitee.com/openharmony/arkui_ace_engine.git
99b3053c5b18c12158c71c4283520d76855473b5
gitee
jjjjjjava/ffmpeg_tools
src/main/ets/ffmpeg/FFmpegCommandBuilder.ets
arkts
filter
添加视频滤镜
public filter(filterExpr: string): FFmpegCommandBuilder { this.filters.push(filterExpr); return this; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left filter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filterExpr AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right...
public filter(filterExpr: string): FFmpegCommandBuilder { this.filters.push(filterExpr); return this; }
https://github.com/jjjjjjava/ffmpeg_tools
929fa04b94b65782893d0f86a449a52af90fb3ea
github
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnIconViewModel.ets
arkts
updateSearchKeyword
更新搜索关键字并刷新数据源 @param keyword 搜索关键字
updateSearchKeyword(keyword: string): void { this.searchKeyword = keyword; const filtered: string[] = this.getFilteredIconNames(); this.iconDataSource.reloadData(filtered); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateSearchKeyword AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left keyword AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) ...
updateSearchKeyword(keyword: string): void { this.searchKeyword = keyword; const filtered: string[] = this.getFilteredIconNames(); this.iconDataSource.reloadData(filtered); }
https://github.com/codelably/tuniao-ui
e024393ede05a67f60d4ee3a5cf5aaa83fa913a9
github
offlinecat-dev/OCNetORM
example/repository/UserRepository.ets
arkts
findByConditions
复杂查询示例:多条件组合 @param isActive 是否激活 @param minAge 最小年龄 @returns 用户列表
async findByConditions(isActive: boolean, minAge: number): Promise<Array<EntityData>> { const queryBuilder = this.repository.createQueryBuilder() queryBuilder .where('isActive', ConditionOperator.EQUAL, isActive) .andWhere('age', ConditionOperator.GREATER_EQUAL, minAge) .orderBy('createdAt',...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left findByConditions AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left isActive AST#identifier#Right AST#type_annotation#Left AST#:#L...
async findByConditions(isActive: boolean, minAge: number): Promise<Array<EntityData>> { const queryBuilder = this.repository.createQueryBuilder() queryBuilder .where('isActive', ConditionOperator.EQUAL, isActive) .andWhere('age', ConditionOperator.GREATER_EQUAL, minAge) .orderBy('createdAt',...
https://github.com/offlinecat-dev/OCNetORM
66a88087b3ec22e64c927547cb0a3942108652d3
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Source/SourceManager.ets
arkts
importFromFile
==================== 导入功能 ==================== 从JSON文件导入图源
async importFromFile(filePath: string): Promise<ImportResult> { try { logger.info(TAG, `开始导入图源: ${filePath}`); // 读取文件内容 const file = SafeFileUtils.openSync(filePath, fileIo.OpenMode.READ_ONLY); const buffer = new ArrayBuffer(1024 * 1024); // 1MB const readLen = SafeFileUtils.readSy...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left importFromFile AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left filePath AST#identifier#Right AST#type_annotation#Left ...
async importFromFile(filePath: string): Promise<ImportResult> { try { logger.info(TAG, `开始导入图源: ${filePath}`); // 读取文件内容 const file = SafeFileUtils.openSync(filePath, fileIo.OpenMode.READ_ONLY); const buffer = new ArrayBuffer(1024 * 1024); // 1MB const readLen = SafeFileUtils.readSy...
https://github.com/DaLongZhuaZi/manxia
1d8bb78d6641acbc6faf09bdc6949ba95ed2e4b7
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
slice
Creates a slice of current Uint8ClampedArray using range [begin, end) @param begin start index to be taken into slice @param end last index to be taken into slice @returns a new Uint8ClampedArray with elements of current Uint8ClampedArray[begin;end) where end index is excluded @link https://developer.mozilla.org/en-US/...
public slice(begin: number, end: number): Uint8ClampedArray { return this.slice(begin as int, end as int) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left slice AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left begin AST#identifier#Right AST#:#Left : AST#:#Right AST#ER...
public slice(begin: number, end: number): Uint8ClampedArray { return this.slice(begin as int, end as int) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
a2e9a525c1ea54f5ac0739860c94a7402a66ef91
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/WebViewSourceManager.ets
arkts
navigateSourceWebView
导航指定源的WebView到URL
navigateSourceWebView(sourceId: string, url: string): void { const info = this.webViewInstances.get(sourceId); if (!info) { logger.warn(TAG, `WebView实例不存在: ${sourceId}`); return; } info.controller.loadUrl(url); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left navigateSourceWebView AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left...
navigateSourceWebView(sourceId: string, url: string): void { const info = this.webViewInstances.get(sourceId); if (!info) { logger.warn(TAG, `WebView实例不存在: ${sourceId}`); return; } info.controller.loadUrl(url); }
https://github.com/DaLongZhuaZi/manxia
26e00737a99ee98a483dc8b76cc625eecaf2fa3d
github
popsiclelmlm/Hey
entry/src/main/ets/services/BackupManager.ets
arkts
collectBackup
读取四块配置 Store,组装一份全量备份对象。
static async collectBackup(context: common.Context): Promise<ConfigBackup> { const profile = await ProfileStore.load(context); const subscriptions = await SubscriptionStore.load(context); const settings = await SettingsStore.load(context); const assets = await AssetStore.load(context); return buil...
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 collectBackup AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : ...
static async collectBackup(context: common.Context): Promise<ConfigBackup> { const profile = await ProfileStore.load(context); const subscriptions = await SubscriptionStore.load(context); const settings = await SettingsStore.load(context); const assets = await AssetStore.load(context); return buil...
https://github.com/popsiclelmlm/Hey
09f08ff2d4012d00c6bef75b73a88208cff0066e
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelSourceExecutor.ets
arkts
ensureJsLib
确保当前执行器使用当前书源的jsLib快照
private ensureJsLib(): void { // 仅更新当前执行器的URL解析器快照,避免并发校验时污染全局jsLib this.urlAnalyzer.setJsLib(this.source.jsLib || ''); this.injectSourceContextToUrlAnalyzer(); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left ensureJsLib AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#express...
private ensureJsLib(): void { // 仅更新当前执行器的URL解析器快照,避免并发校验时污染全局jsLib this.urlAnalyzer.setJsLib(this.source.jsLib || ''); this.injectSourceContextToUrlAnalyzer(); }
https://github.com/DaLongZhuaZi/manxia
5a86ea515bd5b6e1cd21b6914fddd36a596c2792
github
terryma2024/happyword
harmonyos/entry/src/ohosTest/ets/test/CustomWishlistFlow.ui.test.ets
arkts
openAddCustomDialog
Open WishlistPage, tap the add-custom entry, walk through the parent-PIN gate, and land inside AddCustomWishDialog. Caller still has the dialog open on return.
async function openAddCustomDialog(driver: Driver, pin: string): Promise<void> { try { await openWishlist(driver); await driver.assertComponentExist(ON.id('WishlistAddCustomButton')); await clickByIdShared(driver, 'WishlistAddCustomButton'); await driver.delayMs(800); await driver.assertComponentE...
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left openAddCustomDialog AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left driver AST#identifier#Right A...
async function openAddCustomDialog(driver: Driver, pin: string): Promise<void> { try { await openWishlist(driver); await driver.assertComponentExist(ON.id('WishlistAddCustomButton')); await clickByIdShared(driver, 'WishlistAddCustomButton'); await driver.delayMs(800); await driver.assertComponentE...
https://github.com/terryma2024/happyword
3fd8d895fdf958fc6d4d495bee584c7283a7820e
github
FinalScave/SweetEditor
platform/OHOS/sweeteditor/src/main/ets/core/EditorCore.ets
arkts
setFoldRegions
==================== Code Folding ====================
setFoldRegions(regionsOrData: FoldRegion[] | ArrayBuffer, _size?: number): EditorActionResult { if (regionsOrData instanceof ArrayBuffer) { return CoreProtocol.decodeEditorActionResult( native.editorSetFoldRegions(this.handle, regionsOrData, regionsOrData.byteLength)); } const data = CorePro...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setFoldRegions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#identifier#Left regionsOrData AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left FoldRegion AST#identi...
setFoldRegions(regionsOrData: FoldRegion[] | ArrayBuffer, _size?: number): EditorActionResult { if (regionsOrData instanceof ArrayBuffer) { return CoreProtocol.decodeEditorActionResult( native.editorSetFoldRegions(this.handle, regionsOrData, regionsOrData.byteLength)); } const data = CorePro...
https://github.com/FinalScave/SweetEditor
fd9c6c8a3b94ac433140832f26117e7a84a685d7
github
aimilin6688/KeePassHO
entry/src/main/ets/services/TypeDefined.ets
arkts
needPassword
判断认证方式是否需要密码 @param authType 认证方式 @returns 是否需要密码
public static needPassword(authType: AuthTypeInfo): boolean { if (!authType) { return false; } return authType.type === AuthType.PASSWORD.type || authType.type === AuthType.PASSWORD_KEYFILE.type || authType.type === AuthType.PASSWORD_OTP.type || authType.type === Aut...
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 needPassword AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left authType AST#identifier#Right AST#:#Left :...
public static needPassword(authType: AuthTypeInfo): boolean { if (!authType) { return false; } return authType.type === AuthType.PASSWORD.type || authType.type === AuthType.PASSWORD_KEYFILE.type || authType.type === AuthType.PASSWORD_OTP.type || authType.type === Aut...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/TypeDefined.ets#L306-L318
a877e3073c3094c480231fbc32116efa4a306a63
github
kumaleap/ArkSwipeDeck
library/src/main/ets/utils/AnimationUtils.ets
arkts
isFastSwipe
判断是否为快速滑动 @param velocity - 滑动速度 @returns 是否为快速滑动
static isFastSwipe(velocity: number): boolean { return Math.abs(velocity) >= AnimationConstants.FAST_SWIPE_VELOCITY; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isFastSwipe AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left velocity AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Ri...
static isFastSwipe(velocity: number): boolean { return Math.abs(velocity) >= AnimationConstants.FAST_SWIPE_VELOCITY; }
https://github.com/kumaleap/ArkSwipeDeck
95806ca283b8bbaa8a6dc86bf4eb418fee323924
github
LJ666-ui/harmony-health-care
entry/src/main/ets/services/TerminalManager.ets
arkts
isTerminal
检查是否为特定终端 @param terminalType 终端类型
isTerminal(terminalType: TerminalType): boolean { return this.currentTerminal === terminalType; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isTerminal AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left terminalType AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left TerminalType AST#identifier#Right AST...
isTerminal(terminalType: TerminalType): boolean { return this.currentTerminal === terminalType; }
https://github.com/LJ666-ui/harmony-health-care
606ee5fd8bdb9519bca9d1b134539a3c9e290526
github
751496032/ZRouter
RouterApi/src/main/ets/model/NavDestBuilder.ets
arkts
enableCrossPageParamReturn
开启跨多级页面回调监听,这种场景返回需要使用popNavWithResult()方法, popNavWithResult()已废弃 @date 2025/4/19 如果在Navigation根视图中push需要监听返回数据,则需要设置listenPopResultOnRootView为true @deprecated @see listenPopResultOnRootView替代 @returns
public enableCrossPageParamReturn(): NavDestBuilder<T> { this.optionsImpl.listenPopResultOnRootView = true; return this; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left enableCrossPageParamReturn 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...
public enableCrossPageParamReturn(): NavDestBuilder<T> { this.optionsImpl.listenPopResultOnRootView = true; return this; }
https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/model/NavDestBuilder.ets#L125-L128
9e92860e06e3ac5bc667db0a8891c9bd029f24c9
github
arkui-x/samples
CodeLab/Cases/feature/containernestedslide/src/main/ets/view/NewsDetailPage.ets
arkts
getWebScrollEnd
检测web组件是否滚动到边界 isWebAtEnd:true 滚动到Web底部 isWebAtEnd:false 还未滚动到Web底部
getWebScrollEnd() { try { // 获取web组件滚动偏移量 this.webviewController.runJavaScriptExt('document.documentElement.scrollTop || document.body.scrollTop', (error, result) => { if (error || !result) { return; } let type = result.getType(); // web组件内容高度 let page...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getWebScrollEnd 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...
getWebScrollEnd() { try { // 获取web组件滚动偏移量 this.webviewController.runJavaScriptExt('document.documentElement.scrollTop || document.body.scrollTop', (error, result) => { if (error || !result) { return; } let type = result.getType(); // web组件内容高度 let page...
https://gitcode.com/arkui-x/samples
605a38f54485be280e89d4753a8fb637fbd31123
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Utils/Logger.ets
arkts
debug
🔍 调试级别的日志 @param tag - 日志分类标签, 例如 'RenderSystem' @param message - 要输出的日志信息 @param args - 其他可选参数
public debug(tag: string, message: string, ...args: (string | number | boolean)[]): void { if (this.currentLevel <= LogLevel.DEBUG) { if (this.shouldSkipForBackgroundPause(LogLevel.DEBUG)) { return; } const formattedMessage = this.formatMessageWithArgs(LogLevel.DEBUG, tag, message, args)...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left debug AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tag AST#identifier#Right AST#:#Left : AST#:#Right AST#ERRO...
public debug(tag: string, message: string, ...args: (string | number | boolean)[]): void { if (this.currentLevel <= LogLevel.DEBUG) { if (this.shouldSkipForBackgroundPause(LogLevel.DEBUG)) { return; } const formattedMessage = this.formatMessageWithArgs(LogLevel.DEBUG, tag, message, args)...
https://github.com/DaLongZhuaZi/manxia
5bc107502c9c9a1bc6512e1a9f82af89fa15c0ca
github
midori52000/ArkPilot
Agent/entry/src/main/ets/skills/SkillsBackendService.ets
arkts
sanitizeSourcePath
================================================================ 路径安全校验 ================================================================
private sanitizeSourcePath(raw: string): string | null { const trimmed = raw.trim(); if (trimmed.length === 0) { return null; } const parts = trimmed.split('/').filter((p: string): boolean => p.length > 0); if (parts.length === 0) { return null; } for (const part of parts) { ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left sanitizeSourcePath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left raw AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#...
private sanitizeSourcePath(raw: string): string | null { const trimmed = raw.trim(); if (trimmed.length === 0) { return null; } const parts = trimmed.split('/').filter((p: string): boolean => p.length > 0); if (parts.length === 0) { return null; } for (const part of parts) { ...
https://github.com/midori52000/ArkPilot
2d8deede7f2279588f07d7dc8ed07022673e321a
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
toReversed
Creates a reversed copy @returns { Int16Array } - a reversed copy @syscap SystemCapability.Utils.Lang @FaAndStageModel
public toReversed(): Int16Array { let newArray = new Int16Array(this.lengthInt); if (this.lengthInt > 0) { Int16Array.reverseCopyBuffer(newArray.buffer, this.buffer, this.byteOffset, this.lengthInt); } return newArray }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toReversed 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 Int16Array ...
public toReversed(): Int16Array { let newArray = new Int16Array(this.lengthInt); if (this.lengthInt > 0) { Int16Array.reverseCopyBuffer(newArray.buffer, this.buffer, this.byteOffset, this.lengthInt); } return newArray }
https://gitcode.com/iop123123/arkts-static-skills
2a71c39e4bb7f18f29206a413dc76506c0d2d68e
gitcode
Explore-In-HMOS-Wearable/perfume-collection
entry/src/main/ets/service/HapticService.ets
arkts
soft
Trigger a soft haptic feedback. Used when removing from favorites.
static soft(): void { try { vibrator.isSupportEffect('haptic.effect.soft', (err: BusinessError, state: boolean) => { if (!err && state) { try { vibrator.startVibration({ type: 'preset', effectId: 'haptic.effect.soft', count: 1 ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left soft 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...
static soft(): void { try { vibrator.isSupportEffect('haptic.effect.soft', (err: BusinessError, state: boolean) => { if (!err && state) { try { vibrator.startVibration({ type: 'preset', effectId: 'haptic.effect.soft', count: 1 ...
https://github.com/Explore-In-HMOS-Wearable/perfume-collection
66ed9c528252233295894e1e07195f3472d626be
github
openharmony/third_party_typescript
tests/arkTSTest/testcase/arkts-no-implicit-return-types/arkts-no-implicit-return-types-1-ok.ets
arkts
callAddFunction
The return data type can be omitted and will be inferred based on the return type of the add function
function callAddFunction(a: number, b: number) { return add(a, b) }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left callAddFunction AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left a AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Rig...
function callAddFunction(a: number, b: number) { return add(a, b) }
https://gitee.com/openharmony/third_party_typescript.git
850f2d90b7b8c19628f97c1aff973aa1622f5278
gitee
jjjjjjava/ffmpeg_tools
src/main/ets/ffmpeg/FFmpegFactory.ets
arkts
imageRotate
图片旋转 @param input 输入图片路径 @param output 输出图片路径 @param angle 旋转角度:90, 180, 270
public static imageRotate(input: string, output: string, angle: number): string[] { let transpose = ''; switch (angle) { case 90: transpose = 'transpose=1'; // 顺时针 90° break; case 180: transpose = 'transpose=1,transpose=1'; // 180° break; case 270: tra...
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 imageRotate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left input AST#identifier#Right AST#:#Left : AST...
public static imageRotate(input: string, output: string, angle: number): string[] { let transpose = ''; switch (angle) { case 90: transpose = 'transpose=1'; // 顺时针 90° break; case 180: transpose = 'transpose=1,transpose=1'; // 180° break; case 270: tra...
https://github.com/jjjjjjava/ffmpeg_tools
786fff237d8808edca31d1719acb207c774f78c5
github
XHXYT/Pixark
entry/src/main/ets/viewmodel/NovelDetailViewModel.ets
arkts
parseSeriesNavigation
从 HTML 字符串中提取 seriesNavigation 的 JSON
private parseSeriesNavigation(html: string): SeriesNavigation | null { if (!html) return null; const key = '"seriesNavigation"'; const startIndex = html.indexOf(key); if (startIndex === -1) return null; let braceStart = html.indexOf('{', startIndex + key.length); if (braceStart === -1) retur...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseSeriesNavigation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left html AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif...
private parseSeriesNavigation(html: string): SeriesNavigation | null { if (!html) return null; const key = '"seriesNavigation"'; const startIndex = html.indexOf(key); if (startIndex === -1) return null; let braceStart = html.indexOf('{', startIndex + key.length); if (braceStart === -1) retur...
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/viewmodel/NovelDetailViewModel.ets#L151-L198
d441ac41b63b65cffac1614b31e632841adbcf74
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Animation/GlobalAnimationSystem.ets
arkts
setUIContext
设置UI上下文
public setUIContext(uiContext: UIContext): void { this.uiContext = uiContext; logger.debug(TAG, 'UI上下文已设置'); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setUIContext AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uiContext AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
public setUIContext(uiContext: UIContext): void { this.uiContext = uiContext; logger.debug(TAG, 'UI上下文已设置'); }
https://github.com/DaLongZhuaZi/manxia
4b03d9eb10e18590da061ecca57d61ded1e37c81
github
LambdaYH/ScrcpyForHarmonyOS
app/src/main/ets/client/tools/ControlPacket.ets
arkts
createAppSwitchKey
发送App Switch键
static createAppSwitchKey(): ArrayBuffer[] { return ControlPacket.createKeyEventPair(KeyCode.KEYCODE_APP_SWITCH); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createAppSwitchKey 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 Arr...
static createAppSwitchKey(): ArrayBuffer[] { return ControlPacket.createKeyEventPair(KeyCode.KEYCODE_APP_SWITCH); }
https://github.com/LambdaYH/ScrcpyForHarmonyOS
301fa5a0f10fc88fc98685024999c4d87e2b2b30
github
chenchl/GMLogger-HarmonyOS
gmlogger/src/main/ets/components/security/logger/LoggerCryptoUtil.ets
arkts
generateRandom
生成指定长度的随机字节数组 该函数使用加密框架生成一个指定长度的随机字节数组,并返回该数组。 @param len - 需要生成的随机字节数组的长度,类型为 `number`。 @returns 返回生成的随机字节数组,类型为 `Uint8Array`。
static generateRandom(len: number) { // 创建一个随机数生成器实例 let rand = cryptoFramework.createRandom(); // 同步生成指定长度的随机字节数组 let generateRandSync = rand.generateRandomSync(len); // 返回生成的随机字节数组 return generateRandSync; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left generateRandom AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left len AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left nu...
static generateRandom(len: number) { // 创建一个随机数生成器实例 let rand = cryptoFramework.createRandom(); // 同步生成指定长度的随机字节数组 let generateRandSync = rand.generateRandomSync(len); // 返回生成的随机字节数组 return generateRandSync; }
https://github.com/chenchl/GMLogger-HarmonyOS
050937ee570ab74032e8e63e7c2c1cc3338b7a05
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/PieChartModel.ets
arkts
setEntryLabelTextSize
Sets the size of the entry labels in vp. Default: 14vp @param size
public setEntryLabelTextSize(size: number): void { ( /*(PieChartRenderer)*/ this.mRenderer as PieChartRenderer).getPaintEntryLabels() .setTextSize(Utils.handleDataValues(size)); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setEntryLabelTextSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left size AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier...
public setEntryLabelTextSize(size: number): void { ( /*(PieChartRenderer)*/ this.mRenderer as PieChartRenderer).getPaintEntryLabels() .setTextSize(Utils.handleDataValues(size)); }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
d3f070e370c32b4840c671c84b0cdfc5ff0c888a
gitee
LJ666-ui/harmony-health-care
entry/src/main/ets/medicalimaging/MedicalImageUtils.ets
arkts
calculateCosineSimilarity
计算两个特征向量的余弦相似度 @param vector1 向量1 @param vector2 向量2 @returns 相似度(0-1)
static calculateCosineSimilarity(vector1: number[], vector2: number[]): number { if (vector1.length !== vector2.length) { return 0; } let dotProduct = 0; let norm1 = 0; let norm2 = 0; for (let i = 0; i < vector1.length; i++) { dotProduct += vector1[i] * vector2[i]; norm1 +=...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left calculateCosineSimilarity AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left vector1 AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#sub...
static calculateCosineSimilarity(vector1: number[], vector2: number[]): number { if (vector1.length !== vector2.length) { return 0; } let dotProduct = 0; let norm1 = 0; let norm2 = 0; for (let i = 0; i < vector1.length; i++) { dotProduct += vector1[i] * vector2[i]; norm1 +=...
https://github.com/LJ666-ui/harmony-health-care
ca0acf7234a04b1d8e4891b3891420133685c5bf
github
openharmony-sig/applications_calculator
feature/calculation/src/main/ets/calculator/DigitPanelController.ets
arkts
updateMemoryDisplay
updateMemoryDisplay @param value PhysicsButtonInfo @param callBack PhysicsButtonInfo
public updateMemoryDisplay(value: PhysicsButtonInfo, callBack: Function): void { if (this.evaluator !== null) { this.evaluator.updateMemoryDisplay(value, callBack); } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left updateMemoryDisplay AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#...
public updateMemoryDisplay(value: PhysicsButtonInfo, callBack: Function): void { if (this.evaluator !== null) { this.evaluator.updateMemoryDisplay(value, callBack); } }
https://gitee.com/openharmony-sig/applications_calculator.git
5ebdc5ea160aae667d5705a80527782bc2a335c3
gitee
HarmonyCandies/image_cropper
image_cropper/src/main/ets/components/ImageCropper.ets
arkts
_handleAspectRatio
/ handle crop rect with aspectRatio
_handleAspectRatio(gWidth: number, moveType: _MoveType, result: geometry.Rect, layerDestinationRect: geometry.Rect, delta: geometry.Offset): geometry.Rect { let aspectRatio = this._actionDetails!.cropAspectRatio; // do with aspect ratio if (aspectRatio != null) { let minD = gWidth * 2; swi...
AST#program#Left AST#expression_statement#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left _handleAspectRatio AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left gWidth AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie...
_handleAspectRatio(gWidth: number, moveType: _MoveType, result: geometry.Rect, layerDestinationRect: geometry.Rect, delta: geometry.Offset): geometry.Rect { let aspectRatio = this._actionDetails!.cropAspectRatio; // do with aspect ratio if (aspectRatio != null) { let minD = gWidth * 2; swi...
https://github.com/HarmonyCandies/image_cropper/blob/dd3664946b413166307b736a5763f998084364e1/image_cropper/src/main/ets/components/ImageCropper.ets#L915-L980
aa8dda16497633d7116e6021f23e480a3655ee69
github
openharmony/codelabs
ETSUI/ItemManagerAPP/entry/src/main/ets/data/ItemRdb.ets
arkts
queryAll
查询所有物品
async queryAll(): Promise<Item[]> { if (this.isMock) { return [...this.mockData]; // 返回副本,避免外部修改 } if (!this.rdbStore) { throw new Error('数据库未初始化'); } const predicates = new relationalStore.RdbPredicates(this.tableName); predicates.orderByDesc('id'); // 按id倒序,最新添加的在前面 const ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left queryAll AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#...
async queryAll(): Promise<Item[]> { if (this.isMock) { return [...this.mockData]; // 返回副本,避免外部修改 } if (!this.rdbStore) { throw new Error('数据库未初始化'); } const predicates = new relationalStore.RdbPredicates(this.tableName); predicates.orderByDesc('id'); // 按id倒序,最新添加的在前面 const ...
https://gitcode.com/openharmony/codelabs
33c04d91b58a0a19225a04bd99ced1bc0ff9c58d
gitcode
aimilin6688/KeePassHO
entry/src/main/ets/common/utils/ImagePickerUtils.ets
arkts
handlerImages
处理选择的图片, 返回base64编码 @param context @param uris @returns
public static async handlerImages(uris: Array<string>, size: number): Promise<string[]> { let result: string[] = []; if (!uris || uris.length <= 0) { return result; } for (let i = 0; i < uris.length; i++) { let photoUri = uris[i]; try { const file = await fs.open(photoUri, fs...
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 handlerImages AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uris...
public static async handlerImages(uris: Array<string>, size: number): Promise<string[]> { let result: string[] = []; if (!uris || uris.length <= 0) { return result; } for (let i = 0; i < uris.length; i++) { let photoUri = uris[i]; try { const file = await fs.open(photoUri, fs...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/ImagePickerUtils.ets#L44-L97
0f7ed629a42c2310621087e0bee78f5b6554596d
github
zcg741/chengyu-game
entry/src/main/ets/viewmodel/GameViewModel.ets
arkts
createEmptySession
创建空游戏会话
private createEmptySession(): GameSession { return { mode: GAME_MODE.TIMER, score: 0, correctCount: 0, wrongCount: 0, consecutiveCorrect: 0, currentLevel: 1, lives: 0, remainingTime: GAME_CONFIG.TIMER_MODE_DURATION, isPlaying: false, isGameOver: false, ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left createEmptySession 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 ...
private createEmptySession(): GameSession { return { mode: GAME_MODE.TIMER, score: 0, correctCount: 0, wrongCount: 0, consecutiveCorrect: 0, currentLevel: 1, lives: 0, remainingTime: GAME_CONFIG.TIMER_MODE_DURATION, isPlaying: false, isGameOver: false, ...
https://github.com/zcg741/chengyu-game
39d3350959854fd6fd9b185307e57423e8f32c9a
github
openharmony-sig/amountinputtext
libamountinput/src/main/ets/model/CurrencyModel.ets
arkts
constructor
币种符号, ¥
constructor(code, name, symbol) { this.code = code; this.name = name; this.symbol = symbol; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left code AST#identifier#Right AST#,#Left , AST#,#Right AST#identifier#Left name AST#identifier#Right AST#,#Left , AST#,#Right AST#ident...
constructor(code, name, symbol) { this.code = code; this.name = name; this.symbol = symbol; }
https://gitee.com/openharmony-sig/amountinputtext.git
accb47118ce0870a6740fadb1e0b4406fff3ba13
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/libs/htmlparser/Node.ets
arkts
textContent
设置文本内容
set textContent(val: string) { this.rawText = this.encodeHtmlEntities(val); }
AST#program#Left AST#ERROR#Left AST#set#Left set AST#set#Right AST#call_expression#Left AST#identifier#Left textContent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left val AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#ide...
set textContent(val: string) { this.rawText = this.encodeHtmlEntities(val); }
https://github.com/DaLongZhuaZi/manxia
dbd471f2220f77446b3c7ce58abf20b85783ba27
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/listener/BarLineChartTouchListener.ets
arkts
setDragTriggerDist
Sets the minimum distance that will be interpreted as a "drag" by the chart in vp. Default: 3vp @param dragTriggerDistance
public setDragTriggerDist(dragTriggerDistance: number) { this.mDragTriggerDist = Utils.handleDataValues(dragTriggerDistance); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setDragTriggerDist AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left dragTriggerDistance AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left nu...
public setDragTriggerDist(dragTriggerDistance: number) { this.mDragTriggerDist = Utils.handleDataValues(dragTriggerDistance); }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
de69390b10b8969428df4aa42761a3f6584a0ccb
gitee
HarmonyOS_Samples/MusicHome
common/musicbasic/src/main/ets/model/SongDataSource.ets
arkts
getData
@param index Zero-based index. @returns Song at the index, or a new empty {@link SongItem} if index is out of range.
public getData(index: number): SongItem { const len = this.dataArray.length; if (index < 0 || index >= len) { Logger.warn('SongDataSource', `getData out of range: index=${index}, length=${len}`); return new SongItem(); } return this.dataArray[index]; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number ...
public getData(index: number): SongItem { const len = this.dataArray.length; if (index < 0 || index >= len) { Logger.warn('SongDataSource', `getData out of range: index=${index}, length=${len}`); return new SongItem(); } return this.dataArray[index]; }
https://gitcode.com/HarmonyOS_Samples/MusicHome
c51c783300b9ec52d9007a3af9219270bf1723eb
gitcode
OHPG/FinSdk
jellyfin/src/main/ets/api/LibraryApi.ets
arkts
getMediaFolders
@summary Gets all user media folders. @param {LibraryApiGetMediaFoldersRequest} requestParameters Request parameters. @param {*} [options] Override http request option. @throws {RequiredError} @memberof LibraryApi
public getMediaFolders(requestParameters: LibraryApiGetMediaFoldersRequest = {}): Promise<BaseItemDtoQueryResult> { return this.apiClient.get({path: `/Libraries/MediaFolders`, parameters: requestParameters}) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getMediaFolders AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ass...
public getMediaFolders(requestParameters: LibraryApiGetMediaFoldersRequest = {}): Promise<BaseItemDtoQueryResult> { return this.apiClient.get({path: `/Libraries/MediaFolders`, parameters: requestParameters}) }
https://github.com/OHPG/FinSdk
0430509f9821f0b2eeda1f5696ddd6764d99fa23
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Source/SignatureHandler.ets
arkts
generateSignatureHeaders
为请求生成签名头 @param context 签名上下文 @returns 包含签名的请求头
async generateSignatureHeaders(context: SignatureContext): Promise<Record<string, string>> { if (!this.config.enabled) { return {}; } try { // 生成时间戳和nonce const timestamp: number = context.timestamp !== undefined ? context.timestamp : Math.floor(Date.now() / 1000); const nonce: st...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left generateSignatureHeaders AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifi...
async generateSignatureHeaders(context: SignatureContext): Promise<Record<string, string>> { if (!this.config.enabled) { return {}; } try { // 生成时间戳和nonce const timestamp: number = context.timestamp !== undefined ? context.timestamp : Math.floor(Date.now() / 1000); const nonce: st...
https://github.com/DaLongZhuaZi/manxia
f011885687240900821f5fbabaa4b81740a22dc9
github
openharmony-sig/ohos_react_native
tester/harmony/sample_package/src/main/ets/SampleTurboModule.ets
arkts
calculateOnWorker
demonstrates calling `runOnWorkerThread` as well as sharing state between the MAIN and Worker runtimes through `params`
async calculateOnWorker(n: number): Promise<number> { const params = new FibonacciRunnableParams(n); return this.ctx.runOnWorkerThread(new FibonacciRunnable(), params); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left calculateOnWorker AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left n AST#identifier#Right AST#type_annotation#Left AST#:#Left : ...
async calculateOnWorker(n: number): Promise<number> { const params = new FibonacciRunnableParams(n); return this.ctx.runOnWorkerThread(new FibonacciRunnable(), params); }
https://gitee.com/openharmony-sig/ohos_react_native.git
375fd27a567bfe20bc4f79cd0848778859c7b85b
gitee
openharmony-tpc/openharmony_tpc_samples
OhosVideoCache/entry/src/main/ets/pages/DiyCacheCountPage.ets
arkts
timeUpdate
设置播放时间上报监听
timeUpdate(): void { this.avPlayer?.on('timeUpdate', (time: number) => { Logger.info(TAG, 'timeUpdate called: time is :' + time); Logger.info(TAG, 'timeUpdate called: currentTime is :' + this.avPlayer?.currentTime); this.currentTime = this.mediaLibUtils.getShowTime(time); this.setValue = M...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left timeUpdate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#L...
timeUpdate(): void { this.avPlayer?.on('timeUpdate', (time: number) => { Logger.info(TAG, 'timeUpdate called: time is :' + time); Logger.info(TAG, 'timeUpdate called: currentTime is :' + this.avPlayer?.currentTime); this.currentTime = this.mediaLibUtils.getShowTime(time); this.setValue = M...
https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git
5bca8be277ade99357cfe384b12ff7406651d2ac
gitee
cpdd5201314/harmonyOS-music-app
products/phone/src/main/ets/pages/AlbumService.ets
arkts
httpFetch
发送HTTP请求 @param url 请求URL @param options 请求选项 @param retryNum 重试次数 @returns Promise<ESObject>
private static async httpFetch( url: string, options: HttpRequestOptions, retryNum: number ): Promise<ESObject> { if (retryNum >= AlbumService.MAX_RETRY) { throw new Error(`请求失败,已重试${AlbumService.MAX_RETRY}次`); } try { const httpRequest = http.createHttp(); // 设置请求选项 ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left httpFetch AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url A...
private static async httpFetch( url: string, options: HttpRequestOptions, retryNum: number ): Promise<ESObject> { if (retryNum >= AlbumService.MAX_RETRY) { throw new Error(`请求失败,已重试${AlbumService.MAX_RETRY}次`); } try { const httpRequest = http.createHttp(); // 设置请求选项 ...
https://github.com/cpdd5201314/harmonyOS-music-app
e822f13500a0a533b40e377ccfd3395aa97fc9da
github
darcycui/DarcyHarmonyNext
entry/src/main/ets/pages/entry/status/watch/WatchLinkPage.ets
arkts
onBasketUpdated
@Watch 回调
onBasketUpdated(propName: string): void { this.totalPurchase = this.getTotal(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onBasketUpdated AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left propName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST...
onBasketUpdated(propName: string): void { this.totalPurchase = this.getTotal(); }
https://github.com/darcycui/DarcyHarmonyNext/blob/241d0ee75929f6b3f9e1fe5b550acf6c9533c15c/entry/src/main/ets/pages/entry/status/watch/WatchLinkPage.ets#L46-L48
a3b1b68474c101ed90b1230affd6a0d57eabf5bd
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/greater_or_equal/greater_or_equal_long.ets
arkts
main
--- desc: check greater or equal for two long integers ---
function main(): void { const a: long = {{v.left}} const b: long = {{v.right}} assert (a >= b) == {{v.result}}
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A...
function main(): void { const a: long = {{v.left}} const b: long = {{v.right}} assert (a >= b) == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
bfd891feea3c5f8edfeed6e4cbcf23691718fa1c
gitee
dingzhilin1990/zhilinclaw
src/security/SandboxedExecutor.ets
arkts
validateInput
验证输入数据
private validateInput(args: any[]): any[] { // 过滤危险的输入 return args.map(arg => { if (typeof arg === 'string') { // 移除潜在的危险字符 return this.sanitizeString(arg); } return arg; }); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left validateInput AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left args AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expre...
private validateInput(args: any[]): any[] { // 过滤危险的输入 return args.map(arg => { if (typeof arg === 'string') { // 移除潜在的危险字符 return this.sanitizeString(arg); } return arg; }); }
https://github.com/dingzhilin1990/zhilinclaw
cd3459243049afde2137b260a5e827f2b56dbe96
github
openharmony/arkui_advanced_ui_component
atomicservicenavigation/source/atomicservicenavigation.ets
arkts
drawTransparentGradient
双色渐变下透明效果的实现 @param context 画布上下文 @param backgroundTheme 背景色底色
drawTransparentGradient(context: CanvasRenderingContext2D, backgroundTheme: BackgroundTheme): void { let height = this.navigationHeight * COLOR_RATIO_THIRTY_PERCENT; let grad = context.createLinearGradient(0, 0, 0, height); grad.addColorStop(0, backGroundTransparentGradientColor[backgroundTheme - 1][0]); ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left drawTransparentGradient AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left CanvasRenderingContext2D AST#...
drawTransparentGradient(context: CanvasRenderingContext2D, backgroundTheme: BackgroundTheme): void { let height = this.navigationHeight * COLOR_RATIO_THIRTY_PERCENT; let grad = context.createLinearGradient(0, 0, 0, height); grad.addColorStop(0, backGroundTransparentGradientColor[backgroundTheme - 1][0]); ...
https://gitee.com/openharmony/arkui_advanced_ui_component.git
9974c513279c4ac4be5530289be211fa7fb1358d
gitee
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.LightWeightMap.ets
arkts
getKeyAt
Gets the key at the specified index in the LightWeightMap @param index the index to get the key from @returns the key at the specified index @throws BusinessError if the index is out of range, the container is empty or the index exceeds Int.MAX_VALUE.
getKeyAt(index: int): K { this.checkIndex(index); this.checkEmptyContainer(); this.checkRange(index, this.buckets.actualLength); return this.buckets.entryKeys[index] as K; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getKeyAt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left index AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#Right AST#ERROR#Right AST#)#Left ) AST#)#Ri...
getKeyAt(index: int): K { this.checkIndex(index); this.checkEmptyContainer(); this.checkRange(index, this.buckets.actualLength); return this.buckets.entryKeys[index] as K; }
https://gitcode.com/iop123123/arkts-static-skills
4e452a663004053127212f85f6d3eb69d603ced3
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/MangaSourceActionEngine.ets
arkts
waitForElement
等待元素出现
private async waitForElement(selector: string, timeout: number): Promise<boolean> { const startTime = Date.now(); while (Date.now() - startTime < timeout) { const exists = await this.checkElement(selector); if (exists) { return true; } await this.sleep(200); } thr...
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 waitForElement AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left selector AST#identifier#Right AST#ERROR#Left AST#:#Le...
private async waitForElement(selector: string, timeout: number): Promise<boolean> { const startTime = Date.now(); while (Date.now() - startTime < timeout) { const exists = await this.checkElement(selector); if (exists) { return true; } await this.sleep(200); } thr...
https://github.com/DaLongZhuaZi/manxia
f8e16b03b9061c0f2fa6fc98dd11a24526f073e3
github
webabcd/HarmonyDemo
entry/src/main/ets/pages/arkts/advanced/AsyncAwait.ets
arkts
p1
async/await - 用于异步编程(非多线程) async function 返回的是 Promise 对象 await 用于等 Promise 对象或者 thenable 对象,其只能放在 async function 中 所谓的 thenable 对象,就是定义了 then() 方法的对象 async function 的说明 p1() 等价于 p2()
function p1() { return Promise.resolve("webabcd"); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left p1 AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#return_statement#Left AS...
function p1() { return Promise.resolve("webabcd"); }
https://github.com/webabcd/HarmonyDemo
a934b549a2be68c8ed158be64d2922f96fb285d3
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
slice
Creates a slice of current Int16Array using range [begin, end) @param begin start index to be taken into slice @param end last index to be taken into slice @returns a new Int16Array with elements of current Int16Array[begin;end) where end index is excluded @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/R...
public slice(begin: number, end: number): Int16Array { return this.slice(begin as int, end as int) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left slice AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left begin AST#identifier#Right AST#:#Left : AST#:#Right AST#ER...
public slice(begin: number, end: number): Int16Array { return this.slice(begin as int, end as int) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
7c029968abefa15d3ebf6f83ac636a6b37603344
gitee
HarmonyOS_Samples/BestPracticeSnippets
ComponentReuse/entry/src/main/ets/view/WithReuseId.ets
arkts
build
[EndExclude opt_reuseId]
build() { Column() { List({ space: this.LIST_SPACE }) { LazyForEach(this.momentData, (moment: FriendMoment) => { ListItem() { OneMoment({ moment: moment })// ReusId is used to control component reuse .reuseId((moment.image !== '') ? 'withImage_id' : 'noImage_id') ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#object#Left AST#{#Left { AST#{#Right AST#method_def...
build() { Column() { List({ space: this.LIST_SPACE }) { LazyForEach(this.momentData, (moment: FriendMoment) => { ListItem() { OneMoment({ moment: moment })// ReusId is used to control component reuse .reuseId((moment.image !== '') ? 'withImage_id' : 'noImage_id') ...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
07e05abe7d1dfd8d2139d74fa1af22ed41a24a25
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Class.ets
arkts
ofAny
Get the class of an object of any type. @param { Any } obj The object to get the class from. @returns { Class | undefined } the class of the object, or undefined if the object is not a class instance. @static @syscap SystemCapability.Utils.Lang
public static ofAny(obj: Any): Class | undefined { if (obj instanceof Object) { return Class.of(obj as Object) } if (obj === null) { return Class.from<null>() } return undefined }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left ofAny AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST...
public static ofAny(obj: Any): Class | undefined { if (obj instanceof Object) { return Class.of(obj as Object) } if (obj === null) { return Class.from<null>() } return undefined }
https://gitcode.com/iop123123/arkts-static-skills
381766a41aa0e5c1b694ab54350637b51d40f5bd
gitcode
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test60_original_index.ets
arkts
isBalanced
--- Bracket matching ---
function isBalanced(s: string): boolean { let stack: string[] = []; for (let i: number = 0; i < s.length; i++) { let ch: string = s.charAt(i); if (ch === '(' || ch === '[' || ch === '{') { stack.push(ch); } else { if (stack.length === 0) { return false; } let top: string ...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left isBalanced AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left s AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AS...
function isBalanced(s: string): boolean { let stack: string[] = []; for (let i: number = 0; i < s.length; i++) { let ch: string = s.charAt(i); if (ch === '(' || ch === '[' || ch === '{') { stack.push(ch); } else { if (stack.length === 0) { return false; } let top: string ...
https://github.com/miaochiahao/ark-ghidra
ae0607fa41df6153752a74ce67319e8551d8477e
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Array.ets
arkts
create
Creates a new Array of the specified length, filled with the specified initial value. @param { int } arrayLength The amount of elements in the new array. @param { T } initialValue The value to fill the array with. @returns { Array<T> } A new Array instance filled with the initial value. @static @syscap SystemCapability...
public static create<T>(arrayLength: int, initialValue: T): Array<T> { let other = new Array<T>(arrayLength) other.fill(initialValue) return other }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#ERROR#Right AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#identifier#Left create AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#i...
public static create<T>(arrayLength: int, initialValue: T): Array<T> { let other = new Array<T>(arrayLength) other.fill(initialValue) return other }
https://gitcode.com/iop123123/arkts-static-skills
75d878fc1c0b64102a9fbca70d0267c0315f5edf
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Components/ThemeAware.ets
arkts
isLightTheme
判断是否为浅色主题
public isLightTheme(): boolean { return this.currentTheme === ThemeType.LIGHT; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isLightTheme 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#...
public isLightTheme(): boolean { return this.currentTheme === ThemeType.LIGHT; }
https://github.com/DaLongZhuaZi/manxia
14cf9581acead3d92ea0b9968d9256ef0878c4fb
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/OCRRecognitionDAO.ets
arkts
getStatisticsByProvider
按提供商统计
static async getStatisticsByProvider(userId: number): Promise<ProviderStatistics[]> { try { const store = DatabaseManager.getDatabase(); const sql = ` SELECT ocr_provider as provider, COUNT(*) as count, AVG(CASE WHEN recognition_status = 'success' THEN 1.0 ELSE 0....
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 getStatisticsByProvider AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#...
static async getStatisticsByProvider(userId: number): Promise<ProviderStatistics[]> { try { const store = DatabaseManager.getDatabase(); const sql = ` SELECT ocr_provider as provider, COUNT(*) as count, AVG(CASE WHEN recognition_status = 'success' THEN 1.0 ELSE 0....
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
11e5c4971814d5ba3f8cb64616921a1ed0379cbe
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/PieRadarChartBaseModel.ets
arkts
isRotationEnabled
Returns true if rotation of the chart by touch is enabled, false if not. @return
public isRotationEnabled(): boolean { return this.mRotateEnabled; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isRotationEnabled 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...
public isRotationEnabled(): boolean { return this.mRotateEnabled; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
4801b5f6afc399eef42c8182eae5d1b8b53e6791
gitee
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets
arkts
values
Creates and returns an iterator for buf values (bytes). @returns { IterableIterator<long> }
public values(): IterableIterator<long> { return new BufferIteratorValues(this); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left values AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_stat...
public values(): IterableIterator<long> { return new BufferIteratorValues(this); }
https://gitcode.com/iop123123/arkts-static-skills
4310a8ac91df73834e67945e40e9d64ec51f8ffc
gitcode
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/hosts/userdata/keyshortcuts/classes/meowKeyboardMan.ets
arkts
saveToSettings
Save to settings.
private saveToSettings() { const mySettings = getMySettings(); const newSettingsStrings = this.shortcuts.map(shortcut => shortcut.toArray().join(' ')); mySettings.setByIndex(29, newSettingsStrings); mySettings.requestSaveToDisk(); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left saveToSettings AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Le...
private saveToSettings() { const mySettings = getMySettings(); const newSettingsStrings = this.shortcuts.map(shortcut => shortcut.toArray().join(' ')); mySettings.setByIndex(29, newSettingsStrings); mySettings.requestSaveToDisk(); }
https://github.com/awaLiny2333/LinysBrowser_NEXT
912c10c1ec4734a571bb47694f87c008822041ca
github
openharmony/applications_permission_manager
permissionmanager/src/main/ets/common/permissionGroupManager/PermissionGroupManager.ets
arkts
getPermissionOption
根据点击状态,返回当前权限对应的操作 @param permission 权限 @param groupName 权限组名 @param callerAppInfo 调用方信息 @param locationFlag 位置权限组flag @param buttonStatus return
public getPermissionOption( permission: Permission, groupName: PermissionGroup, callerAppInfo: CallerAppInfo, locationFlag: number, buttonStatus: ButtonStatus ): PermissionOption { const groupHandle = this.permissionStrategies.get(groupName); let situation: ClickOption = this.getClickSit...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getPermissionOption AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left permission AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi...
public getPermissionOption( permission: Permission, groupName: PermissionGroup, callerAppInfo: CallerAppInfo, locationFlag: number, buttonStatus: ButtonStatus ): PermissionOption { const groupHandle = this.permissionStrategies.get(groupName); let situation: ClickOption = this.getClickSit...
https://gitee.com/openharmony/applications_permission_manager.git
6d9fe94e1231b525931e1eb79546266622715865
gitee
offlinecat-dev/OCNetORM
src/main/ets/core/EntityMetadata.ets
arkts
setHooks
设置实体钩子 @param hooks 实体钩子
setHooks(hooks: EntityHooks | null): void { this.hooks = hooks }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setHooks AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left hooks AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#identifier#Left EntityHooks AST#ide...
setHooks(hooks: EntityHooks | null): void { this.hooks = hooks }
https://github.com/offlinecat-dev/OCNetORM
135463cab17256c0a69a8ffbe0f866bcefca865f
github
CarGuo/GSYGithubAppOH
entry/src/main/ets/service/RepositoryService.ets
arkts
buildPulse
Pulse 简版:RN 端是抓 GitHub Web Pulse 页 HTML 解析,这里改为 用本仓库已有的 detail.open_issues_count 与近 7 天 closed issues 搜索数做近似聚合。 数据准确度低于 RN,但能给「Pulse」tab 提供可视化卡片。
async buildPulse(fullName: string): Promise<RepositoryServiceResult<RepositoryPulseData>> { const owner: RepoOwnerName = RepoOwnerName.parse(fullName); if (owner.owner.length === 0 || owner.name.length === 0) { const empty: RepositoryPulseData = { weekOpenedCount: 0, weekClosedCount: 0, description: '' ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left buildPulse AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left fullName AST#identifier#Right AST#type_annotation#Left AST#:#Left : ...
async buildPulse(fullName: string): Promise<RepositoryServiceResult<RepositoryPulseData>> { const owner: RepoOwnerName = RepoOwnerName.parse(fullName); if (owner.owner.length === 0 || owner.name.length === 0) { const empty: RepositoryPulseData = { weekOpenedCount: 0, weekClosedCount: 0, description: '' ...
https://github.com/CarGuo/GSYGithubAppOH
d81a413b010756951b40b35f066424ce18f0f627
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/Boolean.ets
arkts
unboxed
Returns the value of this instance as a primitive @returns primitive boolean value
public unboxed(): boolean { return this.value; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left unboxed 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#boole...
public unboxed(): boolean { return this.value; }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
a1f99a2892a4d33a46171ccef57d115f2b4eac76
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Set.ets
arkts
add
Adds an element to the end of the Set object. Returns the Set object. @param { K } val - The value to add to the Set. @returns { this } - Returns the Set instance itself. @syscap SystemCapability.Utils.Lang @FaAndStageModel
add(val: K): this { this.elements.set(val, val) return this }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left add AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left val AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left K AST#identifier#Right AST#ERROR#Right AST#)#Left ) AST#)#Right AST#a...
add(val: K): this { this.elements.set(val, val) return this }
https://gitcode.com/iop123123/arkts-static-skills
6a88c4b3968ef3baa98cb742e4f3602359985745
gitcode
zcg741/chengyu-game
entry/src/main/ets/viewmodel/GameViewModel.ets
arkts
getLives
获取当前生命值(闯关模式)
getLives(): number { return this.session.lives || 0; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getLives AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statement_blo...
getLives(): number { return this.session.lives || 0; }
https://github.com/zcg741/chengyu-game
45b23fb503194f3110efe398d4d44ebe2e6e451e
github
PollenWang6/HiXD
entry/src/main/ets/pages/schoolnet/SchoolNetPage.ets
arkts
loadZfwIfNeeded
切到自服务平台时自动加载
loadZfwIfNeeded(): void { if (this.zfwState === 'idle' && PreferenceUtil.getString('schoolnet_password').length > 0) { this.startZfwFlow(); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left loadZfwIfNeeded AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression...
loadZfwIfNeeded(): void { if (this.zfwState === 'idle' && PreferenceUtil.getString('schoolnet_password').length > 0) { this.startZfwFlow(); } }
https://github.com/PollenWang6/HiXD
904ff90ec4cbd56658e8703a30451ea6814c450d
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
filter
Creates a new Uint8ClampedArray from current Uint8ClampedArray based on a condition fn. @param fn the condition to apply for each element @returns a new Uint8ClampedArray with elements from current Uint8ClampedArray that satisfy condition fn
public filter(fn: (val: number, index: int, array: Uint8ClampedArray) => boolean): Uint8ClampedArray { let markers = new boolean[this.length] let resLen = 0 for (let i = 0; i < this.length; ++i) { markers[i] = fn(this.at(i), i, this) if (markers[i]) { ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left filter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#R...
public filter(fn: (val: number, index: int, array: Uint8ClampedArray) => boolean): Uint8ClampedArray { let markers = new boolean[this.length] let resLen = 0 for (let i = 0; i < this.length; ++i) { markers[i] = fn(this.at(i), i, this) if (markers[i]) { ...
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
efc5bb2eae121cc7012bfefeaee7cb834c4b18ee
gitee
openharmony-sig/commons-cli
library/src/main/ets/components/cli/DefaultParser.ets
arkts
handleProperties
Sets the values of Options using the values in {@code properties}. @param properties The value properties to be processed.
private handleProperties(properties: Properties | null): void { if (properties == null) { return; } let str = properties.propertyNames(); for (let index = 0;index < str.length; index++) { let option: string = str[index]; let opt: CliOption = this.options.getOption(option); if (...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleProperties AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left properties AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary...
private handleProperties(properties: Properties | null): void { if (properties == null) { return; } let str = properties.propertyNames(); for (let index = 0;index < str.length; index++) { let option: string = str[index]; let opt: CliOption = this.options.getOption(option); if (...
https://gitee.com/openharmony-sig/commons-cli.git
93ade0f8f55f58584d7c05020bcc68e09cb9dd4d
gitee
ibestservices/ibest-ui
library/src/main/ets/apis/IBestToast.ets
arkts
showLoading
显示loading
public showLoading(option?: LoadingOption) { let opt: ToastOption = { type: "loading", message: option?.message, loadingType: option?.loadingType, duration: option?.duration } this.open(opt) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left showLoading AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left option AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Rig...
public showLoading(option?: LoadingOption) { let opt: ToastOption = { type: "loading", message: option?.message, loadingType: option?.loadingType, duration: option?.duration } this.open(opt) }
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/apis/IBestToast.ets#L195-L203
bf2db093342a3fa22921958a0e133fce3ab8f984
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Tracking/TrackingManager.ets
arkts
deleteTrackRecord
删除跟踪记录
public async deleteTrackRecord(contentId: string, trackerId: TrackerId): Promise<boolean> { try { const sql = 'DELETE FROM track_record WHERE contentId = ? AND trackerId = ?'; await this.dbManager.executeSql(sql, [contentId, trackerId]); logger.info(TAG, `✅ 删除跟踪记录: contentId=${contentId}, tracke...
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 deleteTrackRecord AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left contentId AST#identifier#Right AST#ERROR#Left AST#:#L...
public async deleteTrackRecord(contentId: string, trackerId: TrackerId): Promise<boolean> { try { const sql = 'DELETE FROM track_record WHERE contentId = ? AND trackerId = ?'; await this.dbManager.executeSql(sql, [contentId, trackerId]); logger.info(TAG, `✅ 删除跟踪记录: contentId=${contentId}, tracke...
https://github.com/DaLongZhuaZi/manxia
8525a4f486c2a768e9e13bde51c339c3578aaa8c
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Animation/AnimationSettingsManager.ets
arkts
isMainPageBottomBarAnimationEnabled
检查主页面底栏动画是否启用
public isMainPageBottomBarAnimationEnabled(): boolean { return this.currentSettings.mainPageBottomBarAnimationEnabled; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isMainPageBottomBarAnimationEnabled 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#bo...
public isMainPageBottomBarAnimationEnabled(): boolean { return this.currentSettings.mainPageBottomBarAnimationEnabled; }
https://github.com/DaLongZhuaZi/manxia
4a21dfa77cef31ddcf26c2c9b8b709761e3d9a0d
github
qiuhaotc/HarmonyOSPlayground
entry/src/main/ets/utils/BillStatisticsUtil.ets
arkts
getMonthlyTrend
获取月度趋势数据(最近N个月)
static getMonthlyTrend(bills: BillModel[], months: number = 12): MonthlyTrend[] { const monthlyMap = new Map<string, DailyStats>(); bills.forEach((bill: BillModel) => { const yearMonth = bill.getYearMonth(); if (!monthlyMap.has(yearMonth)) { const newStats: D...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getMonthlyTrend AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bills AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expre...
static getMonthlyTrend(bills: BillModel[], months: number = 12): MonthlyTrend[] { const monthlyMap = new Map<string, DailyStats>(); bills.forEach((bill: BillModel) => { const yearMonth = bill.getYearMonth(); if (!monthlyMap.has(yearMonth)) { const newStats: D...
https://github.com/qiuhaotc/HarmonyOSPlayground
60397442cb6c807b7c20ac92f029933028c6ea9e
github
openharmony/codelabs
ETSUI/LifeTrack/entry/src/main/ets/pages/CalendarPage.ets
arkts
isSameDay
判断两个时间戳是否在同一天
static isSameDay(timestamp1: number, timestamp2: number): boolean { const date1 = new Date(timestamp1); const date2 = new Date(timestamp2); return date1.getDate() === date2.getDate() && date1.getMonth() === date2.getMonth() && date1.getFullYear() === date2.getFullYear(); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isSameDay AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left timestamp1 AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Ri...
static isSameDay(timestamp1: number, timestamp2: number): boolean { const date1 = new Date(timestamp1); const date2 = new Date(timestamp2); return date1.getDate() === date2.getDate() && date1.getMonth() === date2.getMonth() && date1.getFullYear() === date2.getFullYear(); }
https://gitcode.com/openharmony/codelabs
018895075bff9f8c57f4948af226be97eab08f3a
gitcode
openharmony/codelabs
Ability/StageAbility/entry/src/main/ets/model/ButtonClickMethod.ets
arkts
toSecondAbilityIndex
Navigate to the Index Page of SecondAbility. @param context Context of EntryAbility.
toSecondAbilityIndex(context: common.UIAbilityContext) { let want: Want = { 'deviceId': '', 'bundleName': CommonConstants.BUNDLE_NAME, 'abilityName': CommonConstants.SECOND_ABILITY_NAME, 'moduleName': CommonConstants.DEVICE_MODULE_NAME, 'parameters': { src: textMessage, ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left toSecondAbilityIndex 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#identi...
toSecondAbilityIndex(context: common.UIAbilityContext) { let want: Want = { 'deviceId': '', 'bundleName': CommonConstants.BUNDLE_NAME, 'abilityName': CommonConstants.SECOND_ABILITY_NAME, 'moduleName': CommonConstants.DEVICE_MODULE_NAME, 'parameters': { src: textMessage, ...
https://gitee.com/openharmony/codelabs.git
420120af58e01e9eb271b9e7ae36dddfc64dc976
gitee
YDYm233/EasyRandom_HarmonyNextApp
product/default/src/main/ets/sub_pages/text_marquee/DisplayMarqueePage.ets
arkts
padTextForExternalEntrance
循环间隔定时器
private padTextForExternalEntrance(src: string): string { const scrollLength = this.isVertical ? this.deviceHeight : this.deviceWidth const spacesNeeded = Math.ceil(scrollLength / this.fontSize)+4 // 容错 // const spacesNeeded = Math.ceil(scrollLength / (this.fontSize / 2)) + 4 const leadingSpaces = ' ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left padTextForExternalEntrance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left src AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ide...
private padTextForExternalEntrance(src: string): string { const scrollLength = this.isVertical ? this.deviceHeight : this.deviceWidth const spacesNeeded = Math.ceil(scrollLength / this.fontSize)+4 // 容错 // const spacesNeeded = Math.ceil(scrollLength / (this.fontSize / 2)) + 4 const leadingSpaces = ' ...
https://github.com/YDYm233/EasyRandom_HarmonyNextApp
3599debea6a4ce352bc37ac3943193381906cd93
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets
arkts
writeBigUInt64BE
Writes an unsigned 64-bit integer to the buffer at the specified offset using big-endian format @param {bigint} value - Value to write @param {int} [offset=0] - Number of bytes to skip before writing @returns {int} Offset plus the number of bytes written
public writeBigUInt64BE(value: bigint, offset: int = 0): int { this.checkOffset(offset, 8); this.checkValue(value, 0, ((1n << 64n) - 1n), "0", "2n ** 64n - 1n"); this.getDataView().setBigUint64(offset, value, false); return offset + 8; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left writeBigUInt64BE AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
public writeBigUInt64BE(value: bigint, offset: int = 0): int { this.checkOffset(offset, 8); this.checkValue(value, 0, ((1n << 64n) - 1n), "0", "2n ** 64n - 1n"); this.getDataView().setBigUint64(offset, value, false); return offset + 8; }
https://gitcode.com/iop123123/arkts-static-skills
7e58c4ac42e9eabac59b6345001d4b0f9f215734
gitcode
offlinecat-dev/OCNetORM
src/main/ets/query/QueryBuilder.ets
arkts
getConditions
获取所有条件 @returns 条件数组
getConditions(): Array<WhereCondition> { const cloned: Array<WhereCondition> = [] for (let i = 0; i < this.conditions.length; i++) { cloned.push(this.cloneCondition(this.conditions[i])) } return cloned }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getConditions 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#:#Lef...
getConditions(): Array<WhereCondition> { const cloned: Array<WhereCondition> = [] for (let i = 0; i < this.conditions.length; i++) { cloned.push(this.cloneCondition(this.conditions[i])) } return cloned }
https://github.com/offlinecat-dev/OCNetORM
89804be4ac068f408a414deba180f9367e4deb16
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/json.ets
arkts
checkType
TODO(kirill-mitkin): Map<Long, Long> blocked by internal issue
private static checkType(type: Class, used: Map<Class, TypeColor>): void { const tc = used.get(type) if (tc !== undefined) { if (tc.color == TypeColor.VISITED) { return } throw new Error(`Incorrect type: ${type.getName()}`) } if (ty...
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 checkType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST...
private static checkType(type: Class, used: Map<Class, TypeColor>): void { const tc = used.get(type) if (tc !== undefined) { if (tc.color == TypeColor.VISITED) { return } throw new Error(`Incorrect type: ${type.getName()}`) } if (ty...
https://gitcode.com/iop123123/arkts-static-skills
1e08dc6ccff2f6927d731ad78616955ca115786a
gitcode
fuhhhhhhhh/openharmony
entry/src/main/ets/data/database/DBManager.ets
arkts
createTables
创建数据库表结构
private async createTables(): Promise<void> { if (!this.rdbStore) { throw new Error('数据库未初始化'); } // 创建分类表 const createCategoriesTable: string = ` CREATE TABLE IF NOT EXISTS ${DBManager.TABLE_CATEGORIES} ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL, i...
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 createTables AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#...
private async createTables(): Promise<void> { if (!this.rdbStore) { throw new Error('数据库未初始化'); } // 创建分类表 const createCategoriesTable: string = ` CREATE TABLE IF NOT EXISTS ${DBManager.TABLE_CATEGORIES} ( id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL, i...
https://github.com/fuhhhhhhhh/openharmony
54d441db7a78585d33776e55d32b784fef2e6123
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Byte.ets
arkts
toShort
Returns value of this instance @returns { short } @syscap SystemCapability.Utils.Lang @FaAndStageModel
public override toShort(): short { return this.value.toShort(); }
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 toShort AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Lef...
public override toShort(): short { return this.value.toShort(); }
https://gitcode.com/iop123123/arkts-static-skills
31b97db53dc174d649aad5c0ea95d59c3f8ee9e3
gitcode
SMAT-Lab/Homecheck-Sec2026
test/unittest/sample/SymbolUsage/ets/GenicTypeFind.ets
arkts
register
1、问题单场景
function register<T extends NSTest.Constructor<NSTest.TestInterface>>(clazz: T): T { }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left register AST#identifier#Right AST#type_parameters#Left AST#<#Left < AST#<#Right AST#type_parameter#Left AST#type_identifier#Left T AST#type_identifier#Right AST#constraint#Left AST#extends#Left extends AST#e...
function register<T extends NSTest.Constructor<NSTest.TestInterface>>(clazz: T): T { }
https://github.com/SMAT-Lab/Homecheck-Sec2026
680ac2cd1e7db8c72508d1609c76a81f3822f88b
github
David8Idira/AI-OA
packages/harmonyos/commons/src/main/ets/services/IMService.ets
arkts
addGroupMembers
添加群成员 @param conversationId 会话ID @param memberIds 成员ID列表
async addGroupMembers(conversationId: string, memberIds: string[]): Promise<ApiResponse<any>> { return this.client.post<any>(`/api/v1/im/conversations/${conversationId}/members`, { memberIds }) }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left addGroupMembers AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left conversationId AST#identifier#Right AST#type_annotation#Left AS...
async addGroupMembers(conversationId: string, memberIds: string[]): Promise<ApiResponse<any>> { return this.client.post<any>(`/api/v1/im/conversations/${conversationId}/members`, { memberIds }) }
https://github.com/David8Idira/AI-OA
a29834c3ec82c739d266a3f4681ef6d0102eee32
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/RhinoWasmExecutor.ets
arkts
isSandboxReady
检查沙箱是否就绪
isSandboxReady(): boolean { return this.sandboxReady; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isSandboxReady AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#stat...
isSandboxReady(): boolean { return this.sandboxReady; }
https://github.com/DaLongZhuaZi/manxia
edebde306f53fcec752578f800a3da1d411c2087
github
OMGCA/sakipay
sakipay_hmos/main/src/main/ets/viewmodels/SettingsViewModel.ets
arkts
removeOverride
Removes a day override by date string and recalibrates.
public removeOverride(dateString: string): void { this.dayOverrides = this.dayOverrides.filter((d: DayOverride) => d.dateString !== dateString) this.recalibrateWorkingDays() }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left removeOverride AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left dateString AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#stri...
public removeOverride(dateString: string): void { this.dayOverrides = this.dayOverrides.filter((d: DayOverride) => d.dateString !== dateString) this.recalibrateWorkingDays() }
https://github.com/OMGCA/sakipay
4db4fa79d0f57fe6842a1e351dfafd507363f21b
github
HarmonyOS_Samples/MusicHome
features/player/src/main/ets/view/LrcView.ets
arkts
smoothScrollTo
Scrolls canvas so the given line is centered/top-aligned via startAnimator.
smoothScrollTo(line: number) { let offset = this.getOffset(line); Logger.info('[smoothScrollTo] line:' + line + ',offset:' + offset); this.startAnimator(offset); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left smoothScrollTo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left line AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Righ...
smoothScrollTo(line: number) { let offset = this.getOffset(line); Logger.info('[smoothScrollTo] line:' + line + ',offset:' + offset); this.startAnimator(offset); }
https://gitcode.com/HarmonyOS_Samples/MusicHome
ec3514554455b6dae693e0ed99ce3ec9aa3a7b31
gitcode
CLMC2025/Vignette
entry/src/main/ets/manager/PromptTemplateManager.ets
arkts
importTemplates
导入模板数据
importTemplates(templates: PromptTemplate[]): void { for (const template of templates) { this.addTemplate(template); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left importTemplates AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left templates AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left Promp...
importTemplates(templates: PromptTemplate[]): void { for (const template of templates) { this.addTemplate(template); } }
https://github.com/CLMC2025/Vignette
dc4640f1b2f64d74bca6485be933058fef461b81
github
richshaw2015/nds
ohos/entry/src/test/DependencyRelations.test.ets
arkts
updateDependentSettings
更新依赖的子设置状态 @param parentKey 父设置键名 @param parentValue 父设置值
private updateDependentSettings(parentKey: string, parentValue: boolean | string | number): void { const dependency = this.dependencies.get(parentKey); if (!dependency) return; const shouldEnable = parentValue === dependency.enableValue; for (const dependentKey of dependency.dependentKeys) { c...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left updateDependentSettings AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left parentKey AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left stri...
private updateDependentSettings(parentKey: string, parentValue: boolean | string | number): void { const dependency = this.dependencies.get(parentKey); if (!dependency) return; const shouldEnable = parentValue === dependency.enableValue; for (const dependentKey of dependency.dependentKeys) { c...
https://github.com/richshaw2015/nds
e50a5e0ed3a03cf10389ef6aaaf57fc54b021d60
github
CLMC2025/Vignette
entry/src/main/ets/database/repositories/WordRepository.ets
arkts
deleteAllWords
Delete all words
async deleteAllWords(): Promise<number> { this.ensureInitialized(); const predicates = new relationalStore.RdbPredicates(TABLE_WORDS); const affectedRows = await this.store!.delete(predicates); return affectedRows; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left deleteAllWords AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Righ...
async deleteAllWords(): Promise<number> { this.ensureInitialized(); const predicates = new relationalStore.RdbPredicates(TABLE_WORDS); const affectedRows = await this.store!.delete(predicates); return affectedRows; }
https://github.com/CLMC2025/Vignette
ccb87a9903c7caf17df66bd6a3b72f2947edc700
github
openharmony/codelabs
ETSUI/HarmonyPhotoAlbum/entry/src/main/ets/service/PhotoService.ets
arkts
searchPhotosByCategoryAndKeyword
组合搜索:按分类和关键词搜索 @param category 分类(传 '全部' 表示不限分类) @param keyword 搜索关键词 @returns Promise<PhotoModel[]> 图片列表
searchPhotosByCategoryAndKeyword(category: string, keyword: string): Promise<PhotoModel[]> { if (!this.rdbStore) { console.error('[PhotoService] 数据库未初始化'); return Promise.reject('DB not initialized'); } console.info(`[PhotoService] 🔍 组合搜索 - 分类: "${category}", 关键词: "${keyword}"`); let pr...
AST#program#Left AST#expression_statement#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left searchPhotosByCategoryAndKeyword AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left category AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#st...
searchPhotosByCategoryAndKeyword(category: string, keyword: string): Promise<PhotoModel[]> { if (!this.rdbStore) { console.error('[PhotoService] 数据库未初始化'); return Promise.reject('DB not initialized'); } console.info(`[PhotoService] 🔍 组合搜索 - 分类: "${category}", 关键词: "${keyword}"`); let pr...
https://gitcode.com/openharmony/codelabs
7117bfc8d828e1c06703dc34dacb7718b8ea6d73
gitcode
heeh02/superconnect
harmony/entry/src/main/ets/input/GestureController.ets
arkts
twoPts
The two tracked finger contacts still present.
private twoPts(ts: TouchObject[]): TouchObject[] { const out: TouchObject[] = []; for (const t of ts) { if (this.ids.indexOf(t.id) >= 0) { out.push(t); } } return out; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left private AST#identifier#Right AST#ERROR#Left AST#identifier#Left twoPts AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ts AST#identifier#Right AST#:#Left : AST#...
private twoPts(ts: TouchObject[]): TouchObject[] { const out: TouchObject[] = []; for (const t of ts) { if (this.ids.indexOf(t.id) >= 0) { out.push(t); } } return out; }
https://github.com/heeh02/superconnect
2c805160825d55658b3dd2cf224388476f2a7a8b
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/TaskExecutor.ets
arkts
extractValue
从数据中提取值
private extractValue(expr: string, data: Object): Object | undefined { if (!data) return undefined; // 支持JSON路径: $.field.subfield if (expr.startsWith('$.')) { const path = expr.slice(2); return this.getValueByPath(data as Record<string, Object | undefined>, path); } return data; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left extractValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left expr AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ...
private extractValue(expr: string, data: Object): Object | undefined { if (!data) return undefined; // 支持JSON路径: $.field.subfield if (expr.startsWith('$.')) { const path = expr.slice(2); return this.getValueByPath(data as Record<string, Object | undefined>, path); } return data; }
https://github.com/DaLongZhuaZi/manxia
038e7af12853447be7361263404434861805cfec
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/CategoryDAO.ets
arkts
getById
根据 ID 查询分类(只返回未删除)
static async getById(userId: number, categoryId: number): Promise<Category | null> { const store = DatabaseManager.getDatabase(); const sql = `SELECT * FROM categories WHERE category_id = ? AND user_id = ? AND is_deleted = 0`; let resultSet: relationalStore.ResultSet | null = null; try { resultS...
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 getById AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : AST#:#R...
static async getById(userId: number, categoryId: number): Promise<Category | null> { const store = DatabaseManager.getDatabase(); const sql = `SELECT * FROM categories WHERE category_id = ? AND user_id = ? AND is_deleted = 0`; let resultSet: relationalStore.ResultSet | null = null; try { resultS...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
43a9c4406bb30a33bd40f0f57223ab41dc5b9937
github
CLMC2025/Vignette
entry/src/main/ets/sync/WebDavSyncManager.ets
arkts
executeTaskWithFallback
尝试在 TaskPool 中执行任务,如果 TaskPool 不可用则回退到主线程执行 注意:在主线程执行加密/解密/网络请求等耗时操作可能导致 UI 卡顿。 仅当 TaskPool 不可用时才会使用此 fallback 方案。 @param taskFn TaskPool 版本的函数(带 @Concurrent 装饰器) @param mainThreadFn 主线程版本的函数(不带 @Concurrent 装饰器) @param params 任务参数
private async executeTaskWithFallback<TParams extends Object, TResult>( taskFn: (params: TParams) => TResult | Promise<TResult>, mainThreadFn: (params: TParams) => TResult | Promise<TResult>, params: TParams ): Promise<TResult> { const CRYPTO_ERROR_PATTERNS = ['SecureRandomError', '无法生成安全随机数', 'Cryp...
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 executeTaskWithFallback AST#identifier#Right AST#type_arguments#Left AST#<#Left < AST#<#Right AST#type_identifier#Left TParams AST#type_identifier#Right ...
private async executeTaskWithFallback<TParams extends Object, TResult>( taskFn: (params: TParams) => TResult | Promise<TResult>, mainThreadFn: (params: TParams) => TResult | Promise<TResult>, params: TParams ): Promise<TResult> { const CRYPTO_ERROR_PATTERNS = ['SecureRandomError', '无法生成安全随机数', 'Cryp...
https://github.com/CLMC2025/Vignette
45a2917b9c5855a0ff48e1696f2ccbc06012d26d
github
somnio-software/my-bot-pal
entry/src/main/ets/utils/VibratorManager.ets
arkts
isSupportedEffect
Check if a specific vibration effect is supported @param effectId - The preset effect to check @returns Promise resolving to boolean indicating support
static async isSupportedEffect(effectId: string): Promise<boolean> { return new Promise((resolve, reject) => { try { vibrator.isSupportEffect(effectId, (err: BusinessError, state: boolean) => { if (err) { reject(err); } else { resolve(state); } ...
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 isSupportedEffect AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left effectId AST#identifier#Right AST#ERROR#Left AST#:#Le...
static async isSupportedEffect(effectId: string): Promise<boolean> { return new Promise((resolve, reject) => { try { vibrator.isSupportEffect(effectId, (err: BusinessError, state: boolean) => { if (err) { reject(err); } else { resolve(state); } ...
https://github.com/somnio-software/my-bot-pal
5d95b8660c0a6416540767b47fb82de16abc9b03
github
fuhhhhhhhh/openharmony
entry/src/main/ets/data/database/CategoryDao.ets
arkts
hasTransactionsUsingCategory
检查分类是否被交易记录使用 @param categoryId 分类ID @returns 是否被使用
private async hasTransactionsUsingCategory(categoryId: number): Promise<boolean> { const sql: string = `SELECT COUNT(*) as count FROM ${DBManager.TABLE_TRANSACTIONS} WHERE category_id = ?`; try { const resultSet: relationalStore.ResultSet = await this.rdbStore.querySql(sql, [categoryId]); const co...
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 hasTransactionsUsingCategory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left categoryId AST#identifier#Right AST#ERR...
private async hasTransactionsUsingCategory(categoryId: number): Promise<boolean> { const sql: string = `SELECT COUNT(*) as count FROM ${DBManager.TABLE_TRANSACTIONS} WHERE category_id = ?`; try { const resultSet: relationalStore.ResultSet = await this.rdbStore.querySql(sql, [categoryId]); const co...
https://github.com/fuhhhhhhhh/openharmony
a0be2c3d4b81663db67286d8ab21baa009719784
github