nwo
stringclasses
449 values
path
stringlengths
9
173
language
stringclasses
1 value
identifier
stringlengths
1
53
docstring
stringlengths
5
4.13k
function
stringlengths
10
87.2k
ast_function
stringlengths
351
354k
obf_function
stringlengths
10
87.2k
url
stringlengths
30
175
function_sha
stringlengths
40
40
source
stringclasses
3 values
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Array.ets
arkts
toString
Returns a string representing the specified array and its elements. @returns string representation
public override toString(): String { let str = new StringBuilder() for (let i = 0; i < this.data.length; i++) { const d: Object | null = this.data[i] if (d == null) { str.append("null") } else { str.append((d as Object).toString()) ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left toString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Le...
public override toString(): String { let str = new StringBuilder() for (let i = 0; i < this.data.length; i++) { const d: Object | null = this.data[i] if (d == null) { str.append("null") } else { str.append((d as Object).toString()) ...
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
2f1064fc1f4249cdd5f214e64fc41df4b41926ac
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/MangaSourceEngine.ets
arkts
setPrefetchedPages
2 分钟 [优化] 存储预取的页面列表(供 MangaDetailPage 调用)
static setPrefetchedPages(sourceId: number, chapterId: string, pages: PageInfo[]): void { const key = `${sourceId}_${chapterId}`; const entry: PrefetchCacheEntry = { data: pages, timestamp: Date.now() }; MangaSourceEngine.prefetchedPageLists.set(key, entry); logger.info(TAG, `[预取] 已缓存页面列表: key=${key},...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setPrefetchedPages AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#nu...
static setPrefetchedPages(sourceId: number, chapterId: string, pages: PageInfo[]): void { const key = `${sourceId}_${chapterId}`; const entry: PrefetchCacheEntry = { data: pages, timestamp: Date.now() }; MangaSourceEngine.prefetchedPageLists.set(key, entry); logger.info(TAG, `[预取] 已缓存页面列表: key=${key},...
https://github.com/DaLongZhuaZi/manxia
6ed46067480f64e45be517587f630077e4d677a9
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
of
Creates a new Uint8Array using initializer @param { FixedArray<number> } data - initializer @returns { Uint8Array } - a new Uint8Array from data @throws { Error } - function not implemented @syscap SystemCapability.Utils.Lang @FaAndStageModel
public of(...data: FixedArray<number>): Uint8Array { throw new Error("Uint8Array.of: not implemented") }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left of AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#ERROR#Left AST#identifier#Left data A...
public of(...data: FixedArray<number>): Uint8Array { throw new Error("Uint8Array.of: not implemented") }
https://gitcode.com/iop123123/arkts-static-skills
eaf112040b1d3e079fd5e47e30c629b0adc2ac6d
gitcode
openharmony-sig/applications_calculator
feature/calculation/src/main/ets/historyrecord/HistoryRecordController.ets
arkts
recordsIsEmpty
recordsIsEmpty @param callback
public recordsIsEmpty(callback: Function): void { LogUtil.info(TAG, 'query phone records start'); this.expressionsModel.isEmpty(callback); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left recordsIsEmpty AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le...
public recordsIsEmpty(callback: Function): void { LogUtil.info(TAG, 'query phone records start'); this.expressionsModel.isEmpty(callback); }
https://gitee.com/openharmony-sig/applications_calculator.git
a5f7c41160dc5213703361139074b3a1760a2d28
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Parsers/PdfToMangaImporter.ets
arkts
convertPageToImage
将PDF页面转换为图片 使用 getPagePixelMap() 获取页面 PixelMap,然后直接打包写入目标文件, 避免在内存中额外持有整块编码后的图片 buffer。
private async convertPageToImage(pageIndex: number, outputDir: string): Promise<PdfPageImage | null> { try { if (!this.pdfDocument) { return null; } logger.debug(TAG, `start converting page ${pageIndex + 1}`); // 获取PDF页面 const pdfPage: pdfService.PdfPage = this.pdfDoc...
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 convertPageToImage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left pageIndex AST#identifier#Right AST#ERROR#Left AST...
private async convertPageToImage(pageIndex: number, outputDir: string): Promise<PdfPageImage | null> { try { if (!this.pdfDocument) { return null; } logger.debug(TAG, `start converting page ${pageIndex + 1}`); // 获取PDF页面 const pdfPage: pdfService.PdfPage = this.pdfDoc...
https://github.com/DaLongZhuaZi/manxia
e867b79e8a7768dde3d41fc36aa7d92d609b1c04
github
Amaz1ny/HarmonyDO-public
entry/src/main/ets/services/auth/AuthService.ets
arkts
updateCsrfToken
更新 CSRF Token(登录态写接口会复用)
async updateCsrfToken(csrfToken: string): Promise<void> { this.csrfToken = csrfToken; await PreferencesUtil.putString(AuthService.KEY_CSRF_TOKEN, csrfToken); }
AST#program#Left AST#expression_statement#Left AST#assignment_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left updateCsrfToken AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#L...
async updateCsrfToken(csrfToken: string): Promise<void> { this.csrfToken = csrfToken; await PreferencesUtil.putString(AuthService.KEY_CSRF_TOKEN, csrfToken); }
https://github.com/Amaz1ny/HarmonyDO-public
0e94db1cadb22f381853f8d5d2dad405df071e3c
github
openharmony-sig/flutter_engine
shell/platform/ohos/flutter_embedding/flutter/src/main/ets/util/ByteBuffer.ets
arkts
getFloat64
Gets a double. @param byteOffset The byte offset. @param littleEndian If the value is little endian. @returns The value.
getFloat64(byteOffset: number, littleEndian?: boolean): number { return this.dataView?.getFloat64(byteOffset, littleEndian) ?? 0 }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getFloat64 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left byteOffset AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , AST#,#...
getFloat64(byteOffset: number, littleEndian?: boolean): number { return this.dataView?.getFloat64(byteOffset, littleEndian) ?? 0 }
https://gitee.com/openharmony-sig/flutter_engine.git
936b86fc3e5cfc3661446465852c31fc1e55bca2
gitee
holg/eulumdat-rs
EulumdatHarmonyOS/Eulumdat/entry/src/main/ets/model/EulumdatEngine.ets
arkts
polarSvg
Generate polar diagram SVG @param width SVG width in pixels @param height SVG height in pixels @param theme Light or Dark theme @returns SVG string
public polarSvg(width: number = 400, height: number = 400, theme: SvgTheme = SvgTheme.Light): string { return eulumdat_napi.polarSvg(width, height, theme); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left polarSvg AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left width AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#...
public polarSvg(width: number = 400, height: number = 400, theme: SvgTheme = SvgTheme.Light): string { return eulumdat_napi.polarSvg(width, height, theme); }
https://github.com/holg/eulumdat-rs
c34a1c42ea819917deb9e73e8cab3743af3a1261
github
HarmonyOS_Samples/guide-snippets
Ability/InsightIntentConfigDevelopment/entry/src/main/ets/abilities/MusicPlayerAbility.ets
arkts
onBackground
后台模式:UIAbility退到后台时触发
onBackground() { hilog.info(DOMAIN, 'testTag', `[MusicPlayerAbility]`); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onBackground 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 ...
onBackground() { hilog.info(DOMAIN, 'testTag', `[MusicPlayerAbility]`); }
https://gitcode.com/HarmonyOS_Samples/guide-snippets
dd96b83fae11a07ded33b41e554f33521331078b
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/ReflectField.ets
arkts
getType
Gets the type of this field. @returns { Class } Returns the Class object representing the type of this field.
public getType(): Class { return Field.getTypeInternal(this.fieldPtr) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getType 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 Class AST#iden...
public getType(): Class { return Field.getTypeInternal(this.fieldPtr) }
https://gitcode.com/iop123123/arkts-static-skills
e758853ed08f884999e487e155ed8a6f8d1c0db3
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelContentProcessor.ets
arkts
applyReplaceRules
应用替换规则
private applyReplaceRules( content: string, scope: ReplaceScope, sourceId: string | undefined, enabledRuleIds: string[] | undefined = undefined ): ApplyRulesResult { let rules = this.replaceRuleManager.getEnabledRules(scope, sourceId); if (enabledRuleIds !== undefined) { rules = rule...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left applyReplaceRules AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left content AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#s...
private applyReplaceRules( content: string, scope: ReplaceScope, sourceId: string | undefined, enabledRuleIds: string[] | undefined = undefined ): ApplyRulesResult { let rules = this.replaceRuleManager.getEnabledRules(scope, sourceId); if (enabledRuleIds !== undefined) { rules = rule...
https://github.com/DaLongZhuaZi/manxia
e00da3d910029dc11d8244f2a623f8acb6dea8d2
github
JackJiang2011/harmonychat
entry/src/main/ets/pages/utils/ToolKits.ets
arkts
getTimeHH24Human
获取仅包含“时间:分钟”部分的字符串,24小时制,且可以显示“上午”、“下午”、“晚上”这样的描述。 @param srcDateObj 原始日期对象 @param timeWithSegmentStr 表示在时间字符串前带上“上午”、“下午”、“晚上”这样的描述 @return 如果成功则返回结果,否则返回空字符串""(不是null)
static getTimeHH24Human(srcDateObj: Date, timeWithSegmentStr: boolean): string { let ret: string = ''; try { let timePattern: string = 'hh:mm'; // 原始的时间分钟字符串 let timeStr: string = ToolKits.formatDate(srcDateObj, timePattern); // 时间段描述(形如:“上午”、“下午”、“晚上”这样的描述),只在中文语言下生效 let timeSe...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getTimeHH24Human AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left srcDateObj AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Date AST#...
static getTimeHH24Human(srcDateObj: Date, timeWithSegmentStr: boolean): string { let ret: string = ''; try { let timePattern: string = 'hh:mm'; // 原始的时间分钟字符串 let timeStr: string = ToolKits.formatDate(srcDateObj, timePattern); // 时间段描述(形如:“上午”、“下午”、“晚上”这样的描述),只在中文语言下生效 let timeSe...
https://github.com/JackJiang2011/harmonychat
c3642931cdd50909ef3ab888cb172c489b9695e1
github
DaLongZhuaZi/manxia
entry/src/main/ets/pages/NovelSourceManagementPage.ets
arkts
enterSortMode
进入排序模式
enterSortMode(): void { // 清除筛选和搜索,显示所有启用的书源 this.selectedGroup = ''; this.searchKeyword = ''; this.showSearchBar = false; this.isMultiSelectMode = false; this.selectedSourceIds.clear(); // 重新加载并应用筛选(只显示启用的书源) this.applyFilterForSortMode(); this.isSortMode = true; this.getUICon...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left enterSortMode 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...
enterSortMode(): void { // 清除筛选和搜索,显示所有启用的书源 this.selectedGroup = ''; this.searchKeyword = ''; this.showSearchBar = false; this.isMultiSelectMode = false; this.selectedSourceIds.clear(); // 重新加载并应用筛选(只显示启用的书源) this.applyFilterForSortMode(); this.isSortMode = true; this.getUICon...
https://github.com/DaLongZhuaZi/manxia
e076bbbc1d5bf6009252b8ba53d45b1a9dee87b3
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoCookieStore.ets
arkts
clearCookies
清除指定域名的Cookie
async clearCookies(domain: string): Promise<void> { this.cookies.delete(domain); await this.saveCookies(); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left clearCookies AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Lef...
async clearCookies(domain: string): Promise<void> { this.cookies.delete(domain); await this.saveCookies(); }
https://github.com/DaLongZhuaZi/manxia
f2d3adf7593abd42e699bcf1adcd34477a1168d0
github
DaLongZhuaZi/manxia
entry/src/main/ets/libs/htmlparser/HTMLElement.ets
arkts
matchesPseudoClass
检查元素是否匹配伪类
private matchesPseudoClass(elem: HTMLElement, pseudo: PseudoClass): boolean { const parent = elem.parentNode as HTMLElement | null; if (pseudo.name === 'first-child') { if (!parent) return false; return parent.children[0] === elem; } else if (pseudo.name === 'last-child') { if (!par...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left matchesPseudoClass AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left elem AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier...
private matchesPseudoClass(elem: HTMLElement, pseudo: PseudoClass): boolean { const parent = elem.parentNode as HTMLElement | null; if (pseudo.name === 'first-child') { if (!parent) return false; return parent.children[0] === elem; } else if (pseudo.name === 'last-child') { if (!par...
https://github.com/DaLongZhuaZi/manxia
b026e70285d8c0ce5b14ad7e3c6c398f026ba182
github
YDYm233/EasyRandom_HarmonyNextApp
product/default/src/main/ets/pages/SettingPage/Options.ets
arkts
applyColorMode
保存显示模式并立即应用到全局
applyColorMode(index: number): void { try { const ctx = getContext(this) as common.UIAbilityContext // 1. 持久化存储 const pref = preferences.getPreferencesSync(ctx, { name: PREF_NAME }) pref.putSync(KEY_COLOR_MODE, index) pref.flush() // 2. 立即应用 const appContext = ctx.getAppl...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left applyColorMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left )...
applyColorMode(index: number): void { try { const ctx = getContext(this) as common.UIAbilityContext // 1. 持久化存储 const pref = preferences.getPreferencesSync(ctx, { name: PREF_NAME }) pref.putSync(KEY_COLOR_MODE, index) pref.flush() // 2. 立即应用 const appContext = ctx.getAppl...
https://github.com/YDYm233/EasyRandom_HarmonyNextApp
1e9bb92026442e0837423966b56d9e78bac4c0a0
github
midori52000/ArkPilot
Agent/entry/src/main/ets/backend/CodexNative.ets
arkts
initializeTask
--- Async wrappers via taskpool (offload blocking native calls from UI thread) ---
@Concurrent function initializeTask(configJson: string): string { const mod = entry ?? null; if (mod === null) { return '{}'; } try { return mod.initialize(configJson); } catch (_err) { return '{}'; } }
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Concurrent AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left initializeTask AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST...
@Concurrent function initializeTask(configJson: string): string { const mod = entry ?? null; if (mod === null) { return '{}'; } try { return mod.initialize(configJson); } catch (_err) { return '{}'; } }
https://github.com/midori52000/ArkPilot
f4751496055e16e608cfd671fb2bb4469d1e1a48
github
openharmony/applications_permission_manager
permissionmanager/src/main/ets/pages/authority-management.ets
arkts
getAllPermissionApplications
Get all app permission information
getAllPermissionApplications() { for (let i = 0; i < this.allUserPermissions.length; i++) { let permission: Permission = this.allUserPermissions[i]; let permissionGroup: GroupInfo = getPermissionGroup(permission); let icon: ResourceStr = permissionGroup.icon; let bundleNames: string[] = []...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getAllPermissionApplications 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#state...
getAllPermissionApplications() { for (let i = 0; i < this.allUserPermissions.length; i++) { let permission: Permission = this.allUserPermissions[i]; let permissionGroup: GroupInfo = getPermissionGroup(permission); let icon: ResourceStr = permissionGroup.icon; let bundleNames: string[] = []...
https://gitee.com/openharmony/applications_permission_manager.git
ffa2a5798844102866c96c350463096ca201ef83
gitee
YDYm233/EasyRandom_HarmonyNextApp
common/SystemUtils/src/main/ets/utils/VibratorManager.ets
arkts
shouldDebounce
高频防抖检查:返回 true 表示应跳过本次振动
private static shouldDebounce(): boolean { const now = Date.now(); if (now - VibratorManager.lastVibrateMs < VibratorManager.DEBOUNCE_MS) { return true; } VibratorManager.lastVibrateMs = now; return false; }
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 shouldDebounce AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A...
private static shouldDebounce(): boolean { const now = Date.now(); if (now - VibratorManager.lastVibrateMs < VibratorManager.DEBOUNCE_MS) { return true; } VibratorManager.lastVibrateMs = now; return false; }
https://github.com/YDYm233/EasyRandom_HarmonyNextApp
e7f94f4b93a11bc4ce043db561e133bfb6ac6a6d
github
pangpang20/antennaPodHM
entry/src/main/ets/service/DatabaseService.ets
arkts
getAllEpisodes
查询所有Episodes
async getAllEpisodes(): Promise<Episode[]> { if (!this.rdbStore) return []; try { const predicates = new relationalStore.RdbPredicates(Constants.TABLE_EPISODE); predicates.orderByDesc('pubDate'); const resultSet = await this.rdbStore.query(predicates); const episodes: Episode[] = [];...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getAllEpisodes 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 : AS...
async getAllEpisodes(): Promise<Episode[]> { if (!this.rdbStore) return []; try { const predicates = new relationalStore.RdbPredicates(Constants.TABLE_EPISODE); predicates.orderByDesc('pubDate'); const resultSet = await this.rdbStore.query(predicates); const episodes: Episode[] = [];...
https://github.com/pangpang20/antennaPodHM
0f423cf0b8b0b37dbfd7866204554c1e12e5b666
github
openharmony-sig/flutter_engine
shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/ohos/TouchEventTracker.ets
arkts
track
Tracks the event and returns a unique MotionEventId identifying the event.
public track(event :TouchEvent) : TouchEventId { const eventId:TouchEventId = TouchEventId.createUnique(); this.eventById.add(eventId.getId(), event); this.unusedEvents.add(eventId.getId()); return eventId; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left track AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:#Left : AST#:#Right AST#ER...
public track(event :TouchEvent) : TouchEventId { const eventId:TouchEventId = TouchEventId.createUnique(); this.eventById.add(eventId.getId(), event); this.unusedEvents.add(eventId.getId()); return eventId; }
https://gitee.com/openharmony-sig/flutter_engine.git
d0be1678f54f545ffa65dd2c76ee86d44920fecc
gitee
openharmony/applications_launcher
feature/recents/src/main/ets/default/common/uicomponents/RecentMissionAppIcon.ets
arkts
updateIcon
Update the app icon of recent missions.
updateIcon(): void { this.mResourceManager.getAppIconWithCache(this.appIcon, this.bundleName, this.moduleName, this.iconLoadCallback, ''); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateIcon AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#L...
updateIcon(): void { this.mResourceManager.getAppIconWithCache(this.appIcon, this.bundleName, this.moduleName, this.iconLoadCallback, ''); }
https://gitee.com/openharmony/applications_launcher.git
37292349ab56ff22f0bc386960426736e9585aef
gitee
openharmony/codelabs
ETSUI/HarmonyPhotoAlbum/entry/src/main/ets/service/AuthService.ets
arkts
hasPin
是否已经设置过 PIN 码
static async hasPin(context: common.UIAbilityContext): Promise<boolean> { const store = await AuthService.getStore(context); const value = await store.get(AuthService.KEY_PIN, '') as string; return !!value && value.length > 0; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left hasPin AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#R...
static async hasPin(context: common.UIAbilityContext): Promise<boolean> { const store = await AuthService.getStore(context); const value = await store.get(AuthService.KEY_PIN, '') as string; return !!value && value.length > 0; }
https://gitcode.com/openharmony/codelabs
afb703e4656ebefec93bf4ce489eb17c2a832003
gitcode
CsCesium/KantaiHomo
entry/src/main/ets/infra/fairy/service/FairyService.ets
arkts
init
── public API ──────────────────────────────────────────────────────────── Create the SubWindow and show the fairy ball. Must be called from onWindowStageCreate with the active WindowStage.
async init(stage: window.WindowStage): Promise<void> { const d = display.getDefaultDisplaySync(); const ballPx = Math.round(vp2px(FAIRY_BALL_VP)); // Restore saved position, default to right edge 1/3 from top. this.posXPx = await kvGetNumber(KV_POS_X, d.width - ballPx - Math.round(vp2px(16))); th...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left stage AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Rig...
async init(stage: window.WindowStage): Promise<void> { const d = display.getDefaultDisplaySync(); const ballPx = Math.round(vp2px(FAIRY_BALL_VP)); // Restore saved position, default to right edge 1/3 from top. this.posXPx = await kvGetNumber(KV_POS_X, d.width - ballPx - Math.round(vp2px(16))); th...
https://github.com/CsCesium/KantaiHomo
fc8026d60693afacea25191d981e66e776bf04d9
github
Tencent-RTC/TUIKit_Harmony
atomic_x/src/main/ets/basecomponent/language/LanguageState.ets
arkts
subscribe
Subscribe to layout direction changes
subscribe(callback: (direction: LayoutDirection) => void): void { this.subscribers.push(callback); }
AST#program#Left AST#ERROR#Left AST#identifier#Left subscribe AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left callback 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 di...
subscribe(callback: (direction: LayoutDirection) => void): void { this.subscribers.push(callback); }
https://github.com/Tencent-RTC/TUIKit_Harmony
1124dc3056d7c4492076c5853c7e68a1195d656c
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Source/SourceRepositoryManager.ets
arkts
resolveSourceIconUrl
解析图源图标URL 图标文件位于: base/pkg/icon.{ext} 支持的格式: png, jpg, webp
private resolveSourceIconUrl(indexUrl: string, pkg: string, ext: string = 'webp'): string { return this.resolveRepositoryAssetUrl(indexUrl, `${pkg}/icon.${ext}`); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left resolveSourceIconUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left indexUrl AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string A...
private resolveSourceIconUrl(indexUrl: string, pkg: string, ext: string = 'webp'): string { return this.resolveRepositoryAssetUrl(indexUrl, `${pkg}/icon.${ext}`); }
https://github.com/DaLongZhuaZi/manxia
c28606c2527b820875cb5b525a7e092877f6a08b
github
LJ666-ui/harmony-health-care
entry/src/main/ets/ai/AIOrchestrator.ets
arkts
handleRiskAssessment
处理风险评估(MindSpore端侧)
private async handleRiskAssessment(request: AIRequest): Promise<AIResponse> { if (!request.data?.healthData) { return this.createErrorResponse('MISSING_HEALTH_DATA', '缺少健康数据'); } console.info(`[AI-Orch] 执行风险评估`); // 使用MindSpore进行端侧推理 const riskResult = await mindSporeEngine.assessRisk(requ...
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 handleRiskAssessment AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left request AST#identifier#Right AST...
private async handleRiskAssessment(request: AIRequest): Promise<AIResponse> { if (!request.data?.healthData) { return this.createErrorResponse('MISSING_HEALTH_DATA', '缺少健康数据'); } console.info(`[AI-Orch] 执行风险评估`); // 使用MindSpore进行端侧推理 const riskResult = await mindSporeEngine.assessRisk(requ...
https://github.com/LJ666-ui/harmony-health-care
cf6c9a3de72504f574123cfb561cb7b68f042a04
github
aimilin6688/KeePassHO
entry/src/main/ets/common/utils/FilenameUtils.ets
arkts
getFilePath
获取文件路径,将给定的多个字符串组合成路径
public static getFilePath(...paths: string[]): string { // 如果是空字符串,则返回空字符串 if (paths.length === 0) { return ''; } // 如果字符串 以 / 开头需要去掉 paths = paths.map(path => { if (!path) { return ''; } path = path.startsWith('/') ? path.substring(1) : path; path = path.ends...
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 getFilePath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#ERROR#Left AST#iden...
public static getFilePath(...paths: string[]): string { // 如果是空字符串,则返回空字符串 if (paths.length === 0) { return ''; } // 如果字符串 以 / 开头需要去掉 paths = paths.map(path => { if (!path) { return ''; } path = path.startsWith('/') ? path.substring(1) : path; path = path.ends...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/FilenameUtils.ets#L137-L152
90c39d0b315bb8acd491128cce0547a6edbc3bc4
github
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/utils/KeyboardMapper.ets
arkts
isShiftPressed
Check if Shift is pressed
isShiftPressed(): boolean { return this.shiftPressed; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isShiftPressed AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#stat...
isShiftPressed(): boolean { return this.shiftPressed; }
https://github.com/tangwengang-del/freerdp-harmonyos
b4f1dd1c42ba7a38aca4fee44496dd9513240f96
github
XHXYT/Pixark
entry/src/main/ets/viewmodel/DownloadsViewModel.ets
arkts
fetchSysTask
获取任务列表
async fetchSysTask() { if (!this.context) return; const db = getDownloadRecordTable(this.context); let dbRecords = await db.queryAllDesc(); const stateTypes = [ request.agent.State.RUNNING, request.agent.State.FAILED, request.agent.State.PAUSED, request.agent.State.COMPLETED, request.agen...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left fetchSysTask AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#R...
async fetchSysTask() { if (!this.context) return; const db = getDownloadRecordTable(this.context); let dbRecords = await db.queryAllDesc(); const stateTypes = [ request.agent.State.RUNNING, request.agent.State.FAILED, request.agent.State.PAUSED, request.agent.State.COMPLETED, request.agen...
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/viewmodel/DownloadsViewModel.ets#L159-L206
0553b5f8f2a16d0c256ddc37f71b4393845dd438
github
openharmony/update_update_app
feature/ota/src/main/ets/manager/OtaUpdateManager.ets
arkts
isTerminal
是否升级终止 @return 是否升级终止
public isTerminal(): boolean { return this.isTerminalState(this.stateObj?.otaStatus); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isTerminal AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#bo...
public isTerminal(): boolean { return this.isTerminalState(this.stateObj?.otaStatus); }
https://gitee.com/openharmony/update_update_app.git
57efa4cbd4c15b0c12c29355bf1252e3432e959d
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/components/BookOpenTransition.ets
arkts
startOpenTransition
开始翻开过渡
public startOpenTransition( coverImagePath: string, coverPosition: CoverPosition, onComplete?: () => void ): void { if (this.isTransitioning) { logger.warn(TAG, '已有过渡动画在进行中'); return; } this.isTransitioning = true; this.currentMode = TransitionMode.OPEN; this.pending...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left startOpenTransition AST#identifier#Right AST#(#Left ( AST#(#Right AST#identifier#Left coverImagePath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left...
public startOpenTransition( coverImagePath: string, coverPosition: CoverPosition, onComplete?: () => void ): void { if (this.isTransitioning) { logger.warn(TAG, '已有过渡动画在进行中'); return; } this.isTransitioning = true; this.currentMode = TransitionMode.OPEN; this.pending...
https://github.com/DaLongZhuaZi/manxia
254b49839102a97311c2d95b9ce7cc3ae6f0d8bf
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Tracking/trackers/SuwayomiTracker.ets
arkts
testConnection
测试服务器连接
public async testConnection(): Promise<boolean> { try { if (!this.config.serverUrl) { return false; } // 使用简单的 introspection 查询测试连接 const query = `query { __typename }`; const response = await this.executeGraphQL(query); return !!response; } catch (error) { t...
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 testConnection AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:...
public async testConnection(): Promise<boolean> { try { if (!this.config.serverUrl) { return false; } // 使用简单的 introspection 查询测试连接 const query = `query { __typename }`; const response = await this.executeGraphQL(query); return !!response; } catch (error) { t...
https://github.com/DaLongZhuaZi/manxia
128d59c9c6ff5f8d071be761c6e60b1470a3f7dd
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Utils/FontNameParser.ets
arkts
decodeMacRoman
解码Mac Roman字符串
function decodeMacRoman(data: Uint8Array): string { // Mac Roman到Unicode的映射表 (0x80-0xFF) const macRomanToUnicode: number[] = [ 0x00C4, 0x00C5, 0x00C7, 0x00C9, 0x00D1, 0x00D6, 0x00DC, 0x00E1, 0x00E0, 0x00E2, 0x00E4, 0x00E3, 0x00E5, 0x00E7, 0x00E9, 0x00E8, 0x00EA, 0x00EB, 0x00ED, 0x00EC, 0x00EE, 0x00EF, 0...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left decodeMacRoman AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left data AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#R...
function decodeMacRoman(data: Uint8Array): string { // Mac Roman到Unicode的映射表 (0x80-0xFF) const macRomanToUnicode: number[] = [ 0x00C4, 0x00C5, 0x00C7, 0x00C9, 0x00D1, 0x00D6, 0x00DC, 0x00E1, 0x00E0, 0x00E2, 0x00E4, 0x00E3, 0x00E5, 0x00E7, 0x00E9, 0x00E8, 0x00EA, 0x00EB, 0x00ED, 0x00EC, 0x00EE, 0x00EF, 0...
https://github.com/DaLongZhuaZi/manxia
7e4cd570ffc79c4baf4922b59136165a1c8c122d
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/ComputerManager.ets
arkts
tryPollAddress
尝试通过单个地址轮询
private async tryPollAddress(address: string, computer: ComputerInfo): Promise<PollResult> { try { const nvHttp = NvHttp.fromAddress(address, computer, this.context || undefined); const likelyOnline = computer.state === ComputerState.ONLINE && address === computer.address; const serverInfo = awa...
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 tryPollAddress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left address AST#identifier#Right AST#ERROR#Left AST#:#Lef...
private async tryPollAddress(address: string, computer: ComputerInfo): Promise<PollResult> { try { const nvHttp = NvHttp.fromAddress(address, computer, this.context || undefined); const likelyOnline = computer.state === ComputerState.ONLINE && address === computer.address; const serverInfo = awa...
https://github.com/AlkaidLab/moonlight-harmony
0ff32951842440c6a6643265be0c7c19f1bb9933
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/utils/CryptoUtil.ets
arkts
sha256
SHA-256 哈希
static async sha256(data: Uint8Array): Promise<Uint8Array> { const md = cryptoFramework.createMd('SHA256'); const blob = CryptoUtil.createDataBlob(data); await md.update(blob); const result = await md.digest(); return new Uint8Array(result.data); }
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 sha256 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Righ...
static async sha256(data: Uint8Array): Promise<Uint8Array> { const md = cryptoFramework.createMd('SHA256'); const blob = CryptoUtil.createDataBlob(data); await md.update(blob); const result = await md.digest(); return new Uint8Array(result.data); }
https://github.com/AlkaidLab/moonlight-harmony
fc53d5248fe3726cef13db42c861e7cfd900be2f
github
LJ666-ui/harmony-health-care
entry/src/main/ets/common/utils/TokenManager.ets
arkts
clearUserToken
清除普通用户Token
static clearUserToken() { SettingsUtil.delete('token'); SettingsUtil.put('isLoggedIn', false); SettingsUtil.delete('userInfo'); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left clearUserToken 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 ...
static clearUserToken() { SettingsUtil.delete('token'); SettingsUtil.put('isLoggedIn', false); SettingsUtil.delete('userInfo'); }
https://github.com/LJ666-ui/harmony-health-care
d55e5b2c2fbfd2aefa5197d04b914527398e7a93
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
valueOf
Returns the object itself @returns { Int8Array } @syscap SystemCapability.Utils.Lang @FaAndStageModel
public valueOf(): Int8Array { return this }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left valueOf 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 Int8Array AST#...
public valueOf(): Int8Array { return this }
https://gitcode.com/iop123123/arkts-static-skills
bdf98769d084c6edad5f8cc27901a41fe96455c2
gitcode
azhu0001/localsend-harmony
entry/src/main/ets/utils/Dates.ets
arkts
consumed
返回当前时间戳与给定的时间戳相差的时间 @param mill @returns
static consumed(mill: number): number { return new Date().getTime() - mill }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left consumed AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left mill AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number ...
static consumed(mill: number): number { return new Date().getTime() - mill }
https://gitcode.com/azhu0001/localsend-harmony
d6c3bdaf9054a52064c3a233110596345e2524a4
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/usbdriver/Dualshock4Controller.ets
arkts
handleRead
处理输入报告 https://www.psdevwiki.com/ps4/DS4-USB 参考
protected handleRead(buffer: Uint8Array): boolean { if (buffer.length < 64) { console.warn(`${TAG} 数据太短: ${buffer.length}`); return false; } // 检查报告 ID (0x01=USB, 0x11=Bluetooth) const reportId = buffer[0]; if (reportId !== 0x01 && reportId !== 0x11) { return false; } ...
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left handleRead AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left buffer AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier...
protected handleRead(buffer: Uint8Array): boolean { if (buffer.length < 64) { console.warn(`${TAG} 数据太短: ${buffer.length}`); return false; } // 检查报告 ID (0x01=USB, 0x11=Bluetooth) const reportId = buffer[0]; if (reportId !== 0x01 && reportId !== 0x11) { return false; } ...
https://github.com/AlkaidLab/moonlight-harmony
21981a92438ee073c92e6ad815c0007f588c5e25
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/utils/CryptoUtil.ets
arkts
asn1Integer
构造 ASN.1 INTEGER
private static asn1Integer(value: Uint8Array): Uint8Array { // 如果最高位是 1,需要添加前导 0 let data = value; if (value.length > 0 && (value[0] & 0x80) !== 0) { data = new Uint8Array(value.length + 1); data[0] = 0; data.set(value, 1); } const len = CryptoUtil.encodeAsn1Length(data.length); ...
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 asn1Integer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : ...
private static asn1Integer(value: Uint8Array): Uint8Array { // 如果最高位是 1,需要添加前导 0 let data = value; if (value.length > 0 && (value[0] & 0x80) !== 0) { data = new Uint8Array(value.length + 1); data[0] = 0; data.set(value, 1); } const len = CryptoUtil.encodeAsn1Length(data.length); ...
https://github.com/AlkaidLab/moonlight-harmony
dc0ac6347a09fed31f8a38f4a3f7e1a0a5234479
github
LJ666-ui/harmony-health-care
entry/src/main/ets/utils/NavigationManager.ets
arkts
navigateTo
页面跳转(无参数) @param url 目标页面路径 @returns Promise<void>
public async navigateTo(url: string): Promise<void> { const startTime = Date.now(); try { // 验证路由路径 if (!this.validateRoute(url)) { throw NavigationErrorHandler.createRouteNotFoundError(url); } // 记录导航开始 this.logNavigation('NAVIGATE_TO', url); // 执行跳转 await...
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 navigateTo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#R...
public async navigateTo(url: string): Promise<void> { const startTime = Date.now(); try { // 验证路由路径 if (!this.validateRoute(url)) { throw NavigationErrorHandler.createRouteNotFoundError(url); } // 记录导航开始 this.logNavigation('NAVIGATE_TO', url); // 执行跳转 await...
https://github.com/LJ666-ui/harmony-health-care
39be5c3a25f8f7b2e1b3de00db409bed7c6be5e3
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/DeviceSensorService.ets
arkts
setControllerNumber
设置绑定的控制器编号
setControllerNumber(controllerNumber: number): void { this.controllerNumber = controllerNumber; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setControllerNumber AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left controllerNumber AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#...
setControllerNumber(controllerNumber: number): void { this.controllerNumber = controllerNumber; }
https://github.com/AlkaidLab/moonlight-harmony
083939334935f68b27a14f24b8e859415c23c9cf
github
qiuhaotc/Sunshine_HarmonyOS
entry/src/main/ets/calculator/AdvancedSunshineCalculator.ets
arkts
rayHitBox
射线与建筑物包围盒相交测试
private rayHitBox( origin: Point3D, dirX: number, dirY: number, dirZ: number, building: BuildingModel ): boolean { // 转换到建筑物局部坐标系 const angle = -building.rotationDeg * Math.PI / 180; const cosA = Math.cos(angle); const sinA = Math.sin(angle); // 将原点转换到局部坐标 const dx =...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left rayHitBox AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left origin AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left P...
private rayHitBox( origin: Point3D, dirX: number, dirY: number, dirZ: number, building: BuildingModel ): boolean { // 转换到建筑物局部坐标系 const angle = -building.rotationDeg * Math.PI / 180; const cosA = Math.cos(angle); const sinA = Math.sin(angle); // 将原点转换到局部坐标 const dx =...
https://github.com/qiuhaotc/Sunshine_HarmonyOS
58f0264eea7b970cf2c175110749a82f8b33698e
github
Joker-x-dev/CoolMallArkTS
core/data/src/main/ets/repository/AuthRepository.ets
arkts
getCaptcha
获取图片验证码 @returns {Promise<NetworkResponse<Captcha>>} 图片验证码
async getCaptcha(): Promise<NetworkResponse<Captcha>> { return this.networkDataSource.getCaptcha(); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getCaptcha AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_t...
async getCaptcha(): Promise<NetworkResponse<Captcha>> { return this.networkDataSource.getCaptcha(); }
https://github.com/Joker-x-dev/CoolMallArkTS
a48b24e02bbbf9d90473b8fda013dd9833537306
github
HarmonyOS_Samples/BestPracticeSnippets
OptimizationAppMemoryUsage/entry/src/main/ets/utils/LRUCacheUtil.ets
arkts
getCapacity
Get the capacity of lruCache
public getCapacity(): number { return this.lruCache.getCapacity(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCapacity 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#num...
public getCapacity(): number { return this.lruCache.getCapacity(); }
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
5611b78e0ccd9f5e52b0418b20f0f0d5c0598f1c
gitcode
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/SharedLedgerService.ets
arkts
getSharedBillById
获取共享账单详情
static async getSharedBillById(billId: number): Promise<SharedBill | null> { try { return await SharedBillDAO.getById(billId); } catch (error) { console.error('[SharedLedgerService] 获取账单详情失败:', error); return null; } }
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 getSharedBillById AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left billId AST#identifier#Right AST#:#Left...
static async getSharedBillById(billId: number): Promise<SharedBill | null> { try { return await SharedBillDAO.getById(billId); } catch (error) { console.error('[SharedLedgerService] 获取账单详情失败:', error); return null; } }
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
6b818b7a7889409ee6e9306755e9ff8e03a113b8
github
wuba/omni-ui
omni_component/src/main/ets/components/guide/model/GuidePage.ets
arkts
getBubbleIndicator
获取当前引导页的气泡指示器 @returns HighLightBubbleIndicator
public getBubbleIndicator(): BubbleIndicator | null { return this.bubbleIndicator; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getBubbleIndicator 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#binary_expression#L...
public getBubbleIndicator(): BubbleIndicator | null { return this.bubbleIndicator; }
https://github.com/wuba/omni-ui
1dfb033070597b45267563bb299e11b020aef03f
github
DaLongZhuaZi/manxia
entry/src/main/ets/pages/MainMenuPage.ets
arkts
openEBookReaderWithComponentId
打开电子书阅读器(带翻开动画)- 通用方法 @param ebook 电子书对象 @param componentId 封面组件ID
private openEBookReaderWithComponentId(ebook: EBook, componentId: string): void { logger.info(TAG, `打开电子书阅读器: ${ebook.metadata.title}`); const coverPath: string = this.getEBookTransitionCoverPath(ebook); const readerParams: EBookReaderParams = { bookId: ebook.id, coverComponentId: componentId...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left openEBookReaderWithComponentId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ebook AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right A...
private openEBookReaderWithComponentId(ebook: EBook, componentId: string): void { logger.info(TAG, `打开电子书阅读器: ${ebook.metadata.title}`); const coverPath: string = this.getEBookTransitionCoverPath(ebook); const readerParams: EBookReaderParams = { bookId: ebook.id, coverComponentId: componentId...
https://github.com/DaLongZhuaZi/manxia
68e462a285f918fa249196314c2de248aecc5799
github
richshaw2015/nds
ohos/entry/src/test/DependencyRelations.test.ets
arkts
calculateSoundDependentDisabledState
计算声音依赖设置的禁用状态 Requirements: 8.2 @param soundEnabled 声音是否启用 @returns 依赖设置的禁用状态
function calculateSoundDependentDisabledState(soundEnabled: boolean): Record<string, boolean> { return { 'audio_interpolation': !soundEnabled, 'audio_bitrate': !soundEnabled, 'volume': !soundEnabled, 'audio_latency': !soundEnabled }; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left calculateSoundDependentDisabledState AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left soundEnabled AST#identifier#Right AST#type_annota...
function calculateSoundDependentDisabledState(soundEnabled: boolean): Record<string, boolean> { return { 'audio_interpolation': !soundEnabled, 'audio_bitrate': !soundEnabled, 'volume': !soundEnabled, 'audio_latency': !soundEnabled }; }
https://github.com/richshaw2015/nds
37872f1f2d41f9bb2f9cf0d6be513ad7503b4fa5
github
openharmony/applications_mms
entry/src/main/ets/utils/TelephoneUtil.ets
arkts
judgeIsInfoMsg
Check whether the mobile number is notification information. @param telephone @return Yes or no
judgeIsInfoMsg(telephone: string): boolean { let result: boolean = false; if (telephone == null || telephone == common.string.EMPTY_STR) { return result; } for (let item of infoMegTelephone) { if (telephone.indexOf(item) == 0) { result = true; ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left judgeIsInfoMsg AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left telephone AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST...
judgeIsInfoMsg(telephone: string): boolean { let result: boolean = false; if (telephone == null || telephone == common.string.EMPTY_STR) { return result; } for (let item of infoMegTelephone) { if (telephone.indexOf(item) == 0) { result = true; ...
https://gitee.com/openharmony/applications_mms.git
0111496b2fba394e09ec6bbf926e648a06ffed85
gitee
openharmony/applications_settings
product/phone/src/main/ets/pages/bluetooth.ets
arkts
getConnectionStateText
Get connection state text @param device
getConnectionStateText(device: BluetoothDevice): string { let stateText: string = ''; switch (device.connectionState) { case ProfileConnectionState.STATE_DISCONNECTED: stateText = ''; break; case ProfileConnectionState.STATE_CONNECTING: stateText = JSON.parse(JSON.stringif...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getConnectionStateText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left device AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left BluetoothDevice AST#identifier#...
getConnectionStateText(device: BluetoothDevice): string { let stateText: string = ''; switch (device.connectionState) { case ProfileConnectionState.STATE_DISCONNECTED: stateText = ''; break; case ProfileConnectionState.STATE_CONNECTING: stateText = JSON.parse(JSON.stringif...
https://gitee.com/openharmony/applications_settings.git
70b6632f4b9ee57355dabbc43cce2297e01e8c9f
gitee
CLMC2025/Vignette
entry/src/main/ets/database/repositories/WordRepository.ets
arkts
getNewWords
Get new words
async getNewWords(limit: number, excludeWord: string): Promise<WordItem[]> { this.ensureInitialized(); const predicates = new relationalStore.RdbPredicates(TABLE_WORDS); predicates.notEqualTo(WordColumns.WORD, excludeWord) .and() .equalTo(WordColumns.STATUS, WordStatus.NEW) .orderByAsc(...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getNewWords AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left limit ...
async getNewWords(limit: number, excludeWord: string): Promise<WordItem[]> { this.ensureInitialized(); const predicates = new relationalStore.RdbPredicates(TABLE_WORDS); predicates.notEqualTo(WordColumns.WORD, excludeWord) .and() .equalTo(WordColumns.STATUS, WordStatus.NEW) .orderByAsc(...
https://github.com/CLMC2025/Vignette
e391025b2dd38924234b035883262eceeaeab6e2
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/LinkedBlockingQueue.ets
arkts
constructor
Constructs a LinkedBlockingQueue with the Iterable. @param { int } capacity the capacity of LinkedBlockingQueue @param { Iterable<T> } iterable the Iterable of LinkedBlockingQueue
constructor(capacity: int, iterable: Iterable<T>) { if (capacity <= 0) { throw new RangeError("LinkedBlockingQueue:: Invalid capacity"); } this.actualCapacity = capacity; this.head = new ListNode<T>(); this.tail = this.head; ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left capacity AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#Right AST#ERROR#Right ...
constructor(capacity: int, iterable: Iterable<T>) { if (capacity <= 0) { throw new RangeError("LinkedBlockingQueue:: Invalid capacity"); } this.actualCapacity = capacity; this.head = new ListNode<T>(); this.tail = this.head; ...
https://gitcode.com/iop123123/arkts-static-skills
35a24be54ae8ff5a4ee2182ed0b3e075f831133f
gitcode
HarmonyOS_Samples/StateStore
entry/src/main/ets/components/TodoItem.ets
arkts
build
[EndExclude todo_list_item]
build() { Row({ space: 8 }) { Checkbox({ name: 'checkbox1', group: 'checkboxGroup' }) .select(this.itemData.selected) .shape(CheckBoxShape.CIRCLE) .onChange((_value) => { // The child component changes the global state by sending a CompleteTodoItem event through the dispatc...
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() { Row({ space: 8 }) { Checkbox({ name: 'checkbox1', group: 'checkboxGroup' }) .select(this.itemData.selected) .shape(CheckBoxShape.CIRCLE) .onChange((_value) => { // The child component changes the global state by sending a CompleteTodoItem event through the dispatc...
https://gitcode.com/HarmonyOS_Samples/StateStore
2d4af97044256bcb9393826d3257c5a96682823f
gitcode
HarmonyOS_Samples/MusicHome
features/player/src/main/ets/view/PlaybackPage.ets
arkts
clampRgbByte
Clamps a numeric RGB channel to an integer byte in [0, 255].
function clampRgbByte(n: number): number { if (!Number.isFinite(n)) { return 0; } return Math.max(0, Math.min(255, Math.floor(n))); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left clampRgbByte AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left n AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right ...
function clampRgbByte(n: number): number { if (!Number.isFinite(n)) { return 0; } return Math.max(0, Math.min(255, Math.floor(n))); }
https://gitcode.com/HarmonyOS_Samples/MusicHome
8926ad57d66a06466a7908f7656f448d53eaaada
gitcode
cduestc-course/ArkLearn
entry/src/main/ets/pages/08/8.2.1.2.ets
arkts
getData
1.创建任务
@Concurrent async function getData(params1: string, params2: string) { await new Promise<boolean>((resolve) => { setTimeout(() => { return resolve(true) }, 1000) }) // 线程内无法通信,会阻塞await // getContext().eventHub.emit('taskpool') // 跨线程通信可以成功 emitter.emit('taskpool') return params1 + params2 + ...
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Concurrent AST#identifier#Right AST#decorator#Right AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left getData AST#identifier#Right AST#formal_parameters#Lef...
@Concurrent async function getData(params1: string, params2: string) { await new Promise<boolean>((resolve) => { setTimeout(() => { return resolve(true) }, 1000) }) // 线程内无法通信,会阻塞await // getContext().eventHub.emit('taskpool') // 跨线程通信可以成功 emitter.emit('taskpool') return params1 + params2 + ...
https://github.com/cduestc-course/ArkLearn
7fc87c4e668667e2534137431af096e47814812a
github
aimilin6688/KeePassHO
entry/src/main/ets/workers/DatabaseLoad.ets
arkts
handleLoadDatabase
加载数据库 @param request 请求参数 @param callback 回调
async handleLoadDatabase(request: LoadDatabase, callback?: KdbxLoadServiceCallback): Promise<void> { try { this.postMessage($r('app.string.creating_key'), callback?.onLoadMessage); // 创建凭证 let credentials: KdbxCredentials = await CredentialsService.createKdbxCredentials(request); this.post...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left handleLoadDatabase AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left request AST#identifier#Right AST#type_annotation#Left AST#:#...
async handleLoadDatabase(request: LoadDatabase, callback?: KdbxLoadServiceCallback): Promise<void> { try { this.postMessage($r('app.string.creating_key'), callback?.onLoadMessage); // 创建凭证 let credentials: KdbxCredentials = await CredentialsService.createKdbxCredentials(request); this.post...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/workers/DatabaseLoad.ets#L20-L40
334dab4734edbd61611a5fbfd694901f55944bb3
github
Joker-x-dev/CoolMallArkTS
core/designsystem/src/main/ets/component/Column.ets
arkts
build
渲染布局 @returns {void} 无返回值 @example ColumnSpaceAround() { Text("A"); Text("B"); Text("C"); }
build(): void { ColumnBase({ options: this.options, justifyContent: FlexAlign.SpaceAround, alignItems: HorizontalAlign.Center, widthValue: this.widthValue, heightValue: this.heightValue, sizeValue: this.sizeValue, paddingValue: this.paddingValue, marginValue: this.m...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#...
build(): void { ColumnBase({ options: this.options, justifyContent: FlexAlign.SpaceAround, alignItems: HorizontalAlign.Center, widthValue: this.widthValue, heightValue: this.heightValue, sizeValue: this.sizeValue, paddingValue: this.paddingValue, marginValue: this.m...
https://github.com/Joker-x-dev/CoolMallArkTS
3db6c82028b1a684a9feda3b7b6dba7a6f80c698
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.TreeMap.ets
arkts
entries
Return the elements in the TreeMap as an Iterator of [key, value]s @returns an Iterator of [key, value]s
override entries(): IterableIterator<[K, V]> { return this.mappedIterator<[K, V]>((e: TreeMapEntry<K, V>): [K, V] => [e.key, e.val]); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left override AST#identifier#Right AST#ERROR#Left AST#identifier#Left entries AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#R...
override entries(): IterableIterator<[K, V]> { return this.mappedIterator<[K, V]>((e: TreeMapEntry<K, V>): [K, V] => [e.key, e.val]); }
https://gitcode.com/iop123123/arkts-static-skills
95a55f38793340bfce7b114d99dc34a644c7deba
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets
arkts
setUTCHours
Sets the hour for a specified date according to universal time. @param { int } value new hours @param { int } min @param { int } sec @param { int } ms @returns { long } @syscap SystemCapability.Utils.Lang @FaAndStageModel
public setUTCHours(value: int, min: int, sec: int, ms: int): long { this.setUTCHours(value); this.setUTCMinutes(min); this.setUTCSeconds(sec); this.setUTCMilliseconds(ms); return this.ms; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setUTCHours AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#...
public setUTCHours(value: int, min: int, sec: int, ms: int): long { this.setUTCHours(value); this.setUTCMinutes(min); this.setUTCSeconds(sec); this.setUTCMilliseconds(ms); return this.ms; }
https://gitcode.com/iop123123/arkts-static-skills
2b3185f24fbea2872da9576496d92e693a36b921
gitcode
codelably/HCompass
entry/src/main/ets/entryability/AppInterceptors.ets
arkts
normalizeMethod
规范化请求方法
private normalizeMethod(method?: string): string { return method ? method.toUpperCase() : "UNKNOWN"; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left normalizeMethod AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left method AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ER...
private normalizeMethod(method?: string): string { return method ? method.toUpperCase() : "UNKNOWN"; }
https://github.com/codelably/HCompass
d281c5fcc10e3a7c23be2785c54b734b5acbb07c
github
2763981847/Accounting-app
entry/src/main/ets/common/database/tables/AccountTable.ets
arkts
constructor
类构造函数,用于初始化数据库表
constructor(callback: Function = () => { }) { // 获取数据库表的 RdbStore 对象,并调用回调函数 this.accountTable.getRdbStore(callback); }
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 callback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#identifier...
constructor(callback: Function = () => { }) { // 获取数据库表的 RdbStore 对象,并调用回调函数 this.accountTable.getRdbStore(callback); }
https://github.com/2763981847/Accounting-app
4c2c124e3c786998464b958800c4db221c4ac8e2
github
YANGZX22/Voot
entry/src/main/ets/services/PipSubtitleManager.ets
arkts
getOptimalPipWidth
根据设备类型获取最佳 PiP 窗口宽度 平板设备使用更宽的窗口
private getOptimalPipWidth(): number { const type = deviceInfo.deviceType; // deviceType: 'phone', 'tablet', '2in1', 'default' 等 if (type === 'tablet' || type === '2in1') { // 平板和2合1设备使用更宽的窗口 return 800; } // 手机使用默认宽度 return 400; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getOptimalPipWidth 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 numb...
private getOptimalPipWidth(): number { const type = deviceInfo.deviceType; // deviceType: 'phone', 'tablet', '2in1', 'default' 等 if (type === 'tablet' || type === '2in1') { // 平板和2合1设备使用更宽的窗口 return 800; } // 手机使用默认宽度 return 400; }
https://github.com/YANGZX22/Voot
9674a7436db7129dda1d054a3972db94a7d7a704
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/String.ets
arkts
hashCode
Computes the hashcode for this String. @returns hashcode value of this String
public override hashCode(): int { let hash: int = 0; for (let i: int = 0; i < this.length(); i++) { hash = 31 * hash + (this.charAt(i) as int); } return hash; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left hashCode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Le...
public override hashCode(): int { let hash: int = 0; for (let i: int = 0; i < this.length(); i++) { hash = 31 * hash + (this.charAt(i) as int); } return hash; }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
85aaf14080e39f8f9b298fb64f1b8acbda552ad6
gitee
LZZLHY/hlib
entry/src/main/ets/utils/AppRouter.ets
arkts
popTo
出栈到指定路由名。
static popTo(name: string): void { const s: NavPathStack | null = AppRouter.stack; if (s === null) { return; } try { s.popToName(name); } catch (e) { Logger.w(TAG, `popTo(${name}) failed: ${(e as Error).message}`); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left popTo AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERR...
static popTo(name: string): void { const s: NavPathStack | null = AppRouter.stack; if (s === null) { return; } try { s.popToName(name); } catch (e) { Logger.w(TAG, `popTo(${name}) failed: ${(e as Error).message}`); } }
https://github.com/LZZLHY/hlib
3086ab5066fbf8ee35d71c983baaf3a53ac31429
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/String.ets
arkts
fontcolor
The fontcolor() method creates a string that embeds a string in a <font> element (<font color="...">str</font>), which causes a string to be displayed in the specified font color.
public fontcolor(color: String): String{ return this.CreateHTMLString("font", " color=\"" + color + "\"") }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left fontcolor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left color AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Strin...
public fontcolor(color: String): String{ return this.CreateHTMLString("font", " color=\"" + color + "\"") }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
38f649e2838a69e1e1c57428431b86aa1afe5724
gitee
apap6628114/nga_oh
entry/src/main/ets/common/concurrency/RequestQueue.ets
arkts
done
标记一个任务完成:活跃数减一,并尽可能唤醒队首等待者。 必须在 {@link schedule} 投递的任务结束时(无论成功/失败)调用一次, 以保证后续排队任务得以执行。
done(): void { this.activeCount--; while (this.requestQueue.length > 0 && this.activeCount < this.maxConcurrent) { const next: (() => void) | undefined = this.requestQueue.shift(); if (next) { this.activeCount++; next(); } } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left done AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left AS...
done(): void { this.activeCount--; while (this.requestQueue.length > 0 && this.activeCount < this.maxConcurrent) { const next: (() => void) | undefined = this.requestQueue.shift(); if (next) { this.activeCount++; next(); } } }
https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/common/concurrency/RequestQueue.ets#L52-L61
1aaada4a7dd15dd78f20c2153552ecfcbb05904a
github
Yebingiscn/SweetVideo
entry/src/main/ets/utils/BiometricAccessUtil.ets
arkts
startUserAuth
6.发起原生用户生物认证检测
static startUserAuth(): Promise<boolean> { return new Promise((resolve) => { if (canIUse('SystemCapability.UserIAM.UserAuth.Core')) { let userAuthInstance: userAuth.UserAuthInstance | null = null try { // 生成随机挑战值,增强安全性 const challenge = new Uint8Array(16) for (l...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left startUserAuth 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...
static startUserAuth(): Promise<boolean> { return new Promise((resolve) => { if (canIUse('SystemCapability.UserIAM.UserAuth.Core')) { let userAuthInstance: userAuth.UserAuthInstance | null = null try { // 生成随机挑战值,增强安全性 const challenge = new Uint8Array(16) for (l...
https://github.com/Yebingiscn/SweetVideo
c7b3bb1c52c8ebe9a4c590e3bf59e25353b136e8
github
arkui-x/samples
CodeLab/Cases/feature/bluetooth/src/main/ets/viewmodel/AdvertiserBluetoothViewModel.ets
arkts
disableBluetooth
关闭蓝牙功能
disableBluetooth(): void { Log.showInfo(TAG, `disableBluetooth`); try { this.offBTStateChange(); access.disableBluetooth(); } catch (err) { Log.showError(TAG, `disableBluetooth: err = ${err}`); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left disableBluetooth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_b...
disableBluetooth(): void { Log.showInfo(TAG, `disableBluetooth`); try { this.offBTStateChange(); access.disableBluetooth(); } catch (err) { Log.showError(TAG, `disableBluetooth: err = ${err}`); } }
https://gitcode.com/arkui-x/samples
a61933d3390f277194765fac4bf623f8b8872692
gitcode
StarHeartY/CalculatorX
entry/src/main/ets/utils/HapticUtils.ets
arkts
playVibration
触发按键触感反馈 @param action 按键的 actionId @param hapticFeedback 是否开启触感反馈 @param vibrationCurve 振动风格 (0:自动, 1:清脆, 2:轻柔, 3:厚重)
public static playVibration(action: string, hapticFeedback: boolean, vibrationCurve: number): void { // 1. 判断“触感反馈”总开关是否打开 if (!hapticFeedback) return; let effectId = 'haptic.effect.sharp'; // 声明默认效果 if (vibrationCurve === 0) { // 自动模式(基于按键类型的差异化震动) if (action === '=' || action === 'AC' ...
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 playVibration AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left action AST#identifier#Right AST#:#Left : ...
public static playVibration(action: string, hapticFeedback: boolean, vibrationCurve: number): void { // 1. 判断“触感反馈”总开关是否打开 if (!hapticFeedback) return; let effectId = 'haptic.effect.sharp'; // 声明默认效果 if (vibrationCurve === 0) { // 自动模式(基于按键类型的差异化震动) if (action === '=' || action === 'AC' ...
https://github.com/StarHeartY/CalculatorX
c341245dd6c18cd1de2a6ab7dae6ecf1896c7fb0
github
codelably/HCompass
packages/auth/src/main/ets/services/AuthRepositoryImpl.ets
arkts
refreshToken
刷新 Token @param {Record<string, string>} params - 刷新参数 @returns {Promise<NetworkResult<Auth>>} 刷新后的认证信息
async refreshToken(params: Record<string, string>): Promise<NetworkResult<Auth>> { return this.networkDataSource.refreshToken(params); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left refreshToken AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left params AST#identifier#Right AST#type_annotation#Left AST#:#Left : ...
async refreshToken(params: Record<string, string>): Promise<NetworkResult<Auth>> { return this.networkDataSource.refreshToken(params); }
https://github.com/codelably/HCompass
89ac435b18192b7c02550c3817b5fe1bf11ab818
github
arkui-x/samples
CodeLab/Cases/feature/foldablescreencases/src/main/ets/model/AVSessionModel.ets
arkts
setSessionInfo
设置AVSession实例初始化数据和状态 @param {MusicModel | undefined} musicModel 歌曲数据 @returns {Promise<void>}
async setSessionInfo(musicModel?: MusicModel): Promise<void> { const resourceManager = this.bindContext!.resourceManager; const coverUInt8Arr: Uint8Array = await resourceManager.getRawFileContent(musicModel?.cover!); const imageBuffer: ArrayBuffer = coverUInt8Arr.buffer as ArrayBuffer; const imageSour...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left setSessionInfo AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#optional_parameter#Left AST#identifier#Left musicModel AST#identifier#Right AST#?#Left ? AST#?#Right AST#typ...
async setSessionInfo(musicModel?: MusicModel): Promise<void> { const resourceManager = this.bindContext!.resourceManager; const coverUInt8Arr: Uint8Array = await resourceManager.getRawFileContent(musicModel?.cover!); const imageBuffer: ArrayBuffer = coverUInt8Arr.buffer as ArrayBuffer; const imageSour...
https://gitcode.com/arkui-x/samples
689e8c7f1ddcaf530ec3e0dc04a7488e71f6ddf7
gitcode
Tencent-RTC/TUIKit_Harmony
atomic_x/src/main/ets/messagelist/utils/TranslationDisplayManager.ets
arkts
expand
Expand (show) translation bubble for a message in this session. With hidden-set semantics, this means removing from hidden set.
expand(messageID: string | undefined): void { if (!messageID || messageID.length === 0) { return; } if (this.hiddenMessageIDs.has(messageID)) { this.hiddenMessageIDs.delete(messageID); this.version++; // Trigger UI update console.log(`[TranslationDisplayManager] 👁️ Show translatio...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left expand AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#identifier#Left messageID AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Rig...
expand(messageID: string | undefined): void { if (!messageID || messageID.length === 0) { return; } if (this.hiddenMessageIDs.has(messageID)) { this.hiddenMessageIDs.delete(messageID); this.version++; // Trigger UI update console.log(`[TranslationDisplayManager] 👁️ Show translatio...
https://github.com/Tencent-RTC/TUIKit_Harmony
ead14977c8d21ccd8fcf0aa311ae1d2879226aa3
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets
arkts
of
Returns Type of value @param {char} v value @returns {Type} Type instance of this value @static @syscap SystemCapability.Utils.Lang @FaAndStageModel
public static of(v: char): Type { return CharType.VAL }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#of#Left of AST#of#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left v AST#identifier#Right AST#:#...
public static of(v: char): Type { return CharType.VAL }
https://gitcode.com/iop123123/arkts-static-skills
8735e54e1209db3985cb5eb838c2286d2f1a24f6
gitcode
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test7_original_index.ets
arkts
testInt32Array
=== Round 7: TypedArrays, Optional Chaining, Nullish Coalescing, Interface impl, Map/Set iteration, Type assertion (as) === --- TypedArray patterns ---
function testInt32Array(): number { let arr: Int32Array = new Int32Array(4); arr[0] = 10; arr[1] = 20; arr[2] = 30; arr[3] = 40; let sum: number = 0; for (let i: number = 0; i < arr.length; i++) { sum = sum + arr[i]; } return sum; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testInt32Array AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_t...
function testInt32Array(): number { let arr: Int32Array = new Int32Array(4); arr[0] = 10; arr[1] = 20; arr[2] = 30; arr[3] = 40; let sum: number = 0; for (let i: number = 0; i < arr.length; i++) { sum = sum + arr[i]; } return sum; }
https://github.com/miaochiahao/ark-ghidra
f8134052ea8e62a4b53285b7afb9f5319fcccf7c
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebDAV/WebDAVNativeClient.ets
arkts
putFileContents
上传文件内容 (PUT)
async putFileContents(remotePath: string, data: string): Promise<WebDAVNativeResult> { if (!this.initialized) { await this.initialize(); } try { logger.info(TAG, `上传文件内容: ${remotePath}, size=${data.length}`); const result: WebDAVNativeResult = getNativeModule().putFileContents(remot...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left putFileContents AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left remotePath AST#identifier#Rig...
async putFileContents(remotePath: string, data: string): Promise<WebDAVNativeResult> { if (!this.initialized) { await this.initialize(); } try { logger.info(TAG, `上传文件内容: ${remotePath}, size=${data.length}`); const result: WebDAVNativeResult = getNativeModule().putFileContents(remot...
https://github.com/DaLongZhuaZi/manxia
6e0e8dae4757c612be379ae6b66dda4482408c9e
github
HarmonyOS_Samples/sample_in_harmonyos
common/src/main/ets/widget/ActionUtils.ets
arkts
jumpToPage
this function call up main app with a want and designate a target tab page to jump to
jumpToPage(component: Object, tabBarType: TabBarType = TabBarType.SAMPLE) { let shorCutKey: ShortCutKey = ShortCutKey.COMPONENT_LIST; switch (tabBarType) { case TabBarType.HOME: shorCutKey = ShortCutKey.COMPONENT_LIST; break; case TabBarType.SAMPLE: shorCutKey = ShortCutKey...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left jumpToPage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left component AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Object AST#identifier#Right AST#ERROR#Rig...
jumpToPage(component: Object, tabBarType: TabBarType = TabBarType.SAMPLE) { let shorCutKey: ShortCutKey = ShortCutKey.COMPONENT_LIST; switch (tabBarType) { case TabBarType.HOME: shorCutKey = ShortCutKey.COMPONENT_LIST; break; case TabBarType.SAMPLE: shorCutKey = ShortCutKey...
https://gitcode.com/HarmonyOS_Samples/sample_in_harmonyos
dfbff798a4eda28833d6d6394fae145604a01968
gitcode
751496032/ZRouter
RouterApi/src/main/ets/api/Router.ets
arkts
getActiveRouteInfos
获取已入路由栈的所有页面 @param listener
public static getActiveRouteInfos(stackName: string = DEFAULT_STACK_NAME): RouteItem[] { return ZRouter.getInstance(stackName) .getAllPathName() .map((name) => { const target = runCatching<RouteItem>(() => { return ZRouter.routerMap[name] }).getOrNull() return target ...
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 getActiveRouteInfos AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left stackName AST#identifier#Right AST#...
public static getActiveRouteInfos(stackName: string = DEFAULT_STACK_NAME): RouteItem[] { return ZRouter.getInstance(stackName) .getAllPathName() .map((name) => { const target = runCatching<RouteItem>(() => { return ZRouter.routerMap[name] }).getOrNull() return target ...
https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/api/Router.ets#L99-L108
ee344a12e7604ee4e44bac0a6e904e3639836603
github
Mydstiny/RemoteDeskHarmonyOS
entry/src/main/ets/services/ExtensionLoader.ets
arkts
setOnDataCallback
注册推送式 SSH 数据回调. 后台 reader 线程读到数据后立即触发 cb(data). 传 null 卸载.
setOnDataCallback(sessionId: number, cb: ((data: string) => void) | null): void { try { rdpnapi.setOnDataCallback(sessionId, cb); } catch (err) { hilog.error(DOMAIN, TAG, '[ExtensionLoader] setOnDataCallback: ' + JSON.stringify(err)); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setOnDataCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sessionId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , ...
setOnDataCallback(sessionId: number, cb: ((data: string) => void) | null): void { try { rdpnapi.setOnDataCallback(sessionId, cb); } catch (err) { hilog.error(DOMAIN, TAG, '[ExtensionLoader] setOnDataCallback: ' + JSON.stringify(err)); } }
https://github.com/Mydstiny/RemoteDeskHarmonyOS
df28c2643d0f8546244ed785082a64a6ddc35208
github
Joker-x-dev/CoolMallArkTS
feature/user/src/main/ets/viewmodel/AddressDetailViewModel.ets
arkts
refreshRegionDisplay
刷新省市区展示文本 @returns {void} 无返回值
private refreshRegionDisplay(): void { if (this.province && this.city && this.district) { this.regionDisplay = `${this.province} ${this.city} ${this.district}`; return; } this.regionDisplay = ""; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left refreshRegionDisplay 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 AS...
private refreshRegionDisplay(): void { if (this.province && this.city && this.district) { this.regionDisplay = `${this.province} ${this.city} ${this.district}`; return; } this.regionDisplay = ""; }
https://github.com/Joker-x-dev/CoolMallArkTS
b2d54ae7d8e730e99f7724e908160635456cfce8
github
Joker-x-dev/CoolMallArkTS
feature/goods/src/main/ets/viewmodel/GoodsCategoryViewModel.ets
arkts
applyFilters
应用筛选条件并刷新数据 @param {number[]} categoryIds - 分类 ID 列表 @param {string} minPrice - 最低价格 @param {string} maxPrice - 最高价格 @returns {void} 无返回值
applyFilters(categoryIds: number[], minPrice: string, maxPrice: string): void { this.selectedCategoryIds = [...categoryIds]; this.minPrice = minPrice; this.maxPrice = maxPrice; this.onRefresh(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left applyFilters AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left categoryIds AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#[#Left [ AST#[#Right AST#]#L...
applyFilters(categoryIds: number[], minPrice: string, maxPrice: string): void { this.selectedCategoryIds = [...categoryIds]; this.minPrice = minPrice; this.maxPrice = maxPrice; this.onRefresh(); }
https://github.com/Joker-x-dev/CoolMallArkTS
620db4fb537361f9f7de28d6fda63203fd5327e8
github
daugf2527/harmonyos-libretro-emulator
entry/src/main/ets/common/LibraryMetadataMigration.ets
arkts
normalizeRomFileKey
规范化 romFile 键(用于映射匹配)
function normalizeRomFileKey(romFile: string): string { return romFile.trim().toLowerCase() }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left normalizeRomFileKey AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left romFile AST#identifier#Right AST#type_annotation#Left AST#:#Left :...
function normalizeRomFileKey(romFile: string): string { return romFile.trim().toLowerCase() }
https://github.com/daugf2527/harmonyos-libretro-emulator
4d46f3ad2fd2c8eb06073285951f41271bf30649
github
openharmony/vendor_unionman
unionpi_tiger/sample_hzu/smartHome/src/main/ets/pages/light.ets
arkts
aboutToAppear
页面出现时执行的操作
aboutToAppear() { // 从 AppStorage 中获取 LED 状态和自动模式状态 const storedState = AppStorage.get<boolean>('isON'); const storedAutoMode = AppStorage.get<boolean>('isAutoMode'); console.log('从 AppStorage 获取的值: ' + storedState); this.isOn = storedState ?? false; this.isAutoMode = storedAutoMode ?? false; ...
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() { // 从 AppStorage 中获取 LED 状态和自动模式状态 const storedState = AppStorage.get<boolean>('isON'); const storedAutoMode = AppStorage.get<boolean>('isAutoMode'); console.log('从 AppStorage 获取的值: ' + storedState); this.isOn = storedState ?? false; this.isAutoMode = storedAutoMode ?? false; ...
https://gitee.com/openharmony/vendor_unionman.git
5d8ae1e7865339aee7c7847c0273966714b91367
gitee
GrassyUnknown/Health-Life-HarmonyOS-Next
entry/src/main/ets/entryability/EntryAbility.ets
arkts
onCreate
UIA实例
async onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) { GlobalContext.getContext().setObject('want', want); GlobalContext.getContext().setObject('launchParam', launchParam); RdbUtils.initDb(this.context, Const.RDB_NAME.dbName ? Const.RDB_NAME.dbName : ''); await RdbUtils.createDb(); ...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left onCreate AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left want AST#identifier#Right AST#type_annotation#Left AST#:#Left...
async onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) { GlobalContext.getContext().setObject('want', want); GlobalContext.getContext().setObject('launchParam', launchParam); RdbUtils.initDb(this.context, Const.RDB_NAME.dbName ? Const.RDB_NAME.dbName : ''); await RdbUtils.createDb(); ...
https://github.com/GrassyUnknown/Health-Life-HarmonyOS-Next
6062e5591bb9e93e68266e00a015297372498936
github
HarmonyOS_Samples/guide-snippets
ArkGraphics2D/Drawing/ArkTSGraphicsDraw/entry/src/main/ets/drawing/pages/ComplexEffect.ets
arkts
drawRenderNode
[Start arkts_graphics_draw_render_node]
function drawRenderNode(canvas: drawing.Canvas) { canvas.saveLayer(null, null); const brushCircle = new drawing.Brush(); const colorCircle: common2D.Color = {alpha: 255, red: 0, green: 0, blue: 255}; brushCircle.setColor(colorCircle); canvas.attachBrush(brushCircle); canvas.drawCircle(500, 500, 200); cons...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left drawRenderNode AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left canvas AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:...
function drawRenderNode(canvas: drawing.Canvas) { canvas.saveLayer(null, null); const brushCircle = new drawing.Brush(); const colorCircle: common2D.Color = {alpha: 255, red: 0, green: 0, blue: 255}; brushCircle.setColor(colorCircle); canvas.attachBrush(brushCircle); canvas.drawCircle(500, 500, 200); cons...
https://gitcode.com/HarmonyOS_Samples/guide-snippets
261492884fa4a6eaf8c2d03ae03199bcb6b4281b
gitcode
ZestBox-18/kitebook-frontend
commons/kite_utils/src/main/ets/utils/clog/Clog.ets
arkts
setSaveDir
设置日志保存目录 仅设置目录本身,不清空既有文件,也不更改落盘开关
public static setSaveDir(dir: string): void { Clog.SAVE_DIR = dir; }
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 setSaveDir AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dir AST#identifier#Right AST#:#Left : AST#:#...
public static setSaveDir(dir: string): void { Clog.SAVE_DIR = dir; }
https://github.com/ZestBox-18/kitebook-frontend
6fea551c57b3a6716ada09f943042c49909ebde9
github
openharmony/codelabs
ETSUI/PositioningDemo/entry/src/main/ets/service/PlanService.ets
arkts
getCompletedPlansCount
获取已完成计划数量
async getCompletedPlansCount(): Promise<number> { const plans = await this.getAllPlans(); return plans.filter(p => p.status === PlanStatus.COMPLETED).length; }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getCompletedPlansCount 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 A...
async getCompletedPlansCount(): Promise<number> { const plans = await this.getAllPlans(); return plans.filter(p => p.status === PlanStatus.COMPLETED).length; }
https://gitcode.com/openharmony/codelabs
9262cb84fa90e531871c78c1744cb5ef9940225f
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/CookieManager.ets
arkts
forceCaptureWebViewCookies
强制从WebView捕获Cookie(用于CF验证后强制刷新) 不检查现有Cookie,直接从WebView提取并保存
async forceCaptureWebViewCookies(sourceId: number, controller: webview.WebviewController | null, baseUrl: string): Promise<boolean> { let captured: boolean = false; let captureUrl: string = baseUrl ? baseUrl.trim() : ''; try { if (captureUrl.length === 0 && controller) { try { capt...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left forceCaptureWebViewCookies AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceId AST#identifier#Right AST#type_anno...
async forceCaptureWebViewCookies(sourceId: number, controller: webview.WebviewController | null, baseUrl: string): Promise<boolean> { let captured: boolean = false; let captureUrl: string = baseUrl ? baseUrl.trim() : ''; try { if (captureUrl.length === 0 && controller) { try { capt...
https://github.com/DaLongZhuaZi/manxia
69d410ee6ab396f22db3b7ca4aa6afd974689933
github
LongLiveY96/chatcube
entry/src/main/ets/services/AIApiService.ets
arkts
buildChatUrl
构建聊天 API URL
private buildChatUrl(config: AIApiConfig, model: string = '', forceChatCompletions: boolean = false): string { // 如果提供了自定义 apiPath,直接使用 if (config.apiPath && config.apiPath.trim() !== '') { return ApiUrlResolver.buildUrl(config.baseUrl, config.apiPath) } let baseUrl = config.baseUrl if (bas...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildChatUrl 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#Lef...
private buildChatUrl(config: AIApiConfig, model: string = '', forceChatCompletions: boolean = false): string { // 如果提供了自定义 apiPath,直接使用 if (config.apiPath && config.apiPath.trim() !== '') { return ApiUrlResolver.buildUrl(config.baseUrl, config.apiPath) } let baseUrl = config.baseUrl if (bas...
https://github.com/LongLiveY96/chatcube
8c1a69fbe2840f09e8cb5dc576adf11b5bfe372c
github
OHPG/FinSdk
emby/src/main/ets/network/EmbyApiClient.ets
arkts
getLoginHeader
登录请求 header:使用 X-Emby-Authorization(不含 Token)
private getLoginHeader(): Record<string, string> { return { 'Content-Type': 'application/json', 'Accept': 'application/json, application/octet-stream;q=0.9, */*;q=0.8', 'X-Emby-Authorization': this.buildEmbyAuthorization(false), 'User-Agent': `${this.clientInfo.name}/${this.clientInfo.vers...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getLoginHeader 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#expr...
private getLoginHeader(): Record<string, string> { return { 'Content-Type': 'application/json', 'Accept': 'application/json, application/octet-stream;q=0.9, */*;q=0.8', 'X-Emby-Authorization': this.buildEmbyAuthorization(false), 'User-Agent': `${this.clientInfo.name}/${this.clientInfo.vers...
https://github.com/OHPG/FinSdk
b21f4c5e3b7c574dd4962f39268c544a30846f45
github
DaLongZhuaZi/manxia
entry/src/main/ets/EntryAbility.ets
arkts
handleShortcutIntent
处理长按快捷入口(兼容实现,便于后续接入系统shortcuts)
private handleShortcutIntent(want: Want): void { try { if (!want.parameters) { return; } const shortcutId = want.parameters['shortcutId'] as string; if (!shortcutId) { return; } logger.info('EntryAbility', `📌 收到快捷入口请求: shortcutId=${shortcutId}`); switch ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleShortcutIntent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi...
private handleShortcutIntent(want: Want): void { try { if (!want.parameters) { return; } const shortcutId = want.parameters['shortcutId'] as string; if (!shortcutId) { return; } logger.info('EntryAbility', `📌 收到快捷入口请求: shortcutId=${shortcutId}`); switch ...
https://github.com/DaLongZhuaZi/manxia
c12668c9c298b4eb0c127584b24e466a685c16b4
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/UndefinableObjectArray.ets
arkts
at
Returns an element at the specified index @param { int } index - Element position @returns { UndefinableObject } An element at the specified index @syscap SystemCapability.Utils.Lang
public at(index: int): UndefinableObject { return this.data[index] }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left at AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left index AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ident...
public at(index: int): UndefinableObject { return this.data[index] }
https://gitcode.com/iop123123/arkts-static-skills
c01e6d0b6c0e12532ad693539f8b5bce20733921
gitcode
luojiang001/Pulse
Pulse/entry/src/main/ets/pages/utils/fileUtils.ets
arkts
getUserData
读取用户数据(目标页面调用) @returns 用户数据 | null
static async getUserData(): Promise<User | null> { try { const preferences = await PreferencesUtil.getPreferencesInstance(); // 读取时返回的是字符串,默认值为空字符串 const userDataStr = await preferences.get('user_data', '') as string; if (!userDataStr) { return null; } // 反序列化 JSON 字符...
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 getUserData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Le...
static async getUserData(): Promise<User | null> { try { const preferences = await PreferencesUtil.getPreferencesInstance(); // 读取时返回的是字符串,默认值为空字符串 const userDataStr = await preferences.get('user_data', '') as string; if (!userDataStr) { return null; } // 反序列化 JSON 字符...
https://github.com/luojiang001/Pulse
f23b0f37f4c7ddfd50b31332aa91eb3f7614a6ce
github
OHPG/FinSdk
jellyfin/src/main/ets/api/PlayStateApi.ets
arkts
reportPlaybackStopped
reportPlaybackStopped @summary Reports playback has stopped within a session. @param {PlayStateApiReportPlaybackStoppedRequest} requestParameters Request parameters. @throws {RequiredError} @memberof PlayStateApi
public async reportPlaybackStopped(requestParameters: PlayStateApiReportPlaybackStoppedRequest = {}): Promise<void> { return this.apiClient.post({path: "/Sessions/Playing/Stopped", data: requestParameters.playbackStopInfo}) }
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 reportPlaybackStopped AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#R...
public async reportPlaybackStopped(requestParameters: PlayStateApiReportPlaybackStoppedRequest = {}): Promise<void> { return this.apiClient.post({path: "/Sessions/Playing/Stopped", data: requestParameters.playbackStopInfo}) }
https://github.com/OHPG/FinSdk
794182635104671069cf380b6b774dc6189e9784
github
NissonCX/CQU-HarmonyOS-APP-Dev-Final
entry/src/main/ets/pages/ReminderSettingsPage.ets
arkts
selectWorkdays
选择工作日
selectWorkdays() { this.editRepeatDays = [1, 2, 3, 4, 5]; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left selectWorkdays 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#Lef...
selectWorkdays() { this.editRepeatDays = [1, 2, 3, 4, 5]; }
https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final
5c5f83f212a31b99530f1dff7e9887cabc9713b9
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/json.ets
arkts
stringifyJsonElement
Converts a JsonElementSerializable to a JSON string with optional formatting. @param elem - The JsonElementDeserializable to stringify @param replacer - Array of keys to include (currently not implemented) @param space - String or number of spaces for indentation @returns The JSON string representation
public static stringifyJsonElement(elem: jsonx.JsonElementSerializable, replacer?: (double | string)[], space?: int | string): string { return JSON.stringifyJsonElement(elem.toJSON(), replacer, space) }
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 stringifyJsonElement AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left elem AST#identifier#Right AST#:#Le...
public static stringifyJsonElement(elem: jsonx.JsonElementSerializable, replacer?: (double | string)[], space?: int | string): string { return JSON.stringifyJsonElement(elem.toJSON(), replacer, space) }
https://gitcode.com/iop123123/arkts-static-skills
5ecb3518a61edb6ac2aab345b1cfc8d47db09204
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/SessionManager.ets
arkts
checkCookieExpiry
检查Cookie是否过期
private async checkCookieExpiry(sourceId: number, indicator: ExpiryIndicator): Promise<boolean> { try { const cookieManager = CookieManager.getInstance(); const cookieInfo = await cookieManager.getCookieInfo(sourceId); if (!cookieInfo.hasCookie) { return false; } // 如...
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 checkCookieExpiry AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:...
private async checkCookieExpiry(sourceId: number, indicator: ExpiryIndicator): Promise<boolean> { try { const cookieManager = CookieManager.getInstance(); const cookieInfo = await cookieManager.getCookieInfo(sourceId); if (!cookieInfo.hasCookie) { return false; } // 如...
https://github.com/DaLongZhuaZi/manxia
50e6cd29c76651b18c278c4508272a1f40ba6770
github
wuba/omni-ui
omni_component/src/main/ets/components/guide/model/HighLightInfoOfComponent.ets
arkts
isComponentHighLight
高亮区域的类型 @returns 返回组件id 即高亮区域为组件类型,否则为指定的高亮区域
isComponentHighLight(): string | boolean { return this.componentId; }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left isComponentHighLight AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#...
isComponentHighLight(): string | boolean { return this.componentId; }
https://github.com/wuba/omni-ui
1824c8542b8003f047455893eca345e0e7c578cd
github
RedRackham-R/WanAndroidHarmoney
entry/src/main/ets/net/wanAPI/WanHttpClient.ets
arkts
collectUrl
https://www.wanandroid.com/lg/collect/addtool/json 收藏网址
public collectUrl(name: string, link: string): Promise<AxiosResponse<IWanCommonResponse<ICollectedUrl>>> { return this.postRequest( "lg/collect/addtool/json", {}, { params: { name: name, link: link } }, ) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left collectUrl 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 strin...
public collectUrl(name: string, link: string): Promise<AxiosResponse<IWanCommonResponse<ICollectedUrl>>> { return this.postRequest( "lg/collect/addtool/json", {}, { params: { name: name, link: link } }, ) }
https://github.com/RedRackham-R/WanAndroidHarmoney
d3f2642a4d0f0b97f6adb6989bf906d7e15ffc3a
github