nwo
stringclasses
449 values
path
stringlengths
9
173
language
stringclasses
1 value
identifier
stringlengths
1
53
docstring
stringlengths
5
4.13k
function
stringlengths
10
87.2k
ast_function
stringlengths
351
354k
obf_function
stringlengths
10
87.2k
url
stringlengths
30
175
function_sha
stringlengths
40
40
source
stringclasses
3 values
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/BigInt.ets
arkts
constructor
Creates a new `BigInt` instance from a long value. @param { long } d The long value to convert. @syscap SystemCapability.Utils.Lang @FaAndStageModel
constructor(d: long) { this.sign = d < 0 ? -1 : (d == 0 ? 0 : 1) this.bytes = this.sign == 0 ? [] as ValueArray<int> : BigInt.fromLongHelper(d, 64, this.sign) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left d AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left long AST#identifier#Right AST#)#...
constructor(d: long) { this.sign = d < 0 ? -1 : (d == 0 ? 0 : 1) this.bytes = this.sign == 0 ? [] as ValueArray<int> : BigInt.fromLongHelper(d, 64, this.sign) }
https://gitcode.com/iop123123/arkts-static-skills
00032627b3e9adcc7d766a3ac98e8947193aa132
gitcode
richshaw2015/nds
ohos/entry/src/test/InputValidation.test.ets
arkts
generateRandomMac
生成随机MAC地址 使用 Nintendo DS 的 OUI 前缀 (00:09:BF) @returns 随机MAC地址字符串
function generateRandomMac(): string { const hexChars = '0123456789ABCDEF'; let mac = '00:09:BF'; for (let i = 0; i < 3; i++) { mac += ':'; mac += hexChars.charAt(Math.floor(Math.random() * 16)); mac += hexChars.charAt(Math.floor(Math.random() * 16)); } return mac; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left generateRandomMac 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#predefine...
function generateRandomMac(): string { const hexChars = '0123456789ABCDEF'; let mac = '00:09:BF'; for (let i = 0; i < 3; i++) { mac += ':'; mac += hexChars.charAt(Math.floor(Math.random() * 16)); mac += hexChars.charAt(Math.floor(Math.random() * 16)); } return mac; }
https://github.com/richshaw2015/nds
60cecf4b946b5b2609fa0775d58269ab532e9857
github
PollenWang6/HiXD
entry/src/main/ets/services/CasLoginService.ets
arkts
tryAutoRestoreLogin
========== 尝试自动恢复登录(无需密码)========== 如果 CAS TGC (Ticket Granting Cookie) 仍有效, 直接访问 login?service= 就会 302 到 ehall 并签发新 MOD_AUTH_CAS
async tryAutoRestoreLogin(): Promise<boolean> { console.info(TAG, 'tryAutoRestoreLogin: start'); const serviceUrl: string = encodeURIComponent(this.SERVICE_URL); const loginWithService: string = this.LOGIN_PAGE + '?service=' + serviceUrl; let currentUrl: string = loginWithService; let resp: HttpR...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left tryAutoRestoreLogin 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#:#R...
async tryAutoRestoreLogin(): Promise<boolean> { console.info(TAG, 'tryAutoRestoreLogin: start'); const serviceUrl: string = encodeURIComponent(this.SERVICE_URL); const loginWithService: string = this.LOGIN_PAGE + '?service=' + serviceUrl; let currentUrl: string = loginWithService; let resp: HttpR...
https://github.com/PollenWang6/HiXD
db2198c98ecccfdeb6c7b56ac0ba80cad47890f9
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Diagnostics/StartupRecovery.ets
arkts
reset
重置恢复状态
public reset(): void { this.recoveryAttempts.clear(); this.lastSnapshot = null; this.isRecovering = false; logger.info('StartupRecovery', '🔄 恢复状态已重置'); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left reset 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#:#Rig...
public reset(): void { this.recoveryAttempts.clear(); this.lastSnapshot = null; this.isRecovering = false; logger.info('StartupRecovery', '🔄 恢复状态已重置'); }
https://github.com/DaLongZhuaZi/manxia
12e378097bee3971ad0934bdea85ddec2131c08e
github
HarmonyOS_Samples/BestPracticeSnippets
OptimizationAppMemoryUsage/entry/src/main/ets/utils/LRUCacheUtil.ets
arkts
contains
Determine whether the cache corresponding to the key is included.
public contains(key: string): boolean { return this.lruCache.contains(key); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left contains AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string A...
public contains(key: string): boolean { return this.lruCache.contains(key); }
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
6ea89153a3ba1a70e05a2cf508f784c2f39ae8e2
gitcode
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/model/FinancialHealth.ets
arkts
calculateOverallScore
计算综合评分
static calculateOverallScore(dimensions: HealthDimensions): number { const scores: DimensionScore[] = [ dimensions.savingsRate, dimensions.budgetAdherence, dimensions.expenseStability, dimensions.debtRatio, dimensions.emergencyFund, dimensions.spendingStructure, dimension...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left calculateOverallScore AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dimensions AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#iden...
static calculateOverallScore(dimensions: HealthDimensions): number { const scores: DimensionScore[] = [ dimensions.savingsRate, dimensions.budgetAdherence, dimensions.expenseStability, dimensions.debtRatio, dimensions.emergencyFund, dimensions.spendingStructure, dimension...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
8b325ec868d02307de34ad0d900d2a00c0423b22
github
richshaw2015/nds
ohos/entry/src/main/ets/components/game/PauseMenu.ets
arkts
getWideMenuItems
宽屏模式下的菜单项(不含保存/加载,由右侧存档区承担)
function getWideMenuItems(): MenuItemConfig[] { return [ { option: PauseMenuOption.RESUME, label: I18n.t('resume'), icon: CupertinoIcons.play }, { option: PauseMenuOption.SAVE_STATE, label: I18n.t('save_manager'), icon: CupertinoIcons.square_and_arrow_down }, { option: PauseMenuOption.CHEATS, label: I18n....
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getWideMenuItems 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#array_type...
function getWideMenuItems(): MenuItemConfig[] { return [ { option: PauseMenuOption.RESUME, label: I18n.t('resume'), icon: CupertinoIcons.play }, { option: PauseMenuOption.SAVE_STATE, label: I18n.t('save_manager'), icon: CupertinoIcons.square_and_arrow_down }, { option: PauseMenuOption.CHEATS, label: I18n....
https://github.com/richshaw2015/nds
1aec8662bf9f33138d43a41dd5bf620b1ecb9394
github
Yuan-Mr/mcCharts
entry/src/main/ets/components/mainpage/McBarChart.ets
arkts
onCountUpdated
自定义组件 @Watch 回调
onCountUpdated(options: Options): void { this.renderType = 'update' this.chartOption = this.options.options }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onCountUpdated AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left options AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Options AST#identifier#Right AST#)#Lef...
onCountUpdated(options: Options): void { this.renderType = 'update' this.chartOption = this.options.options }
https://github.com/Yuan-Mr/mcCharts
c8e1bc0bca87d7d3be16bcbd4ef981ee80096e6d
github
bluedeer000/HarmonyCalendar
entry/src/main/ets/services/CalendarSourceAdapterRegistry.ets
arkts
listAdapters
列出所有已注册的适配器
listAdapters(): AdapterRegistration[] { const result: AdapterRegistration[] = []; this.registrations.forEach((reg: AdapterRegistration) => { result.push(reg); }); return result; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left listAdapters 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 AdapterRegistration AST#identifier#Right AST#[#Le...
listAdapters(): AdapterRegistration[] { const result: AdapterRegistration[] = []; this.registrations.forEach((reg: AdapterRegistration) => { result.push(reg); }); return result; }
https://github.com/bluedeer000/HarmonyCalendar
04285f25db2021ae36828e831f36640ecb24c2da
github
openharmony-sig/ohos-beacon-library
library/src/main/ets/components/beacon/logging/LogManager.ets
arkts
setVerboseLoggingEnabled
Sets whether verbose logging is enabled. If not, expensive calculations to create log strings should be avoided. @param enabled
public static setVerboseLoggingEnabled(enabled: boolean): void { LogManager.sVerboseLoggingEnabled = enabled; }
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 setVerboseLoggingEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right A...
public static setVerboseLoggingEnabled(enabled: boolean): void { LogManager.sVerboseLoggingEnabled = enabled; }
https://gitee.com/openharmony-sig/ohos-beacon-library.git
186b654655d2435ece0bd5cb7430ba3f66a31b19
gitee
LambdaYH/ScrcpyForHarmonyOS
app/src/main/ets/client/tools/NativeStreamClient.ets
arkts
stop
Stop the session
stop(): void { try { this.rejectReverseReady(new Error('Session stopped')); try { libscrcpy.nativeStopStreams(); } catch (e) { LoggerClientStream.error('[NativeStreamClient] nativeStopStreams failed:', e); } this.adbId = -1; if (this.clientStream) { ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left stop AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left AS...
stop(): void { try { this.rejectReverseReady(new Error('Session stopped')); try { libscrcpy.nativeStopStreams(); } catch (e) { LoggerClientStream.error('[NativeStreamClient] nativeStopStreams failed:', e); } this.adbId = -1; if (this.clientStream) { ...
https://github.com/LambdaYH/ScrcpyForHarmonyOS
8f0a09a1152203b7abf724770b8a384c9903d8e5
github
terryma2024/happyword
harmonyos/entry/src/main/ets/services/BattleEngine.ets
arkts
revealMediumStepLetter
Medium fill-letter UX: when step 0 is answered correctly, show that letter in the template while the player is working on step 1. Note: this mutates letterTemplateBase at runtime. Validation allows revealed correct letters at missing indices for in-battle state.
private revealMediumStepLetter(q: Question, chosen: string): void { if (q.kind !== QuestionKind.FillLetterMedium) { return; } if (q.currentStep < 0 || q.currentStep > 1) { return; } const expected: string = q.letterAnswers[q.currentStep]; if (chosen !== expected) { return; ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left revealMediumStepLetter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left q AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie...
private revealMediumStepLetter(q: Question, chosen: string): void { if (q.kind !== QuestionKind.FillLetterMedium) { return; } if (q.currentStep < 0 || q.currentStep > 1) { return; } const expected: string = q.letterAnswers[q.currentStep]; if (chosen !== expected) { return; ...
https://github.com/terryma2024/happyword
ec026a983f2839ddc3a6412e773472711f3f0dde
github
openharmony-tpc/openharmony_tpc_samples
OhosVideoCache/library/src/main/ets/StorageUtils.ets
arkts
getCacheDirectory
Returns application cache directory. Cache directory will be created on SD card <i>("/Android/data/[app_package_name]/cache")</i> (if card is mounted and app has appropriate permission) or on device's file system depending incoming parameters. @param context Application context @param preferExternal Whether pref...
private static getCacheDirectory(context: Context, preferExternal: boolean): string { let appCacheDir: string | null = null; try { if (context && context.cacheDir && preferExternal) { appCacheDir = context.cacheDir } else { appCacheDir = StorageUtils.DEFAULT_DIR } } catc...
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 getCacheDirectory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:...
private static getCacheDirectory(context: Context, preferExternal: boolean): string { let appCacheDir: string | null = null; try { if (context && context.cacheDir && preferExternal) { appCacheDir = context.cacheDir } else { appCacheDir = StorageUtils.DEFAULT_DIR } } catc...
https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git
e177fbd0c817c6cd086c625a4a762b4d55d3399b
gitee
honjow/Next2V
shared/src/main/ets/network/ApiService.ets
arkts
getAllNodes
Get all nodes
async getAllNodes(): Promise<V2exNode[]> { return this.http.get<V2exNode[]>(ApiConstants.API_NODES_ALL) }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getAllNodes AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_...
async getAllNodes(): Promise<V2exNode[]> { return this.http.get<V2exNode[]>(ApiConstants.API_NODES_ALL) }
https://github.com/honjow/Next2V
f6ad0fbfe015b6d6178275ced8c242c6809d7b82
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/BackgroundMusicManager.ets
arkts
initialize
初始化 AVPlayer 并加载背景音乐资源 需要在 context 可用后调用
public async initialize(context: Context): Promise<void> { if (this.initialized || this.initializing) return; this.initializing = true; this.contextRef = context; try { this.avPlayer = await media.createAVPlayer(); // 设置音频渲染信息:使用 MUSIC 流类型 this.avPlayer.audioRendererInfo = { ...
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 initialize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST...
public async initialize(context: Context): Promise<void> { if (this.initialized || this.initializing) return; this.initializing = true; this.contextRef = context; try { this.avPlayer = await media.createAVPlayer(); // 设置音频渲染信息:使用 MUSIC 流类型 this.avPlayer.audioRendererInfo = { ...
https://github.com/richshaw2015/nds
551cb95115523992d6009ffe36b283469433c48b
github
XJTUWYD/ArkDiff
entry/src/main/ets/utils/ThemeColors.ets
arkts
isMonokai
当前是否为 Monokai 主题
get isMonokai(): boolean { return this._isMonokai; }
AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left isMonokai 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#Righ...
get isMonokai(): boolean { return this._isMonokai; }
https://github.com/XJTUWYD/ArkDiff
cc10c53ed0b50c0406d40b9f3c28d7c195456d5c
github
Joker-x-dev/CoolMallArkTS
core/model/src/main/ets/entity/Auth.ets
arkts
constructor
构造函数,支持对接口返回的数据做空值兜底 @param {Partial<Auth>} data - 原始认证数据
constructor(data?: Partial<Auth>) { if (data) { this.token = data.token ?? ""; this.refreshToken = data.refreshToken ?? ""; this.expire = data.expire ?? 0; this.refreshExpire = data.refreshExpire ?? 0; this.createdAt = data.createdAt ?? Date.now(); } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expres...
constructor(data?: Partial<Auth>) { if (data) { this.token = data.token ?? ""; this.refreshToken = data.refreshToken ?? ""; this.expire = data.expire ?? 0; this.refreshExpire = data.refreshExpire ?? 0; this.createdAt = data.createdAt ?? Date.now(); } }
https://github.com/Joker-x-dev/CoolMallArkTS
b687f79769516b8b80f5db990730b318c362299b
github
codelably/HCompass
core/navigation/src/main/ets/NavigationService.ets
arkts
getPathStack
获取导航栈 @returns 导航栈实例
getPathStack(): NavPathStack | null { return this.stack; }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getPathStack AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifi...
getPathStack(): NavPathStack | null { return this.stack; }
https://github.com/codelably/HCompass
911111aaf76c2c951f039d700d06927697cf200b
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/String.ets
arkts
padStart
The padStart() method pads the current string with another string (multiple times, if needed) until the resulting string reaches the given length. The padding is applied from the start of the current string. @param { int } end int @param { char } ch char @returns { String } @syscap SystemCapability.Utils.Lang @FaAndSta...
public padStart(end: int, ch: char): String { let padLen = end - this.getLength(); if (padLen <= 0) { return this; } let arr: ValueArray<char> = new ValueArray<char>(end) for(let i = 0; i < padLen; i++){ arr[i] = ch } for (let i: int = ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left padStart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left end AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left int AST#...
public padStart(end: int, ch: char): String { let padLen = end - this.getLength(); if (padLen <= 0) { return this; } let arr: ValueArray<char> = new ValueArray<char>(end) for(let i = 0; i < padLen; i++){ arr[i] = ch } for (let i: int = ...
https://gitcode.com/iop123123/arkts-static-skills
b65daf8df9f7cf4d42c2fb6a7d0cc07b351bc550
gitcode
xiebyapps/ClipLink
entry/src/main/ets/services/HttpClient.ets
arkts
post
POST request
async post<T>(path: string, data: object): Promise<T> { console.info(`[HttpClient] POST ${this.baseUrl}${path}`); const resultText = await this.request(path, http.RequestMethod.POST, JSON.stringify(data)); return this.parseJson<T>(resultText); }
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left post 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#type_parameter#Right AST#>#Left > ...
async post<T>(path: string, data: object): Promise<T> { console.info(`[HttpClient] POST ${this.baseUrl}${path}`); const resultText = await this.request(path, http.RequestMethod.POST, JSON.stringify(data)); return this.parseJson<T>(resultText); }
https://github.com/xiebyapps/ClipLink
1e4f8d545e957a259a21f3aa4aad8a9295cf0130
github
openharmony/xts_tools
sample/ui_compare/uiCompareTest_01/entry/src/ohosTest/ets/testability/pages/waterflow_fadingedge/WaterFlowDataSource.ets
arkts
delete2ndItem
删除第二个元素
public delete2ndItem(): void { this.dataArray.splice(1, 1); this.notifyDataDelete(1); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left delete2ndItem AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expressi...
public delete2ndItem(): void { this.dataArray.splice(1, 1); this.notifyDataDelete(1); }
https://gitee.com/openharmony/xts_tools.git
ddb748ed5bf1da7932859e92914c05af946312c6
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Utils/SafeUtils.ets
arkts
parseNum
安全解析JSON字符串为数字。解析失败返回 0。
static parseNum(jsonStr: string | undefined | null): number { if (!jsonStr || jsonStr.trim() === '') { return 0; } try { return JSON.parse(jsonStr) as number; } catch (error) { logger.error(TAG, `JSON parse error (Num): ${String(error)}, prefix: ${jsonStr.substring(0, 100)}`); ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left parseNum AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left jsonStr AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Le...
static parseNum(jsonStr: string | undefined | null): number { if (!jsonStr || jsonStr.trim() === '') { return 0; } try { return JSON.parse(jsonStr) as number; } catch (error) { logger.error(TAG, `JSON parse error (Num): ${String(error)}, prefix: ${jsonStr.substring(0, 100)}`); ...
https://github.com/DaLongZhuaZi/manxia
5ae4ad6f03fb76c819df2f893a72bd92a7100dd1
github
AetheriumSimulator/qemu-hmos
entry/src/main/ets/components/DownloadManager.ets
arkts
checkResumeSupport
检查是否支持断点续传
private async checkResumeSupport(url: string): Promise<boolean> { try { const request = http.createHttp(); const options: http.HttpRequestOptions = { method: http.RequestMethod.HEAD, connectTimeout: 10000, readTimeout: 10000 }; const response = await request.reques...
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 checkResumeSupport AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Lef...
private async checkResumeSupport(url: string): Promise<boolean> { try { const request = http.createHttp(); const options: http.HttpRequestOptions = { method: http.RequestMethod.HEAD, connectTimeout: 10000, readTimeout: 10000 }; const response = await request.reques...
https://github.com/AetheriumSimulator/qemu-hmos
5141f41e063d55c6bb75c71b2bfb05065ea45c7d
github
openharmony/codelabs
Data/DeviceHealth/entry/src/main/ets/components/Notification/DialogUtils.ets
arkts
showAlert
只有一个按钮的简单提示
static showAlert(title: string | Resource, message: string | Resource) { AlertDialog.show({ title: title, message: message, alignment: DialogAlignment.Center, confirm: { value: '我知道了', action: () => {} } }); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left showAlert AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left title AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Lef...
static showAlert(title: string | Resource, message: string | Resource) { AlertDialog.show({ title: title, message: message, alignment: DialogAlignment.Center, confirm: { value: '我知道了', action: () => {} } }); }
https://gitcode.com/openharmony/codelabs
27a956ab07814872d5a1ff422ec9e5d139547d2e
gitcode
Mydstiny/RemoteDeskHarmonyOS
entry/src/main/ets/services/CloudStore.ets
arkts
getCryptoParams
==================== Crypto Params (加密参数存储) ==================== 获取密码学参数 (盐值 + 验证器)
getCryptoParams(): Record<string, string> | null { return DataCrypto.getInstance().getCryptoParams(); }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left getCryptoParams AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left ...
getCryptoParams(): Record<string, string> | null { return DataCrypto.getInstance().getCryptoParams(); }
https://github.com/Mydstiny/RemoteDeskHarmonyOS
1429dc200bfacab6966b3f536dd80135bfbe4c2f
github
AGenUI/AGenUI
platforms/harmony/agenui/src/main/ets/agenui/AGenEngineUI.ets
arkts
getVersion
MARK: - Version Information Returns the AGenUI SDK version
static getVersion(): string { return nativeGetVersion(); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getVersion AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#stri...
static getVersion(): string { return nativeGetVersion(); }
https://github.com/AGenUI/AGenUI
5adcd4fd1b2e938d8d19eb284f213ebb9da83bb8
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/BigInt.ets
arkts
operatorRightShift
Shifts the BigInt to the right by a specified number of bits. @param { BigInt } other The number of bits to shift. @returns { BigInt } The shifted BigInt. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public operatorRightShift(other: BigInt): BigInt { if (other.negative()) { return this.operatorLeftShift(other.negate()) } if (other.isZero()) { return this } let lhs = this.as2sComplementBytes() // consider shifting limits, as we can not sh...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left operatorRightShift AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
public operatorRightShift(other: BigInt): BigInt { if (other.negative()) { return this.operatorLeftShift(other.negate()) } if (other.isZero()) { return this } let lhs = this.as2sComplementBytes() // consider shifting limits, as we can not sh...
https://gitcode.com/iop123123/arkts-static-skills
70b3ef6103be78f1f0362f12cac1f8979768a19e
gitcode
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/model/FinancialHealth.ets
arkts
calculateProgress
计算进度百分比
calculateProgress(): number { if (this.targetAmount <= 0) { return 0; } this.progressPercent = Math.min(100, (this.currentAmount / this.targetAmount) * 100); return this.progressPercent; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left calculateProgress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#stat...
calculateProgress(): number { if (this.targetAmount <= 0) { return 0; } this.progressPercent = Math.min(100, (this.currentAmount / this.targetAmount) * 100); return this.progressPercent; }
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
70614ad39edf0c7b632c8f695ff87a6af5e3748b
github
openharmony/codelabs
Data/FirstStartDemo/entry/src/main/ets/entryability/EntryAbility.ets
arkts
onWindowStageCreate
onCreate(want) { globalThis.abilityWant = want; }
onWindowStageCreate(windowStage: window.WindowStage): void { Logger.info(CommonConstants.ENTRY_ABILITY_TAG, 'onWindowStageCreate'); windowStage.loadContent('pages/LauncherPage', (err, data) => { if (err.code) { Logger.error(CommonConstants.ENTRY_ABILITY_TAG, 'Failed to load the content. Cause:' ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onWindowStageCreate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left windowStage AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left window AST#identif...
onWindowStageCreate(windowStage: window.WindowStage): void { Logger.info(CommonConstants.ENTRY_ABILITY_TAG, 'onWindowStageCreate'); windowStage.loadContent('pages/LauncherPage', (err, data) => { if (err.code) { Logger.error(CommonConstants.ENTRY_ABILITY_TAG, 'Failed to load the content. Cause:' ...
https://gitee.com/openharmony/codelabs.git
a6357b5cfc02341880120fa8b676b3bc4617f045
gitee
Yebingiscn/SweetVideo
entry/src/main/ets/utils/IsoFileUtil.ets
arkts
getIsoSize
获取ISO文件大小 @param isoPath ISO文件路径 @returns 文件大小(字节)
static async getIsoSize(isoPath: string): Promise<number> { try { const stat = await fileIo.stat(isoPath) return stat.size } catch (error) { salmonLogger.addLog(TAG, `获取ISO文件大小失败: ${error}`, true) return 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 getIsoSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isoPath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST...
static async getIsoSize(isoPath: string): Promise<number> { try { const stat = await fileIo.stat(isoPath) return stat.size } catch (error) { salmonLogger.addLog(TAG, `获取ISO文件大小失败: ${error}`, true) return 0 } }
https://github.com/Yebingiscn/SweetVideo
6a38fe5d5afeb9fca72b74b60638a1d188549aa8
github
XJTUWYD/ArkDiff
entry/src/main/ets/viewmodel/DiffSessionViewModel.ets
arkts
pushSnapshot
保存当前状态作为编辑快照 在编辑操作之前调用(sync/submitEdit/syncToRight/syncToLeft 调用前先 pushSnapshot)
pushSnapshot(description: string): void { // 清空 redo 栈(新操作后旧 redo 不可用) this.redoStack = []; this.undoStack.push({ textA: this.textA, textB: this.textB, description: description }); // 限制历史记录数量 if (this.undoStack.length > MAX_HISTORY) { this.undoStack.splice(0, 1); }...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left pushSnapshot AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left description AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST...
pushSnapshot(description: string): void { // 清空 redo 栈(新操作后旧 redo 不可用) this.redoStack = []; this.undoStack.push({ textA: this.textA, textB: this.textB, description: description }); // 限制历史记录数量 if (this.undoStack.length > MAX_HISTORY) { this.undoStack.splice(0, 1); }...
https://github.com/XJTUWYD/ArkDiff
f0ac74264d9ea6c5cccff69da51bd7add90e5e94
github
HarmonyOS_Samples/hmosworld
HMOSWorld/Application/commons/utils/src/main/ets/utils/CommonUtil.ets
arkts
formatNumToMaxText
Replace count with text when the count number exceeds the maximum value. @param count @param max @param replaceText
public static formatNumToMaxText(count: number, max: number, replaceText: string): string { return count > max ? max + replaceText : (count ?? 0).toString(); }
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 formatNumToMaxText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left count AST#identifier#Right AST#:#Lef...
public static formatNumToMaxText(count: number, max: number, replaceText: string): string { return count > max ? max + replaceText : (count ?? 0).toString(); }
https://gitcode.com/HarmonyOS_Samples/hmosworld
52bc33487775a414ea8602e951176d6cffa39f7a
gitcode
Cool_foolisher1/ArkTSRepository
ArkTSDemo/products/entry/src/main/ets/MyDemoOld/pages/heima/security/CheckMovePage.ets
arkts
startSensor
订阅传感器
startSensor() { // 加速度传感器 try { sensor.on(sensor.SensorId.ACCELEROMETER, (data: sensor.AccelerometerResponse) => { // 1. 先记录初始值 if (this.sensorResponse === null) { this.sensorResponse = data return } // data if (this.checkMove(data, this.sensor...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left startSensor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A...
startSensor() { // 加速度传感器 try { sensor.on(sensor.SensorId.ACCELEROMETER, (data: sensor.AccelerometerResponse) => { // 1. 先记录初始值 if (this.sensorResponse === null) { this.sensorResponse = data return } // data if (this.checkMove(data, this.sensor...
https://gitcode.com/Cool_foolisher1/ArkTSRepository
47301b27cfa7eb22addcd01b3260049bc35e2459
gitcode
AGenUI/AGenUI
platforms/harmony/agenui/src/main/ets/agenui/bridge/AGenUIEngineSurfaceManagerBridge.ets
arkts
syncState
Synchronizes UI state to the data model.
syncState(surfaceId: string, componentId: string, contextJson: string | null): void { submitUIDataModel(this.instanceId, surfaceId, componentId, contextJson ?? ''); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left syncState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left surfaceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , AST#,#Ri...
syncState(surfaceId: string, componentId: string, contextJson: string | null): void { submitUIDataModel(this.instanceId, surfaceId, componentId, contextJson ?? ''); }
https://github.com/AGenUI/AGenUI
5ce05cb7bac2d22016b00d10983f447118466752
github
midori52000/ArkPilot
Agent/entry/src/main/ets/skills/SkillsBackendService.ets
arkts
reconcileSkills
一致性检查与自动修复(通过 Rust host) 检测并修复 registry 与 SSOT 目录之间的不一致: 1. registry 有条目但 SSOT 目录缺失 → 从 registry 移除 2. SSOT 有目录但 registry 无条目 → 注册为 local skill
async reconcileSkills(): Promise<ReconcileResult> { this.ensureSsotDir(); const json = reconcileSkills(this.codexHome); const parsed = JSON.parse(json) as ReconcileResult; return new ReconcileResult(parsed.removed ?? [], parsed.registered ?? []); }
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 reconcileSkills AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Rig...
async reconcileSkills(): Promise<ReconcileResult> { this.ensureSsotDir(); const json = reconcileSkills(this.codexHome); const parsed = JSON.parse(json) as ReconcileResult; return new ReconcileResult(parsed.removed ?? [], parsed.registered ?? []); }
https://github.com/midori52000/ArkPilot
0760285c308f63cee9070f7e439f45774a4a4dcc
github
midori52000/ArkPilot
Agent/entry/src/main/ets/skills/SkillsBackendService.ets
arkts
scanUnmanaged
扫描未管理的 Skills
async scanUnmanaged(): Promise<UnmanagedSkill[]> { const installed = await this.getInstalled(); const managedDirs = new Set<string>(installed.map((s: InstalledSkill): string => s.directory.toLowerCase())); const ssotDir = this.getSsotDir(); const unmanaged: UnmanagedSkill[] = []; let entries: st...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left scanUnmanaged AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generi...
async scanUnmanaged(): Promise<UnmanagedSkill[]> { const installed = await this.getInstalled(); const managedDirs = new Set<string>(installed.map((s: InstalledSkill): string => s.directory.toLowerCase())); const ssotDir = this.getSsotDir(); const unmanaged: UnmanagedSkill[] = []; let entries: st...
https://github.com/midori52000/ArkPilot
cc40a4eaa6a9cd1bde790efc7871b9f2dfa96a52
github
aimilin6688/KeePassHO
entry/src/main/ets/services/store/SyncSettingsService.ets
arkts
handleRemoteDataChange
处理远端数据变化
private static async handleRemoteDataChange(data: distributedKVStore.ChangeNotification): Promise<void> { if (!(SyncSettingsService.isSyncEnabled())) { return; } try { hilog.debug(DOMAIN, TAG, `Received remote data change: ${JSON.stringify(data)}`); const entries: distributedKVStore.En...
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 handleRemoteDataChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifi...
private static async handleRemoteDataChange(data: distributedKVStore.ChangeNotification): Promise<void> { if (!(SyncSettingsService.isSyncEnabled())) { return; } try { hilog.debug(DOMAIN, TAG, `Received remote data change: ${JSON.stringify(data)}`); const entries: distributedKVStore.En...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/store/SyncSettingsService.ets#L281-L306
051911cc9213e92c5165f0d4fbd88f6f7bcb07e1
github
Yebingiscn/SweetVideo
entry/src/main/ets/utils/AVSessionUtil.ets
arkts
updatePlaybackSessionState
更新播控中心状态
static updatePlaybackSessionState(playing: boolean, playTime: number, repeatMode?: SweetRepeatMode) { if (Setting.allowBackgroundPlay) { let data: AvSessionState = { playing: playing, duration: playTime, } AVSessionUtil.updateSession(data, repeatMode) } }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left updatePlaybackSessionState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left playing AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#id...
static updatePlaybackSessionState(playing: boolean, playTime: number, repeatMode?: SweetRepeatMode) { if (Setting.allowBackgroundPlay) { let data: AvSessionState = { playing: playing, duration: playTime, } AVSessionUtil.updateSession(data, repeatMode) } }
https://github.com/Yebingiscn/SweetVideo
a4dfdea5c9d4be16b27d3c9871cb27efeffccb49
github
arkui-x/samples
CodeLab/Cases/feature/calendarswitch/src/main/ets/customcalendar/utils/TimeUtils.ets
arkts
getWeekDays
获取某周的所有日期 @param weekNum 距离本周的周数。本周用0表示,负数表示过去周,正数表示未来周,以此类推。 @returns 返回某周的所有日期
static getWeekDays(weekNum: number): Day[][] { // 获取当前日期 const CURRENT_DATE = new Date(); // 获取当前日期是本周的周几(0-6,其中0代表周日,1代表周一,以此类推) const WEEK_DAY = CURRENT_DATE.getDay(); // 计算并设置目标周的第一天(周日)的日期 const BEGIN_DATE = new Date(CURRENT_DATE.getTime() - WEEK_DAY * Constants.TOTAL_MILLISECONDS_IN_DAY +...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getWeekDays AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left weekNum AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Rig...
static getWeekDays(weekNum: number): Day[][] { // 获取当前日期 const CURRENT_DATE = new Date(); // 获取当前日期是本周的周几(0-6,其中0代表周日,1代表周一,以此类推) const WEEK_DAY = CURRENT_DATE.getDay(); // 计算并设置目标周的第一天(周日)的日期 const BEGIN_DATE = new Date(CURRENT_DATE.getTime() - WEEK_DAY * Constants.TOTAL_MILLISECONDS_IN_DAY +...
https://gitcode.com/arkui-x/samples
b419c9bab029218943bb7c34fc98e33ce1797ce2
gitcode
openharmony/applications_contacts
feature/call/src/main/ets/missedcall/MissedCallNotifier.ets
arkts
getInstance
getInstance for MissedCallNotifier
public static getInstance() { if (!MissedCallNotifier.sInstance || MissedCallNotifier.sInstance == undefined) { MissedCallNotifier.sInstance = new MissedCallNotifier(); } return MissedCallNotifier.sInstance; }
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 getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERR...
public static getInstance() { if (!MissedCallNotifier.sInstance || MissedCallNotifier.sInstance == undefined) { MissedCallNotifier.sInstance = new MissedCallNotifier(); } return MissedCallNotifier.sInstance; }
https://gitee.com/openharmony/applications_contacts.git
baebced44251c1481244c1718fea159e95f4aafb
gitee
Harrisonls2004/WaterFlow
entry/src/main/ets/common/network/ApiService.ets
arkts
syncCart
同步购物车
static async syncCart(items: CartItemInfo[]): Promise<ApiResponse> { const request = new CartSyncRequest(items); const response = await httpClient.post('/cart/sync', request.toJson()); const result = parseJsonSafe(response.data); if (result) { const data = result as Record<string, Object>; ...
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 syncCart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left items AST#identifier#Right AST#:#Left : AST#:#R...
static async syncCart(items: CartItemInfo[]): Promise<ApiResponse> { const request = new CartSyncRequest(items); const response = await httpClient.post('/cart/sync', request.toJson()); const result = parseJsonSafe(response.data); if (result) { const data = result as Record<string, Object>; ...
https://github.com/Harrisonls2004/WaterFlow
b5fbc25da81f2177e40a250ae92b6ab318418ce5
github
LongLiveY96/chatcube
entry/src/main/ets/services/ToolExecutionService.ets
arkts
handleAskUser
ask_user 特殊路径: 不走通用 executor, 挂起等待 UI 层 (AskUserCard) 的回答, 拿到 answerJson 后直接作为 ToolResult 返回; 用户取消/页面销毁则按 denied 处理。
private async handleAskUser(toolCall: ToolCall, context: ToolExecutionContext): Promise<ToolResult> { // 用 ASK_USER_TOOL_ID 回填, 保证工具卡片/消息事件按统一 id 识别 toolCall.toolId = ASK_USER_TOOL_ID if (toolCall.displayName.trim() === '') { toolCall.displayName = '向用户提问' } toolCall.sourceType = ToolSourceT...
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 handleAskUser AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left toolCall AST#identifier#Right AST#:#Lef...
private async handleAskUser(toolCall: ToolCall, context: ToolExecutionContext): Promise<ToolResult> { // 用 ASK_USER_TOOL_ID 回填, 保证工具卡片/消息事件按统一 id 识别 toolCall.toolId = ASK_USER_TOOL_ID if (toolCall.displayName.trim() === '') { toolCall.displayName = '向用户提问' } toolCall.sourceType = ToolSourceT...
https://github.com/LongLiveY96/chatcube
03242adb82f8de57070c0f2e0c32557adf23ad65
github
NissonCX/CQU-HarmonyOS-APP-Dev-Final
entry/src/main/ets/pages/TrendsPage.ets
arkts
getSelectedDateString
获取选中的日期字符串
getSelectedDateString(): string { if (this.selectedDateIndex >= 0 && this.selectedDateIndex < this.recentDates.length) { return this.recentDates[this.selectedDateIndex]; } return ''; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getSelectedDateString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#...
getSelectedDateString(): string { if (this.selectedDateIndex >= 0 && this.selectedDateIndex < this.recentDates.length) { return this.recentDates[this.selectedDateIndex]; } return ''; }
https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final
616e08420783e10b1e4084cee11eabcd7ba2d6a1
github
Joker-x-dev/CoolMallArkTS
core/navigation/src/main/ets/goods/GoodsNavigator.ets
arkts
toSearch
跳转到商品搜索 @returns {void} 无返回值
static toSearch(): void { navigateTo(GoodsRoutes.Search); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left toSearch 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_st...
static toSearch(): void { navigateTo(GoodsRoutes.Search); }
https://github.com/Joker-x-dev/CoolMallArkTS
72cac81ac7256afed56b88bceb229dd6df42066d
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/ContentFilterManager.ets
arkts
toggleSFWMode
切换SFW模式
public async toggleSFWMode(): Promise<boolean> { const newState = !this.sfwModeEnabled; await this.setSFWMode(newState); return newState; }
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 toggleSFWMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#...
public async toggleSFWMode(): Promise<boolean> { const newState = !this.sfwModeEnabled; await this.setSFWMode(newState); return newState; }
https://github.com/DaLongZhuaZi/manxia
a601ecb5fc5d82d02932f44cc36e19fbb353e064
github
openharmony/codelabs
ETSUI/LifeHub/entry/src/main/ets/model/LifeHubData.ets
arkts
addTravelPlan
==================== 旅行模块方法 ====================
async addTravelPlan(plan: TravelPlan): Promise<number> { await this.ensureDatabaseReady(); if (!this.rdbStore) { throw new Error('数据库未初始化'); } const valuesBucket: relationalStore.ValuesBucket = { title: plan.title, destination: plan.destination, startDate: plan.startDate, ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left addTravelPlan AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left plan AST#identifier#Right AST#type_annotation#Left AST#:#Left : A...
async addTravelPlan(plan: TravelPlan): Promise<number> { await this.ensureDatabaseReady(); if (!this.rdbStore) { throw new Error('数据库未初始化'); } const valuesBucket: relationalStore.ValuesBucket = { title: plan.title, destination: plan.destination, startDate: plan.startDate, ...
https://gitcode.com/openharmony/codelabs
928bce8087fec2772a165044cda6c08ace2ae7c6
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Float.ets
arkts
isFinite
Checks if float is a floating point value (not a NaN or infinity) @param v the float to test @returns true if the argument is a floating point value
public static isFinite(v: float): boolean { return !(Float.isNaN(v) || (v == Float.POSITIVE_INFINITY) || (v == Float.NEGATIVE_INFINITY)); }
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 isFinite AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left v AST#identifier#Right AST#:#Left : AST#:#Righ...
public static isFinite(v: float): boolean { return !(Float.isNaN(v) || (v == Float.POSITIVE_INFINITY) || (v == Float.NEGATIVE_INFINITY)); }
https://gitcode.com/iop123123/arkts-static-skills
9a9e34653f094c3668d858c939855416e0795e2e
gitcode
LJ666-ui/harmony-health-care
entry/src/main/ets/services/FamilyService.ets
arkts
viewPatientMedicalRecord
查看患者病历
async viewPatientMedicalRecord(patientId: string): Promise<MedicalRecord | null> { const relation = this.relations.get(patientId); if (!relation) { console.error('无权查看该患者病历'); return null; } if (relation.authorizationLevel < 2) { console.error('授权等级不足,无法查看完整病历'); return nu...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left viewPatientMedicalRecord AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left patientId AST#identifier#Right AST#type_annotation#Lef...
async viewPatientMedicalRecord(patientId: string): Promise<MedicalRecord | null> { const relation = this.relations.get(patientId); if (!relation) { console.error('无权查看该患者病历'); return null; } if (relation.authorizationLevel < 2) { console.error('授权等级不足,无法查看完整病历'); return nu...
https://github.com/LJ666-ui/harmony-health-care
4d7323ae22c0326c81f132c0ec87527ae0ffb245
github
jjjjjjava/ffmpeg_tools
src/main/ets/ffmpeg/FFmpegCommandBuilder.ets
arkts
arg
添加额外参数
public arg(key: string, value?: string): FFmpegCommandBuilder { this.extraArgs.push(key); if (value !== undefined) { this.extraArgs.push(value); } return this; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left arg AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#...
public arg(key: string, value?: string): FFmpegCommandBuilder { this.extraArgs.push(key); if (value !== undefined) { this.extraArgs.push(value); } return this; }
https://github.com/jjjjjjava/ffmpeg_tools
8c35ada772542625c9a445093d8c95f586fdeadf
github
yongoe1024/RdbPlus
rdbplus/src/main/ets/core/Wrapper.ets
arkts
notLike
单个字段的非模糊匹配条件 @param field 字段 @param value 值 @returns Wrapper
notLike(field: string, value: relationalStore.ValueType, condition: boolean = true): Wrapper { if (condition) { this.whereList.push(`and ${field} not like ?`) this.valueList.push(value) } return this }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left notLike AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left field AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#...
notLike(field: string, value: relationalStore.ValueType, condition: boolean = true): Wrapper { if (condition) { this.whereList.push(`and ${field} not like ?`) this.valueList.push(value) } return this }
https://github.com/yongoe1024/RdbPlus/blob/83f7347b7ac692941729d3464923155948e876bb/rdbplus/src/main/ets/core/Wrapper.ets#L202-L208
98980843f5608e20c500c0fde22f69e9f2521a01
github
erosTeam/NextE
shared/src/main/ets/i18n/EhErrorText.ets
arkts
forUser
Localized message for any caught value (classifies the kind via EhError.kindOf).
static forUser(err: Object): string { return EhErrorText.message(EhError.kindOf(err)) }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left forUser AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left err AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Object AS...
static forUser(err: Object): string { return EhErrorText.message(EhError.kindOf(err)) }
https://github.com/erosTeam/NextE
9d8e8639b5a40065f199f1e8b3c7c725b20663ae
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Parsers/PdfToMangaImporter.ets
arkts
generateComicInfoXml
生成ComicInfo.xml内容
private generateComicInfoXml(info: PdfComicInfo): string { const escapeXml = (str: string | undefined): string => { if (!str) return ''; return str .replace(/&/g, '&amp;') .replace(/</g, '&lt;') .replace(/>/g, '&gt;') .replace(/"/g, '&quot;') .replace(/'/g, '&ap...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left generateComicInfoXml AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left info AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi...
private generateComicInfoXml(info: PdfComicInfo): string { const escapeXml = (str: string | undefined): string => { if (!str) return ''; return str .replace(/&/g, '&amp;') .replace(/</g, '&lt;') .replace(/>/g, '&gt;') .replace(/"/g, '&quot;') .replace(/'/g, '&ap...
https://github.com/DaLongZhuaZi/manxia
cb919deade90d6f452819c0c88a8920241c8ee68
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/utils/CryptoUtil.ets
arkts
generateRsaKeyPair
生成 RSA 2048 密钥对
static async generateRsaKeyPair(): Promise<cryptoFramework.KeyPair> { const generator = cryptoFramework.createAsyKeyGenerator('RSA2048|PRIMES_2'); return await generator.generateKeyPair(); }
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 generateRsaKeyPair AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A...
static async generateRsaKeyPair(): Promise<cryptoFramework.KeyPair> { const generator = cryptoFramework.createAsyKeyGenerator('RSA2048|PRIMES_2'); return await generator.generateKeyPair(); }
https://github.com/AlkaidLab/moonlight-harmony
16bf4fa1acd2e3f5733f551ecc68a1c98ef897fc
github
1ilI/WebViewJavascriptBridge_harmony
webview_javascript_bridge/src/main/ets/WebViewJavascriptBridgeTools.ets
arkts
mapToObject
Map 转 Object @param map @returns
public static mapToObject(map: Map<object, Object>): object { let obj: object = new Object(); if (map instanceof Map) { map.forEach((value: Object, key: Object) => { if (value instanceof Map) { obj[key.toString()] = WebViewJavascriptBridgeTools.mapToObject(value); } else { ...
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 mapToObject AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left map AST#identifier#Right AST#:#Left : AST#:...
public static mapToObject(map: Map<object, Object>): object { let obj: object = new Object(); if (map instanceof Map) { map.forEach((value: Object, key: Object) => { if (value instanceof Map) { obj[key.toString()] = WebViewJavascriptBridgeTools.mapToObject(value); } else { ...
https://github.com/1ilI/WebViewJavascriptBridge_harmony
801fdcb77fa370ff864a2d41dc32e300b54ad11b
github
openharmony/codelabs
ETSUI/MediaReview/entry/src/main/ets/utils/RdbUtil.ets
arkts
addFavorite
收藏:增/删/查
static async addFavorite(context: Context, userName: string, mediaId: string, type: string): Promise<boolean> { const list = RdbUtil.favMemory.get(userName) ?? [] if (!list.find(it => it.mediaId === mediaId)) { list.unshift({ mediaId, type }) RdbUtil.favMemory.set(userName, list) } try { ...
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 addFavorite AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AS...
static async addFavorite(context: Context, userName: string, mediaId: string, type: string): Promise<boolean> { const list = RdbUtil.favMemory.get(userName) ?? [] if (!list.find(it => it.mediaId === mediaId)) { list.unshift({ mediaId, type }) RdbUtil.favMemory.set(userName, list) } try { ...
https://gitcode.com/openharmony/codelabs
ba604718c57f5d90caef2fe3c398dd8960b135ef
gitcode
xblLab/HarmonyProjectTemplate
commons/lib_common/src/main/ets/utils/RouterUtils.ets
arkts
createStack
创建新栈 @param stackName @returns
public static createStack(stackName: string, isNew: boolean = false) { if (!RouterUtils.stackMap.has(stackName) || isNew) { RouterUtils.stackMap.set(stackName, new NavPathStack()); } return RouterUtils.getStack(stackName); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left createStack AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left stackName AST#identifier#Right AST#ERROR#Left AST#:#Left :...
public static createStack(stackName: string, isNew: boolean = false) { if (!RouterUtils.stackMap.has(stackName) || isNew) { RouterUtils.stackMap.set(stackName, new NavPathStack()); } return RouterUtils.getStack(stackName); }
https://github.com/xblLab/HarmonyProjectTemplate
a51c97688d6b598ed4d775476a15400da7b48f61
github
arkui-x/samples
CodeLab/Cases/feature/h5cache/src/main/ets/common/MemoryCacheManager.ets
arkts
submitToMemory
保存数据到内存中 @param key 键值 @param data 数据
submitToMemory(key: string, data: ResponseDataType) { this.cache.put(key, data); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left submitToMemory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right...
submitToMemory(key: string, data: ResponseDataType) { this.cache.put(key, data); }
https://gitcode.com/arkui-x/samples
a57841559c41279464cbfeb26c18ffb86c978060
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets
arkts
parseCSSSelectorAndAttr
解析CSS选择器和属性 支持Legado的@分隔符语法
private parseCSSSelectorAndAttr(selector: string): CssSelectorResult { // Legado使用@分隔选择器链,最后一个@后面可能是属性名 // 例如 .s2 a@href 意味着:选择.s2 a,然后提取href属性 // 例如 .s2 a@text 意味着:选择.s2 a,然后提取文本 const parts = selector.split('@'); let attr = 'text'; let sel = selector; if (parts.length > 1) { ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseCSSSelectorAndAttr AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left selector AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left strin...
private parseCSSSelectorAndAttr(selector: string): CssSelectorResult { // Legado使用@分隔选择器链,最后一个@后面可能是属性名 // 例如 .s2 a@href 意味着:选择.s2 a,然后提取href属性 // 例如 .s2 a@text 意味着:选择.s2 a,然后提取文本 const parts = selector.split('@'); let attr = 'text'; let sel = selector; if (parts.length > 1) { ...
https://github.com/DaLongZhuaZi/manxia
746982f58c9f800ed0ff7815a59c9aeb4bb4afbe
github
offlinecat-dev/OCNetORM
src/main/ets/mapping/EntityData.ets
arkts
getPropertyValue
获取属性值(响应式版本) @param propertyName 属性名 @returns 属性值,如果不存在返回 null
getPropertyValue(propertyName: string): ValueType { const value = this.propertyMap.get(propertyName) if (value === undefined) { return null } return value }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getPropertyValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left propertyName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ...
getPropertyValue(propertyName: string): ValueType { const value = this.propertyMap.get(propertyName) if (value === undefined) { return null } return value }
https://github.com/offlinecat-dev/OCNetORM
3d1fe7bcdd198151c87715b7fca6977d61d01323
github
Your-USTC/DailyNic_HMOS
entry/src/main/ets/utils/Classes/ScheduleManager.ets
arkts
parseOnlineSchedule
解析在线课程表数据,将多层嵌套的课程数据扁平化 @param originData 原始的三层嵌套课程数据结构 [][][] @param fillAll 是否补充颜色和优先级属性 @returns 扁平化后的课程属性数组,已处理在线课表缺失或待处理的课程ID、学分、优先级、颜色等信息
parseOnlineSchedule(originData: classAttribute[][][], fillAll: boolean = false): classAttribute[] { const parsedData: classAttribute[] = []; if (fillAll) { const nameToColor: Map<string, number> = new Map<string, number>(); let randomColor: number = getRandomInt(0, colorSetLen - 1); originDa...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left parseOnlineSchedule AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left originData AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#i...
parseOnlineSchedule(originData: classAttribute[][][], fillAll: boolean = false): classAttribute[] { const parsedData: classAttribute[] = []; if (fillAll) { const nameToColor: Map<string, number> = new Map<string, number>(); let randomColor: number = getRandomInt(0, colorSetLen - 1); originDa...
https://github.com/Your-USTC/DailyNic_HMOS
0aa1e0500686f59101dab76f2198643874e34631
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/MangaSourceActionEngine.ets
arkts
executeScript
执行脚本操作
private async executeScript(action: ScriptAction, context: ActionContext): Promise<string> { const code = this.replaceVariables(action.code, context.variables); // 输出更详细的日志,帮助调试变量替换问题 logger.info(TAG, `执行脚本: ${code.substring(0, 200)}...`); // 输出关键筛选变量 logger.debug(TAG, `脚本变量: category=${context.va...
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 executeScript AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left action AST#identifier#Right AST#:#Left ...
private async executeScript(action: ScriptAction, context: ActionContext): Promise<string> { const code = this.replaceVariables(action.code, context.variables); // 输出更详细的日志,帮助调试变量替换问题 logger.info(TAG, `执行脚本: ${code.substring(0, 200)}...`); // 输出关键筛选变量 logger.debug(TAG, `脚本变量: category=${context.va...
https://github.com/DaLongZhuaZi/manxia
a28e42cc8c20539d8c73a0032d713f28922afa6a
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/Char.ets
arkts
compareTo
Compares this instance to other Char object The result is less than 0 if this instance lesser than provided object 0 if they are equal and greater than 0 otherwise. @param other Char object to compare with @returns result of the comparison
public override compareTo(other: Char): int { return (this.value as int) - (other.unboxed() as int); }
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 compareTo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left other AST#identifier#Right AST#ERROR#Left AST#:#Left : AST...
public override compareTo(other: Char): int { return (this.value as int) - (other.unboxed() as int); }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
df5bf86d23866dd8be6aa4ee2f68fb804fbffc48
gitee
HarmonyOS_Samples/guide-snippets
ArkGraphics3D/entry/src/main/ets/common/utils.ets
arkts
angleAxis
Creates a rotation which rotates angle degrees around axis, takes in angle as radians
function angleAxis(angle: number, axis: Vec3): Quaternion { let sinHalfAngle: number = Math.sin(angle * 0.5); let axisMultiplied: Vec3 = { x: axis.x * sinHalfAngle, y: axis.y * sinHalfAngle, z: axis.z * sinHalfAngle }; let ret: Quaternion = { x: axisMultiplied.x, y: axisMultiplied.y, z: axisMultiplied...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left angleAxis AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left angle AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right...
function angleAxis(angle: number, axis: Vec3): Quaternion { let sinHalfAngle: number = Math.sin(angle * 0.5); let axisMultiplied: Vec3 = { x: axis.x * sinHalfAngle, y: axis.y * sinHalfAngle, z: axis.z * sinHalfAngle }; let ret: Quaternion = { x: axisMultiplied.x, y: axisMultiplied.y, z: axisMultiplied...
https://gitcode.com/HarmonyOS_Samples/guide-snippets
c56dcec7b1d5ecc59df397d53c10f803ef5733d4
gitcode
erosTeam/NextE
feature/gallery/src/main/ets/components/GalleryTagsCard.ets
arkts
chipBg
Member chip background: the user's editable MyTags color, else EH preview fill, else neutral grey. Never namespace.
chipBg(t: SimpleTag, ns: string): ResourceColor { const u: EhUsertag | undefined = UserTagStore.getInstance().lookup(ns, t.text) if (u !== undefined && u.colorCode.length > 0) { return u.colorCode } if (u !== undefined && u.fillColor.length > 0) { return u.fillColor } return $r('sy...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left chipBg AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left t AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left SimpleTag AST#identifier#Right AST#,#Left , AST#,#Ri...
chipBg(t: SimpleTag, ns: string): ResourceColor { const u: EhUsertag | undefined = UserTagStore.getInstance().lookup(ns, t.text) if (u !== undefined && u.colorCode.length > 0) { return u.colorCode } if (u !== undefined && u.fillColor.length > 0) { return u.fillColor } return $r('sy...
https://github.com/erosTeam/NextE
06db68e4308c60e6534ddd2e57daf4c1d76f688d
github
Countly/countly-sdk-hos
library/src/main/ets/internal/modules/ModuleConfiguration.ets
arkts
removeUnsupportedKeys
Filter inner-config keys to those the SDK knows about AND whose value type matches the expected schema. Returns a new object, does not mutate the input.
private removeUnsupportedKeys(inner: Record<string, Object>): Record<string, Object> { const out: Record<string, Object> = {}; const keys: string[] = Object.keys(inner); for (let i = 0; i < keys.length; i++) { const k: string = keys[i]; const v: Object = inner[k]; if (this.isValidKeyValu...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left removeUnsupportedKeys AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left inner AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instan...
private removeUnsupportedKeys(inner: Record<string, Object>): Record<string, Object> { const out: Record<string, Object> = {}; const keys: string[] = Object.keys(inner); for (let i = 0; i < keys.length; i++) { const k: string = keys[i]; const v: Object = inner[k]; if (this.isValidKeyValu...
https://github.com/Countly/countly-sdk-hos
a748c3f6856dc73056817c9356714afdc89a1726
github
LJ666-ui/harmony-health-care
entry/src/main/ets/services/SyncService.ets
arkts
applyChange
应用单个变更
private async applyChange(change: SyncRecord): Promise<void> { console.log(`应用变更: ${change.entityType} ${change.operation}`); }
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 applyChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left change AST#identifier#Right AST#:#Left : ...
private async applyChange(change: SyncRecord): Promise<void> { console.log(`应用变更: ${change.entityType} ${change.operation}`); }
https://github.com/LJ666-ui/harmony-health-care
4dc702d6e250bd06dc2a6f0fb0f8247c4280d271
github
HarmonyOS_Samples/guide-snippets
ArkTS/ArkTSCompilationToolchain/ArkGuardForBytecodeObfuscation/BytecodeObfuscationIssues/entry/src/main/ets/pages/MainPage.ets
arkts
loadAndUseAdd
[Start import_utils] main.ts
async function loadAndUseAdd() { try { const mathUtils = await import('./ExportUtils'); const result = mathUtils.add(2, 3); } catch (error) { console.error('Failure reason:', error); } }
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left loadAndUseAdd AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{...
async function loadAndUseAdd() { try { const mathUtils = await import('./ExportUtils'); const result = mathUtils.add(2, 3); } catch (error) { console.error('Failure reason:', error); } }
https://gitcode.com/HarmonyOS_Samples/guide-snippets
59cf83d1b4a8c62af8645c95d9e6bfff9d48c874
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/ErrorHandler.ets
arkts
handleUncaughtError
Handles uncaught errors. It calls the custom error handling callback and exits the process if handling fails or the error type is invalid. @param { Object } error - The uncaught error object that occurred. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public handleUncaughtError(error: Object): void { if (error instanceof Error) { error = error as Error; } else { console.error('Error type is not recognized:', error); let procManager = new StdProcess.ProcessManager(); procManager.exit(1); } ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left handleUncaughtError AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left error AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#...
public handleUncaughtError(error: Object): void { if (error instanceof Error) { error = error as Error; } else { console.error('Error type is not recognized:', error); let procManager = new StdProcess.ProcessManager(); procManager.exit(1); } ...
https://gitcode.com/iop123123/arkts-static-skills
0fb2590258a1e155e12d6a5ee00d0a9c21f0b650
gitcode
HarmonyOS_Samples/guide-snippets
ArkData/DataShare/ShareConfig/entry/src/main/ets/pages/Index.ets
arkts
deleteSharedConfig
[End publish_shared_config] [Start delete_shared_config]
function deleteSharedConfig() { dataShare.createDataProxyHandle().then((dataProxyHandle) => { const urisToDelete: string[] = [ 'datashareproxy://com.samples.shareconfig/config1', 'datashareproxy://com.samples.shareconfig/config2' ]; const config: dataShare.DataProxyConfig = { type: dataS...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left deleteSharedConfig 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#expressi...
function deleteSharedConfig() { dataShare.createDataProxyHandle().then((dataProxyHandle) => { const urisToDelete: string[] = [ 'datashareproxy://com.samples.shareconfig/config1', 'datashareproxy://com.samples.shareconfig/config2' ]; const config: dataShare.DataProxyConfig = { type: dataS...
https://gitcode.com/HarmonyOS_Samples/guide-snippets
8182726b0faa1ad27787f37e2082bb643eb1f440
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Object.ets
arkts
hasOwn
Determines whether an object has a element with the specified index @param target an object @param index the number index of the element to test @returns true if the object has the specified element; false otherwise
public static hasOwn(target: Object, index: number): boolean { return target.hasOwnProperty(index) }
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 hasOwn AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left target AST#identifier#Right AST#:#Left : AST#:#R...
public static hasOwn(target: Object, index: number): boolean { return target.hasOwnProperty(index) }
https://gitcode.com/iop123123/arkts-static-skills
3d80c73f0da34ae276a7c88db74c16895910ffbc
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
from
Creates an BigInt64Array from array-like argument @param o array-like object to initialize BigInt64Array @returns new BigInt64Array
public from(o: Object): BigInt64Array { throw new Error("BigInt64Array.from: not implemented") }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left from AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left o AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#R...
public from(o: Object): BigInt64Array { throw new Error("BigInt64Array.from: not implemented") }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
eb8a22b8b370bd21165547355245872983f275e8
gitee
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/GamepadManager.ets
arkts
toggleMouseEmulation
切换鼠标模拟模式
toggleMouseEmulation(): void { this.mouseEmulationService.toggle(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toggleMouseEmulation 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#stateme...
toggleMouseEmulation(): void { this.mouseEmulationService.toggle(); }
https://github.com/AlkaidLab/moonlight-harmony
dbf3a489858aec2c59f97aa0fe478f99ea6a594e
github
cpdd5201314/harmonyOS-music-app
products/phone/src/main/ets/pages/MusicApiClient.ets
arkts
base64Encode
Base64编码
private static base64Encode(data: string): string { const textEncoder = new util.TextEncoder(); const uint8Array = textEncoder.encodeInto(data); const base64Helper = new util.Base64Helper(); const encoded = base64Helper.encodeToStringSync(uint8Array); // URL safe编码 return encoded.replace(/\+/g...
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 base64Encode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : ...
private static base64Encode(data: string): string { const textEncoder = new util.TextEncoder(); const uint8Array = textEncoder.encodeInto(data); const base64Helper = new util.Base64Helper(); const encoded = base64Helper.encodeToStringSync(uint8Array); // URL safe编码 return encoded.replace(/\+/g...
https://github.com/cpdd5201314/harmonyOS-music-app
3be7e45e8b32a477c1919a4beda8e2356691a473
github
the-wwyang/kids-learning-app
src/main/ets/storage/LearningRecordStorageService.ets
arkts
loadAnswerRecords
加载答题记录列表 @returns 答题记录列表
static async loadAnswerRecords(): Promise<AnswerRecord[]> { try { const hasData = await dataStorage.has( LearningRecordStorageService.STORE_NAME, LearningRecordStorageService.KEY_RECORDS ); if (!hasData) { console.log('[LearningRecordStorage] No saved records'); ...
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 loadAnswerRecords AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS...
static async loadAnswerRecords(): Promise<AnswerRecord[]> { try { const hasData = await dataStorage.has( LearningRecordStorageService.STORE_NAME, LearningRecordStorageService.KEY_RECORDS ); if (!hasData) { console.log('[LearningRecordStorage] No saved records'); ...
https://github.com/the-wwyang/kids-learning-app
fdcf4a7e8a7f3b93b061532fafa3cf8e0b1332a9
github
CLMC2025/Vignette
entry/src/main/ets/manager/PromptTemplateManager.ets
arkts
addTemplate
添加新模板
addTemplate(template: PromptTemplate): void { const key = `${template.id}_v${template.version}`; this.templates.set(key, template); // 添加到历史记录 if (!this.templateHistory.has(template.id)) { this.templateHistory.set(template.id, []); } this.templateHistory.get(template.id)!.push(templ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addTemplate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left template AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left PromptTemplate AST#identifier#Right AST#...
addTemplate(template: PromptTemplate): void { const key = `${template.id}_v${template.version}`; this.templates.set(key, template); // 添加到历史记录 if (!this.templateHistory.has(template.id)) { this.templateHistory.set(template.id, []); } this.templateHistory.get(template.id)!.push(templ...
https://github.com/CLMC2025/Vignette
6329c57b2a123384fc445c782ccb3262e98de487
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Map.ets
arkts
get
Returns a value associated with key if present, or a default value otherwise @param key the key to find in the Map @param def a value to return if key is not in the Map @returns value if key presents, def otherwise
get(key: K, def: V): V { return this.get(key) ?? def }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left get AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left key AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left K AST#identifier#Right AST#ERROR#Right AST#,#Left , AST#,#Right AST#i...
get(key: K, def: V): V { return this.get(key) ?? def }
https://gitcode.com/iop123123/arkts-static-skills
e972ce077a57f0cc4dc2c7c0892f284569f9b543
gitcode
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/services/RdpSessionManager.ets
arkts
notifyStateChanged
Notify state changed
private notifyStateChanged(state: SessionState): void { if (onSessionStateChangedCallback) { onSessionStateChangedCallback(state); } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left notifyStateChanged AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left state AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie...
private notifyStateChanged(state: SessionState): void { if (onSessionStateChangedCallback) { onSessionStateChangedCallback(state); } }
https://github.com/tangwengang-del/freerdp-harmonyos
e9db7cffee472596e40394ba66456723cc4078ba
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/BigInt.ets
arkts
constructor
Creates a new `BigInt` instance from a string value. @param { string } d The string value to convert to BigInt. @syscap SystemCapability.Utils.Lang @FaAndStageModel
constructor(d: string) { let trimmed = d.trim() let a = BigInt.parseFromString(trimmed) this.bytes = a[0] as ValueArray<int> this.sign = a[1] as int }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left d AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#...
constructor(d: string) { let trimmed = d.trim() let a = BigInt.parseFromString(trimmed) this.bytes = a[0] as ValueArray<int> this.sign = a[1] as int }
https://gitcode.com/iop123123/arkts-static-skills
abbef9771008e43d95ec17719c5aace5045363f1
gitcode
openharmony/app_samples
Preset/Clock/entry/src/main/ets/pages/Index.ets
arkts
drawTime
绘制表盘下面时间文本
drawTime(time) { this.context.save() this.context.beginPath() this.context.font = '60px' this.context.textAlign = "center" this.context.textBaseline = "middle" this.context.fillStyle = '#000' this.context.fillText(time, 0, this.radius + 80) this.context.restore() }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left drawTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left time AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression...
drawTime(time) { this.context.save() this.context.beginPath() this.context.font = '60px' this.context.textAlign = "center" this.context.textBaseline = "middle" this.context.fillStyle = '#000' this.context.fillText(time, 0, this.radius + 80) this.context.restore() }
https://gitee.com/openharmony/app_samples.git
50552da8e169d99a64523483f2f0d0f3dcdd45e9
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
includes
Checks if specified argument is in BigInt64Array @param e search element @returns true if e is in BigInt64Array, false otherwise
public includes(e: BigInt): boolean { return this.includes(e.getLong(), 0) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left includes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left e AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left BigInt AST...
public includes(e: BigInt): boolean { return this.includes(e.getLong(), 0) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
ccee819b283fa6ebe6b6945b4b9c17c3e734f400
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
of
Returns a new array from a set of elements. @param { FixedArray<int> } items - a set of elements to include in the new array object. @returns { Float32Array } - a new Float32Array @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static of(...items: FixedArray<int>): Float32Array { let res = new Float32Array(items.length.toInt()) res.ofInt(stub.toValueArray(items)) return res }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#of#Left of AST#of#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#ERROR...
public static of(...items: FixedArray<int>): Float32Array { let res = new Float32Array(items.length.toInt()) res.ofInt(stub.toValueArray(items)) return res }
https://gitcode.com/iop123123/arkts-static-skills
401b90fb26e59b3101d8202f2e95d6e87606125d
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/greater_than/greater_than_ulong.ets
arkts
main
--- desc: check greater operation for two unsigned long integers ---
function main(): void { const a: ulong = {{v.left}} const b: ulong = {{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: ulong = {{v.left}} const b: ulong = {{v.right}} assert (a > b) == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
81af27e206e0ebf0c049e204cf826f328bb7a6bb
gitee
offlinecat-dev/OCNetORM
src/main/ets/mapping/ResultSetUtils.ets
arkts
getValueByRuntimeType
根据 ResultSet 类型信息读取值(无元数据场景) @param resultSet 结果集 @param columnIndex 列索引 @returns 列值
static getValueByRuntimeType( resultSet: relationalStore.ResultSet, columnIndex: number ): DbValueType { try { if (resultSet.isColumnNull(columnIndex)) { return null } const columnType = resultSet.getColumnTypeSync(columnIndex) switch (columnType) { case relationa...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getValueByRuntimeType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resultSet AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#membe...
static getValueByRuntimeType( resultSet: relationalStore.ResultSet, columnIndex: number ): DbValueType { try { if (resultSet.isColumnNull(columnIndex)) { return null } const columnType = resultSet.getColumnTypeSync(columnIndex) switch (columnType) { case relationa...
https://github.com/offlinecat-dev/OCNetORM
7fe7c4dcdf55d9095b2621e26821e2599a609e8b
github
Cool_foolisher1/ArkTSRepository
GraphicalCode/features/algorithm/src/main/ets/view/AlgorithmListView.ets
arkts
jumpComponentDetailView
跳转组件详情视图 @param cardComponentContentModel CardComponentContentModel
jumpComponentDetailView(cardComponentContentModel: CardComponentContentModel) { this.cardComponentDataViewModel.sendEvent<CardComponentContentModel>({ type: CardComponentDataEventTypeEnum.JUMP_COMPONENT_DETAIL, param: cardComponentContentModel, }) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left jumpComponentDetailView AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left cardComponentContentModel AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
jumpComponentDetailView(cardComponentContentModel: CardComponentContentModel) { this.cardComponentDataViewModel.sendEvent<CardComponentContentModel>({ type: CardComponentDataEventTypeEnum.JUMP_COMPONENT_DETAIL, param: cardComponentContentModel, }) }
https://gitcode.com/Cool_foolisher1/ArkTSRepository
d474007b1ecd556949d9200248f38146c26c456e
gitcode
TDCQCX/ShiHuaMusic-Harmony
entry/src/main/ets/utils/GlobalDataManager.ets
arkts
constructor
图片服务器API
private constructor() { this.audioManager = AudioManager.getInstance(); this.httpUtil = new HttpUtil(); this.initializeApp(); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left ...
private constructor() { this.audioManager = AudioManager.getInstance(); this.httpUtil = new HttpUtil(); this.initializeApp(); }
https://github.com/TDCQCX/ShiHuaMusic-Harmony
af7e67acf9ec92decc57dfb8ff2e72061df95667
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Promise.ets
arkts
any
Create a promise that will be resolved after all promises are completed and at least one is resolved @param promises array of promise-like objects @returns { Promise } promise that will be resolved if at least one promise is resolved with the result of resolved promise or rejected with AggregateError if all promises ar...
static any<U>(promises: FixedArray<PromiseLike<U>|U|undefined>): Promise<Awaited<U>> { return new Promise<Awaited<U>>((resolve: (value: Awaited<U>) => void, reject: (error: Error) => void): void => { let resolvedCnt = 0; let rejectedCnt = 0; const errors: Error[] = new Er...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left any AST#identifier#Right AST#ERROR#Right AST#<#Left < AST#<#Right AST#identifier#Left U AST#identifier#Right AST#binary_expression#Right...
static any<U>(promises: FixedArray<PromiseLike<U>|U|undefined>): Promise<Awaited<U>> { return new Promise<Awaited<U>>((resolve: (value: Awaited<U>) => void, reject: (error: Error) => void): void => { let resolvedCnt = 0; let rejectedCnt = 0; const errors: Error[] = new Er...
https://gitcode.com/iop123123/arkts-static-skills
4ebd10b1e32a3bfac18f98a256d74fbf485fc855
gitcode
openharmony/applications_app_samples
code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example1/SecondaryLinkExample.ets
arkts
aboutToAppear
是否点击一级列表 生命周期函数
aboutToAppear(): void { // 构造数据 for (let i = 0; i < TAG_LIST_LENGTH; i++) { this.tagLists.push(`类别${i + 1}`); const tempData: Array<CustomDataType> = new Array<CustomDataType>(CONTENT_PER_TAG).fill({ desc: '内容数据', tag: `类别${i + 1}` }); this.records.push(i * CONTENT_PER_...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc...
aboutToAppear(): void { // 构造数据 for (let i = 0; i < TAG_LIST_LENGTH; i++) { this.tagLists.push(`类别${i + 1}`); const tempData: Array<CustomDataType> = new Array<CustomDataType>(CONTENT_PER_TAG).fill({ desc: '内容数据', tag: `类别${i + 1}` }); this.records.push(i * CONTENT_PER_...
https://github.com/openharmony/applications_app_samples
2cca724a39e6c28be1ac74453318be8cb5d20994
github
JackJiang2011/harmonychat
entry/src/main/ets/pages/model/MessagesProvider.ets
arkts
updateMessagesSendStatus
更新指定指纹码的消息的发送状态(更新多条消息)。 目前用于QoS送达机制中告诉应用层有哪些原始消息报文未成功送达给对方。 @param protocals 原始消息报文对象数组,数组中Protocal对象指纹码(消息id)就是本次要更新的对象,这个数组目前来自于SDK的 EventType.onMessagesLost 事件通知 @param sendStatus 发送状态,see {@link MsgSendStatus}
updateMessagesSendStatus(protocals: Protocal[], sendStatus: MsgSendStatus): void { let updateIndexes: number[] = []; // 遍历消息列表 // this.messages.forEach((m: Message) => { for(let mi = 0; mi < this.messages.length; mi++) { let m = this.messages[mi]; for(let i = 0; i < protocals.length; i++)...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateMessagesSendStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left protocals AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#L...
updateMessagesSendStatus(protocals: Protocal[], sendStatus: MsgSendStatus): void { let updateIndexes: number[] = []; // 遍历消息列表 // this.messages.forEach((m: Message) => { for(let mi = 0; mi < this.messages.length; mi++) { let m = this.messages[mi]; for(let i = 0; i < protocals.length; i++)...
https://github.com/JackJiang2011/harmonychat
7a645069060aad36b286bb729ef29a00a8ac363a
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/WebViewSourceManager.ets
arkts
loadSourceConfigsFromDatabase
从数据库加载源配置
private async loadSourceConfigsFromDatabase(): Promise<void> { try { const sources: ComicSourceDatabaseRecord[] = await this.databaseManager.query<ComicSourceDatabaseRecord>( 'comic_source', undefined, 'isEnabled = ?', [1] ); for (const source of sources) { ...
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 loadSourceConfigsFromDatabase AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expr...
private async loadSourceConfigsFromDatabase(): Promise<void> { try { const sources: ComicSourceDatabaseRecord[] = await this.databaseManager.query<ComicSourceDatabaseRecord>( 'comic_source', undefined, 'isEnabled = ?', [1] ); for (const source of sources) { ...
https://github.com/DaLongZhuaZi/manxia
b64131e48de95ae07280e28c764efe85f50d3aad
github
Amaz1ny/HarmonyDO-public
entry/src/main/ets/common/theme/ThemeManager.ets
arkts
getCategoryColor
分类颜色安全获取
static getCategoryColor(color: string | null): string { if (color === null || color.length === 0) { return '#999999'; } if (color.startsWith('#')) { return color; } return `#${color}`; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getCategoryColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left color AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_express...
static getCategoryColor(color: string | null): string { if (color === null || color.length === 0) { return '#999999'; } if (color.startsWith('#')) { return color; } return `#${color}`; }
https://github.com/Amaz1ny/HarmonyDO-public
3f7e1058d33785c4dab901e48093a38ccf3f21bc
github
LJ666-ui/harmony-health-care
entry/src/main/ets/core/SmartTVController.ets
arkts
sendCommand
发送控制命令到电视设备
public async sendCommand(deviceId: string, command: DeviceCommand): Promise<void> { console.log(`SmartTVController: Sending command to ${deviceId}`, command); // 解析命令参数 const params = command.params; let volume: number = 50; let channel: number = 1; let isOn: boolean = false; if ('volume...
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 sendCommand AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left deviceId AST#identifier#Right AST#ERROR#Left AST#:#Left : A...
public async sendCommand(deviceId: string, command: DeviceCommand): Promise<void> { console.log(`SmartTVController: Sending command to ${deviceId}`, command); // 解析命令参数 const params = command.params; let volume: number = 50; let channel: number = 1; let isOn: boolean = false; if ('volume...
https://github.com/LJ666-ui/harmony-health-care
7e5b42ba49e0802e7a1876726766aec71141ad91
github
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/BinaryEncodingVisitor.ets
arkts
visitRepeatedInt32
========== Repeated 字段 ========== 访问 repeated int32 字段 每个元素单独编码
visitRepeatedInt32(value: number[], fieldNumber: number): void { for (const item of value) { this.visitInt32(item, fieldNumber) } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitRepeatedInt32 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#subscript_expression#Left AST#identifier#Left number...
visitRepeatedInt32(value: number[], fieldNumber: number): void { for (const item of value) { this.visitInt32(item, fieldNumber) } }
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
8808091495780b7b33f21722a949ec8c3b960baa
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/DynamicUrlResolver.ets
arkts
resolveBaseUrl
解析baseUrl(支持动态域名切换)
private resolveBaseUrl(config: UrlResolverConfig): string { // 检查是否有域名选择设置 const domainSetting = config.variables?.['apiDomain']; if (!domainSetting || domainSetting === 'main') { return config.baseUrl; } // 使用备用域名 if (config.alternativeUrls && config.alternativeUrls[domainSetting]...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left resolveBaseUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
private resolveBaseUrl(config: UrlResolverConfig): string { // 检查是否有域名选择设置 const domainSetting = config.variables?.['apiDomain']; if (!domainSetting || domainSetting === 'main') { return config.baseUrl; } // 使用备用域名 if (config.alternativeUrls && config.alternativeUrls[domainSetting]...
https://github.com/DaLongZhuaZi/manxia
8fd414050d780e4394fe0ffbd98b0e2fb2a5d251
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/DataView.ets
arkts
getUint8
=== Uint8 === Read bytes as they represent given type @param { int } byteOffset zero index to read @returns { int } return byteOffset's Uint8 value @throws { RangeError } - Input parameter error. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public getUint8(byteOffset: int): int { return this.getUint8Big(byteOffset) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getUint8 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left byteOffset AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifie...
public getUint8(byteOffset: int): int { return this.getUint8Big(byteOffset) }
https://gitcode.com/iop123123/arkts-static-skills
3ae565ba2cd892d575598052d60d3ba401f75252
gitcode
OHPG/FinSdk
jellyfin/src/main/ets/api/AudioApi.ets
arkts
getAudioStreamByContainer
@summary Gets an audio stream. @param {AudioApiGetAudioStreamByContainerRequest} requestParameters Request parameters. @param {*} [options] Override http request option. @throws {RequiredError} @memberof AudioApi
public getAudioStreamByContainer(requestParameters: AudioApiGetAudioStreamByContainerRequest) { this.assertParam(requestParameters.itemId) this.assertParam(requestParameters.container) return this.apiClient.createUrl({ method: "GET", path: `/Audio/${requestParameters.itemId}/stream.${requestParameters.con...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getAudioStreamByContainer 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#Rig...
public getAudioStreamByContainer(requestParameters: AudioApiGetAudioStreamByContainerRequest) { this.assertParam(requestParameters.itemId) this.assertParam(requestParameters.container) return this.apiClient.createUrl({ method: "GET", path: `/Audio/${requestParameters.itemId}/stream.${requestParameters.con...
https://github.com/OHPG/FinSdk
0477f289e972659b5e959c77db772a12fda437a1
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/PersistedUriManager.ets
arkts
persistFilePermission
持久化文件权限
public async persistFilePermission(uri: string): Promise<PersistedUri | null> { if (!PersistedUriManager.isSupported()) { console.error(`${TAG} Device does not support folder authorization`); return null; } const existing = this.fileUris.find(item => item.uri === uri); if (existing) { ...
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 persistFilePermission AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uri AST#identifier#Right AST#:#Lef...
public async persistFilePermission(uri: string): Promise<PersistedUri | null> { if (!PersistedUriManager.isSupported()) { console.error(`${TAG} Device does not support folder authorization`); return null; } const existing = this.fileUris.find(item => item.uri === uri); if (existing) { ...
https://github.com/richshaw2015/nds
e5800a9987d359076eb06c55f7456a396c24cbf3
github
offlinecat-dev/OCNetORM
src/main/ets/errors/OrmError.ets
arkts
getFullMessage
获取完整的错误信息 @returns 包含错误码和上下文的完整错误描述
getFullMessage(): string { let fullMessage = `[${this.code}] ${this.message}` if (this.context.entityName) { fullMessage += ` | 实体: ${this.context.entityName}` } if (this.context.columnName) { fullMessage += ` | 列: ${this.context.columnName}` } if (this.context.tableName) { f...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getFullMessage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#stateme...
getFullMessage(): string { let fullMessage = `[${this.code}] ${this.message}` if (this.context.entityName) { fullMessage += ` | 实体: ${this.context.entityName}` } if (this.context.columnName) { fullMessage += ` | 列: ${this.context.columnName}` } if (this.context.tableName) { f...
https://github.com/offlinecat-dev/OCNetORM
0d35de7f241670520d49c34bc408611426bb4124
github
popsiclelmlm/Hey
entry/src/main/ets/features/subscriptions/SubscriptionsController.ets
arkts
applyNodeFilter
Keeps only nodes whose name matches the group's filter regex. An empty filter, an invalid regex, or a pattern that matches nothing all fall back to the full node list so a subscription is never silently emptied.
private applyNodeFilter(nodes: Array<ProxyNode>, filter: string): Array<ProxyNode> { const pattern = filter.trim(); if (pattern.length === 0) { return nodes; } try { const regex = new RegExp(pattern); const result = new Array<ProxyNode>(); for (let index = 0; index < nodes.leng...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left applyNodeFilter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left nodes AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiatio...
private applyNodeFilter(nodes: Array<ProxyNode>, filter: string): Array<ProxyNode> { const pattern = filter.trim(); if (pattern.length === 0) { return nodes; } try { const regex = new RegExp(pattern); const result = new Array<ProxyNode>(); for (let index = 0; index < nodes.leng...
https://github.com/popsiclelmlm/Hey
f0c344629dbde1c59770d1035a630749218ccd64
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Components/ThemeAware.ets
arkts
createThemedStyle
创建主题感知的样式对象
public static createThemedStyle<T>( lightStyle: T, darkStyle: T, theme: ThemeType ): T { return theme === ThemeType.LIGHT ? lightStyle : darkStyle; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#binary_expression#Left AST#identifier#Left createThemedStyle AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>...
public static createThemedStyle<T>( lightStyle: T, darkStyle: T, theme: ThemeType ): T { return theme === ThemeType.LIGHT ? lightStyle : darkStyle; }
https://github.com/DaLongZhuaZi/manxia
2dcf987094be570c1eaa14ab38e727648555cf29
github
HarmonyOS_Samples/MusicHome
common/musicbasic/src/main/ets/model/SongDataSource.ets
arkts
addData
Inserts a song at the index and notifies listeners of an add. @param index Insert position (clamped to [0, length] so it matches {@link IDataSource} / LazyForEach). @param data Song to insert.
public addData(index: number, data: SongItem): void { if (data === undefined || data === null) { Logger.warn('SongDataSource', 'addData ignored: data is null or undefined'); return; } const len: number = this.dataArray.length; const insertAt: number = Math.max(0, Math.min(index, len)); ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number ...
public addData(index: number, data: SongItem): void { if (data === undefined || data === null) { Logger.warn('SongDataSource', 'addData ignored: data is null or undefined'); return; } const len: number = this.dataArray.length; const insertAt: number = Math.max(0, Math.min(index, len)); ...
https://gitcode.com/HarmonyOS_Samples/MusicHome
451a26a8aa0e1444d8653c40ff521b79c173eb3e
gitcode