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
CLMC2025/Vignette
entry/src/main/ets/manager/PromptTemplateManager.ets
arkts
getTemplateType
获取模板类型
private getTemplateType(templateId: string): PromptTemplateType { const templates = this.getTemplateHistory(templateId); return templates.length > 0 ? templates[0].type : PromptTemplateType.DEFINITION; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getTemplateType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left templateId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#...
private getTemplateType(templateId: string): PromptTemplateType { const templates = this.getTemplateHistory(templateId); return templates.length > 0 ? templates[0].type : PromptTemplateType.DEFINITION; }
https://github.com/CLMC2025/Vignette
dfddc033e93b5526e9162cd6051988a7f9cbd2db
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/WebViewContainerPage.ets
arkts
addWebView
添加WebView实例
addWebView( sourceId: string, controller: webview.WebviewController, config: WebViewSourceConfig, callbacks?: WebViewEventCallbacks, initialUrl: string = 'about:blank' ): void { // 检查是否已存在 const existingIndex = this.webViewItems.findIndex(item => item.sourceId === sourceId); if (exis...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addWebView AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,#Left , AST#,#Ri...
addWebView( sourceId: string, controller: webview.WebviewController, config: WebViewSourceConfig, callbacks?: WebViewEventCallbacks, initialUrl: string = 'about:blank' ): void { // 检查是否已存在 const existingIndex = this.webViewItems.findIndex(item => item.sourceId === sourceId); if (exis...
https://github.com/DaLongZhuaZi/manxia
5894049b792a11668a0f9c73bb61b15cbdc48d8e
github
HarmonyOS_Samples/MusicHome
features/player/src/main/ets/viewmodel/PlayerViewModel.ets
arkts
songSinger
Artist line for the current track, or empty when none.
public songSinger(): string | Resource { const track = this.currentTrack(); return track !== undefined ? track.singer : ''; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left songSinger 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#Left AST#...
public songSinger(): string | Resource { const track = this.currentTrack(); return track !== undefined ? track.singer : ''; }
https://gitcode.com/HarmonyOS_Samples/MusicHome
ee967ea36f282acdaa3eb1f7f8eeb7d77b7d1ab4
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Debug/HidebugPerformanceCollector.ets
arkts
collectGcInfo
收集GC信息
private async collectGcInfo(): Promise<HidebugGcInfo> { const gcInfo: HidebugGcInfo = { vmRuntimeStats: null, gcCount: 0, gcTime: 0, gcBytesAllocated: 0, gcBytesFreed: 0, fullgcLongtimeCount: 0 }; try { // 获取VM运行时统计信息 gcInfo.vmRuntimeStats = hidebug.getVMRu...
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 collectGcInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST...
private async collectGcInfo(): Promise<HidebugGcInfo> { const gcInfo: HidebugGcInfo = { vmRuntimeStats: null, gcCount: 0, gcTime: 0, gcBytesAllocated: 0, gcBytesFreed: 0, fullgcLongtimeCount: 0 }; try { // 获取VM运行时统计信息 gcInfo.vmRuntimeStats = hidebug.getVMRu...
https://github.com/DaLongZhuaZi/manxia
a125fdc475814075c4c7d53d49297f0d92122a30
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/remainder/remainder_char.ets
arkts
main
--- desc: check remainder of division operation for two char operands ---
function main(): void { const a: char = {{v.left}} const b: char = {{v.right}} assert (a % b) == {{v.result}}
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A...
function main(): void { const a: char = {{v.left}} const b: char = {{v.right}} assert (a % b) == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
585aa1c0595f88bf1df52d44eb1492a46e5d7038
gitee
StarHeartY/CalculatorX
entry/src/main/ets/components/TopBar.ets
arkts
build
暴露重做事件
build() { // 顶部悬浮控制栏 Row() { // ================= 左侧组合:菜单 + 撤销 ================= Row({ space: 8 }) { // 1. 设置菜单按钮 Button({ type: ButtonType.Capsule, stateEffect: true }) { SymbolGlyph($r('sys.symbol.slider_horizontal_2_1')) .fontSize(18) .fontColor...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST...
build() { // 顶部悬浮控制栏 Row() { // ================= 左侧组合:菜单 + 撤销 ================= Row({ space: 8 }) { // 1. 设置菜单按钮 Button({ type: ButtonType.Capsule, stateEffect: true }) { SymbolGlyph($r('sys.symbol.slider_horizontal_2_1')) .fontSize(18) .fontColor...
https://github.com/StarHeartY/CalculatorX
24cdb2ede30fac211107b3cb44a491d7344f8ee5
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/EnhancedBackupManager.ets
arkts
generateEBookMetadataXml
生成电子书元数据XML文件
private async generateEBookMetadataXml(ebook: EBookBackupItem, targetDir: string): Promise<void> { try { const metadata: EBookMetadata = { id: ebook.id, title: ebook.title, author: ebook.author, publisher: ebook.publisher, publishDate: ebook.publishDate, isbn:...
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 generateEBookMetadataXml AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ebook AST#identifier#Right A...
private async generateEBookMetadataXml(ebook: EBookBackupItem, targetDir: string): Promise<void> { try { const metadata: EBookMetadata = { id: ebook.id, title: ebook.title, author: ebook.author, publisher: ebook.publisher, publishDate: ebook.publishDate, isbn:...
https://github.com/DaLongZhuaZi/manxia
4e9e2a8dcae3cbed3e9c5767f4750faf05f12a9e
github
offlinecat-dev/OCNetORM
src/main/ets/database/DatabaseManager.ets
arkts
getQueryCache
获取查询缓存实例 @returns QueryCache 实例
getQueryCache(): QueryCache { return QueryCache.getInstance() }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getQueryCache 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 QueryCache AST#identifier#Right AST#ERROR#Right ...
getQueryCache(): QueryCache { return QueryCache.getInstance() }
https://github.com/offlinecat-dev/OCNetORM
21cd198ea4ce9f35f33464fa1d1e3bbe009d0ecd
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/export/utils/ChecksumHelper.ets
arkts
bytesToHex
将字节数组转换为十六进制字符串 @param bytes 字节数组 @returns 十六进制字符串
private static bytesToHex(bytes: Uint8Array): string { const hexChars: Array<string> = []; for (let i = 0; i < bytes.length; i++) { const byte = bytes[i] as number; hexChars.push(((byte >> 4) & 0x0f).toString(16)); hexChars.push((byte & 0x0f).toString(16)); } return hexChars.join('')...
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 bytesToHex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bytes AST#identifier#Right AST#:#Left : A...
private static bytesToHex(bytes: Uint8Array): string { const hexChars: Array<string> = []; for (let i = 0; i < bytes.length; i++) { const byte = bytes[i] as number; hexChars.push(((byte >> 4) & 0x0f).toString(16)); hexChars.push((byte & 0x0f).toString(16)); } return hexChars.join('')...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
41b2091a85e68a50386e67d2ce954418d2e9a2cd
github
Joker-x-dev/CoolMallArkTS
core/datastore/src/main/ets/datasource/launch/LaunchStoreDataSourceImpl.ets
arkts
constructor
构造函数 @param {common.Context} [context] UIAbility 上下文
constructor(context?: common.Context) { const resolvedContext: common.Context = context ?? ContextUtil.getUIAbilityCtx(); this.prefs = new PreferencesUtil(resolvedContext, LaunchStoreDataSourceImpl.PREFS_NAME); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression...
constructor(context?: common.Context) { const resolvedContext: common.Context = context ?? ContextUtil.getUIAbilityCtx(); this.prefs = new PreferencesUtil(resolvedContext, LaunchStoreDataSourceImpl.PREFS_NAME); }
https://github.com/Joker-x-dev/CoolMallArkTS
78055d4cff0dfeec4057c71c9030869203c514d6
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Database/MigrationScripts.ets
arkts
cleanDuplicateChapters
清理chapter表的重复数据 保留最新的记录,删除旧的重复记录
async cleanDuplicateChapters(store: any): Promise<void> { logger.info(TAG, '开始清理chapter表的重复数据'); // 查找重复的章节(相同的comicId和externalId) const findDuplicatesSql = ` SELECT comicId, externalId, COUNT(*) as count FROM chapter GROUP BY comicId, externalId HAVING COUNT(*) > 1 `; ...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left cleanDuplicateChapters AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left store AST#identifier#Right AST#type_annotation#...
async cleanDuplicateChapters(store: any): Promise<void> { logger.info(TAG, '开始清理chapter表的重复数据'); // 查找重复的章节(相同的comicId和externalId) const findDuplicatesSql = ` SELECT comicId, externalId, COUNT(*) as count FROM chapter GROUP BY comicId, externalId HAVING COUNT(*) > 1 `; ...
https://github.com/DaLongZhuaZi/manxia
59b8e2e17dc00afabd98bb66bef6920a7ea6cab3
github
offlinecat-dev/OCNetORM
src/main/ets/query/RelationLoadResult.ets
arkts
addResult
添加单个关联加载结果 @param result 关联加载结果
addResult(result: RelationLoadResult): void { this.results.push(result) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addResult AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left result AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left RelationLoadResult AST#identifier#Right AST#...
addResult(result: RelationLoadResult): void { this.results.push(result) }
https://github.com/offlinecat-dev/OCNetORM
a008a84c4ec894e3373be76c9871a3b3bce8460c
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets
arkts
getYear
Returns the year of the specified date according to local time. @returns { int } get year @syscap SystemCapability.Utils.Lang @FaAndStageModel
public getYear(): int { return this.getFullYear(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getYear 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 int AST#identi...
public getYear(): int { return this.getFullYear(); }
https://gitcode.com/iop123123/arkts-static-skills
59a379ac1c4535cc39c0f6ac2f0224f9580ae175
gitcode
tdcare/tdwebrtc
src/main/ets/WebRTCManager.ets
arkts
addVideoTrack
添加视频轨道(便捷方法) @param trackId 轨道 ID @param codec 编解码器 (H264, VP8, VP9) @param ssrc SSRC
public addVideoTrack(trackId: string, codec: string = 'H264', ssrc: number = 0): boolean { const config: MediaTrackConfig = { trackId: trackId, streamId: 'ARDAMS', kind: 'video', codec: codec, ssrc: ssrc || Math.floor(Math.random() * 0xFFFFFFFF), payloadType: codec === 'VP8' ? ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addVideoTrack AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left trackId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#R...
public addVideoTrack(trackId: string, codec: string = 'H264', ssrc: number = 0): boolean { const config: MediaTrackConfig = { trackId: trackId, streamId: 'ARDAMS', kind: 'video', codec: codec, ssrc: ssrc || Math.floor(Math.random() * 0xFFFFFFFF), payloadType: codec === 'VP8' ? ...
https://github.com/tdcare/tdwebrtc
73b1a0f68183cc181609a2f41c319af4ef65de70
github
openharmony-sig/ohos_dataorm
entry/src/main/ets/pages/MuktiDataViewlibrary.ets
arkts
addData1
第一个数据库
addData1() { if (!this.mConvertInfo1) { this.mConvertInfo1 = new ConvertInfo(); } let images = new ArrayList<string>(); images.add("image1"); images.add("image2"); this.mConvertInfo1.images = images; if (this.noteDao1) { this.noteDao1.insert(this.mConvertInfo1); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addData1 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#if_statement#Left AST#if#Lef...
addData1() { if (!this.mConvertInfo1) { this.mConvertInfo1 = new ConvertInfo(); } let images = new ArrayList<string>(); images.add("image1"); images.add("image2"); this.mConvertInfo1.images = images; if (this.noteDao1) { this.noteDao1.insert(this.mConvertInfo1); } }
https://gitee.com/openharmony-sig/ohos_dataorm.git
ee064fef64174f51ddb2853d6947438f1dfa8039
gitee
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/GamepadManager.ets
arkts
handleDeviceReconnect
处理设备重连
private handleDeviceReconnect(deviceKey: string, newControllerId: number): void { const existingControllerId = this.usbDeviceKeyToId.get(deviceKey); if (existingControllerId !== undefined && existingControllerId !== newControllerId) { console.info(`[GAMEPAD-USB] 设备重连: Key=${deviceKey}, 旧ID=${existingCon...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleDeviceReconnect AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left deviceKey AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string...
private handleDeviceReconnect(deviceKey: string, newControllerId: number): void { const existingControllerId = this.usbDeviceKeyToId.get(deviceKey); if (existingControllerId !== undefined && existingControllerId !== newControllerId) { console.info(`[GAMEPAD-USB] 设备重连: Key=${deviceKey}, 旧ID=${existingCon...
https://github.com/AlkaidLab/moonlight-harmony
331f9392f8c41a39641a1ad63688be232cdd0165
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Source/SourceExecutor.ets
arkts
getPages
获取章节图片
async getPages(sourceId: number, chapterId: string): Promise<PageInfo[]> { try { const parser = await this.getParser(sourceId); const params: Record<string, Object> = { 'chapterId': chapterId }; const requestInfo = parser.buildRequest('pages', params); const httpOptio...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getPages AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceId AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS...
async getPages(sourceId: number, chapterId: string): Promise<PageInfo[]> { try { const parser = await this.getParser(sourceId); const params: Record<string, Object> = { 'chapterId': chapterId }; const requestInfo = parser.buildRequest('pages', params); const httpOptio...
https://github.com/DaLongZhuaZi/manxia
021c9f09a9b0f4c0b97cb50ac18fb674b6a28f5e
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets
arkts
toString
Returns a string representing the specified `Date` object interpreted in the local timezone. @returns { string } get new date value @throws { Error } - Input parameter error. @syscap SystemCapability.Utils.Lang @FaAndStageModel
public override toString(): string { let res: String = "Invalid Date"; if (!this.isDateValid()) { return res; } try { res = this.toDateString() + " " + this.toTimeString(); } catch (e) { } return res; }
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 res: String = "Invalid Date"; if (!this.isDateValid()) { return res; } try { res = this.toDateString() + " " + this.toTimeString(); } catch (e) { } return res; }
https://gitcode.com/iop123123/arkts-static-skills
1577db485d637a59c4b3817560a4a16a44bf819a
gitcode
openharmony-sig/earth
hpauditor/tests/issues/expected/issue450.ets.audit.ets
arkts
initAll
init properties of scenePanelView HPAudit: Explicitly declare return types of functions and methods : hp-specs-explicit-return-types : 1 : 53 : issue450.ets
public initAll(): void { this.flexWidth = "100%"; this.flexHeight = "100%"; this.flexPadding = 0; this.flexOffsetX = 0; this.flexOffsetY = 0; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left initAll 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_sta...
public initAll(): void { this.flexWidth = "100%"; this.flexHeight = "100%"; this.flexPadding = 0; this.flexOffsetX = 0; this.flexOffsetY = 0; }
https://gitee.com/openharmony-sig/earth.git
810b365d51a718f5d4f03ec2acf5f94dc389ef7a
gitee
openharmony-tpc/ImageKnife
library/src/main/ets/utils/FileUtils.ets
arkts
deleteFile
异步删除文件 @param path @returns
async deleteFile(path: string): Promise<void> { try { await fs.unlink(path) } catch (err) { LogUtil.error('FileUtils deleteFile failed: err msg=' + err.message + ' err code=' + err.code); } }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left deleteFile AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left path AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#...
async deleteFile(path: string): Promise<void> { try { await fs.unlink(path) } catch (err) { LogUtil.error('FileUtils deleteFile failed: err msg=' + err.message + ' err code=' + err.code); } }
https://gitee.com/openharmony-tpc/ImageKnife.git
a86222ee7453bea71524886702d1d041f79945db
gitee
hiyuey3/Hixy_MyMemories
entry/src/main/ets/pages/Index.ets
arkts
onInit
页面加载与切换逻辑说明(注释版): - onInit(): 组件被创建并初始化时调用一次。 用于执行一次性的初始化,例如加载持久化头图与首次从数据库读取事件。 - aboutToAppear(): 页面即将可见时调用(比 onShow 更靠前), 这里代码会强制重新查询数据库并启动短延迟的二次查询,目的是尽可能保证在慢设备上也能看到刚写入的数据。 - onShow(): 页面每次变为可见时调用(例如从其他页面返回),会再次触发加载; 同时会检查 AppStorage 的 'needsReload' 标志以决定是否需要额外刷新。 - build() 中传入的 IndexTabs 回调(onReloadHome/onAdd/onTabC...
onInit(): void { // 初始化数据库并加载事件(只在组件创建时执行一次) this.loadHeaderImage(); this.loadEvents(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onInit 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 ...
onInit(): void { // 初始化数据库并加载事件(只在组件创建时执行一次) this.loadHeaderImage(); this.loadEvents(); }
https://github.com/hiyuey3/Hixy_MyMemories/blob/9769d82c97a877be3d464456e79f66c5c84a9590/entry/src/main/ets/pages/Index.ets#L35-L39
8e94bd88939b0d199df4d45846eae9b6953f3afa
github
fbinba3955/Flymby
main/src/main/ets/pages/player/ReportUtil.ets
arkts
doReportStop
报告播放结束
async function doReportStop(playbackInfo: PlaybackResponse, itemId: string, currentTime: number) { const firstMediaSource: MediaSource = playbackInfo?.MediaSources[0] LogUtil.info("报告播放结束成功 - itemId:", itemId, "playSessionId:", playbackInfo?.PlaySessionId, "mediaSourceId:", firstMediaSource.Id, "currentTime:", ...
AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left doReportStop AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left playbackInfo AST#identifier#Right AS...
async function doReportStop(playbackInfo: PlaybackResponse, itemId: string, currentTime: number) { const firstMediaSource: MediaSource = playbackInfo?.MediaSources[0] LogUtil.info("报告播放结束成功 - itemId:", itemId, "playSessionId:", playbackInfo?.PlaySessionId, "mediaSourceId:", firstMediaSource.Id, "currentTime:", ...
https://github.com/fbinba3955/Flymby
61ee4977a3c409875010f54e5a7cb15929f25334
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/network/QrCodeGenerator.ets
arkts
writeVersionInfo
Write version info (v7+)
writeVersionInfo(version: number): void { if (version < 7) return; const info = VERSION_INFO[version - 7]; for (let i = 0; i < 18; i++) { const bit = ((info >> i) & 1) === 1; const row = Math.floor(i / 3); const col = this.size - 11 + (i % 3); this.modules[row][col] = bit; th...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left writeVersionInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left version AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) AST...
writeVersionInfo(version: number): void { if (version < 7) return; const info = VERSION_INFO[version - 7]; for (let i = 0; i < 18; i++) { const bit = ((info >> i) & 1) === 1; const row = Math.floor(i / 3); const col = this.size - 11 + (i % 3); this.modules[row][col] = bit; th...
https://github.com/AlkaidLab/moonlight-harmony
fb024bd435a9fc996b03b6e1917afc5cc9ac85b7
github
richshaw2015/nds
ohos/entry/src/main/ets/pages/settings/GameConfigSettings.ets
arkts
onPageShow
页面重新显示时检查布局选择器回传结果 对齐 Android: LayoutSelector 返回后更新 RomConfig.layoutId
onPageShow(): void { if (this.layoutPickerResult !== '__unset__') { const selectedId = this.layoutPickerResult; // 重置标记 this.layoutPickerResult = '__unset__'; // 空字符串表示"使用全局布局" (layoutId = null) // 非空字符串表示使用指定布局 (包括内置默认布局 __builtin_default__) const newLayoutId = selectedId.leng...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onPageShow 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...
onPageShow(): void { if (this.layoutPickerResult !== '__unset__') { const selectedId = this.layoutPickerResult; // 重置标记 this.layoutPickerResult = '__unset__'; // 空字符串表示"使用全局布局" (layoutId = null) // 非空字符串表示使用指定布局 (包括内置默认布局 __builtin_default__) const newLayoutId = selectedId.leng...
https://github.com/richshaw2015/nds
8db9f90f242ca6a35044dae52dcc2d47a851f409
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/StreamLifecycleManager.ets
arkts
handleAppResume
==================== 应用恢复 ==================== 处理应用从后台恢复 当应用从后台切回前台时,需要检查串流状态并尝试恢复 - 后台保活开启:进程未被冻结,Flush+IDR 恢复解码器 - 后台保活关闭:进程可能被系统冻结,连接可能已断,执行重连 - 如果后台期间连接已断开(pendingTerminationErrorCode),尝试重连
private handleAppResume(): void { console.info(`[StreamPage] 处理应用恢复, 连接状态: ${this.viewModel?.connectionState}, ` + `后台保活: ${this.enableBackgroundTask}, 待处理断连: ${this.pendingTerminationErrorCode}`); // 后台期间连接断开 → 尝试重连而非直接弹错误对话框 if (this.pendingTerminationErrorCode !== null) { const errorCode =...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleAppResume AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#exp...
private handleAppResume(): void { console.info(`[StreamPage] 处理应用恢复, 连接状态: ${this.viewModel?.connectionState}, ` + `后台保活: ${this.enableBackgroundTask}, 待处理断连: ${this.pendingTerminationErrorCode}`); // 后台期间连接断开 → 尝试重连而非直接弹错误对话框 if (this.pendingTerminationErrorCode !== null) { const errorCode =...
https://github.com/AlkaidLab/moonlight-harmony
7490d77349b02fad4a776db578cb7fe3cc2cb2bb
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
indexOf
Returns the index of the first occurrence of a value in Int8Array. @param { int } searchElement - The value to locate in the array. The search starts at index 0. @returns { int } - index of element if it presents, -1 otherwise @syscap SystemCapability.Utils.Lang @FaAndStageModel
public indexOf(searchElement: int): int { return this.indexOf(searchElement, 0) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left indexOf AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left searchElement AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identif...
public indexOf(searchElement: int): int { return this.indexOf(searchElement, 0) }
https://gitcode.com/iop123123/arkts-static-skills
ca433dd0dd866fe9b690c8befac036c2178b4624
gitcode
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/SharedLedgerDAO.ets
arkts
updateRole
更新成员角色
static async updateRole( ledgerId: number, userId: number, newRole: string ): Promise<boolean> { try { const store = DatabaseManager.getDatabase(); const values: relationalStore.ValuesBucket = { role: newRole, updated_at: new Date().toISOString() }; const pre...
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 updateRole AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left ledgerId AST#identifier#Right AST#ERROR#Left AST#:#Left : AS...
static async updateRole( ledgerId: number, userId: number, newRole: string ): Promise<boolean> { try { const store = DatabaseManager.getDatabase(); const values: relationalStore.ValuesBucket = { role: newRole, updated_at: new Date().toISOString() }; const pre...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
0003c7836b883ae22a580463599e51ef8446f589
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/ArrayBuffer.ets
arkts
sliceInternal
Internal implementation for slicing the ArrayBuffer. @param { int } begin Starting index. @param { int } end Ending index. @returns { ArrayBuffer } A new ArrayBuffer containing the sliced data. @syscap SystemCapability.Utils.Lang @FaAndStageModel
private sliceInternal(begin: int, end: int): ArrayBuffer { const byteLength = this.getByteLength() const startIndex = normalizeIndex(begin, byteLength) const endIndex = normalizeIndex(end, byteLength) let resultLength = endIndex - startIndex if (resultLength < 0) { ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left sliceInternal AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left begin AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identi...
private sliceInternal(begin: int, end: int): ArrayBuffer { const byteLength = this.getByteLength() const startIndex = normalizeIndex(begin, byteLength) const endIndex = normalizeIndex(end, byteLength) let resultLength = endIndex - startIndex if (resultLength < 0) { ...
https://gitcode.com/iop123123/arkts-static-skills
84a844442b9fee81a4e7d503d2d477dceba6602a
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
subarray
Creates a Int32Array with the same underlying ArrayBuffer @param begin start index, inclusive @param end last index, exclusive @returns new Int32Array with the same underlying ArrayBuffer
public subarray(begin: number, end: number): Int32Array { return this.subarray(begin as int, end as int) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left subarray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left begin AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number...
public subarray(begin: number, end: number): Int32Array { return this.subarray(begin as int, end as int) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
a722ba83653ee3d1cd30da3da60a8fe2d776ca97
gitee
terryma2024/happyword
harmonyos/entry/src/main/ets/services/FamilyPackService.ets
arkts
isRemoteStale
True when the server reports a different ETag from what we cached. Returns false on network error or when both sides agree.
async isRemoteStale(deviceToken: string, familyId?: string): Promise<boolean> { const remote: string | null = await this.peekRemoteEtag(deviceToken, familyId); if (remote === null) { return false; } const localEtag: string = this.memoryEnvelope?.etag ?? ''; return remote !== localEtag; }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left isRemoteStale AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left deviceToken AST#identifier#Right AST#type_annotation#Left AST#:#L...
async isRemoteStale(deviceToken: string, familyId?: string): Promise<boolean> { const remote: string | null = await this.peekRemoteEtag(deviceToken, familyId); if (remote === null) { return false; } const localEtag: string = this.memoryEnvelope?.etag ?? ''; return remote !== localEtag; }
https://github.com/terryma2024/happyword
24c8c77da014d85e0108236823d35e56d0fc78e2
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Array.ets
arkts
toLocaleString
Returns a locale string representing the specified array and its elements. @param locales @param options @returns string representation
public toLocaleString(locales: Object, options: Object): string { throw new Error("Array.toLocaleString: not implemented") }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toLocaleString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left locales AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Object AST#ide...
public toLocaleString(locales: Object, options: Object): string { throw new Error("Array.toLocaleString: not implemented") }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
01972eca001eecd5961812aa16e7a4cb1da155f5
gitee
Joker-x-dev/CoolMallArkTS
feature/main/src/main/ets/component/HomeCategorySection.ets
arkts
build
构建分类卡片 @returns {void} 无返回值
build(): void { if (this.categories && this.categories.length > 0) { Card({ paddingValue: $r("app.float.space_padding_small") }) { Grid() { ForEach(this.categories, (category: Category): void => { GridItem() { this.categoryItem(category); } }...
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 { if (this.categories && this.categories.length > 0) { Card({ paddingValue: $r("app.float.space_padding_small") }) { Grid() { ForEach(this.categories, (category: Category): void => { GridItem() { this.categoryItem(category); } }...
https://github.com/Joker-x-dev/CoolMallArkTS
a7ea72bfc73b3517528559c4cc7c1bdae2b743a5
github
openharmony/arkui_ace_engine
advanced_ui_component/imageGeneratorDialog/source/image_generator_dialog_project/image_generator_dialog/src/main/ets/general/components/CanvasComplete.ets
arkts
snapScaleToBounds
Snap scale value back to valid range
snapScaleToBounds(): void { if (this.imageScale < this.minScale) { this.imageScale = this.minScale; } else if (this.imageScale > this.maxScale) { this.imageScale = this.maxScale; } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left snapScaleToBounds 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_...
snapScaleToBounds(): void { if (this.imageScale < this.minScale) { this.imageScale = this.minScale; } else if (this.imageScale > this.maxScale) { this.imageScale = this.maxScale; } }
https://gitcode.com/openharmony/arkui_ace_engine
72c82c10a577bf0c16a8f582f1ccff7a75605870
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/network/NetworkBoostService.ets
arkts
getLatestQos
最近一次系统上报的网络质量;未支持/未上报则为 null
getLatestQos(): SystemNetQos | null { return this.latestQos; }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getLatestQos AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifi...
getLatestQos(): SystemNetQos | null { return this.latestQos; }
https://github.com/AlkaidLab/moonlight-harmony
743802c65984cf90afd5bc88327fed2e5ea78ddb
github
iJcher/openharmony-app-znjj
entry/src/main/ets/models/huaweiUser.ets
arkts
toRequestBody
生成标准请求体
toRequestBody() { return this.res }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left toRequestBody 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...
toRequestBody() { return this.res }
https://github.com/iJcher/openharmony-app-znjj
35f4ab24c56d879c2d57e35f66d8ad9395b9ab17
github
openharmony/applications_notes
common/utils/src/main/ets/default/model/searchModel/SearchModel.ets
arkts
search
Search @param query - query content
public async search(noteDataArray: NoteData[], query: string): Promise<NoteData[]> { LogUtil.info(TAG, "query is " + query) if (!query) { LogUtil.info(TAG, "query is null") return [] } let searchData: NoteData[] = []; noteDataArray.forEach((noteData) => { let base64regex = new Re...
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 search AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left noteDataArray AST#identifier#Right AST#ERROR#Left AST#:#Left : A...
public async search(noteDataArray: NoteData[], query: string): Promise<NoteData[]> { LogUtil.info(TAG, "query is " + query) if (!query) { LogUtil.info(TAG, "query is null") return [] } let searchData: NoteData[] = []; noteDataArray.forEach((noteData) => { let base64regex = new Re...
https://gitee.com/openharmony/applications_notes.git
b2eedb3206c7cf3a873da97cadd3710476e14f21
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Double.ets
arkts
valueOf
Returns boxed representation of the primitive @returns { number } boxed value @syscap SystemCapability.Utils.Lang @FaAndStageModel
public valueOf(): number { return this.value as number; }
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#number#Left number AST#number#...
public valueOf(): number { return this.value as number; }
https://gitcode.com/iop123123/arkts-static-skills
e26f277ff38d5e40ae01244245b03aa6f54d82f9
gitcode
Joker-x-dev/CoolMallArkTS
core/navigation/src/main/ets/common/CommonNavigator.ets
arkts
toAbout
跳转到关于我们 @returns {void} 无返回值
static toAbout(): void { navigateTo(CommonRoutes.About); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left toAbout 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_sta...
static toAbout(): void { navigateTo(CommonRoutes.About); }
https://github.com/Joker-x-dev/CoolMallArkTS
1746a08e677d6a1c957b050d69b41e152b0ba7a6
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/String.ets
arkts
anchor
The anchor() method creates a string that embeds a string in an <a> element with a name (<a name="...">str</a>) @returns A string beginning with an <a name="name"> start tag (double quotes in name are replaced with &quot;), then the text str, and then an </a> end tag.
public anchor(name: String): String { return this.CreateHTMLString("a", " name=\"" + name + "\"") }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left anchor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left String AS...
public anchor(name: String): String { return this.CreateHTMLString("a", " name=\"" + name + "\"") }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
70a562e101dcc72435d4c7f20e6a0fa4fb531785
gitee
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/hosts/app/tabs/classes/meowTabsBunch.ets
arkts
ensureTheresOneTab
ACTIONS Ensures there is at least one tab. @returns True if a new tab was created, false if nothing done.
private ensureTheresOneTab(overwriteUrl?: string) { if (this.tabs.length == 0) { this.newTabWrapped(overwriteUrl); this.switchTo(0); return true; } return false; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left ensureTheresOneTab AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left overwriteUrl AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Rig...
private ensureTheresOneTab(overwriteUrl?: string) { if (this.tabs.length == 0) { this.newTabWrapped(overwriteUrl); this.switchTo(0); return true; } return false; }
https://github.com/awaLiny2333/LinysBrowser_NEXT
b702f7c6a06557b4f20666aaafdd535b7e5a7245
github
DaLongZhuaZi/manxia
entry/src/main/ets/libs/htmlparser/HtmlEntities.ets
arkts
decode
解码 HTML 实体 支持命名实体(如 &amp;)和数字实体(如 &#38; 和 &#x26;)
static decode(text: string): string { if (!text || !text.includes('&')) { return text; } const namedEntities = HtmlEntities.getNamedEntities(); return text.replace(/&(#?[a-zA-Z0-9]+);?/g, (match: string, entity: string): string => { // 数字实体 (十进制) if (entity.startsWith('#') && !enti...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left decode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AS...
static decode(text: string): string { if (!text || !text.includes('&')) { return text; } const namedEntities = HtmlEntities.getNamedEntities(); return text.replace(/&(#?[a-zA-Z0-9]+);?/g, (match: string, entity: string): string => { // 数字实体 (十进制) if (entity.startsWith('#') && !enti...
https://github.com/DaLongZhuaZi/manxia
3b3ad19287c6148d408ca4db39289dfa4a4be11f
github
NissonCX/CQU-HarmonyOS-APP-Dev-Final
entry/src/main/ets/pages/ReminderSettingsPage.ets
arkts
selectAllDays
选择所有日期
selectAllDays() { this.editRepeatDays = [1, 2, 3, 4, 5, 6, 0]; }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left selectAllDays 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...
selectAllDays() { this.editRepeatDays = [1, 2, 3, 4, 5, 6, 0]; }
https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final
21f485df0926f4ea7ea11f2dfa1b59f80a1fd083
github
openharmony-sig/ohos_danmaku_flame_master
library/src/main/ets/components/common/master/flame/danmaku/danmaku/model/ohos/DanmakuContext.ets
arkts
setUserHashBlackList
�������ε�Ļ�û�hash @param hashes @return
public setUserHashBlackList(hashes: string[]): DanmakuContext { this.mUserHashBlackList.splice(0, this.mUserHashBlackList.length) if (hashes == null || hashes.length == 0) { this.mDanmakuFilters.unregisterFilter({ tag: DanmakuFilters.TAG_USER_HASH_FILTER }); } else { this.mUserHashBlackList.pu...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setUserHashBlackList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left hashes AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript...
public setUserHashBlackList(hashes: string[]): DanmakuContext { this.mUserHashBlackList.splice(0, this.mUserHashBlackList.length) if (hashes == null || hashes.length == 0) { this.mDanmakuFilters.unregisterFilter({ tag: DanmakuFilters.TAG_USER_HASH_FILTER }); } else { this.mUserHashBlackList.pu...
https://gitee.com/openharmony-sig/ohos_danmaku_flame_master.git
92f12ad525f2f4b7800edc0e0c75b668578a3cc4
gitee
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test5_original_index.ets
arkts
testNestedConditions
=== Nested conditionals ===
function testNestedConditions(x: number, y: number): string { if (x > 0) { if (y > 0) { return 'both positive'; } else { return 'x positive, y not'; } } else { if (y > 0) { return 'y positive, x not'; } else { return 'neither positive'; } } }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testNestedConditions AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left x AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#...
function testNestedConditions(x: number, y: number): string { if (x > 0) { if (y > 0) { return 'both positive'; } else { return 'x positive, y not'; } } else { if (y > 0) { return 'y positive, x not'; } else { return 'neither positive'; } } }
https://github.com/miaochiahao/ark-ghidra
6f92044f0bc1091a43eb1087f2beaf105e240b4d
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/WebViewSourceManager.ets
arkts
invalidateSourceRuntime
图源运行配置已变化时清理内存状态。 用于镜像站点、domain/apiDomain 等会影响工作流变量的设置变更。
invalidateSourceRuntime(sourceId: number, sourceName?: string): void { try { const sourceIdText: string = String(sourceId); this.destroyWebViewInstance(sourceIdText); this.sourceConfigs.delete(sourceIdText); const mappedName: string | undefined = this.sourceIdToName.get(sourceId); i...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left invalidateSourceRuntime 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#number#Right AST#ERROR#Right AST#,#Le...
invalidateSourceRuntime(sourceId: number, sourceName?: string): void { try { const sourceIdText: string = String(sourceId); this.destroyWebViewInstance(sourceIdText); this.sourceConfigs.delete(sourceIdText); const mappedName: string | undefined = this.sourceIdToName.get(sourceId); i...
https://github.com/DaLongZhuaZi/manxia
34b1dda9218f25d9cb20233fe03e1be474d28563
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/TabContentCacheManager.ets
arkts
getBookSourceCache
获取书源Tab缓存
getBookSourceCache(): BookSourceCacheData | null { return this.bookSourceCache; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getBookSourceCache 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#Left AST#identifier#Left BookSourceCacheD...
getBookSourceCache(): BookSourceCacheData | null { return this.bookSourceCache; }
https://github.com/DaLongZhuaZi/manxia
30a2b6890182783f7979efb65910cd687b043cad
github
HarmonyOS_Samples/guide-snippets
Ability/AppServiceExtensionAbility/entry/src/main/ets/myappserviceextability/MyAppServiceExtAbility.ets
arkts
onRequest
[StartExclude ability_app_service_two]
onRequest(want: Want, startId: number): void { hilog.info(DOMAIN_NUMBER, TAG, `onRequest, want: ${want.abilityName}`); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onRequest AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Want AST#identifier#Right AST#,#Left , AST#,#R...
onRequest(want: Want, startId: number): void { hilog.info(DOMAIN_NUMBER, TAG, `onRequest, want: ${want.abilityName}`); }
https://gitcode.com/HarmonyOS_Samples/guide-snippets
fd7894becb2db42f5e74cea807d9ee9a134ac28a
gitcode
PollenWang6/HiXD
entry/src/main/ets/services/VersionService.ets
arkts
checkForUpdate
完整检查:返回 null 表示无更新,否则返回更新信息和下载链接
static async checkForUpdate(): Promise<VersionInfo | null> { try { const current = await VersionService.getCurrentVersion(); const remote = await VersionService.fetchRemoteVersion(); if (remote && remote.version.length > 0) { if (VersionService.compareVersion(current, remote.version) < 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 checkForUpdate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:...
static async checkForUpdate(): Promise<VersionInfo | null> { try { const current = await VersionService.getCurrentVersion(); const remote = await VersionService.fetchRemoteVersion(); if (remote && remote.version.length > 0) { if (VersionService.compareVersion(current, remote.version) < 0...
https://github.com/PollenWang6/HiXD
da2abda78f637eeeefbccbad15750565714c7acb
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.uri.ets
arkts
checkRelative
Determine whether URI is Relative. @returns { boolean } Return true as Relative, otherwise return false.
checkRelative(): boolean { return this.uriEntry.isRelative(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left checkRelative 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#state...
checkRelative(): boolean { return this.uriEntry.isRelative(); }
https://gitcode.com/iop123123/arkts-static-skills
80ca3a66f6f2c77261b985f954812bbc43e73a55
gitcode
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/pages/CategoryManagement.ets
arkts
buildParentOptions
构建父分类下拉选项
buildParentOptions(): SelectOption[] { const options: SelectOption[] = [{ value: '无(顶级分类)' }] this.availableParents.forEach((cat: Category) => { options.push({ value: `${cat.icon} ${cat.name}` }) }) return options }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left buildParentOptions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left SelectOption AST#identifier#...
buildParentOptions(): SelectOption[] { const options: SelectOption[] = [{ value: '无(顶级分类)' }] this.availableParents.forEach((cat: Category) => { options.push({ value: `${cat.icon} ${cat.name}` }) }) return options }
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
4f4008364cc28df3fe41c393b358addab515aa02
github
azhu0001/localsend-harmony
entry/src/main/ets/utils/FileProvider.ets
arkts
setTransferringNow
设置当前是否正在处理文件传输 @param transferring true 正在传输文件
static setTransferringNow(transferring: boolean) { AppStorage.setOrCreate(Keys.CURRENTLY_TRANSFERRING_STATUS, transferring) }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setTransferringNow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left transferring AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean ...
static setTransferringNow(transferring: boolean) { AppStorage.setOrCreate(Keys.CURRENTLY_TRANSFERRING_STATUS, transferring) }
https://gitcode.com/azhu0001/localsend-harmony
20e7d777c8ef2197e208d233bbba54d4897776d0
gitcode
CLMC2025/Vignette
entry/src/main/ets/database/DBManager.ets
arkts
initialize
Initialize database
async initialize(context: common.UIAbilityContext): Promise<void> { if (this.initialized) { return; } try { this.store = await relationalStore.getRdbStore(context, DB_CONFIG); this.wordRepo.setStore(this.store); this.reviewEventRepo.setStore(this.store); this.vignette...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left initialize AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#Right AST#t...
async initialize(context: common.UIAbilityContext): Promise<void> { if (this.initialized) { return; } try { this.store = await relationalStore.getRdbStore(context, DB_CONFIG); this.wordRepo.setStore(this.store); this.reviewEventRepo.setStore(this.store); this.vignette...
https://github.com/CLMC2025/Vignette
79c8e1d49a1ac81b1d8c08d3496f4826e5d5d3e1
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
subarray
Creates a BigUint64Array with the same underlying Buffer @param { int } [begin] - start index, inclusive @param { int } [end] - last index, exclusive @returns { BigUint64Array } - a new BigUint64Array with the same underlying Buffer @syscap SystemCapability.Utils.Lang @FaAndStageModel
public subarray(begin?: int, end?: int): BigUint64Array { const len: int = this.lengthInt const relStart = normalizeIndex(begin ?? 0, len) const relEnd = normalizeIndex(end ?? this.lengthInt, len) let count = relEnd - relStart if (count < 0) { count = 0 } ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left subarray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left begin AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#identifier#Le...
public subarray(begin?: int, end?: int): BigUint64Array { const len: int = this.lengthInt const relStart = normalizeIndex(begin ?? 0, len) const relEnd = normalizeIndex(end ?? this.lengthInt, len) let count = relEnd - relStart if (count < 0) { count = 0 } ...
https://gitcode.com/iop123123/arkts-static-skills
8d0b7784f1c50f2f5deaccdcbd656454cf4acc08
gitcode
LJ666-ui/harmony-health-care
entry/src/main/ets/service/ChartService.ets
arkts
niceNumber
Nice Number算法 计算美观的数字
private niceNumber(range: number, round: boolean): number { // 处理0的情况 if (range === 0) { return 1; } const exponent = Math.floor(Math.log10(Math.abs(range))); const fraction = Math.abs(range) / Math.pow(10, exponent); let niceFraction: number; if (round) { // 四舍五...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left niceNumber AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left range AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left n...
private niceNumber(range: number, round: boolean): number { // 处理0的情况 if (range === 0) { return 1; } const exponent = Math.floor(Math.log10(Math.abs(range))); const fraction = Math.abs(range) / Math.pow(10, exponent); let niceFraction: number; if (round) { // 四舍五...
https://github.com/LJ666-ui/harmony-health-care
b38e9529825b783cbcb0f4c9793c5ed9887fe41b
github
offlinecat-dev/OCNetORM
src/main/ets/query/QueryBuilder.ets
arkts
getLimitValue
获取 LIMIT 值 @returns LIMIT 值
getLimitValue(): number { return this.limitValue }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getLimitValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statemen...
getLimitValue(): number { return this.limitValue }
https://github.com/offlinecat-dev/OCNetORM
df9fb60878e0f8e8663f6e3e002fc35d9cd97cca
github
openharmony-sig/knowledge_demo_shopping
FA/MyAccountBook/entry/src/main/ets/MainAbility/pages/RemoteDataManager.ets
arkts
registerDataListCallback
TODO 包名和 storeId
registerDataListCallback(callback) { let that = this if (this.kvManager == null) { try { const config = { userInfo: { userId: '0', userType: 0 }, bundleName: 'com.example.accountbookets' } factory.createKVManager(config).then(...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left registerDataListCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left callback AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#...
registerDataListCallback(callback) { let that = this if (this.kvManager == null) { try { const config = { userInfo: { userId: '0', userType: 0 }, bundleName: 'com.example.accountbookets' } factory.createKVManager(config).then(...
https://gitee.com/openharmony-sig/knowledge_demo_shopping.git
7a2f01ff663a235659bc9d687b58a882a8c131cb
gitee
Tencent-RTC/TUIKit_Harmony
atomic_x/src/main/ets/basecomponent/utils/IMErrorCode.ets
arkts
getErrorMessage
Get error message by error code @param code Error code @param defaultMsg Default message if code not found @returns Error message
static getErrorMessage(code: number, defaultMsg?: string): Resource | string { const errorMessages = new Map<number, Resource>(); // Success code errorMessages.set(IMErrorCode.ERR_SUCC, $r('app.string.error_code_success')); // General errors errorMessages.set(IMErrorCode.ERR_IN_PROGESS, ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getErrorMessage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left code AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ...
static getErrorMessage(code: number, defaultMsg?: string): Resource | string { const errorMessages = new Map<number, Resource>(); // Success code errorMessages.set(IMErrorCode.ERR_SUCC, $r('app.string.error_code_success')); // General errors errorMessages.set(IMErrorCode.ERR_IN_PROGESS, ...
https://github.com/Tencent-RTC/TUIKit_Harmony
b42ef20080c1ea2d735a0aec5cf146f79c5dbba4
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/EBookDataManager.ets
arkts
getAllCustomBackgroundImages
获取所有电子书的自定义背景图片路径 用于在设置页面中选择已有的背景图片 [修复] 不再去重,显示每本使用背景图片的电子书
public async getAllCustomBackgroundImages(): Promise<BackgroundImageInfo[]> { try { const sql = ` SELECT s.bookId, s.backgroundImagePath, i.title FROM ebook_reading_settings s LEFT JOIN ebook_info i ON s.bookId = i.id WHERE s.backgroundImagePath IS NOT NULL AND s.b...
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 getAllCustomBackgroundImages AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expressi...
public async getAllCustomBackgroundImages(): Promise<BackgroundImageInfo[]> { try { const sql = ` SELECT s.bookId, s.backgroundImagePath, i.title FROM ebook_reading_settings s LEFT JOIN ebook_info i ON s.bookId = i.id WHERE s.backgroundImagePath IS NOT NULL AND s.b...
https://github.com/DaLongZhuaZi/manxia
ee7a3cb488cc2aac4970b4c5f0d0838f9bdef0cb
github
openharmony-sig/flutter_inappwebview
flutter_inappwebview_ohos/ohos/src/main/ets/components/plugin/types/WebMessagePort.ets
arkts
setWebMessageCallback
/ 抛异常,暂未完善
public setWebMessageCallback(callback: ValueCallback<void>): void{ if (this.isClosed || this.isTransferred) { throw new Error("Port is already closed or transferred"); } this.isStarted = true; let webView: InAppWebViewInterface | null = this.webMessageChannel != null && this.webMessageChannel.we...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setWebMessageCallback 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#instan...
public setWebMessageCallback(callback: ValueCallback<void>): void{ if (this.isClosed || this.isTransferred) { throw new Error("Port is already closed or transferred"); } this.isStarted = true; let webView: InAppWebViewInterface | null = this.webMessageChannel != null && this.webMessageChannel.we...
https://gitee.com/openharmony-sig/flutter_inappwebview.git
7f708a56ed28a6c88dec4b0fd8ebd2bec8445b63
gitee
cpdd5201314/harmonyOS-music-app
common/mediaCommon/src/main/ets/utils/request.ets
arkts
getPostDetail
获取帖子详情
static async getPostDetail(postId: number): Promise<Post> { return request<Post>(`/posts/${postId}`); }
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 getPostDetail AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left postId AST#identifier#Right AST#:#Left : A...
static async getPostDetail(postId: number): Promise<Post> { return request<Post>(`/posts/${postId}`); }
https://github.com/cpdd5201314/harmonyOS-music-app
217bcd6cacc9e2ebe439ace2568a80b55654e950
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/AudioVibrationService.ets
arkts
triggerGameHdHaptic
==================== 游戏/电影模式振动 ==================== 游戏模式 HD Haptic: 持续低沉振动 频率 30-50Hz, 持续 300ms, 强度跟随音频
private triggerGameHdHaptic(intensity: number): void { try { const builder = new vibrator.VibratorPatternBuilder(); const frequency = Math.floor(30 + (intensity / 100) * 20); // 30-50Hz builder.addContinuousEvent(0, 300, { intensity: Math.min(100, intensity), frequency: frequenc...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left triggerGameHdHaptic AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left intensity AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number A...
private triggerGameHdHaptic(intensity: number): void { try { const builder = new vibrator.VibratorPatternBuilder(); const frequency = Math.floor(30 + (intensity / 100) * 20); // 30-50Hz builder.addContinuousEvent(0, 300, { intensity: Math.min(100, intensity), frequency: frequenc...
https://github.com/AlkaidLab/moonlight-harmony
08db8bbf4180780b02eed57d371c1df4f5c9d984
github
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnListViewModel.ets
arkts
resetClickState
重置点击状态
resetClickState(): void { this.clickCount = 0; this.lastClickedItem = ""; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left resetClickState 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_bl...
resetClickState(): void { this.clickCount = 0; this.lastClickedItem = ""; }
https://github.com/codelably/tuniao-ui
7b06e8eac1ac77f7ee3f5f388222538522a6a303
github
openharmony/codelabs
ETSUI/RoundThreadScheduler/entry/src/main/ets/scheduler/RoundExecutor.ets
arkts
executeOneRound
执行单轮 @param roundIndex 当前轮次
private async executeOneRound(roundIndex: number): Promise<void> { const tasks: Promise<number>[] = []; for (let i = 0; i < this.workerCount; i++) { const worker = this.workers[i]; tasks.push(worker.run(roundIndex)); } // 等待本轮所有 worker 完成(轮次屏障) const results = await Promise.all(tasks...
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 executeOneRound AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left roundIndex AST#identifier#Right AST#ERROR#Left AST#:...
private async executeOneRound(roundIndex: number): Promise<void> { const tasks: Promise<number>[] = []; for (let i = 0; i < this.workerCount; i++) { const worker = this.workers[i]; tasks.push(worker.run(roundIndex)); } // 等待本轮所有 worker 完成(轮次屏障) const results = await Promise.all(tasks...
https://gitcode.com/openharmony/codelabs
154088c113d567c9d1695ac8678092504b3663b7
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/AsyncArrayConcurrentQueue.ets
arkts
getFirst
Returns the first element in a ConcurrentQueue. @returns { T | undefined } the first element or undefined when the queue is empty. @syscap SystemCapability.Utils.Lang
public override getFirst(): T | undefined { ConcurrencyHelpers.mutexLock(this.mutex); try { if (this.isQueueEmpty) { return undefined; } const value = this.array[this.curHeadIdx]; return value; ...
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 getFirst 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 getFirst(): T | undefined { ConcurrencyHelpers.mutexLock(this.mutex); try { if (this.isQueueEmpty) { return undefined; } const value = this.array[this.curHeadIdx]; return value; ...
https://gitcode.com/iop123123/arkts-static-skills
485477a3c99159b45f98267a32f6121766d6b8df
gitcode
popsiclelmlm/Hey
entry/src/main/ets/features/nodes/NodeDetailFields.ets
arkts
pushSection
---- 工具 ----
function pushSection(sections: Array<NodeDetailSection>, titleKey: string, fields: Array<NodeDetailField>): void { if (fields.length > 0) { sections.push({ titleKey, fields }); } }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left pushSection AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sections AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#...
function pushSection(sections: Array<NodeDetailSection>, titleKey: string, fields: Array<NodeDetailField>): void { if (fields.length > 0) { sections.push({ titleKey, fields }); } }
https://github.com/popsiclelmlm/Hey
3aa2befea203c64a6293bdf06828846737d6b123
github
openharmony-sig/applications_calculator
feature/calculation/src/main/ets/calculator/Evaluator.ets
arkts
receiveMsg
receive msg @param calculatorCallBack Function
receiveMsg(calculatorCallBack: Function): void { this.worker.onmessage = (msg: MessageEvents) => { this.result = msg.data.result; if (DisplayUtil.isNumber(msg.data.exp) || DisplayUtil.isNumber(this.expression) || this.isOperatorChar(this.expression)) { this.result = ''; } Com...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left receiveMsg AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left calculatorCallBack AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Function AST#identifier#Right AST#ERROR#Right A...
receiveMsg(calculatorCallBack: Function): void { this.worker.onmessage = (msg: MessageEvents) => { this.result = msg.data.result; if (DisplayUtil.isNumber(msg.data.exp) || DisplayUtil.isNumber(this.expression) || this.isOperatorChar(this.expression)) { this.result = ''; } Com...
https://gitee.com/openharmony-sig/applications_calculator.git
a00746f734a9492469b870220041fee736a89053
gitee
LongLiveY96/chatcube
entry/src/main/ets/services/ImportExportService.ets
arkts
exportData
============ 导出功能 ============
async exportData(options: ExportOptions, onProgress?: (progress: number) => void): Promise<string> { if (this.context === null) { throw new Error('Service not initialized') } try { let lastProgress = -1 const emitProgress = (progress: number): void => { if (onProgress && progres...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left exportData AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left options AST#identifier#Right AST#t...
async exportData(options: ExportOptions, onProgress?: (progress: number) => void): Promise<string> { if (this.context === null) { throw new Error('Service not initialized') } try { let lastProgress = -1 const emitProgress = (progress: number): void => { if (onProgress && progres...
https://github.com/LongLiveY96/chatcube
a0254ff1e18a676702ee6be217d6b2faf3f27c0b
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/GamepadManager.ets
arkts
hasUsbGamepad
检查是否有 USB 手柄连接 用于 UI 决定是否显示 USB 驱动相关选项
hasUsbGamepad(): boolean { return this.usbDriverService.getControllerCount() > 0; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasUsbGamepad 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#state...
hasUsbGamepad(): boolean { return this.usbDriverService.getControllerCount() > 0; }
https://github.com/AlkaidLab/moonlight-harmony
6ff1d9ec4dd45fb96b9721cbff23352532cb6669
github
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnRateViewModel.ets
arkts
setRateValue1
设置评分组件1的评分值 @param value 新的评分值
setRateValue1(value: number): void { this.rateValue1 = value; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setRateValue1 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) ...
setRateValue1(value: number): void { this.rateValue1 = value; }
https://github.com/codelably/tuniao-ui
c94c65afb12b938c160d06d9345fc64922073b51
github
ZestBox-18/kitebook-frontend
commons/kite_utils/src/main/ets/utils/clog/Clog.ets
arkts
writeStr
将数据写入文件并关闭文件 以 JSON 数组形式维护文件: - 空文件写入为 `[{...}]` - 非空文件在末尾 `]` 前插入 `,{...}]`
private static writeStr(path: string, str: string): number { const file = fs.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); let offset = fs.statSync(file.fd).size; if (offset === 0) { str = `[${str}]`; } else { offset = offset - 1; str = `,${str}]`; } const opti...
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 writeStr AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#...
private static writeStr(path: string, str: string): number { const file = fs.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); let offset = fs.statSync(file.fd).size; if (offset === 0) { str = `[${str}]`; } else { offset = offset - 1; str = `,${str}]`; } const opti...
https://github.com/ZestBox-18/kitebook-frontend
d2b5b95d965426956e135fcd31aad456531ff614
github
aimilin6688/KeePassHO
entry/src/main/ets/common/utils/CommonUtils.ets
arkts
back
返回 @param options
public static back(options?: router.RouterOptions): void { if (CommonUtils.uiContext) { return CommonUtils.uiContext.getRouter().back(options); } return router.back(options); }
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#identifier#Left back AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left options AST...
public static back(options?: router.RouterOptions): void { if (CommonUtils.uiContext) { return CommonUtils.uiContext.getRouter().back(options); } return router.back(options); }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/CommonUtils.ets#L181-L186
cc7895d27655ca0e67e1795bfc5ee6727b0539f5
github
YANGZX22/Voot
entry/src/main/ets/sherpa/NonStreamingAsr.ets
arkts
acceptWaveform
obj is {samples: samples, sampleRate: sampleRate} samples is a float32 array containing samples in the range [-1, 1] sampleRate is a number
acceptWaveform(obj: Samples) { acceptWaveformOffline(this.handle, obj) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left acceptWaveform AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Samples AST#identifier#Righ...
acceptWaveform(obj: Samples) { acceptWaveformOffline(this.handle, obj) }
https://github.com/YANGZX22/Voot
602875d9ea7ac7f3cfe1bf9c7eda6ee859900525
github
LongLiveY96/chatcube
entry/src/main/ets/services/ProviderShareScanner.ets
arkts
pickImageAndDecodeQr
调起系统图库,让用户选一张图,然后用 ScanKit 解二维码。 用户取消选图:ok=false, error='cancelled'。 没识别到 QR:ok=false, error='no_qr'。
async pickImageAndDecodeQr(): Promise<ProviderShareScanResult> { let imageUri: string = '' try { const picker = new photoAccessHelper.PhotoViewPicker() const options = new photoAccessHelper.PhotoSelectOptions() options.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE options....
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left pickImageAndDecodeQr 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#:#...
async pickImageAndDecodeQr(): Promise<ProviderShareScanResult> { let imageUri: string = '' try { const picker = new photoAccessHelper.PhotoViewPicker() const options = new photoAccessHelper.PhotoSelectOptions() options.MIMEType = photoAccessHelper.PhotoViewMIMETypes.IMAGE_TYPE options....
https://github.com/LongLiveY96/chatcube
19cc66cefaa3dd7142a5d55ce0ac96d18ad433e1
github
arkui-x/samples
CodeLab/Cases/feature/customscan/src/main/ets/model/PermissionModel.ets
arkts
checkPermission
检测是否已授权 @param {Permissions} permissionName 检测授权的权限名 @returns {boolean} 检测结果
async checkPermission(permissionName: Permissions): Promise<boolean> { // 检测用户是否已经授权 const grantStatus: abilityAccessCtrl.GrantStatus = await this.reqCurGrantStatus(permissionName); if (grantStatus === abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED) { // 用户之前已授权,可以直接访问目标操作 return true; }...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left checkPermission AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left permissionName AST#identifier#Right AST#type_annotation#Left AS...
async checkPermission(permissionName: Permissions): Promise<boolean> { // 检测用户是否已经授权 const grantStatus: abilityAccessCtrl.GrantStatus = await this.reqCurGrantStatus(permissionName); if (grantStatus === abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED) { // 用户之前已授权,可以直接访问目标操作 return true; }...
https://gitcode.com/arkui-x/samples
9e50ace568fe9b39c3091bd3d62ceeaa9c41223e
gitcode
openharmony-sig/flutter_packages
packages/camera/camera_ohos/ohos/src/main/ets/io/flutter/plugins/camera/CameraUtils.ets
arkts
getExposureBiasRange
查询曝光补偿范围
public static getExposureBiasRange(captureSession: camera.PhotoSession | camera.VideoSession): Array<number> { let biasRangeArray: Array<number> = []; try { biasRangeArray = captureSession.getExposureBiasRange(); } catch (error) { // 失败返回错误码error.code并处理 let err = error as BusinessError;...
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 getExposureBiasRange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#member_expression#Left AST#identifier#...
public static getExposureBiasRange(captureSession: camera.PhotoSession | camera.VideoSession): Array<number> { let biasRangeArray: Array<number> = []; try { biasRangeArray = captureSession.getExposureBiasRange(); } catch (error) { // 失败返回错误码error.code并处理 let err = error as BusinessError;...
https://gitee.com/openharmony-sig/flutter_packages.git
53a2b5dbf435c30af3a98ed427fbbc03f71a6b58
gitee
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/SeasonalityDetectionService.ets
arkts
detectSeasonalityBatch
批量检测季节性
static detectSeasonalityBatch( dataList: Array<CategoryMonthlyData>, thresholds?: SeasonalityThresholds ): SeasonalityAnalysisResult[] { const results: SeasonalityAnalysisResult[] = []; for (const item of dataList) { const result = SeasonalityDetectionService.detectSeasonality( item.c...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left detectSeasonalityBatch AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left dataList AST#identifier#Right AST#ERROR#Left AST#:#Left : AST...
static detectSeasonalityBatch( dataList: Array<CategoryMonthlyData>, thresholds?: SeasonalityThresholds ): SeasonalityAnalysisResult[] { const results: SeasonalityAnalysisResult[] = []; for (const item of dataList) { const result = SeasonalityDetectionService.detectSeasonality( item.c...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
c50c25b2e6714de9e7d081fecf780d792a9f6db2
github
Joker-x-dev/CoolMallArkTS
core/data/src/main/ets/repository/AddressRepository.ets
arkts
getAddressInfo
获取地址信息 @param id 地址ID @returns 地址详情
async getAddressInfo(id: number): Promise<NetworkResponse<Address>> { return this.networkDataSource.getAddressInfo(id); }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getAddressInfo AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS...
async getAddressInfo(id: number): Promise<NetworkResponse<Address>> { return this.networkDataSource.getAddressInfo(id); }
https://github.com/Joker-x-dev/CoolMallArkTS
2406deef4d5db807b37e00a6886a5ca5ea4ac610
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
every
Checks that all elements of Uint8ClampedArray satisfy the passed function @param fn check function @returns true if all elements satisfy fn
public every(fn: (element: number, index: int, array: Uint8ClampedArray) => boolean): boolean { for (let i = 0; i < this.length; ++i) { if (!fn(this.at(i), i, this)) { return false } } return true }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left every AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Rig...
public every(fn: (element: number, index: int, array: Uint8ClampedArray) => boolean): boolean { for (let i = 0; i < this.length; ++i) { if (!fn(this.at(i), i, this)) { return false } } return true }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
69212797bbc4ca33a6b0a528322ead19c2db842b
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Math.ets
arkts
cbrt
Cube root of a number. @param x arbitrary number @remark Math.𝚌brt(𝚡) = ∛x = the unique y such that y³ = x.
public static cbrt(x: float): float { if (isNaN(x) || x == Float.POSITIVE_INFINITY || x == Float.NEGATIVE_INFINITY) return x; return cbrt(x); }
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#identifier#Left cbrt AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left x AST#ident...
public static cbrt(x: float): float { if (isNaN(x) || x == Float.POSITIVE_INFINITY || x == Float.NEGATIVE_INFINITY) return x; return cbrt(x); }
https://gitcode.com/iop123123/arkts-static-skills
9231b00b48023d4f94f6a0c0ec2c65325779a865
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Source/SourceManager.ets
arkts
mapToSourceInfo
映射到SourceInfo
private mapToSourceInfo(source: ESObject): SourceInfo { const pkg = source.pkg as string || undefined; let iconPath: string | undefined = undefined; // 尝试获取图标路径 if (pkg) { const repoManager = SourceRepositoryManager.getInstance(); const foundIconPath = repoManager.getSourceIconPath(pk...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left mapToSourceInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left source AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#...
private mapToSourceInfo(source: ESObject): SourceInfo { const pkg = source.pkg as string || undefined; let iconPath: string | undefined = undefined; // 尝试获取图标路径 if (pkg) { const repoManager = SourceRepositoryManager.getInstance(); const foundIconPath = repoManager.getSourceIconPath(pk...
https://github.com/DaLongZhuaZi/manxia
b331230afaa8728edda651c05a674c9e162dc3e7
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/division/division_uint.ets
arkts
main
--- desc: check division for unsigned integer operands ---
function main(): void { const a: uint = {{v.left}} const b: uint = {{v.right}} assert (a / b) == {{v.result}}
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A...
function main(): void { const a: uint = {{v.left}} const b: uint = {{v.right}} assert (a / b) == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
39f85374c9c7b9a92982933a68f2decd7f7545ce
gitee
offlinecat-dev/OCNetORM
src/main/ets/query/SubQuery.ets
arkts
constructor
构造函数 @param relationName 关联关系名称
constructor(relationName: string) { this.relationName = relationName }
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 relationName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right A...
constructor(relationName: string) { this.relationName = relationName }
https://github.com/offlinecat-dev/OCNetORM
006cd9549dc5e2abd0d986877b7b96ffd0a3ff74
github
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/services/RdpSessionManager.ets
arkts
onBackground
Handle app going to background
async onBackground(): Promise<void> { if (!isSessionActive) { console.info(`${TAG}: No active session, skip background handling`); return; } console.info(`${TAG}: App going to background`); isInBackground = true; // Start background service for audio if (backgroundService...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left onBackground AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AS...
async onBackground(): Promise<void> { if (!isSessionActive) { console.info(`${TAG}: No active session, skip background handling`); return; } console.info(`${TAG}: App going to background`); isInBackground = true; // Start background service for audio if (backgroundService...
https://github.com/tangwengang-del/freerdp-harmonyos
f9807a11c66f3e6dd61c7e67230256026892da93
github
LongLiveY96/chatcube
entry/src/main/ets/viewmodels/ChatViewModel.ets
arkts
appendBuiltinSearchReferences
OpenAI Responses 内置搜索引用累积: url_citation 流式按 annotation 增量到达, 这里按 url 去重 push 到 aiMessage.searchReferences。 来源标记 'openai_builtin', 引擎名固定为 'OpenAI Web Search', 让 SearchReferenceCard 走现有展示。
private appendBuiltinSearchReferences( aiMessage: ChatMessage, refs: SearchReference[], onAIMessageUpdated: (message: ChatMessage) => void ): void { if (refs.length === 0) { return } let changed = false for (let i = 0; i < refs.length; i++) { const ref = refs[i] let exi...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left appendBuiltinSearchReferences AST#identifier#Right AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left aiMessage AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ChatMessage AST#identi...
private appendBuiltinSearchReferences( aiMessage: ChatMessage, refs: SearchReference[], onAIMessageUpdated: (message: ChatMessage) => void ): void { if (refs.length === 0) { return } let changed = false for (let i = 0; i < refs.length; i++) { const ref = refs[i] let exi...
https://github.com/LongLiveY96/chatcube
abe94abe07156909c6e4f252d42dd06956dff2e8
github
aimilin6688/KeePassHO
entry/src/main/ets/storage/onedrive/OneDriveClient.ets
arkts
valid
验证连接 @returns Promise<HttpResponse> 验证结果
public async valid(): Promise<HttpResponse> { if (!this.axiosInstance) { throw new Error('Axios instance not initialized'); } try { const response: AxiosResponse = await this.axiosInstance.get('/me/drive/root'); return this.convertAxiosResponse(response); } catch (error) { retu...
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 valid AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : A...
public async valid(): Promise<HttpResponse> { if (!this.axiosInstance) { throw new Error('Axios instance not initialized'); } try { const response: AxiosResponse = await this.axiosInstance.get('/me/drive/root'); return this.convertAxiosResponse(response); } catch (error) { retu...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/onedrive/OneDriveClient.ets#L510-L520
1d0604805eb96e8e4fee895f691cc0c461778f09
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/SettingsBackupService.ets
arkts
hasSettings
检查当前是否有已保存的设置
static async hasSettings(): Promise<boolean> { try { const prefs = await PreferencesUtil.getPreferences(); const all = await prefs.getAll(); return Object.keys(all).length > 0; } catch { return false; } }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left hasSettings 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 hasSettings(): Promise<boolean> { try { const prefs = await PreferencesUtil.getPreferences(); const all = await prefs.getAll(); return Object.keys(all).length > 0; } catch { return false; } }
https://github.com/AlkaidLab/moonlight-harmony
81385064178e2df2f2d4b217b57aabd2c0dc340f
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/BigInt.ets
arkts
constructor
Creates a new `BigInt` instance from an int value. @param { int } d The int value to convert. @syscap SystemCapability.Utils.Lang @FaAndStageModel
constructor(d: int) { this.sign = d < 0 ? -1 : (d == 0 ? 0 : 1) this.bytes = this.sign == 0 ? [] as ValueArray<int> : BigInt.fromLongHelper(d.toLong(), 32, this.sign) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left d AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left int AST#identifier#Right AST#)#L...
constructor(d: int) { this.sign = d < 0 ? -1 : (d == 0 ? 0 : 1) this.bytes = this.sign == 0 ? [] as ValueArray<int> : BigInt.fromLongHelper(d.toLong(), 32, this.sign) }
https://gitcode.com/iop123123/arkts-static-skills
696536686a82356025c03b32c861bf60f2d3e4ac
gitcode
HarmonyOS_Samples/HarmonyOSComponentUXExamples
products/pc/src/main/ets/components/presentation/progress/components/CircleProgress.ets
arkts
clearTimer
Helper method to clear the timer
clearTimer() { if (this.timerId !== -1) { clearInterval(this.timerId); this.timerId = -1; } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left clearTimer 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 AS...
clearTimer() { if (this.timerId !== -1) { clearInterval(this.timerId); this.timerId = -1; } }
https://gitcode.com/HarmonyOS_Samples/HarmonyOSComponentUXExamples
37ac08ebdcf6ea0ccc30f0f7d56a8768fdd6c43d
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Utils/WindowManager.ets
arkts
syncBackgroundState
统一同步应用前后台状态(供窗口事件与Ability生命周期共用)
static syncBackgroundState(isInBackground: boolean, source: string): void { const current = AppStorage.get<boolean>(WindowManager.BACKGROUND_STORAGE_KEY); if (current === isInBackground) { WindowManager.applyBackgroundPrivacyMode(isInBackground, source); return; } AppStorage.setOrCreate(W...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left syncBackgroundState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isInBackground AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boole...
static syncBackgroundState(isInBackground: boolean, source: string): void { const current = AppStorage.get<boolean>(WindowManager.BACKGROUND_STORAGE_KEY); if (current === isInBackground) { WindowManager.applyBackgroundPrivacyMode(isInBackground, source); return; } AppStorage.setOrCreate(W...
https://github.com/DaLongZhuaZi/manxia
ba21bfcfe53d3da4530aacfcfbe2353fa93e2cff
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test25_original_index.ets
arkts
testForOf
--- for-of loop ---
function testForOf(): string { let items: string[] = ['a', 'b', 'c', 'd']; let result: string = ''; for (let item of items) { result = result + item; } return result; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testForOf AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#L...
function testForOf(): string { let items: string[] = ['a', 'b', 'c', 'd']; let result: string = ''; for (let item of items) { result = result + item; } return result; }
https://github.com/miaochiahao/ark-ghidra
735f227501c4a466b88ac6d7d2ba323c36cc9a68
github
the-wwyang/kids-learning-app
src/main/ets/common/UserService.ets
arkts
userExists
检查用户是否存在
public async userExists(username: string): Promise<boolean> { const users = await this.getUsers(); return users.has(username); }
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 userExists AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left username AST#identifier#Right AST#ERROR#Left AST#:#Left : AS...
public async userExists(username: string): Promise<boolean> { const users = await this.getUsers(); return users.has(username); }
https://github.com/the-wwyang/kids-learning-app
801882cd23d4f017f5d1f30fb442db910676ae90
github
SMAT-Lab/PhantomRendering
example/entry/src/main/ets/common/DeviceUtils.ets
arkts
dp2px
dp转px
static dp2px(dp: number): number { return Math.round(dp * DeviceUtils.getDensity()) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left dp2px AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dp AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR...
static dp2px(dp: number): number { return Math.round(dp * DeviceUtils.getDensity()) }
https://github.com/SMAT-Lab/PhantomRendering
c3cf7ecaa509527bfccbc233103b5719d9562e8d
github
Countly/countly-sdk-hos
library/src/main/ets/Countly.ets
arkts
stopAll
Stop every active instance (shared + every named instance) WITHOUT wiping persisted storage. Equivalent to calling `instance.stop()` on each, see the `stop` vs `halt` distinction on `CountlyInstance`. Use this for tests / between-config swaps where you want to drop SDK activity but keep buffered telemetry on disk for t...
public static async stopAll(): Promise<void> { if (Countly.shared) { await Countly.shared.stop(); Countly.shared = null; } // Snapshot values into an array so a stop() that mutates the map can't // invalidate the iteration. const instances: CountlyInstance[] = []; Countly.namedInst...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left stopAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right ...
public static async stopAll(): Promise<void> { if (Countly.shared) { await Countly.shared.stop(); Countly.shared = null; } // Snapshot values into an array so a stop() that mutates the map can't // invalidate the iteration. const instances: CountlyInstance[] = []; Countly.namedInst...
https://github.com/Countly/countly-sdk-hos
f2cc17bddd4fb69e89b1c58b521ac6028eb8f525
github
HarmonyOS_Samples/BestPracticeSnippets
Privacy/PrivacyError/src/main/ets/pages/UntrustedDataToSQL.ets
arkts
readFile
[End untrusted_data_to_sql] 最佳实践:应用安全编码实践 场景二十九:避免使用未校验的外部数据拼接文件路径 [Start untrusted_data_to_file_name] The fileName is from external
function readFile(fileName: string) { let filePath = '/data/storage/'; if (fileName.indexOf('..') === -1) { // Anti-splicing verification let fileAllPath: string = filePath + fileName; // Service processing } else { hilog.info(0x0000, 'privacy', 'be attacked'); return; } }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left readFile AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left fileName AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Rig...
function readFile(fileName: string) { let filePath = '/data/storage/'; if (fileName.indexOf('..') === -1) { // Anti-splicing verification let fileAllPath: string = filePath + fileName; // Service processing } else { hilog.info(0x0000, 'privacy', 'be attacked'); return; } }
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
6b2f3aed9f8cab5d64d8ce5c1916629b09b4ab32
gitcode
Joker-x-dev/CoolMallArkTS
core/data/src/main/ets/repository/AccountStoreRepository.ets
arkts
constructor
构造函数 @param {common.Context} context UIAbility 上下文 @param {AccountStoreDataSource} [dataSource] 可选自定义数据源
constructor(context: common.Context, dataSource?: AccountStoreDataSource) { this.dataSource = dataSource ?? new AccountStoreDataSourceImpl(context); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Left...
constructor(context: common.Context, dataSource?: AccountStoreDataSource) { this.dataSource = dataSource ?? new AccountStoreDataSourceImpl(context); }
https://github.com/Joker-x-dev/CoolMallArkTS
42348e4369ce594dacef0901dd1b5271255de2dc
github
HarmonyOS_Samples/MusicHome
features/player/src/main/ets/model/MediaService.ets
arkts
registerSessionControlListeners
Subscribe to AVSession controller commands (play / pause / next / previous).
private async registerSessionControlListeners(): Promise<void> { if (!this.session) { return; } try { this.session.on('play', this.playCall); this.session.on('pause', this.pauseCall); this.session.on('playNext', this.playNextCall); this.session.on('playPrevious', this.playPre...
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 registerSessionControlListeners AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_ex...
private async registerSessionControlListeners(): Promise<void> { if (!this.session) { return; } try { this.session.on('play', this.playCall); this.session.on('pause', this.pauseCall); this.session.on('playNext', this.playNextCall); this.session.on('playPrevious', this.playPre...
https://gitcode.com/HarmonyOS_Samples/MusicHome
efba32f423d20222b1ec4f52dea541a45addd735
gitcode
OHPG/FinSdk
jellyfin/src/main/ets/api/LibraryApi.ets
arkts
postUpdatedSeries
@summary Reports that new episodes of a series have been added by an external source. @param {LibraryApiPostUpdatedSeriesRequest} requestParameters Request parameters. @param {*} [options] Override http request option. @throws {RequiredError} @memberof LibraryApi
public postUpdatedSeries(requestParameters: LibraryApiPostUpdatedSeriesRequest = {}): Promise<void> { return this.apiClient.post({path: `/Library/Series/Updated`, parameters: requestParameters}) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left postUpdatedSeries AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#a...
public postUpdatedSeries(requestParameters: LibraryApiPostUpdatedSeriesRequest = {}): Promise<void> { return this.apiClient.post({path: `/Library/Series/Updated`, parameters: requestParameters}) }
https://github.com/OHPG/FinSdk
2b1f1378ceb1efb4cbc05d8a95a80b90dd3d0fb8
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/GC.ets
arkts
startGC
The function triggers specific GC @param cause cause of requested GC @param callback callback is called in concurrent phase @throws IllegalArgumentException if cause of GC is invalid or current GC does not support requested cause @returns id of started GC. - The id can be passed to waitForFinishGC to ensure the GC is f...
public static startGC(cause: int, callback: () => void): long throws { GC.startGCImpl(cause, callback as Object); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#identifier#Left startGC AST#identifier#Right AST#(#Left ( AST#(#Right AST#identifier#Left cause AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#...
public static startGC(cause: int, callback: () => void): long throws { GC.startGCImpl(cause, callback as Object); }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
07bd36eff1302e3e3048a4f615ce862466f8bbec
gitee
openharmony/applications_app_samples
code/BasicFeature/ApplicationModels/DynamicRouter/RouterModule/src/main/ets/utils/RouterModule.ets
arkts
getRouter
通过名称获取router
public static getRouter(routerName: string): NavPathStack{ let router = RouterModule.routerMap.get(routerName); return router as NavPathStack; }
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 getRouter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left routerName AST#identifier#Right AST#ERROR#Left AST#:#Left : ...
public static getRouter(routerName: string): NavPathStack{ let router = RouterModule.routerMap.get(routerName); return router as NavPathStack; }
https://github.com/openharmony/applications_app_samples
90168dd68470831978a57d94811c0dc90e811c1d
github
Joker-x-dev/CoolMallArkTS
core/data/src/main/ets/repository/LaunchStoreRepository.ets
arkts
saveGuideShown
保存引导页已展示状态 @param {boolean} shown - 是否已展示 @returns {Promise<void>} Promise<void>
saveGuideShown(shown: boolean): Promise<void> { return this.dataSource.setGuideShown(shown); }
AST#program#Left AST#expression_statement#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left saveGuideShown AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left shown AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif...
saveGuideShown(shown: boolean): Promise<void> { return this.dataSource.setGuideShown(shown); }
https://github.com/Joker-x-dev/CoolMallArkTS
f347fc637206d49d9a163e0f93d8b74db5170dfa
github