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
aimilin6688/KeePassHO
entry/src/main/ets/common/utils/CommonUtils.ets
arkts
pushUrl
跳转页面 @param options @returns
public static pushUrl(options: router.RouterOptions, mode?: router.RouterMode,): Promise<void> { if (CommonUtils.uiContext) { return CommonUtils.uiContext.getRouter().pushUrl(options, mode).catch((error: Error) => { hilog.error(DOMAIN, TAG, `uiContext pushUrl error: ${error?.message}`); retu...
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 pushUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left options AST#identifier#Right AST#:#Left : AST#:...
public static pushUrl(options: router.RouterOptions, mode?: router.RouterMode,): Promise<void> { if (CommonUtils.uiContext) { return CommonUtils.uiContext.getRouter().pushUrl(options, mode).catch((error: Error) => { hilog.error(DOMAIN, TAG, `uiContext pushUrl error: ${error?.message}`); retu...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/CommonUtils.ets#L145-L156
028c9839b32e53e34654607c8666a606cfc46e43
github
webabcd/HarmonyDemo
entry/src/main/ets/entryability/EntryAbility.ets
arkts
onDestroy
UIAbility 实例销毁时
onDestroy(): void { MyLog.d('ability onDestroy'); if (this.cardCallMethod != '') { // 取消监听 this.callee.off(this.cardCallMethod) } // 停止监听未处理异常 this.stopErrorManager() }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onDestroy 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#Le...
onDestroy(): void { MyLog.d('ability onDestroy'); if (this.cardCallMethod != '') { // 取消监听 this.callee.off(this.cardCallMethod) } // 停止监听未处理异常 this.stopErrorManager() }
https://github.com/webabcd/HarmonyDemo
a58143be42f4b43cadf59a096e45c41c341a25fb
github
XHXYT/Pixark
entry/src/main/ets/common/utils/database/impl/IllustHistoryDao.ets
arkts
getEntityId
获取实体的主键值 @param item 历史记录实体对象 @returns 实体的主键值
getEntityId(item: IllustHistoryInfo): ValueType { return item.id || -1 }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getEntityId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left item AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left IllustHistoryInfo AST#identifier#Right AST#)...
getEntityId(item: IllustHistoryInfo): ValueType { return item.id || -1 }
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/common/utils/database/impl/IllustHistoryDao.ets#L37-L39
573c3d117b0bea12789c0f3ccbcc8bd4a553773a
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Task/BackgroundTaskManager.ets
arkts
getActiveTasks
获取所有活跃任务
public getActiveTasks(): BackgroundTask[] { const activeTasks: BackgroundTask[] = []; this.tasks.forEach((task: InternalTask) => { if (task.status === TaskStatus.PENDING || task.status === TaskStatus.RUNNING) { activeTasks.push(task); } }); return activeTasks; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getActiveTasks 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 Backgro...
public getActiveTasks(): BackgroundTask[] { const activeTasks: BackgroundTask[] = []; this.tasks.forEach((task: InternalTask) => { if (task.status === TaskStatus.PENDING || task.status === TaskStatus.RUNNING) { activeTasks.push(task); } }); return activeTasks; }
https://github.com/DaLongZhuaZi/manxia
24bb17b0cac6c68bb2de10104aa983cd30638f6f
github
AGenUI/AGenUI
playground/harmony/entry/src/mock/Libentry.mock.ets
arkts
dispatchMockMessages
Dispatches mock callbacks by parsing A2UI protocol messages.
function dispatchMockMessages(engineId: number, buffer: string): void { const listeners = mockListeners.get(engineId); if (!listeners || listeners.length === 0) { return; } const jsonStrings = extractJsonStrings(buffer); for (const jsonStr of jsonStrings) { try { const msg: MockA2UIMessage = JS...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left dispatchMockMessages AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left engineId AST#identifier#Right AST#type_annotation#Left AST#:#Left...
function dispatchMockMessages(engineId: number, buffer: string): void { const listeners = mockListeners.get(engineId); if (!listeners || listeners.length === 0) { return; } const jsonStrings = extractJsonStrings(buffer); for (const jsonStr of jsonStrings) { try { const msg: MockA2UIMessage = JS...
https://github.com/AGenUI/AGenUI
b27afe06f3729c497216cd0508a1166f4b0a3600
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets
arkts
htmlToTextCached
将HTML转换为纯文本 移除所有HTML标签、script、style、注释,并处理HTML实体
private htmlToTextCached(html: string): string { if (!html) { return ''; } if (html.length > PerformanceConfig.HTML_TO_TEXT_CACHE_MAX_INPUT_SIZE) { return this.htmlToText(html); } const cacheKey = this.buildHtmlToTextCacheKey(html); const cached = this.htmlToTextCache.get(cacheKey)...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left htmlToTextCached AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left html AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
private htmlToTextCached(html: string): string { if (!html) { return ''; } if (html.length > PerformanceConfig.HTML_TO_TEXT_CACHE_MAX_INPUT_SIZE) { return this.htmlToText(html); } const cacheKey = this.buildHtmlToTextCacheKey(html); const cached = this.htmlToTextCache.get(cacheKey)...
https://github.com/DaLongZhuaZi/manxia
938fe1a6c0b96da922cf2f2e627b4b56cae72d14
github
openharmony/codelabs
Data/PersonalAssistantPro/entry/src/main/ets/common/utils/DateUtils.ets
arkts
getStartOfWeek
获取本周第一天
public static getStartOfWeek(timestamp: number = Date.now()): number { const date = new Date(timestamp); const day = date.getDay(); const diff = date.getDate() - day + (day === 0 ? -6 : 1); date.setDate(diff); date.setHours(0, 0, 0, 0); return date.getTime(); }
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 getStartOfWeek AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left timestamp AST#identifier#Right AST#:#Lef...
public static getStartOfWeek(timestamp: number = Date.now()): number { const date = new Date(timestamp); const day = date.getDay(); const diff = date.getDate() - day + (day === 0 ? -6 : 1); date.setDate(diff); date.setHours(0, 0, 0, 0); return date.getTime(); }
https://gitcode.com/openharmony/codelabs
34b5806d575483b2cb45e67169568e5a80c0fedd
gitcode
Lycorius03/studyos
apps/harmonyos/entry/src/main/ets/bridge/StudyOsBridge.ets
arkts
ensureInit
---- Internal ----
private ensureInit(): void { if (!this.initialized || this.handle === null) { throw new Error('StudyOsBridge not initialized. Call init() first.'); } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left ensureInit 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...
private ensureInit(): void { if (!this.initialized || this.handle === null) { throw new Error('StudyOsBridge not initialized. Call init() first.'); } }
https://github.com/Lycorius03/studyos
73cbdffa91c83700745ee2707e8e4076f05b3be7
github
PollenWang6/HiXD
entry/src/main/ets/utils/HttpUtil.ets
arkts
cloneCookieStore
深拷贝整个 cookieStore(对象引用,不受后续修改影响)
cloneCookieStore(): Record<string, Record<string, string>> { const clone: Record<string, Record<string, string>> = {}; for (const domain of Object.keys(this.cookieStore)) { clone[domain] = {}; for (const name of Object.keys(this.cookieStore[domain])) { clone[domain][name] = this.cookieStor...
AST#program#Left AST#expression_statement#Left AST#sequence_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left cloneCookieStore 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#...
cloneCookieStore(): Record<string, Record<string, string>> { const clone: Record<string, Record<string, string>> = {}; for (const domain of Object.keys(this.cookieStore)) { clone[domain] = {}; for (const name of Object.keys(this.cookieStore[domain])) { clone[domain][name] = this.cookieStor...
https://github.com/PollenWang6/HiXD
813cec742730d2a66050e6a4ab9f277c880106ff
github
LJ666-ui/harmony-health-care
entry/src/main/ets/ar/VoiceGuide.ets
arkts
reset
重置播报状态
public reset(): void { this.lastAnnouncedWaypointId = null; this.announcementQueue = []; this.stopCurrentAnnouncement(); console.log('[VoiceGuide] 重置播报状态'); }
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.lastAnnouncedWaypointId = null; this.announcementQueue = []; this.stopCurrentAnnouncement(); console.log('[VoiceGuide] 重置播报状态'); }
https://github.com/LJ666-ui/harmony-health-care
56fa1d8f42b82e2dc418824aeb03a239967c5444
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets
arkts
checkOffsetConstraint
Checks if the offset parameter is within valid range @param {int} offset - Number of bytes to skip before reading @param {int} lengthOffset - Maximum allowed value (inclusive) @returns {void} @throws {Error} If byteLength is less than 0 or greater than lengthOffset @private
private static checkOffsetConstraint(offset: int, lengthOffset: int) { if (offset < 0 || offset > lengthOffset) { throw createBusinessError(OutOfBoundsErrorCodeId, `The value of "offset" is out of range. ` + `It must be >= 0 and <= ${lengthOffset}. Received value ...
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 checkOffsetConstraint AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left offset AST#identifier#Right AST#ERROR#Left AS...
private static checkOffsetConstraint(offset: int, lengthOffset: int) { if (offset < 0 || offset > lengthOffset) { throw createBusinessError(OutOfBoundsErrorCodeId, `The value of "offset" is out of range. ` + `It must be >= 0 and <= ${lengthOffset}. Received value ...
https://gitcode.com/iop123123/arkts-static-skills
f7ce0c3e6748d6395fc169c65a2685d1dd56d055
gitcode
erosTeam/NextE
feature/home/src/main/ets/components/GalleryListBody.ets
arkts
aboutToAppear
Re-tapping the active bottom tab refreshes this list: the nav shell looks the action up by this list's Scroller (it tracks each tab's active sub-tab Scroller) and fires it. Used by Gallery + Toplist tabs.
aboutToAppear(): void { RootRefreshRegistry.register(this.scroller, () => { this.refreshController.triggerTopRefresh() }) }
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 { RootRefreshRegistry.register(this.scroller, () => { this.refreshController.triggerTopRefresh() }) }
https://github.com/erosTeam/NextE
c47e2ab1a701a9984a8fbe047e8e2552cd641f08
github
Joker-x-dev/CoolMallArkTS
core/network/src/main/ets/interceptors/LogInterceptor.ets
arkts
splitChunks
按最大长度拆分字符串 @param {string} value - 原始字符串 @param {number} maxLength - 单段最大长度 @returns {string[]} 拆分后的片段
function splitChunks(value: string, maxLength: number): string[] { if (value.length <= maxLength) { return [value]; } const result: string[] = []; for (let start: number = 0; start < value.length; start += maxLength) { result.push(value.slice(start, start + maxLength)); } return result; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left splitChunks AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left value AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Rig...
function splitChunks(value: string, maxLength: number): string[] { if (value.length <= maxLength) { return [value]; } const result: string[] = []; for (let start: number = 0; start < value.length; start += maxLength) { result.push(value.slice(start, start + maxLength)); } return result; }
https://github.com/Joker-x-dev/CoolMallArkTS
898d15dcb783004eed38cfc10ef47d407f4a10c9
github
openharmony/developtools_profiler
host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/data/ScaleMode.ets
arkts
onSingleClick
需要覆写的 单击事件 @param event
public onSingleClick(event: ClickEvent) { }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left onSingleClick AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left C...
public onSingleClick(event: ClickEvent) { }
https://gitee.com/openharmony/developtools_profiler.git
ff2b352038bb22f970f081fd0e3fe1ca32d5ddba
gitee
mqxu/HarmonyOS_In_Action
examples/01_foundation/F001_hello_world/entry/src/main/ets/utils/I18nUtil.ets
arkts
isChineseLocale
判断是否为中文环境
static isChineseLocale(): boolean { const language = I18nUtil.getSystemLanguage(); return language.startsWith('zh'); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isChineseLocale AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean A...
static isChineseLocale(): boolean { const language = I18nUtil.getSystemLanguage(); return language.startsWith('zh'); }
https://github.com/mqxu/HarmonyOS_In_Action
bde3f03de59a3406fac03c9506dc13cb6a4875c5
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
from
Creates an array from an array-like or iterable object. @param { Iterable<number> } arrayLike - An array-like or iterable object to convert to an array. @param { function } [mapfn] - A mapping function to call on every element of the array. @returns { Int32Array } - A new Int32Array @static @syscap SystemCapability.Uti...
public static from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number): Int32Array { if (mapfn == undefined) { mapfn = (v: number, k: number): number => { return v } } let iter = arrayLike.$_iterator() // NOTE (templin.konstantin): This code section is...
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#from#Left from AST#from#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arrayLike AST#identifie...
public static from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number): Int32Array { if (mapfn == undefined) { mapfn = (v: number, k: number): number => { return v } } let iter = arrayLike.$_iterator() // NOTE (templin.konstantin): This code section is...
https://gitcode.com/iop123123/arkts-static-skills
1726f7c8c1a83f5b8ee44c21d726c1a9a078909b
gitcode
CLMC2025/Vignette
entry/src/main/ets/context/OfflineContext.ets
arkts
generateMultipleContexts
生成多个语境变体
generateMultipleContexts( targetWord: string, supportWords: string[], count: number = 3, style: ContextStyle = ContextStyle.CONVERSATIONAL, difficulty: DifficultyLevel = DifficultyLevel.IELTS ): GenerationResult[] { const results: GenerationResult[] = []; const styles: ContextStyle[] = [...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left generateMultipleContexts AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left targetWord AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ER...
generateMultipleContexts( targetWord: string, supportWords: string[], count: number = 3, style: ContextStyle = ContextStyle.CONVERSATIONAL, difficulty: DifficultyLevel = DifficultyLevel.IELTS ): GenerationResult[] { const results: GenerationResult[] = []; const styles: ContextStyle[] = [...
https://github.com/CLMC2025/Vignette
831dd219385df778aa240486c335a7fa022a2f15
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Theme/UserThemeConfig.ets
arkts
mergeEffects
合并特效配置(用partial覆盖base)
function mergeEffects(base: EffectsConfig, partial: Partial<EffectsConfig>): EffectsConfig { return { enableBlur: partial.enableBlur !== undefined ? partial.enableBlur : base.enableBlur, blurIntensity: partial.blurIntensity !== undefined ? partial.blurIntensity : base.blurIntensity, enableShadow: partial....
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left mergeEffects AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left base AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Rig...
function mergeEffects(base: EffectsConfig, partial: Partial<EffectsConfig>): EffectsConfig { return { enableBlur: partial.enableBlur !== undefined ? partial.enableBlur : base.enableBlur, blurIntensity: partial.blurIntensity !== undefined ? partial.blurIntensity : base.blurIntensity, enableShadow: partial....
https://github.com/DaLongZhuaZi/manxia
030a1a85a440fe5af0198fa6ef4e2de174c5ce7b
github
openharmony/codelabs
ETSUI/PositioningDemo/entry/src/main/ets/model/PlanModel.ets
arkts
getCurrentDay
获取当前进行中的天数
getCurrentDay(): number { const today = new Date(); today.setHours(0, 0, 0, 0); const start = new Date(this.startDate); start.setHours(0, 0, 0, 0); if (today < start) { return 0; // 还未开始 } const diffTime = today.getTime() - start.getTime(); const diffDays = Math.floor(diffTime ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCurrentDay 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#statemen...
getCurrentDay(): number { const today = new Date(); today.setHours(0, 0, 0, 0); const start = new Date(this.startDate); start.setHours(0, 0, 0, 0); if (today < start) { return 0; // 还未开始 } const diffTime = today.getTime() - start.getTime(); const diffDays = Math.floor(diffTime ...
https://gitcode.com/openharmony/codelabs
0bac8576b8c839d368ddaad0677b74cfdf98c10d
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/MangaSourceEngine.ets
arkts
resumeTask
恢复等待中的任务(用户交互完成后) @param taskId 任务ID @param userInput 用户输入的数据
async resumeTask(taskId: string, userInput?: Record<string, Object | undefined>): Promise<void> { if (this.taskExecutor) { await this.taskExecutor.resumeTask(taskId, userInput); } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left resumeTask AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left taskId AST#identifier#Right AST#ty...
async resumeTask(taskId: string, userInput?: Record<string, Object | undefined>): Promise<void> { if (this.taskExecutor) { await this.taskExecutor.resumeTask(taskId, userInput); } }
https://github.com/DaLongZhuaZi/manxia
fa0b239284b4fb45de25ae8977a1bff4fea7e683
github
azhu0001/localsend-harmony
serve/src/main/ets/http/ContentType.ets
arkts
getContentTypeHeader
返回整个content-type字符串
public getContentTypeHeader(): string { return this.contentTypeHeader; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getContentTypeHeader 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 strin...
public getContentTypeHeader(): string { return this.contentTypeHeader; }
https://gitcode.com/azhu0001/localsend-harmony
6b87613cd97a40dd573e9000481b6ee3b90875c6
gitcode
HarmonyOS_Samples/BestPracticeSnippets
WaterFlowSample/entry/src/main/ets/model/StickyWaterFlowDataSource.ets
arkts
addLastItem
Add last item to the list.
public addLastItem() { let mediaItem: MediaItem = this.createMediaItem(this.dataArray.length); this.dataArray.splice(this.dataArray.length, 0, mediaItem); this.notifyDataAdd(this.dataArray.length - 1); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addLastItem 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 { A...
public addLastItem() { let mediaItem: MediaItem = this.createMediaItem(this.dataArray.length); this.dataArray.splice(this.dataArray.length, 0, mediaItem); this.notifyDataAdd(this.dataArray.length - 1); }
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
21598736cd2e6cfb0c6981c601d0efaf5e17a4dc
gitcode
XJTUWYD/ArkDiff
entry/src/main/ets/engine/DiffEngine.ets
arkts
buildSBS
========== SBS 构建 ==========
private static buildSBS(unified: DiffLine[]): DiffSideBySideResult { const left: DiffLine[] = []; const right: DiffLine[] = []; for (const line of unified) { switch (line.type) { case DiffType.UNCHANGED: left.push(DiffEngine.clone(line)); right.push(DiffEngine.clone(line...
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 buildSBS AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left unified AST#identifier#Right AST#:#Left : A...
private static buildSBS(unified: DiffLine[]): DiffSideBySideResult { const left: DiffLine[] = []; const right: DiffLine[] = []; for (const line of unified) { switch (line.type) { case DiffType.UNCHANGED: left.push(DiffEngine.clone(line)); right.push(DiffEngine.clone(line...
https://github.com/XJTUWYD/ArkDiff
5daa6574842c885587f95e059842f5528d858bc5
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
subarray
Creates a Uint8ClampedArray with the same underlying Buffer @param { int } [begin] - start index, inclusive @param { int } [end] - last index, exclusive @returns { Uint8ClampedArray } - a new Uint8ClampedArray with the same underlying Buffer @syscap SystemCapability.Utils.Lang @FaAndStageModel
public subarray(begin?: int, end?: int): Uint8ClampedArray { const len: int = this.lengthInt const relStart = normalizeIndex(begin ?? 0, len) const relEnd = normalizeIndex(end ?? this.lengthInt, len) let count = relEnd - relStart if (count < 0) { count = 0 ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left subarray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left begin AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#identifier#Le...
public subarray(begin?: int, end?: int): Uint8ClampedArray { const len: int = this.lengthInt const relStart = normalizeIndex(begin ?? 0, len) const relEnd = normalizeIndex(end ?? this.lengthInt, len) let count = relEnd - relStart if (count < 0) { count = 0 ...
https://gitcode.com/iop123123/arkts-static-skills
fb86870a5fa6155338e10f781f02e29625776a5e
gitcode
Joker-x-dev/HarmonyKit
feature/demo/src/main/ets/view/SafeAreaDemoPage.ets
arkts
build
构建安全区示例页 @returns {void} 无返回值
build() { AppNavDestination({ title: $r("app.string.demo_safe_area_title"), viewModel: this.vm }) { this.SafeAreaContent(); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c...
build() { AppNavDestination({ title: $r("app.string.demo_safe_area_title"), viewModel: this.vm }) { this.SafeAreaContent(); } }
https://github.com/Joker-x-dev/HarmonyKit
f18462845f36a45ca3fc49c96d218353a3e27c8c
github
NissonCX/CQU-HarmonyOS-APP-Dev-Final
entry/src/main/ets/utils/ExportManager.ets
arkts
generateHealthGoalsCSV
生成健康目标 CSV
private async generateHealthGoalsCSV(): Promise<string> { const goals = await this.dataManager.getAllHealthGoals(); // CSV 表头 let csv = 'ID,目标类型,目标值,当前值,单位,方向,截止日期,是否完成\n'; // 数据行 for (const goal of goals) { const row = [ goal.id, goal.type, goal.targetValue, ...
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 generateHealthGoalsCSV AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#...
private async generateHealthGoalsCSV(): Promise<string> { const goals = await this.dataManager.getAllHealthGoals(); // CSV 表头 let csv = 'ID,目标类型,目标值,当前值,单位,方向,截止日期,是否完成\n'; // 数据行 for (const goal of goals) { const row = [ goal.id, goal.type, goal.targetValue, ...
https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final
ca9e5b952c697b66987af80c613a803ef8be6a33
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Int.ets
arkts
mul
Performs integral multiplication of this instance with provided one, returns the result as new instance @param other Right hand side of the multiplication @returns Result of the multiplication
public mul(other: Int): Int { return new Int(this.value * other.toInt()) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left mul AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left other AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#iden...
public mul(other: Int): Int { return new Int(this.value * other.toInt()) }
https://gitcode.com/iop123123/arkts-static-skills
e304d1b32182ac99000b7fe3d4b764da962e14a7
gitcode
buqiuz/game-puzzle
entry/src/main/ets/model/PuzzleSolver.ets
arkts
getEmptyIndex
获取空白块位置
getEmptyIndex(state: number[]): number { return state.indexOf(this._splitSize**2 - 1); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getEmptyIndex 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#subscript_expression#Left AST#identifier#Left number AST#...
getEmptyIndex(state: number[]): number { return state.indexOf(this._splitSize**2 - 1); }
https://github.com/buqiuz/game-puzzle
7f137eeebfdf1c75ccf78a4a414242645a98bb88
github
openharmony/arkcompiler_taihe_ffi_gen
test/ani_overload/user/main.ets
arkts
testByte
测试 byte (i8)
function testByte() { let instance: test_overload.OverloadInterface = test_overload.get_interface(); let res = instance.overloadFunc((5).toByte(), (5).toByte()); arktest.assertEQ(res, 5); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testByte AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#lexical_declaratio...
function testByte() { let instance: test_overload.OverloadInterface = test_overload.get_interface(); let res = instance.overloadFunc((5).toByte(), (5).toByte()); arktest.assertEQ(res, 5); }
https://gitcode.com/openharmony/arkcompiler_taihe_ffi_gen
729444bd3d9bb6f01159feff79154abb988d1852
gitcode
Countly/countly-sdk-hos
library/src/main/ets/internal/modules/ModuleEvents.ets
arkts
recordEvent
Public event recording entry. Consent gating: - custom events require "events" consent - internal events ([CLY]_*) require their feature-specific consent ONLY (not "events") per dev guide. We enforce that here, don't trust external callers to have done it.
public async recordEvent( key: string, segmentation: SegmentationMap | null, count: number, sum: number, dur: number ): Promise<void> { if (this.rejectIfHalted('ModuleEvents', 'recordEvent')) return; await this.recordEventAt(key, segmentation, count, sum, dur, this.config.clock.nowMs());...
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 recordEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#...
public async recordEvent( key: string, segmentation: SegmentationMap | null, count: number, sum: number, dur: number ): Promise<void> { if (this.rejectIfHalted('ModuleEvents', 'recordEvent')) return; await this.recordEventAt(key, segmentation, count, sum, dur, this.config.clock.nowMs());...
https://github.com/Countly/countly-sdk-hos
db2f470cf0bec9a30ff20393a246ccf491383a88
github
openharmony/applications_settings
product/phone/src/main/ets/pages/passwordCheck.ets
arkts
getPromptMessage
Get prompt message @return : message
getPromptMessage(): string { return (this.remainTimes > 0 && this.remainTimes < DEFAULT_TIMES) ? JSON.parse(JSON.stringify($r('app.string.password_message_incorrect', this.remainTimes))) : ''; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getPromptMessage 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#state...
getPromptMessage(): string { return (this.remainTimes > 0 && this.remainTimes < DEFAULT_TIMES) ? JSON.parse(JSON.stringify($r('app.string.password_message_incorrect', this.remainTimes))) : ''; }
https://gitee.com/openharmony/applications_settings.git
7dedf71015fbb01ebcb6b86d47470569b356bd85
gitee
Gramony/Gramony
features/home/src/main/ets/utils/push.ets
arkts
loadNickname
加载保存的昵称
async loadNickname(): Promise<string> { try { const dataPreferences = await preferences.getPreferences(this.context, 'push_settings'); return await dataPreferences.get(PUSH_NICKNAME_KEY, '') as string; } catch (e) { Logger.error('PushService loadNickname error: ' + JSON.stringify(e)); ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left loadNickname 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 loadNickname(): Promise<string> { try { const dataPreferences = await preferences.getPreferences(this.context, 'push_settings'); return await dataPreferences.get(PUSH_NICKNAME_KEY, '') as string; } catch (e) { Logger.error('PushService loadNickname error: ' + JSON.stringify(e)); ...
https://github.com/Gramony/Gramony
378b8400731ca450dafdba403b6e0022d528fc2a
github
Cool_foolisher1/ArkTSRepository
GuardianAssistant/entry/src/main/ets/pages/Hardware/HardwareIndexPage.ets
arkts
formatToDateTime
计算上次启动时间,YYYY-MM-DD HH:mm:ss
formatToDateTime(seconds: number) { // 减去秒数,返回 dayjs 对象 const dayjsInstance = dayjs() .subtract(seconds, 'seconds') // 格式化 dayjs 对象 return dayjsInstance.format('YYYY-MM-DD HH:mm:ss') // format 格式化占位符 // 年 year YYYY // 月 mouth MM // 日 day DD // 时 hour hh 12小时 /...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left formatToDateTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left seconds AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right A...
formatToDateTime(seconds: number) { // 减去秒数,返回 dayjs 对象 const dayjsInstance = dayjs() .subtract(seconds, 'seconds') // 格式化 dayjs 对象 return dayjsInstance.format('YYYY-MM-DD HH:mm:ss') // format 格式化占位符 // 年 year YYYY // 月 mouth MM // 日 day DD // 时 hour hh 12小时 /...
https://gitcode.com/Cool_foolisher1/ArkTSRepository
4a9002424a1aed031d54451e8694accacbabca22
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/DataManager.ets
arkts
validateId
验证ID格式是否有效
private validateId(id: string): boolean { return isValidId(id); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left validateId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left stri...
private validateId(id: string): boolean { return isValidId(id); }
https://github.com/DaLongZhuaZi/manxia
04e87c9d636f4c1c8b4d72d3845c1f749debb76c
github
Joker-x-dev/CoolMallArkTS
feature/order/src/main/ets/view/OrderLogisticsPage.ets
arkts
build
构建订单物流页面 @returns {void} 无返回值
build() { AppNavDestination({ title: $r("app.string.order_logistics"), viewModel: this.vm, paddingValue: { top: this.windowSafeAreaState.topInset, left: this.windowSafeAreaState.leftInset, right: this.windowSafeAreaState.rightInset } }) { this.PageContent(...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c...
build() { AppNavDestination({ title: $r("app.string.order_logistics"), viewModel: this.vm, paddingValue: { top: this.windowSafeAreaState.topInset, left: this.windowSafeAreaState.leftInset, right: this.windowSafeAreaState.rightInset } }) { this.PageContent(...
https://github.com/Joker-x-dev/CoolMallArkTS
18de0bfc08025b8e4a69765bad4113facbc06b56
github
openharmony/vendor_unionman
unionpi_tiger/sample_api10/app/adc_module_app/entry/src/main/ets/pages/widgets.ets
arkts
aboutToDisappear
销毁定时器
aboutToDisappear() { if (this.timerId > 0) { clearTimeout(this.timerId) this.timerId = -1 } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToDisappear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#L...
aboutToDisappear() { if (this.timerId > 0) { clearTimeout(this.timerId) this.timerId = -1 } }
https://gitee.com/openharmony/vendor_unionman.git
62aec60456f6436c3b1f8a0df594fc89325bcabf
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Services/DataService.ets
arkts
getAppDataStats
==================== 数据统计服务 ==================== 获取应用数据统计
public async getAppDataStats(): Promise<AppDataStatsResult> { try { const stats = await this.dataManager.getDataStats(); // 计算存储使用情况 const storageUsage = `${(stats.storageStats.totalSize / 1024 / 1024).toFixed(2)} MB`; const cacheUsage = `${(stats.cacheStats.diskCache.size / 1024 / ...
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 getAppDataStats AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#...
public async getAppDataStats(): Promise<AppDataStatsResult> { try { const stats = await this.dataManager.getDataStats(); // 计算存储使用情况 const storageUsage = `${(stats.storageStats.totalSize / 1024 / 1024).toFixed(2)} MB`; const cacheUsage = `${(stats.cacheStats.diskCache.size / 1024 / ...
https://github.com/DaLongZhuaZi/manxia
cfd398ef2f43806051bd3e25bb14d19eb8bdcefc
github
OHPG/FinMusic
entry/src/main/ets/player/LyricCache.ets
arkts
getCacheSize
获取歌词缓存目录总大小(字节)
getCacheSize(): number { return FileTool.getDirSize(this.lrcDir) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCacheSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statement...
getCacheSize(): number { return FileTool.getDirSize(this.lrcDir) }
https://github.com/OHPG/FinMusic
643f834b93a739a20196174bb4b71af9996cbbd4
github
openharmony-sig/applications_clock
feature/worldclock/src/main/ets/utils/CityClockCardUtil.ets
arkts
initCityClockCard
initCityClockCard @param cityIndex cityIndex @returns
public static initCityClockCard(cityIndex: string): object { const faCityFirst: FaCityData = CityClockCardUtil.getCityNameAndDate(cityIndex); let formData: formDataInterface = { city: faCityFirst.cityName, date: faCityFirst.cityDate, hoursWests: faCityFirst.hoursWests, }; return form...
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 initCityClockCard AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left cityIndex AST#identifier#Right AST#ERROR#Left AST#:#...
public static initCityClockCard(cityIndex: string): object { const faCityFirst: FaCityData = CityClockCardUtil.getCityNameAndDate(cityIndex); let formData: formDataInterface = { city: faCityFirst.cityName, date: faCityFirst.cityDate, hoursWests: faCityFirst.hoursWests, }; return form...
https://gitee.com/openharmony-sig/applications_clock.git
5a86e380e0be1fc108213d455261eabd9c9e1f9b
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Map.ets
arkts
forEach
Applies a function over all elements of the Map @param fn to apply TODO: return undefined
forEach(fn: (v: V, k: K) => void): void { Map.forEachNode(this.tree, fn) }
AST#program#Left AST#ERROR#Left AST#identifier#Left forEach AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left v AST#iden...
forEach(fn: (v: V, k: K) => void): void { Map.forEachNode(this.tree, fn) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
4818d08f444f82cb427c17f7483c870281ae07a9
gitee
AetheriumSimulator/qemu-hmos
entry/src/main/ets/utils/RDPInputHandler.ets
arkts
handlePinchGesture
处理缩放手势
private handlePinchGesture(event: TouchEvent) { if (event.touches.length >= 2) { // 模拟鼠标滚轮缩放 const centerX = (event.touches[0].x + event.touches[1].x) / 2 const centerY = (event.touches[0].y + event.touches[1].y) / 2 this.sendInputEvent({ type: 'mouse', x: Math.floor...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handlePinchGesture AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie...
private handlePinchGesture(event: TouchEvent) { if (event.touches.length >= 2) { // 模拟鼠标滚轮缩放 const centerX = (event.touches[0].x + event.touches[1].x) / 2 const centerY = (event.touches[0].y + event.touches[1].y) / 2 this.sendInputEvent({ type: 'mouse', x: Math.floor...
https://github.com/AetheriumSimulator/qemu-hmos
71e8934d304e773f327bb5673e41b0123e21f609
github
honjow/Next2V
shared/src/main/ets/storage/LocalDataCloudSync.ets
arkts
reuploadTouchSql
Touch SQL (no-op self-assignment of a non-PK column) for a synced table. Running it re-fires the AFTER-UPDATE cloud-sync trigger, re-flagging every existing row dirty for upload. '' = skip. Deliberately limited to the small, user-curated "set once" tables (saved nodes/topics, marks, search, KV). The large auto-history ...
private static reuploadTouchSql(table: string): string { if (table === 'search_history') { return 'UPDATE search_history SET searched_at = searched_at' } if (table === 'synced_kv') { return 'UPDATE synced_kv SET updated_at = updated_at' } if (table === 'collection_saved_topics') { ...
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 reuploadTouchSql AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left table AST#identifier#Right AST#:#Le...
private static reuploadTouchSql(table: string): string { if (table === 'search_history') { return 'UPDATE search_history SET searched_at = searched_at' } if (table === 'synced_kv') { return 'UPDATE synced_kv SET updated_at = updated_at' } if (table === 'collection_saved_topics') { ...
https://github.com/honjow/Next2V
fefb64f9a3f9cb277309a198956ea685d68935d9
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/OnlineImageLoader.ets
arkts
extractHost
提取主机名
private extractHost(url: string): string { try { const match = url.match(/^https?:\/\/([^\/]+)/); if (match && match.length > 1) { return match[1]; } return ''; } catch (e) { return ''; } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left extractHost AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left st...
private extractHost(url: string): string { try { const match = url.match(/^https?:\/\/([^\/]+)/); if (match && match.length > 1) { return match[1]; } return ''; } catch (e) { return ''; } }
https://github.com/DaLongZhuaZi/manxia
ccb02e8fd6eeb0566c8d30160cffe8d353b9c6b6
github
Harrisonls2004/WaterFlow
entry/src/main/ets/common/utils/FollowManager.ets
arkts
isFollowing
Check if a user is following another user
static async isFollowing(follower: string, followee: string, followeeId?: number): Promise<boolean> { try { // 服务器模式下优先查询服务器 if (SERVER_ENABLED && followeeId !== undefined && followeeId > 0) { try { const response = await FollowApi.checkFollow(followeeId); console.info(`Fol...
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 isFollowing AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left follower AST#identifier#Right AST#ERROR#Left AST#:#Left : A...
static async isFollowing(follower: string, followee: string, followeeId?: number): Promise<boolean> { try { // 服务器模式下优先查询服务器 if (SERVER_ENABLED && followeeId !== undefined && followeeId > 0) { try { const response = await FollowApi.checkFollow(followeeId); console.info(`Fol...
https://github.com/Harrisonls2004/WaterFlow
57d822e5eddfabde5024a7651294e4de3a21351f
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Errors.ets
arkts
$_invoke
Constructs a new EvalError instance with provided message and options @param { String } [message] - Error text @param { ErrorOptions } [options] - Error options @returns { EvalError } - Newly created EvalError instance @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
static $_invoke(message?: String, options?: ErrorOptions): EvalError { return new EvalError(message, options) }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left $_invoke AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left message AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#identifier#...
static $_invoke(message?: String, options?: ErrorOptions): EvalError { return new EvalError(message, options) }
https://gitcode.com/iop123123/arkts-static-skills
9b21c63c902a40d46c911c2c4fe5cfde51b97fa2
gitcode
openharmony/codelabs
ETSUI/LifeTrack/entry/src/main/ets/pages/StepManager.ets
arkts
getStepTrends
获取步数趋势数据
async getStepTrends(days: number = 7): Promise<StepTrend[]> { try { const now = new Date(); const startDate = new Date(); startDate.setDate(now.getDate() - (days - 1)); const startDateStr = this.formatDate(startDate); const endDateStr = this.formatDate(now); const result = aw...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getStepTrends AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left days AST#identifier#Right AST#type_annotation#Left AST#:#Left : A...
async getStepTrends(days: number = 7): Promise<StepTrend[]> { try { const now = new Date(); const startDate = new Date(); startDate.setDate(now.getDate() - (days - 1)); const startDateStr = this.formatDate(startDate); const endDateStr = this.formatDate(now); const result = aw...
https://gitcode.com/openharmony/codelabs
c6352396c57a2ec6dbe55616319a7fa3d08aa99d
gitcode
mqxu/HarmonyOS_In_Action
examples/01_foundation/F001_hello_world/entry/src/main/ets/utils/StringUtil.ets
arkts
capitalize
首字母大写 @param str 原始字符串 @returns 首字母大写后的字符串
static capitalize(str: string): string { if (StringUtil.isEmpty(str)) { return str; } return str.charAt(0).toUpperCase() + str.slice(1); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left capitalize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string...
static capitalize(str: string): string { if (StringUtil.isEmpty(str)) { return str; } return str.charAt(0).toUpperCase() + str.slice(1); }
https://github.com/mqxu/HarmonyOS_In_Action
0fb2fd0fab5de72adef0cc71d730c2a061b2c775
github
Mydstiny/RemoteDeskHarmonyOS
entry/src/main/ets/services/CloudStore.ets
arkts
getCryptoStatus
读取当前加密状态
getCryptoStatus(): string { if (!this.store) { return ''; } try { const rs = this.store.querySqlSync("SELECT value FROM cryptoparams WHERE key = 'crypto_status'"); let result: string = ''; if (rs.goToFirstRow()) { result = rs.getString(0); } rs.close(); // 兼容旧数据: 有 ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCryptoStatus 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#statem...
getCryptoStatus(): string { if (!this.store) { return ''; } try { const rs = this.store.querySqlSync("SELECT value FROM cryptoparams WHERE key = 'crypto_status'"); let result: string = ''; if (rs.goToFirstRow()) { result = rs.getString(0); } rs.close(); // 兼容旧数据: 有 ...
https://github.com/Mydstiny/RemoteDeskHarmonyOS
3f41ae0234fd79afaaf0c6d1a27104964b2e2318
github
offlinecat-dev/OCNetORM
src/main/ets/core/ScopeRegistry.ets
arkts
registerScope
注册实体的作用域 @param entityName 实体名称 @param scopeName 作用域名称 @param scopeFunction 作用域函数
registerScope(entityName: string, scopeName: string, scopeFunction: ScopeFunction): void { let entityScopes = this.scopes.get(entityName) if (entityScopes === undefined) { entityScopes = new Map<string, ScopeFunction>() this.scopes.set(entityName, entityScopes) } entityScopes.set(scopeName...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left registerScope AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left entityName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , AST...
registerScope(entityName: string, scopeName: string, scopeFunction: ScopeFunction): void { let entityScopes = this.scopes.get(entityName) if (entityScopes === undefined) { entityScopes = new Map<string, ScopeFunction>() this.scopes.set(entityName, entityScopes) } entityScopes.set(scopeName...
https://github.com/offlinecat-dev/OCNetORM
38f9da1941e068db40aa117af2ab04c20fe2990e
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
some
Checks that at least one element of Uint8ClampedArray satisfies the passed function @param fn check function @returns true if some element satisfies fn
public some(fn: (element: number, index: int) => boolean): boolean { let newF: (element: number, index: int, array: Uint8ClampedArray) => boolean = (element: number, index: int, array: Uint8ClampedArray): boolean => { return fn(element, index) } return this.some(newF) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left some AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Righ...
public some(fn: (element: number, index: int) => boolean): boolean { let newF: (element: number, index: int, array: Uint8ClampedArray) => boolean = (element: number, index: int, array: Uint8ClampedArray): boolean => { return fn(element, index) } return this.some(newF) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
45a148bde3dd73637f6b38cafa72845b48830890
gitee
openharmony-tpc/XmlGraphicsBatik
library/src/main/ets/batik/svggen/SVGCircle.ets
arkts
setR
设置圆半径 @param newR 矩形宽度
public setR(newR: number): void{ this._r = newR; this._circleResultObj['r'] = newR; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left setR AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left newR AST#identifier#Right AST#:#Left : AST#:#Right AST#ERRO...
public setR(newR: number): void{ this._r = newR; this._circleResultObj['r'] = newR; }
https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git
e1b24fe7e5c60fad8da8d5ff392a2e0886819d81
gitee
Delsin-Yu/JustPDF
entry/src/main/ets/components/PageInfo.ets
arkts
applyMemoryPressure
响应系统内存压力(由 UIAbility.onMemoryLevel 经 eventHub 转发,勿在主回调内做重释放)。
public applyMemoryPressure( level: AbilityConstant.MemoryLevel, displayedPageIndices: number[], currentPageIndex: number ): void { const center = this.lastPrefetchCenterIndex; const displayed = displayedPageIndices.length > 0 ? displayedPageIndices.slice() : [currentPageIndex]; if (le...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left applyMemoryPressure AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left level AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expr...
public applyMemoryPressure( level: AbilityConstant.MemoryLevel, displayedPageIndices: number[], currentPageIndex: number ): void { const center = this.lastPrefetchCenterIndex; const displayed = displayedPageIndices.length > 0 ? displayedPageIndices.slice() : [currentPageIndex]; if (le...
https://github.com/Delsin-Yu/JustPDF/blob/07d9dd917e7592f584d67821fb06a7369bd3f15b/entry/src/main/ets/components/PageInfo.ets#L1013-L1061
fc5da691ad60fef997c524a78fba285d7ff6f31c
github
Xiwei753/xiezuoruanjian
apps/harmony/entry/src/main/ets/common/AdaptiveContext.ets
arkts
readSafeAreas
========== 安全区域 / 键盘 / 折叠 读取方法 ========== 读取系统栏避让区域,更新 cachedSafeTopVp / cachedSafeBottomVp
private readSafeAreas(): void { if (!this.mainWindow) { return } try { const displayInfo = display.getDefaultDisplaySync() const density = displayInfo.densityPixels // 系统栏(状态栏)避让区域 → safeTopVp const systemAvoidArea = this.mainWindow.getWindowAvoidArea(window.AvoidAreaType.TY...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left readSafeAreas 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#vo...
private readSafeAreas(): void { if (!this.mainWindow) { return } try { const displayInfo = display.getDefaultDisplaySync() const density = displayInfo.densityPixels // 系统栏(状态栏)避让区域 → safeTopVp const systemAvoidArea = this.mainWindow.getWindowAvoidArea(window.AvoidAreaType.TY...
https://github.com/Xiwei753/xiezuoruanjian
fe68efa4721c447699f384c0e508fa49cdafe5a9
github
holg/eulumdat-rs
EulumdatHarmonyOS/Eulumdat/entry/src/main/ets/model/EulumdatEngine.ets
arkts
getCAngles
Get C-plane angles array from the loaded file
public getCAngles(): number[] { return eulumdat_napi.getCAngles(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCAngles AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_...
public getCAngles(): number[] { return eulumdat_napi.getCAngles(); }
https://github.com/holg/eulumdat-rs
341d5f313f695f26ec8b9ffab97bc16145fe7fac
github
openharmony/applications_calendar_data
datamanager/src/main/ets/utils/CalendarDataHelper.ets
arkts
getInstance
get the instance of CalendarDataHelper class
public static getInstance() { if (!CalendarDataHelper.instance) { Log.log(TAG, 'call getInstance init'); CalendarDataHelper.instance = new CalendarDataHelper(); } return CalendarDataHelper.instance; }
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 (!CalendarDataHelper.instance) { Log.log(TAG, 'call getInstance init'); CalendarDataHelper.instance = new CalendarDataHelper(); } return CalendarDataHelper.instance; }
https://gitee.com/openharmony/applications_calendar_data.git
7c187e1f89dc769746637e8a6ef9d832b840845d
gitee
openharmony-sig/commons-cli
library/src/main/ets/components/cli/Options.ets
arkts
getRequiredOptions
Gets the required options. @return read-only List of required options
public getRequiredOptions(): JList<Object> { return this.requiredOpts; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getRequiredOptions 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#exp...
public getRequiredOptions(): JList<Object> { return this.requiredOpts; }
https://gitee.com/openharmony-sig/commons-cli.git
dfcf0903a92f0b079d0c72ac54dffab9eecf5eb8
gitee
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/BarLineChartBaseModel.ets
arkts
setHighlightPerDragEnabled
Set this to true to allow highlighting per dragging over the chart surface when it is fully zoomed out. Default: true @param enabled
public setHighlightPerDragEnabled(enabled: boolean): void { this.mHighlightPerDragEnabled = enabled; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setHighlightPerDragEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#id...
public setHighlightPerDragEnabled(enabled: boolean): void { this.mHighlightPerDragEnabled = enabled; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
12bdb8e7599957803188c1abe99171bf88c47f20
gitee
aimilin6688/KeePassHO
entry/src/main/ets/storage/onedrive/OneDriveClient.ets
arkts
normalizePath
规范化路径并转换为 OneDrive API 路径 @param path 输入路径(支持多种格式::/path, /path, /drive/root:/path, /drive/root/path, path) @param pathType 路径类型(INFO/CHILDREN/CONTENT/UPLOAD) @returns OneDrive API 路径
private normalizePath(path: string, pathType: OneDrivePathType): string { // 处理根目录或空路径 if (!path || path === '/' || path.trim() === '') { switch (pathType) { case OneDrivePathType.CHILDREN: return '/me/drive/root/children'; case OneDrivePathType.CONTENT: case OneDrivePa...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left normalizePath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left...
private normalizePath(path: string, pathType: OneDrivePathType): string { // 处理根目录或空路径 if (!path || path === '/' || path.trim() === '') { switch (pathType) { case OneDrivePathType.CHILDREN: return '/me/drive/root/children'; case OneDrivePathType.CONTENT: case OneDrivePa...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/onedrive/OneDriveClient.ets#L239-L298
b6331ddfe77abbb2b37efff1a84d2ec57267a41e
github
openharmony-sig/commons-cli
library/src/main/ets/components/cli/DefaultParser.ets
arkts
stripLeadingAndTrailingQuotesDefaultOff
Strips balanced leading and trailing quotes if the stripLeadingAndTrailingQuotes is set If stripLeadingAndTrailingQuotes is null, then do not strip @param token a string @return token with the quotes stripped (if set)
private stripLeadingAndTrailingQuotesDefaultOff(token: string): string { if (this.stripLeadingAndTrailingQuotes) { return Util.stripLeadingAndTrailingQuotes(token); } return token; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left stripLeadingAndTrailingQuotesDefaultOff AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left token AST#identifier#Right AST#:#Left : AST#:#Right AST#ERRO...
private stripLeadingAndTrailingQuotesDefaultOff(token: string): string { if (this.stripLeadingAndTrailingQuotes) { return Util.stripLeadingAndTrailingQuotes(token); } return token; }
https://gitee.com/openharmony-sig/commons-cli.git
c3d7303bb2933dc0a3967bac880dba346d3e88aa
gitee
Eklps/harmony-mall-perf
entry/src/main/ets/viewmodel/CartModel.ets
arkts
getTotalPrice
获取购物车总价
static getTotalPrice(): number { const cartList = AppStorage.get<CartItemType[]>('cartList') || []; return cartList.reduce((total, item) => total + item.goods.priceVal * item.quantity, 0); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getTotalPrice 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#n...
static getTotalPrice(): number { const cartList = AppStorage.get<CartItemType[]>('cartList') || []; return cartList.reduce((total, item) => total + item.goods.priceVal * item.quantity, 0); }
https://github.com/Eklps/harmony-mall-perf
7141b90a95c9213c40fe2c1a7e6ae5effee08a30
github
Explore-In-HMOS-Wearable/music-player
entry/src/main/ets/utils/MediaController.ets
arkts
startByIndex
Start music by index. @param musicIndex
public async startByIndex(musicIndex: number = this.musicIndex) { if (musicIndex >= this.songList.length) { hilog.error(audioDomain, audioPrefix, `current musicIndex ${musicIndex}`); return; } BackgroundUtil.startContinuousTask(this.context); this.updateMusicIndex(musicIndex); if (thi...
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 startByIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left musicIndex AST#identifier#Right AST#:#Left ...
public async startByIndex(musicIndex: number = this.musicIndex) { if (musicIndex >= this.songList.length) { hilog.error(audioDomain, audioPrefix, `current musicIndex ${musicIndex}`); return; } BackgroundUtil.startContinuousTask(this.context); this.updateMusicIndex(musicIndex); if (thi...
https://github.com/Explore-In-HMOS-Wearable/music-player
f17d11da53e1bccc4ce62b516c7fa86c7aacbd05
github
Tencent-RTC/TUIKit_Harmony
atomic_x/src/main/ets/call/common/CallStore.ets
arkts
isGroupCall
是否为群组通话
isGroupCall(): boolean { return this.chatGroupId.length > 0 || this.inviteeIds.length > 1; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isGroupCall AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#stateme...
isGroupCall(): boolean { return this.chatGroupId.length > 0 || this.inviteeIds.length > 1; }
https://github.com/Tencent-RTC/TUIKit_Harmony
6ce07733b2b839eaf65d1ae3cc69b97b2b95de74
github
openharmony-sig/flutter_packages
packages/camera/camera_ohos/ohos/src/main/ets/io/flutter/plugins/camera/CameraUtils.ets
arkts
isFlashModeSupported
检测闪光灯模式是否支持
public static isFlashModeSupported(captureSession: camera.PhotoSession | camera.VideoSession, mode: camera.FlashMode): boolean { let status: boolean = false; try { status = captureSession.isFlashModeSupported(mode); } catch (error) { // 失败返回错误码error.code并处理 let err = error as BusinessErr...
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 isFlashModeSupported AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#member_expression#Left AST#identifier#...
public static isFlashModeSupported(captureSession: camera.PhotoSession | camera.VideoSession, mode: camera.FlashMode): boolean { let status: boolean = false; try { status = captureSession.isFlashModeSupported(mode); } catch (error) { // 失败返回错误码error.code并处理 let err = error as BusinessErr...
https://gitee.com/openharmony-sig/flutter_packages.git
bf1bb26e9b35faf313e1228b9a4989622eb6ba64
gitee
Nekofox-POT/LinMusic
entry/src/main/ets/pages/ui/ui.ets
arkts
emitter_status
广播监听 //
emitter_status(status: boolean) { // 开 // if (status) { // ui模式监听 // emitter.on({ eventId: 1012 }, () => {this.ui_mode = this.global_config.ui_mode}) } // 关 // else { emitter.off(1012) } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left emitter_status AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left status AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#R...
emitter_status(status: boolean) { // 开 // if (status) { // ui模式监听 // emitter.on({ eventId: 1012 }, () => {this.ui_mode = this.global_config.ui_mode}) } // 关 // else { emitter.off(1012) } }
https://github.com/Nekofox-POT/LinMusic
25a217bc66009bcd61f7075d4989d7fb4a05cfc3
github
Cool_foolisher1/ArkTSRepository
MultiCalculator/features/calculator/src/main/ets/components/Calculator.ets
arkts
aboutToAppear
注册断点监听
aboutToAppear() { breakpointSystem.register() }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left...
aboutToAppear() { breakpointSystem.register() }
https://gitcode.com/Cool_foolisher1/ArkTSRepository
fdeb77e51a85649e1247ab25886b10e5238e360d
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/DataManager.ets
arkts
getUserReadHistory
获取用户阅读历史
public async getUserReadHistory(userId: string, limit: number = 50): Promise<ReadHistory[]> { try { // [修复] 同时获取本地和在线阅读历史 const localRecords = await this.databaseManager.query( 'read_history', undefined, 'userId = ?', [userId], 'readTime DESC', limit ...
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 getUserReadHistory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Lef...
public async getUserReadHistory(userId: string, limit: number = 50): Promise<ReadHistory[]> { try { // [修复] 同时获取本地和在线阅读历史 const localRecords = await this.databaseManager.query( 'read_history', undefined, 'userId = ?', [userId], 'readTime DESC', limit ...
https://github.com/DaLongZhuaZi/manxia
644070df821dc13ac6c35b748360ccd4a98286c8
github
Countly/countly-sdk-hos
library/src/main/ets/internal/modules/ModuleCrashes.ets
arkts
isErrorHandlerInstalled
Test seam — true iff the platform `errorManager` observer is currently registered. Used by the acr precedence tests to verify the install decision (the underlying observer-id field is private).
public isErrorHandlerInstalled(): boolean { return this.errorObserverId !== -1; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isErrorHandlerInstalled 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 b...
public isErrorHandlerInstalled(): boolean { return this.errorObserverId !== -1; }
https://github.com/Countly/countly-sdk-hos
d8acfae20ae4615ec465f577bee4843194c31639
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test26_original_index.ets
arkts
testImmutableCopy
--- Object.freeze emulation (manual copy with seal) ---
function testImmutableCopy(): string { let original: Record<string, number> = {}; original['a'] = 1; original['b'] = 2; // Manual copy (no Object.freeze in strict ArkTS) let copy: Record<string, number> = {}; copy['a'] = original['a']; copy['b'] = original['b']; return String(copy['a']) + ',' + String(c...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testImmutableCopy 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 testImmutableCopy(): string { let original: Record<string, number> = {}; original['a'] = 1; original['b'] = 2; // Manual copy (no Object.freeze in strict ArkTS) let copy: Record<string, number> = {}; copy['a'] = original['a']; copy['b'] = original['b']; return String(copy['a']) + ',' + String(c...
https://github.com/miaochiahao/ark-ghidra
c4adc436cfbc8c412082076e327e9d95ec3a6179
github
aimilin6688/KeePassHO
entry/src/main/ets/workers/DatabaseLoad.ets
arkts
postSuccessMessage
发送成功消息 @param message 消息
postSuccessMessage(message: SuccessMessage, onSuccessMessage?: (message: SuccessMessage) => void) { if (onSuccessMessage) { onSuccessMessage(message); } }
AST#program#Left AST#ERROR#Left AST#identifier#Left postSuccessMessage AST#identifier#Right AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left message AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left SuccessMessage AST#identifier#Right AST#,#Left , AST#,#Right AST#binary_expres...
postSuccessMessage(message: SuccessMessage, onSuccessMessage?: (message: SuccessMessage) => void) { if (onSuccessMessage) { onSuccessMessage(message); } }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/workers/DatabaseLoad.ets#L82-L86
1d206489f294d5fdd6a898cc641cc3326601fc80
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test26_original_index.ets
arkts
testMapFromEntries
--- Map constructor from entries (manual) ---
function testMapFromEntries(): string { let entries: string[][] = [['name', 'Alice'], ['age', '30']]; let m: Map<string, string> = new Map<string, string>(); for (let i: number = 0; i < entries.length; i++) { let pair: string[] = entries[i]; m.set(pair[0], pair[1]); } let name: string | undefined = m....
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testMapFromEntries 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#predefin...
function testMapFromEntries(): string { let entries: string[][] = [['name', 'Alice'], ['age', '30']]; let m: Map<string, string> = new Map<string, string>(); for (let i: number = 0; i < entries.length; i++) { let pair: string[] = entries[i]; m.set(pair[0], pair[1]); } let name: string | undefined = m....
https://github.com/miaochiahao/ark-ghidra
bfe938fb81b634f1261d5300f69cbcc8d87a5ba8
github
OpenHarmonyToolkitsPlaza/LocationKitDemo
entry/src/main/ets/pages/location/InfoDetailItem.ets
arkts
convertToChinese
转换 location 的中英文显示 @param key @returns
convertToChinese(key: string) { if (LOCATION_KEY_MAP.has(key)) { return LOCATION_KEY_MAP.get(key) } return key }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left convertToChinese 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#Rig...
convertToChinese(key: string) { if (LOCATION_KEY_MAP.has(key)) { return LOCATION_KEY_MAP.get(key) } return key }
https://gitcode.com/OpenHarmonyToolkitsPlaza/LocationKitDemo
39b1a288a83f1d5e9a580d9750c0c07a0f25649d
gitcode
aimilin6688/KeePassHO
entry/src/main/ets/services/TotpService.ets
arkts
generateUri
生成TOTP URI @param config TOTP配置 @returns TOTP URI字符串
public generateUri(config: TotpConfig): string { // 构建标签(Issuer:Name 格式) let label = config.name || ''; if (config.issuer) { label = `${config.issuer}:${label}`; } // 创建基本URI const uri = `otpauth://totp/${encodeURIComponent(label)}?secret=${config.secret}`; // 添加可选参数 const para...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left generateUri 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#Left To...
public generateUri(config: TotpConfig): string { // 构建标签(Issuer:Name 格式) let label = config.name || ''; if (config.issuer) { label = `${config.issuer}:${label}`; } // 创建基本URI const uri = `otpauth://totp/${encodeURIComponent(label)}?secret=${config.secret}`; // 添加可选参数 const para...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/TotpService.ets#L473-L509
38db2cfaac2bc70d6e9cc18b40661aef3dc98c9f
github
openharmony-sig/ohos_react_native
docs/Samples/demo_without_rnAbility/NativeProject/library/src/main/ets/UPRNSDKImpl.ets
arkts
defaultBackPressHandler
Invoked when the React application doesn't handle the device back press.
protected defaultBackPressHandler() { this.context?.terminateSelf() }
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left defaultBackPressHandler 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_bloc...
protected defaultBackPressHandler() { this.context?.terminateSelf() }
https://gitee.com/openharmony-sig/ohos_react_native.git
db52fa874d218a1a8fa8cc6da21e3a3335d48ec4
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Date.ets
arkts
constructor
`Date` constructor. @param year @param month @param day @param hours @param minutes @param seconds @see ECMA-262, 21.4.2.1
constructor(year: double, month: double, day: double, hours: double, minutes: double, seconds: double) { this.ms = ecmaMakeDate(ecmaMakeDay(year, month, day), ecmaMakeTime(hours, minutes, seconds, 0.0)) this.TZOffset = Date.getLocalTimezoneOffset() }
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 year AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left double AST#identifier#Right A...
constructor(year: double, month: double, day: double, hours: double, minutes: double, seconds: double) { this.ms = ecmaMakeDate(ecmaMakeDay(year, month, day), ecmaMakeTime(hours, minutes, seconds, 0.0)) this.TZOffset = Date.getLocalTimezoneOffset() }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
89d510b305ccd51abd94dbc6d6b99b18802171b1
gitee
offlinecat-dev/OCNetORM
src/main/ets/mapping/ValuesBucket.ets
arkts
set
设置值 @param key 键名 @param value 值
set(key: string, value: DbValueType): void { this.data.set(key, value) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left set 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 AST#,#Left , AST#,#Right ...
set(key: string, value: DbValueType): void { this.data.set(key, value) }
https://github.com/offlinecat-dev/OCNetORM
6d652e1cc7d5d919f3ab2fae4f47d9a30064fe45
github
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnSwitchViewModel.ets
arkts
toggleColorPrimary
切换自定义颜色-主题色开关 @param value 新的开关状态
toggleColorPrimary(value: boolean): void { this.switchColorPrimary = value; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left toggleColorPrimary AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right AST#)#L...
toggleColorPrimary(value: boolean): void { this.switchColorPrimary = value; }
https://github.com/codelably/tuniao-ui
aa802e74900587f03ca29aa1777019476447369c
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Download/DownloadManager.ets
arkts
unregisterProgressCallback
取消注册下载进度回调
public unregisterProgressCallback(listenerId: string): void { this.progressCallbacks.delete(listenerId); logger.debug(TAG, `取消进度回调: ${listenerId}`); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left unregisterProgressCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left listenerId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left str...
public unregisterProgressCallback(listenerId: string): void { this.progressCallbacks.delete(listenerId); logger.debug(TAG, `取消进度回调: ${listenerId}`); }
https://github.com/DaLongZhuaZi/manxia
7fd7c3fc77d7a25cc5aedba3f0fef8b11b41a7d0
github
Joker-x-dev/CoolMallArkTS
core/state/src/main/ets/BreakpointState.ets
arkts
getValueByName
根据断点名称获取值 @param {BreakpointValueOptions<T>} options - 断点值配置 @param {BreakpointType} type - 断点类型 @returns {T | undefined} 断点值
function getValueByName<T>(options: BreakpointValueOptions<T>, type: BreakpointType): T | undefined { if (type === BreakpointType.XS) { return options.xs; } if (type === BreakpointType.SM) { return options.sm; } if (type === BreakpointType.MD) { return options.md; } return options.lg; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getValueByName 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 > AST#>#...
function getValueByName<T>(options: BreakpointValueOptions<T>, type: BreakpointType): T | undefined { if (type === BreakpointType.XS) { return options.xs; } if (type === BreakpointType.SM) { return options.sm; } if (type === BreakpointType.MD) { return options.md; } return options.lg; }
https://github.com/Joker-x-dev/CoolMallArkTS
6350853909d2dcad84641443c1f62a65f68f2957
github
Cool_foolisher1/ArkTSRepository
ArkTSDemo/products/entry/src/main/ets/MyDemoOld/pages/heima/security/AlarmPage.ets
arkts
startVibrator
开启马达震动
startVibrator() { try { vibrator.startVibration({ type: 'time', duration: 1000 * 60, }, { id: 0, usage: 'alarm' }) } catch (err) { this.uiContext.showAlertDialog({ message: JSON.stringify(err) }) } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left startVibrator 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...
startVibrator() { try { vibrator.startVibration({ type: 'time', duration: 1000 * 60, }, { id: 0, usage: 'alarm' }) } catch (err) { this.uiContext.showAlertDialog({ message: JSON.stringify(err) }) } }
https://gitcode.com/Cool_foolisher1/ArkTSRepository
15fbddc300b742982d7d0d76c7a982626bf1db3f
gitcode
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.uri.ets
arkts
ssp
Sets the decoding scheme-specific part of the URI. @param { string } input NOTE(zhangziye):#25267 Unable to use different getter/setter signature
set ssp(input: string) { this.uriEntry.setSsp(encodeURI(input)) }
AST#program#Left AST#ERROR#Left AST#set#Left set AST#set#Right AST#call_expression#Left AST#identifier#Left ssp AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left input AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifie...
set ssp(input: string) { this.uriEntry.setSsp(encodeURI(input)) }
https://gitcode.com/iop123123/arkts-static-skills
3eb42b9a4d002d90f5ccf404bb266c0e8b74b5d7
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/usbdriver/AbstractDualSenseController.ets
arkts
findEndpoints
查找并设置端点
private findEndpoints(): boolean { if (!this.device.configs || this.device.configs.length === 0) { console.error(`${TAG} 设备没有配置`); return false; } const config = this.device.configs[0]; if (!config.interfaces || config.interfaces.length === 0) { console.error(`${TAG} 配置没有接口`); ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left findEndpoints 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 ...
private findEndpoints(): boolean { if (!this.device.configs || this.device.configs.length === 0) { console.error(`${TAG} 设备没有配置`); return false; } const config = this.device.configs[0]; if (!config.interfaces || config.interfaces.length === 0) { console.error(`${TAG} 配置没有接口`); ...
https://github.com/AlkaidLab/moonlight-harmony
d743040bf579b6dbe1b64ff494e8ef94edea38ed
github
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/hosts/system/windows/classes/meowUiHost.ets
arkts
goBackWeb
Go backwards in web. @returns if go back is successful. E.g. if there is no backward page, then we cannot go back, return false.
private goBackWeb() { const myTabs: meowTabsBunch = AppStorageV2.connect(meowTabsBunch, `meowTabsBunch_${this.windowId}`)!; const tabBackSuccessful = myTabs.goBackCurrent(); if (tabBackSuccessful) { return true; } else { // Try close tab if (myTabs.tabs.length > 0) { myTabs.c...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left goBackWeb 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 goBackWeb() { const myTabs: meowTabsBunch = AppStorageV2.connect(meowTabsBunch, `meowTabsBunch_${this.windowId}`)!; const tabBackSuccessful = myTabs.goBackCurrent(); if (tabBackSuccessful) { return true; } else { // Try close tab if (myTabs.tabs.length > 0) { myTabs.c...
https://github.com/awaLiny2333/LinysBrowser_NEXT
ab74b1713d24b131808f12535e01c50e94ccf066
github
Countly/countly-sdk-hos
library/src/main/ets/internal/modules/ModuleUserProfile.ets
arkts
save
Public save entry, UNCONDITIONAL. Queues an unconditional task on the chain so the explicit caller's "save now" intent isn't gated on the events queue. Still goes through the chain for ordering (so a mutation that fired auto-save just before doesn't double-enqueue with us).
public async save(): Promise<void> { if (this.rejectIfHalted('ModuleUserProfile', 'save')) return; await this.scheduleUnconditionalSave(); }
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 save AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AS...
public async save(): Promise<void> { if (this.rejectIfHalted('ModuleUserProfile', 'save')) return; await this.scheduleUnconditionalSave(); }
https://github.com/Countly/countly-sdk-hos
d30ff3133ba2a65b4f34b3423e01b3d47a992cda
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Debug/CrashRecorderService.ets
arkts
handleCrash
处理崩溃事件 在崩溃前同步保存日志快照
private handleCrash(errorMessage: string, stackTrace: string): void { // 防止重复保存(短时间内可能触发多次) if (this.isSaving) { return; } this.isSaving = true; try { this.ensureCrashLogsDir(); console.error(`[NGF] ${TAG}: 🚨 捕获到未处理异常: ${errorMessage}`); const now = Date.now(); con...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleCrash AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left errorMessage AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#st...
private handleCrash(errorMessage: string, stackTrace: string): void { // 防止重复保存(短时间内可能触发多次) if (this.isSaving) { return; } this.isSaving = true; try { this.ensureCrashLogsDir(); console.error(`[NGF] ${TAG}: 🚨 捕获到未处理异常: ${errorMessage}`); const now = Date.now(); con...
https://github.com/DaLongZhuaZi/manxia
2471b46bc8e87ebc06629cf8b8d94bbca19f8559
github
OHPG/FinSdk
jellyfin/src/main/ets/api/PlaylistsApi.ets
arkts
getPlaylistItems
@summary Gets the original items of a playlist. @param {PlaylistsApiGetPlaylistItemsRequest} requestParameters Request parameters. @param {*} [options] Override http request option. @throws {RequiredError} @memberof PlaylistsApi
public getPlaylistItems(requestParameters: PlaylistsApiGetPlaylistItemsRequest): Promise<BaseItemDtoQueryResult> { return this.apiClient.get({path: `/Playlists/${requestParameters.playlistId}/Items`, parameters: requestParameters, excludeParams: ['playlistId']}) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getPlaylistItems AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#id...
public getPlaylistItems(requestParameters: PlaylistsApiGetPlaylistItemsRequest): Promise<BaseItemDtoQueryResult> { return this.apiClient.get({path: `/Playlists/${requestParameters.playlistId}/Items`, parameters: requestParameters, excludeParams: ['playlistId']}) }
https://github.com/OHPG/FinSdk
24fd357787fb6d957e4a7dd1cdc799e0c2669db2
github
LJ666-ui/harmony-health-care
entry/src/main/ets/common/utils/AccessibilityConfig.ets
arkts
meetsWCAGAA
检查是否符合WCAG AA标准
public static meetsWCAGAA(color1: string, color2: string, isLargeText: boolean = false): boolean { const ratio = this.getContrastRatio(color1, color2); const threshold = isLargeText ? 3.0 : 4.5; return ratio >= threshold; }
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 meetsWCAGAA AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left color1 AST#identifier#Right AST#:#Left : AS...
public static meetsWCAGAA(color1: string, color2: string, isLargeText: boolean = false): boolean { const ratio = this.getContrastRatio(color1, color2); const threshold = isLargeText ? 3.0 : 4.5; return ratio >= threshold; }
https://github.com/LJ666-ui/harmony-health-care
03d4341f698e2334a7276156773b660940e93dc4
github
StarHeartY/CalculatorX
entry/src/main/ets/database/HistoryRepository.ets
arkts
deleteRecord
删除单条指定 ID 的历史记录(供列表单条滑动删除或长按删除使用) @param id 主键ID
public static async deleteRecord(id: number): Promise<number> { if (!HistoryRepository.rdbStore) { return 0; } try { const predicates = new relationalStore.RdbPredicates('history'); predicates.equalTo('id', id); return await HistoryRepository.rdbStore.delete(predicates); } catc...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left deleteRecord AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AS...
public static async deleteRecord(id: number): Promise<number> { if (!HistoryRepository.rdbStore) { return 0; } try { const predicates = new relationalStore.RdbPredicates('history'); predicates.equalTo('id', id); return await HistoryRepository.rdbStore.delete(predicates); } catc...
https://github.com/StarHeartY/CalculatorX
52c4a44e73d4d942868e556051a6fd43d484b5c4
github
erosTeam/NextE
shared/src/main/ets/backup/BackupService.ets
arkts
parseAndPreview
Parse a raw file. A recognized encrypted container returns ok=false + encrypted=true + 'password_required' so the caller prompts for a password.
static async parseAndPreview(raw: string): Promise<BackupParseResult> { return BackupService.parseEnvelope(raw, false) }
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 parseAndPreview AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left raw AST#identifier#Right AST#:#Left : AS...
static async parseAndPreview(raw: string): Promise<BackupParseResult> { return BackupService.parseEnvelope(raw, false) }
https://github.com/erosTeam/NextE
36ffd6b19181257c77a1f9e8d2419bf2c86676b5
github
apap6628114/nga_oh
entry/src/main/ets/common/concurrency/Throttler.ets
arkts
acquire
申请 domain 的执行许可:若当前并发未满且距上次 dispatch 已超过最小间隔,立即 resolve; 否则进入等待队列,待有空闲槽位且间隔满足时被唤醒。调用方取得许可后执行请求, 完成后必须调用 {@link release} 释放槽位。 @param domain - 限流维度(通常为请求域名) @returns 许可授予后 resolve 的 Promise
acquire(domain: string): Promise<void> { const bucket = this.getBucket(domain); if (bucket.concurrency < bucket.maxConcurrency) { const now = Date.now(); const elapsed = now - bucket.lastDispatch; if (elapsed >= bucket.minInterval) { bucket.concurrency += 1; bucket.lastDispa...
AST#program#Left AST#expression_statement#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left acquire AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left domain AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le...
acquire(domain: string): Promise<void> { const bucket = this.getBucket(domain); if (bucket.concurrency < bucket.maxConcurrency) { const now = Date.now(); const elapsed = now - bucket.lastDispatch; if (elapsed >= bucket.minInterval) { bucket.concurrency += 1; bucket.lastDispa...
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/common/concurrency/Throttler.ets#L94-L111
9d6c6645124c5c2711923f17fd86aa11c63b1316
github
JackJiang2011/harmonychat
entry/src/main/ets/pages/LoginPage.ets
arkts
doLoginImpl
真正的登陆信息发送实现方法。
doLoginImpl(loginUserId: string, loginToken: string) { // * 立即显示登陆处理进度提示等(并将同时启动超时检查线程) this.isLogining = true; // * 将要提交的登陆信息对象 let loginInfo: PLoginInfo = new PLoginInfo(); loginInfo.loginUserId = loginUserId; loginInfo.loginToken = loginToken; // * 发送登陆数据包(提交登陆名和密码) let code: numb...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left doLoginImpl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left loginUserId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AS...
doLoginImpl(loginUserId: string, loginToken: string) { // * 立即显示登陆处理进度提示等(并将同时启动超时检查线程) this.isLogining = true; // * 将要提交的登陆信息对象 let loginInfo: PLoginInfo = new PLoginInfo(); loginInfo.loginUserId = loginUserId; loginInfo.loginToken = loginToken; // * 发送登陆数据包(提交登陆名和密码) let code: numb...
https://github.com/JackJiang2011/harmonychat
917d0a94b0d24d1f15ae8b9ca992e39da96a6b8f
github
DaLongZhuaZi/manxia
entry/src/main/ets/pages/NovelSettingsPage.ets
arkts
navigateTo
导航到指定页面
navigateTo(route: string): void { this.pathStack.pushPathByName(route, null); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left navigateTo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left route AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST...
navigateTo(route: string): void { this.pathStack.pushPathByName(route, null); }
https://github.com/DaLongZhuaZi/manxia
724f1c3ba481e9c14f366a8c841cb8f3e8c3bf3f
github
offlinecat-dev/OCNetORM
src/main/ets/logging/Logger.ets
arkts
logQuery
记录查询日志 仅在 DEBUG 级别记录,包含 SQL 语句和执行耗时 注意:生产环境应禁用 DEBUG 级别日志,避免敏感数据泄露 @param sql SQL 语句 @param duration 执行耗时(毫秒)
logQuery(sql: string, duration: number): void { // 查询日志仅在 DEBUG 级别记录 if (!this.shouldLog(LogLevel.DEBUG)) { return } // 对 SQL 中可能的敏感值进行脱敏处理 const sanitizedSql = this.sanitizeSql(sql) const message = this.formatMessage(LOG_TYPE_QUERY, `${duration}ms`, sanitizedSql) this.recordToHistor...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left logQuery AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left sql AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#R...
logQuery(sql: string, duration: number): void { // 查询日志仅在 DEBUG 级别记录 if (!this.shouldLog(LogLevel.DEBUG)) { return } // 对 SQL 中可能的敏感值进行脱敏处理 const sanitizedSql = this.sanitizeSql(sql) const message = this.formatMessage(LOG_TYPE_QUERY, `${duration}ms`, sanitizedSql) this.recordToHistor...
https://github.com/offlinecat-dev/OCNetORM
72713f111bb334e0ad3ae80f596fe4bf4c29ab1a
github
tdcare/tdwebrtc
src/main/ets/utils/StrUtil.ets
arkts
unit8ArrayToBuffer
Uint8Array转ArrayBuffer @param str @returns
static unit8ArrayToBuffer(src: Uint8Array): ArrayBuffer { // return buffer.from(src).buffer; return src.buffer as ArrayBuffer; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left unit8ArrayToBuffer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left src AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
static unit8ArrayToBuffer(src: Uint8Array): ArrayBuffer { // return buffer.from(src).buffer; return src.buffer as ArrayBuffer; }
https://github.com/tdcare/tdwebrtc
f340d3daf9eb9e81ffe6131322963168e588d382
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/MangaSourceEngine.ets
arkts
extractImageUrl
提取图片URL
private extractImageUrl(data: Object): string { if (typeof data === 'string') { return data; } const item = data as Record<string, Object>; return String(item.imageUrl || item.url || item.src || ''); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left extractImageUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le...
private extractImageUrl(data: Object): string { if (typeof data === 'string') { return data; } const item = data as Record<string, Object>; return String(item.imageUrl || item.url || item.src || ''); }
https://github.com/DaLongZhuaZi/manxia
e1621139854aa4c39ec3de07fb7a3c2a89e43e4c
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Theme/UserThemeConfig.ets
arkts
createDefaultProfile
创建默认主题配置
function createDefaultProfile(): UserThemeProfile { return { id: 'default', name: '默认配置', lastModified: Date.now(), transparency: copyTransparency(DEFAULT_TRANSPARENCY), effects: copyEffects(DEFAULT_EFFECTS), hdsTabEffects: copyHdsTabEffects(DEFAULT_HDS_TAB_EFFECTS) }; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left createDefaultProfile 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#type_i...
function createDefaultProfile(): UserThemeProfile { return { id: 'default', name: '默认配置', lastModified: Date.now(), transparency: copyTransparency(DEFAULT_TRANSPARENCY), effects: copyEffects(DEFAULT_EFFECTS), hdsTabEffects: copyHdsTabEffects(DEFAULT_HDS_TAB_EFFECTS) }; }
https://github.com/DaLongZhuaZi/manxia
88d2dd89389a74e170015728511421a2d7027895
github
harmonyos/codelabs
HarmonyOS_NEXT/DistributedContacts/entry/src/main/ets/viewmodel/DetailPageViewModel.ets
arkts
deleteContactButton
Delete contact button.
deleteContactButton(name: string): void { let contactsKey = CommonConstants.CONTACTS_DATABASE_KEY + name; try { // This interface is used to delete the information about a specified contact. this.contactsDataBase.delete(contactsKey, () => { promptAction.showToast({ message: $r('a...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left deleteContactButton AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Le...
deleteContactButton(name: string): void { let contactsKey = CommonConstants.CONTACTS_DATABASE_KEY + name; try { // This interface is used to delete the information about a specified contact. this.contactsDataBase.delete(contactsKey, () => { promptAction.showToast({ message: $r('a...
https://gitee.com/harmonyos/codelabs.git
730f99d24c2325e18eb89fe9997c527a809310b2
gitee
offlinecat-dev/OCNetORM
src/main/ets/query/QueryBuilder.ets
arkts
getHavingClause
获取 HAVING 子句 @returns HAVING 子句
getHavingClause(): string { return this.havingClause }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getHavingClause 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#statem...
getHavingClause(): string { return this.havingClause }
https://github.com/offlinecat-dev/OCNetORM
edb5fc10693654243ef3d4c3e77f28b9d1918560
github
openharmony/codelabs
Distributed/DistributeDraw/entry/src/main/ets/viewmodel/KvStoreModel.ets
arkts
createKvStore
Create a distributed key-value database. @param context Ability context. @param callback Callback.
createKvStore( context: common.UIAbilityContext, callback: (data: distributedKVStore.ChangeNotification) => void ): void { if (this.kvStore !== undefined) { Logger.info('KvStoreModel', 'createKvStore KVManager is exist'); return; } let config: distributedKVStore.KVManagerConfig = { ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left createKvStore AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Le...
createKvStore( context: common.UIAbilityContext, callback: (data: distributedKVStore.ChangeNotification) => void ): void { if (this.kvStore !== undefined) { Logger.info('KvStoreModel', 'createKvStore KVManager is exist'); return; } let config: distributedKVStore.KVManagerConfig = { ...
https://gitee.com/openharmony/codelabs.git
be05b97ffa2f06efaf58444eb255ab1a15d1b92b
gitee
harmonyos/codelabs
CanvasComponent/entry/src/main/ets/viewmodel/DrawModel.ets
arkts
drawOutCircle
Draw outer disc, small circle.
drawOutCircle() { // Draw outer disc. this.fillArc(new FillArcData(0, 0, this.screenWidth * CommonConstants.OUT_CIRCLE_RATIOS, 0, Math.PI * CommonConstants.TWO), ColorConstants.OUT_CIRCLE_COLOR); let beginAngle = this.startAngle; // Draw small circle. for (let i = 0; i < CommonConstants.SMA...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left drawOutCircle 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...
drawOutCircle() { // Draw outer disc. this.fillArc(new FillArcData(0, 0, this.screenWidth * CommonConstants.OUT_CIRCLE_RATIOS, 0, Math.PI * CommonConstants.TWO), ColorConstants.OUT_CIRCLE_COLOR); let beginAngle = this.startAngle; // Draw small circle. for (let i = 0; i < CommonConstants.SMA...
https://gitee.com/harmonyos/codelabs.git
643a67853beb103627d33833cd21f5b183a036fc
gitee
CLMC2025/Vignette
entry/src/main/ets/vocabulary/UnknownWordHandler.ets
arkts
getHandlingRecommendation
获取处理建议
getHandlingRecommendation(word: string, userLevel: number): HandlingResult { const wordInfo = this.analyzeUnknownWord(word, ''); return this.determineHandlingStrategy(wordInfo, userLevel); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getHandlingRecommendation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left word AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AS...
getHandlingRecommendation(word: string, userLevel: number): HandlingResult { const wordInfo = this.analyzeUnknownWord(word, ''); return this.determineHandlingStrategy(wordInfo, userLevel); }
https://github.com/CLMC2025/Vignette
0f4cdddae2b397a42b691a900f0f3412c0e2a962
github