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
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Source/SuwayomiSource.ets
arkts
markChapterRead
标记章节为已读
public async markChapterRead(chapterId: string, isRead: boolean = true): Promise<boolean> { const query = ` mutation UpdateChapter($id: Int!, $isRead: Boolean!) { updateChapter(input: { id: $id, patch: { isRead: $isRead } }) { chapter { id isRead } ...
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 markChapterRead AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left chapterId AST#identifier#Right AST#ERROR#Left AST#:#Lef...
public async markChapterRead(chapterId: string, isRead: boolean = true): Promise<boolean> { const query = ` mutation UpdateChapter($id: Int!, $isRead: Boolean!) { updateChapter(input: { id: $id, patch: { isRead: $isRead } }) { chapter { id isRead } ...
https://github.com/DaLongZhuaZi/manxia
2561fe5ec5e94a87acf8b7d24615ba1cb855b44e
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.stream.ets
arkts
constructor
The Readable constructor. @param { ReadableOptions } options - Provide options. @throws { BusinessError } 401 - Parameter error.
constructor(options: ReadableOptions) { this.initializeMembers(); if (options.encoding) { this.readableEncodingInner = options.encoding!; if (this.readableEncodingInner!.toLowerCase() === 'utf8') { this.readableEncodingInner = DEFAULT_...
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 options AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ReadableOptions AST#identi...
constructor(options: ReadableOptions) { this.initializeMembers(); if (options.encoding) { this.readableEncodingInner = options.encoding!; if (this.readableEncodingInner!.toLowerCase() === 'utf8') { this.readableEncodingInner = DEFAULT_...
https://gitcode.com/iop123123/arkts-static-skills
1dbe4217ae399b31caaf205573bf6d974f912c6b
gitcode
cpdd5201314/harmonyOS-music-app
products/phone/src/main/ets/pages/SearchHistoryManager.ets
arkts
getMostUsedSource
获取最常用的搜索源
private static getMostUsedSource(sourceCount: Map<string, number>): string { let maxCount = 0 let mostUsedSource = 'all' const entries = Array.from(sourceCount.entries()) for (let i = 0; i < entries.length; i++) { const entry = entries[i] if (entry[1] > maxCount) { maxCount = entr...
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 getMostUsedSource AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left sourceCount AST...
private static getMostUsedSource(sourceCount: Map<string, number>): string { let maxCount = 0 let mostUsedSource = 'all' const entries = Array.from(sourceCount.entries()) for (let i = 0; i < entries.length; i++) { const entry = entries[i] if (entry[1] > maxCount) { maxCount = entr...
https://github.com/cpdd5201314/harmonyOS-music-app
a8c8aa3277c64fab585a1ae55f3b6c05db39eb20
github
pangpang20/antennaPodHM
entry/src/main/ets/entryability/EntryAbility.ets
arkts
requestPermissions
请求必要权限
private async requestPermissions(): Promise<void> { try { const atManager = abilityAccessCtrl.createAtManager(); const bundleInfo = await bundleManager.getBundleInfoForSelf(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION); const tokenId = bundleInfo.appInfo.accessTokenId; // 必要权...
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 requestPermissions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ...
private async requestPermissions(): Promise<void> { try { const atManager = abilityAccessCtrl.createAtManager(); const bundleInfo = await bundleManager.getBundleInfoForSelf(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION); const tokenId = bundleInfo.appInfo.accessTokenId; // 必要权...
https://github.com/pangpang20/antennaPodHM
9c2399b54e6a8f6a6a0b4090caf8e984ce04a74b
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/utils/HttpClient.ets
arkts
request
执行 HTTP 请求(GET,返回完整响应)
static async request(url: string, config?: HttpClientConfig): Promise<HttpResponse> { return HttpClient.executeGet(url, config); }
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 request AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Righ...
static async request(url: string, config?: HttpClientConfig): Promise<HttpResponse> { return HttpClient.executeGet(url, config); }
https://github.com/AlkaidLab/moonlight-harmony
b333c09785e4a2f025ac46faf21f966fe31cb657
github
openharmony-sig/ohos_easyui
easyui/src/main/ets/common/components/SwipeCaptcha/rotatePuzzle.ets
arkts
swipeRoad
使用@Extend装饰器,可简化代码,方便组件样式的复用
@Extend(Row) function swipeRoad(){//滑轨 样式 .height('50') .width(280) .borderRadius(5) .border({ width: 1, color: Color.Blue }) }
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#call_expression#Left AST#identifier#Left Extend AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left Row AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Ri...
@Extend(Row) function swipeRoad(){//滑轨 样式 .height('50') .width(280) .borderRadius(5) .border({ width: 1, color: Color.Blue }) }
https://gitee.com/openharmony-sig/ohos_easyui.git
cf2ec4edbb67147a10ae2051a6e14d5e9eccf45b
gitee
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/services/RdpSessionManager.ets
arkts
startKeepaliveTimer
Start keepalive timer
private startKeepaliveTimer(): void { if (keepaliveTimerId !== -1) { return; // Already running } console.info(`${TAG}: Starting keepalive timer`); const keepaliveCallback = (): void => { if (isSessionActive && currentInstance !== 0) { LibFreeRDP.sendKeepalive(currentInst...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left startKeepaliveTimer 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 ...
private startKeepaliveTimer(): void { if (keepaliveTimerId !== -1) { return; // Already running } console.info(`${TAG}: Starting keepalive timer`); const keepaliveCallback = (): void => { if (isSessionActive && currentInstance !== 0) { LibFreeRDP.sendKeepalive(currentInst...
https://github.com/tangwengang-del/freerdp-harmonyos
dfb9f3a1161ac94555e85d6a50efefd2a5a55abf
github
openharmony-sig/jtar
library/src/main/ets/ohos_tar.ets
arkts
constructor
用于存储要进行untar解包的路径 用于构建Jtar工具 @param fileName 压缩后的文件名 @param untarDirName 解压后的文件夹名
constructor(rootPath: string, fileName: string) { this.rootPath = rootPath; ohos_tar.setTarRootPath(this.rootPath); this.tarFileName = fileName + ".tar"; this.untarFileName = fileName + ".tar"; }
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 rootPath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#,...
constructor(rootPath: string, fileName: string) { this.rootPath = rootPath; ohos_tar.setTarRootPath(this.rootPath); this.tarFileName = fileName + ".tar"; this.untarFileName = fileName + ".tar"; }
https://gitee.com/openharmony-sig/jtar.git
8f39cebd0e179a57228a2c4f67ba5a71a43104e0
gitee
CarGuo/GSYGithubAppOH
entry/src/main/ets/entryability/EntryAbility.ets
arkts
handleBootWelcomeHoldInjection
测试通道:want.parameters.bootWelcomeHold=true, 保持 WelcomePage 不自动路由,用于短时间动画截图对比。
private handleBootWelcomeHoldInjection(want: Want): void { const params: Record<string, Object> | undefined = want.parameters as Record<string, Object> | undefined; if (!params) { return; } const raw: Object | undefined = params[PARAM_BOOT_WELCOME_HOLD]; if (typeof raw !== 'string') { ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleBootWelcomeHoldInjection 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 AS...
private handleBootWelcomeHoldInjection(want: Want): void { const params: Record<string, Object> | undefined = want.parameters as Record<string, Object> | undefined; if (!params) { return; } const raw: Object | undefined = params[PARAM_BOOT_WELCOME_HOLD]; if (typeof raw !== 'string') { ...
https://github.com/CarGuo/GSYGithubAppOH
3e6638424d5925eed0f60dc5fd7ee2eb8a554694
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoRhinoEngine.ets
arkts
timeout
超时Promise
private timeout(ms: number): Promise<boolean> { return new Promise((resolve) => { setTimeout(() => resolve(false), ms); }); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left timeout AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ms AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number ...
private timeout(ms: number): Promise<boolean> { return new Promise((resolve) => { setTimeout(() => resolve(false), ms); }); }
https://github.com/DaLongZhuaZi/manxia
254626b9cab982a163c1994ba3d8365358d521c5
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Loaders/MangaDetailLoader.ets
arkts
loadLocalManga
加载本地漫画
private async loadLocalManga(comicInfo: ComicInfo, params: MangaDetailLoadParams): Promise<MangaDetailLoadResult> { const result: MangaDetailLoadResult = { success: false, manga: null, chapters: [], isFavorite: false, isLocalManga: true, sourceId: 0, sourceName: '本地导入', ...
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 loadLocalManga AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left comicInfo AST#identifier#Right AST#:#L...
private async loadLocalManga(comicInfo: ComicInfo, params: MangaDetailLoadParams): Promise<MangaDetailLoadResult> { const result: MangaDetailLoadResult = { success: false, manga: null, chapters: [], isFavorite: false, isLocalManga: true, sourceId: 0, sourceName: '本地导入', ...
https://github.com/DaLongZhuaZi/manxia
da49584d899a4a31a6b998a7e871defdf00f6a98
github
openharmony/arkui_advanced_ui_component
customappbar/source/custom_app_bar.ets
arkts
updateRatio
半屏嵌入式定制使用,当半屏嵌入式组件首次被拉起或者屏幕宽度断点发生变化时被调用 被调用时更新半屏嵌入式组件的宽高比例
updateRatio(): void { // 屏幕断点为LG或MD时设置成直板机的宽高尺寸比,断点为SM时设置成undefined从而使控制尺寸比的字段失效 const isRatioBeUndefined = this.breakPoint === BreakPointsType.LG || this.breakPoint === BreakPointsType.MD; this.ratio = isRatioBeUndefined ? 1 / LG_WIDTH_HEIGHT_RATIO : undefined; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateRatio 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#...
updateRatio(): void { // 屏幕断点为LG或MD时设置成直板机的宽高尺寸比,断点为SM时设置成undefined从而使控制尺寸比的字段失效 const isRatioBeUndefined = this.breakPoint === BreakPointsType.LG || this.breakPoint === BreakPointsType.MD; this.ratio = isRatioBeUndefined ? 1 / LG_WIDTH_HEIGHT_RATIO : undefined; }
https://gitee.com/openharmony/arkui_advanced_ui_component.git
f78df8f58e4fca3fc3fc94a1d917a6430e7de378
gitee
webabcd/HarmonyDemo
entry/src/main/ets/pages/basic/LifecycleDemo.ets
arkts
aboutToAppear
组件生命周期
aboutToAppear() { MyLog.d('aboutToAppear 组件即将创建之前'); // 开启 windowEvent 监听 window.getLastWindow(getContext(this), (err, win) => { win.on("windowEvent", (event) => { // 监听切到前台和切到后台的事件 if (event == window.WindowEventType.WINDOW_SHOWN) { MyLog.d('切到前台'); } else if (eve...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left...
aboutToAppear() { MyLog.d('aboutToAppear 组件即将创建之前'); // 开启 windowEvent 监听 window.getLastWindow(getContext(this), (err, win) => { win.on("windowEvent", (event) => { // 监听切到前台和切到后台的事件 if (event == window.WindowEventType.WINDOW_SHOWN) { MyLog.d('切到前台'); } else if (eve...
https://github.com/webabcd/HarmonyDemo
28db2a24316b6933b1301ef5ccbdf163688d4e9c
github
aimilin6688/KeePassHO
entry/src/main/ets/services/TypeDefined.ets
arkts
create
创建移动参数 @param entryIds 要移动的条目ID列表 @param groupIds 要移动的分组ID列表 @param sourceGroupId 源分组ID
public static create(entryIds: string[], groupIds: string[], sourceGroupId: string): MoveParam { const param = new MoveParam(); param.entryIds = entryIds; param.groupIds = groupIds; param.sourceGroupId = sourceGroupId; return param; }
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 create AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left entryIds AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:...
public static create(entryIds: string[], groupIds: string[], sourceGroupId: string): MoveParam { const param = new MoveParam(); param.entryIds = entryIds; param.groupIds = groupIds; param.sourceGroupId = sourceGroupId; return param; }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/TypeDefined.ets#L417-L423
27c4d617ae4c4276e895d7c1eda6d079fa58cc17
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/model/Account.ets
arkts
constructor
默认未删除
constructor( accountId: number = 0, userId: number = 0, name: string = '', type: 'cash' | 'bank' | 'credit_card' | 'other' = 'cash', balance: number = 0.0, color: string = '#1890FF', createdAt: string = '', is_deleted: number = 0 // 新增 ) { this.accountId = accountId; this.us...
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 accountId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#identifie...
constructor( accountId: number = 0, userId: number = 0, name: string = '', type: 'cash' | 'bank' | 'credit_card' | 'other' = 'cash', balance: number = 0.0, color: string = '#1890FF', createdAt: string = '', is_deleted: number = 0 // 新增 ) { this.accountId = accountId; this.us...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
e128da1b4bb52c7901920a5dfb01a5cd6e2ffb7c
github
openharmony-tpc/VCard
library/src/main/ets/components/VCardBuilder.ets
arkts
shouldAppendCharsetParam
Returns true when the property line should contain charset parameter information. This method may return true even when vCard version is 3.0. Strictly, adding charset information is invalid in VCard 3.0. However we'll add the info only when charset we use is not UTF-8 in vCard 3.0 format, since parser side may be able ...
private shouldAppendCharsetParam(...propertyValueList: string[]): boolean { if (!this.mShouldAppendCharsetParam) { return false; } for (let propertyValue of propertyValueList) { if (!VCardUtils.containsOnlyPrintableAscii(propertyValue)) { return true; ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left shouldAppendCharsetParam AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#identifier#Left propertyValueList AST#identifier#Ri...
private shouldAppendCharsetParam(...propertyValueList: string[]): boolean { if (!this.mShouldAppendCharsetParam) { return false; } for (let propertyValue of propertyValueList) { if (!VCardUtils.containsOnlyPrintableAscii(propertyValue)) { return true; ...
https://gitee.com/openharmony-tpc/VCard.git
93ba0b7f60409bb8694cd8829b5b0b4e77719b45
gitee
PollenWang6/HiXD
entry/src/main/ets/services/ClassService.ets
arkts
getSemesterStartDateFromApi
从 ehall API 获取学期开学日期
async getSemesterStartDateFromApi(semCode: string): Promise<string | null> { try { await this.init(); await this.activateAppSession(EHALL_APP_CLASS_TABLE); const parts: string[] = semCode.split('-'); const body: Record<string, string> = {'XN': parts[0] + '-' + parts[1], 'XQ': parts[2]}; ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getSemesterStartDateFromApi AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left semCode AST#identifier#Right AST#type_annotation#Le...
async getSemesterStartDateFromApi(semCode: string): Promise<string | null> { try { await this.init(); await this.activateAppSession(EHALL_APP_CLASS_TABLE); const parts: string[] = semCode.split('-'); const body: Record<string, string> = {'XN': parts[0] + '-' + parts[1], 'XQ': parts[2]}; ...
https://github.com/PollenWang6/HiXD
5f7b2de1fe084f19171023a327421cbfb9c4944b
github
openharmony/codelabs
Data/PersonalAssistantPro/entry/src/main/ets/view/form/DatePickerItem.ets
arkts
build
构建 UI
build() { Column() { // 1. 标题区域 Text(this.title) .fontSize(StyleConstants.ICON_SIZE_MD) .fontColor(StyleConstants.COLOR_TEXT_SECONDARY) .margin({ bottom: StyleConstants.SPACE_XS }) .width('100%') // 2. 交互区域 (模拟输入框样式) Row() { // 显示选中的时间,或者占位符 ...
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() { Column() { // 1. 标题区域 Text(this.title) .fontSize(StyleConstants.ICON_SIZE_MD) .fontColor(StyleConstants.COLOR_TEXT_SECONDARY) .margin({ bottom: StyleConstants.SPACE_XS }) .width('100%') // 2. 交互区域 (模拟输入框样式) Row() { // 显示选中的时间,或者占位符 ...
https://gitcode.com/openharmony/codelabs
db5beeae3af68112500b5f13e3bda879747b1571
gitcode
Joker-x-dev/CoolMallArkTS
core/state/src/main/ets/UserState.ets
arkts
updateUserInfo
更新用户信息 @param {User} user - 新的用户信息 @returns {void} 无返回值 @example getUserState().updateUserInfo(new User({ nickName: "ArkUI" }));
updateUserInfo(user: User): void { this.userInfo = User.fromResponse(user); this.persist(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateUserInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left user AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left User AST#identifier#Right AST#)#Left ) AS...
updateUserInfo(user: User): void { this.userInfo = User.fromResponse(user); this.persist(); }
https://github.com/Joker-x-dev/CoolMallArkTS
60d0722454fdd1d69a14ed36aa1b8488f48f3c9a
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/equal/equal_short.ets
arkts
main
--- desc: check equality of two short integers ---
function main(): void { const a: short = {{v.left}} const b: short = {{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: short = {{v.left}} const b: short = {{v.right}} assert (a == b) == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
a228f2132fbef9f04816e25e693238c4e8e7b2ab
gitee
openharmony/applications_call
entry/src/main/ets/common/utils/Storage.ets
arkts
setSyncStorage
set sync storage @param { string } key @param { string | number | boolean } value
public setSyncStorage(key, value) { if (typeof value !== 'string') { value = JSON.stringify(value); } storageObj.putSync(key, value); storageObj.flushSync(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setSyncStorage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left key AST#identifier#Right AST#,#Left , AST#,#Right AST#identifier#Left value AST#identifier#Right AST#)#...
public setSyncStorage(key, value) { if (typeof value !== 'string') { value = JSON.stringify(value); } storageObj.putSync(key, value); storageObj.flushSync(); }
https://gitee.com/openharmony/applications_call.git
37ff8d664f068cf4979aed58427d4bf06e4942ff
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Boolean.ets
arkts
constructor
Constructs a new Boolean with provided int value @param { int } value value to construct class instance with @syscap SystemCapability.Utils.Lang @FaAndStageModel
public constructor(value: int) { this.value = value != 0; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#...
public constructor(value: int) { this.value = value != 0; }
https://gitcode.com/iop123123/arkts-static-skills
dba48f98403f6ee712b19685d3a5e9fbd99fab5e
gitcode
codelably/tuniao-ui
packages/main/src/main/ets/view/TnLoadingPage.ets
arkts
build
构建加载展示页面
build() { AppNavDestination({ title: "加载", viewModel: this.vm, paddingValue: { top: this.windowSafeAreaState.topInset, left: this.windowSafeAreaState.leftInset, right: this.windowSafeAreaState.rightInset, } }) { this.LoadingContent(); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c...
build() { AppNavDestination({ title: "加载", viewModel: this.vm, paddingValue: { top: this.windowSafeAreaState.topInset, left: this.windowSafeAreaState.leftInset, right: this.windowSafeAreaState.rightInset, } }) { this.LoadingContent(); } }
https://github.com/codelably/tuniao-ui
4e10b77e0de59b107298dda0cc989529f8d4ffd7
github
the-wwyang/kids-learning-app
src/main/ets/common/UserService.ets
arkts
isValidPhone
验证手机号格式
public isValidPhone(phone: string): boolean { const phoneRegex = /^1[3-9]\d{9}$/; return phoneRegex.test(phone); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isValidPhone AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left phone AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left st...
public isValidPhone(phone: string): boolean { const phoneRegex = /^1[3-9]\d{9}$/; return phoneRegex.test(phone); }
https://github.com/the-wwyang/kids-learning-app
d2edac2e88c96f929d9d958821fb734e62a50d5f
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/components/AxisBase.ets
arkts
setDrawGridLinesBehindData
If this is set to false, the grid lines are draw on top of the actual data, otherwise behind. Default: true @param enabled
public setDrawGridLinesBehindData(enabled: boolean): void { this.mDrawGridLinesBehindData = enabled; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setDrawGridLinesBehindData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#id...
public setDrawGridLinesBehindData(enabled: boolean): void { this.mDrawGridLinesBehindData = enabled; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
d608cc2489f33c2ed5cfa304dfd21acdbefb5cb2
gitee
openharmony/arkui_ace_engine
advanced_ui_component_static/assembled_advanced_ui_component/@ohos.arkui.advanced.TreeView.ets
arkts
createNodeByNodeParam
TreeViewNodeItemFactory create node by node parameter @param nodeParam node parameter @returns NodeItemView
public createNodeByNodeParam(nodeParam: NodeParam): NodeItemView { let nodeItemView: NodeItemView = this.createNode() as NodeItemView; if (nodeParam.icon) { nodeItemView.imageNode = undefined; let imageNode: ImageNode = new ImageNode( $r('sys.media.ohos_ic_normal_white_grid_folder') as Res...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left createNodeByNodeParam AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left nodeParam AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ident...
public createNodeByNodeParam(nodeParam: NodeParam): NodeItemView { let nodeItemView: NodeItemView = this.createNode() as NodeItemView; if (nodeParam.icon) { nodeItemView.imageNode = undefined; let imageNode: ImageNode = new ImageNode( $r('sys.media.ohos_ic_normal_white_grid_folder') as Res...
https://gitcode.com/openharmony/arkui_ace_engine
220c612e7888dc709b448be32671878d67ecc4b0
gitcode
openharmony/usb_usb_manager
frameworks/dialog/dialog_ui/usb_right_dialog/src/main/ets/components/dialog.ets
arkts
isHasDefaultFocus
is button list has default focus @param buttonList button list @returns boolean
function isHasDefaultFocus(buttonList?: ButtonOptions[]): boolean { try { let isHasDefaultFocus: boolean = false; buttonList?.forEach((button) => { if (button.defaultFocus) { isHasDefaultFocus = true; } }) return isHasDefaultFocus; } catch (error) { let code: number = (error ...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left isHasDefaultFocus AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#optional_parameter#Left AST#identifier#Left buttonList AST#identifier#Right AST#?#Left ? AST#?#Right AST#type_an...
function isHasDefaultFocus(buttonList?: ButtonOptions[]): boolean { try { let isHasDefaultFocus: boolean = false; buttonList?.forEach((button) => { if (button.defaultFocus) { isHasDefaultFocus = true; } }) return isHasDefaultFocus; } catch (error) { let code: number = (error ...
https://gitee.com/openharmony/usb_usb_manager.git
f54bbd3204e222b72ddb84279e8781b69d749ff1
gitee
offlinecat-dev/OCNetORM
src/main/ets/query/QueryBuilder.ets
arkts
getPageSizeValue
获取每页数量 @returns 每页数量,未设置分页时返回 0
getPageSizeValue(): number { return this.pageSizeValue }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getPageSizeValue 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#state...
getPageSizeValue(): number { return this.pageSizeValue }
https://github.com/offlinecat-dev/OCNetORM
c23bb93debe75012dca04920d5516855fd5d4d9f
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/06.conversions_and_contexts/06.numeric_contexts/01.unary_numeric_promotion/array_access.ets
arkts
main
--- desc: >- Unary numeric promotion is performed on expressions in the following situation: The index expression in an array access expression. params: {{c.type}} ---
function main(): int { let v: {{c.type}} = {{c.val}};
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#type_identifier#Left i...
function main(): int { let v: {{c.type}} = {{c.val}};
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
2b75ca160c65f8e5cc73fb1641c23f703585c890
gitee
openharmony/codelabs
ETSUI/PositioningDemo/entry/src/main/ets/service/ReminderService.ets
arkts
onSportStart
处理运动开始
onSportStart(): void { this.triggerSportStartReminder(); console.log('处理运动开始提醒'); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onSportStart 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...
onSportStart(): void { this.triggerSportStartReminder(); console.log('处理运动开始提醒'); }
https://gitcode.com/openharmony/codelabs
ce9c001985c486a5027d249689abb2662774daf8
gitcode
openharmony/applications_settings
product/phone/src/main/ets/pages/passwordCheck.ets
arkts
stopCountDown
Stop count down view.
stopCountDown() { // for freezing view if (this.timerId > 0) { clearTimeout(this.freezingTimeFlag); clearInterval(this.timerId); } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left stopCountDown 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...
stopCountDown() { // for freezing view if (this.timerId > 0) { clearTimeout(this.freezingTimeFlag); clearInterval(this.timerId); } }
https://gitee.com/openharmony/applications_settings.git
3bdb26e3696122cc1ed6703de146fc065c0e3311
gitee
openharmony/applications_notes
features/src/main/ets/components/NoteContentCompPortrait.ets
arkts
confirm
窗口规避区域宽
confirm(excuteJs: string) { this.controllerShow.runJavaScript(excuteJs) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left confirm AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left excuteJs AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Lef...
confirm(excuteJs: string) { this.controllerShow.runJavaScript(excuteJs) }
https://gitee.com/openharmony/applications_notes.git
8b26be3e20365b156137df5d477a70a25b6c6d37
gitee
TDCQCX/ShiHuaMusic-Harmony
entry/src/main/ets/utils/HttpUtil.ets
arkts
initNetworkListener
重试次数 初始化网络状态监听
static initNetworkListener(): void { try { const connectionConfig = connection.getConnectionPropertiesSync(); console.log('初始网络状态:', connectionConfig ? '已连接' : '未连接'); // 监听网络状态变化 connection.on('netConnectionChange', (data: connection.NetConnectionChange) => { console.log('网...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left initNetworkListener 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...
static initNetworkListener(): void { try { const connectionConfig = connection.getConnectionPropertiesSync(); console.log('初始网络状态:', connectionConfig ? '已连接' : '未连接'); // 监听网络状态变化 connection.on('netConnectionChange', (data: connection.NetConnectionChange) => { console.log('网...
https://github.com/TDCQCX/ShiHuaMusic-Harmony
72384398e3d3b50ba5d2139036942ce4da0075e5
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Parsers/PdfToMangaImporter.ets
arkts
delay
延时函数,用于在转换页面之间让出主线程 使用较长的延时确保UI有足够时间响应
function delay(ms: number): Promise<void> { return new Promise<void>((resolve) => { setTimeout(() => { resolve(); }, ms); }); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left delay AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left ms AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#pr...
function delay(ms: number): Promise<void> { return new Promise<void>((resolve) => { setTimeout(() => { resolve(); }, ms); }); }
https://github.com/DaLongZhuaZi/manxia
e0725430d6a97e3ac55d4f3dd2eafeb5351b354f
github
the-wwyang/kids-learning-app
src/main/ets/storage/LearningRecordStorageService.ets
arkts
endCurrentSession
结束当前会话并保存到历史 @param session 要结束的会话
static async endCurrentSession(session: LearningSession): Promise<void> { try { // 结束会话 const endedSession = LearningRecordService.endSession(session); // 添加到会话历史 const sessions = await LearningRecordStorageService.loadSessions(); sessions.push(endedSession); await LearningRec...
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 endCurrentSession AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left session AST#identifier#Right AST#:#Lef...
static async endCurrentSession(session: LearningSession): Promise<void> { try { // 结束会话 const endedSession = LearningRecordService.endSession(session); // 添加到会话历史 const sessions = await LearningRecordStorageService.loadSessions(); sessions.push(endedSession); await LearningRec...
https://github.com/the-wwyang/kids-learning-app
d105895cccc4b59e9c5bc9ea2417904b0ecda0e2
github
openharmony/update_update_app
feature/ota/src/main/ets/components/ProgressContent.ets
arkts
getDisplayProgress
获取显示进度值 @param progress 进度值 @return 显示进度值
function getDisplayProgress(progress): number { let displayProgress = 0; if (!isNaN(progress)) { displayProgress = (progress).toFixed(0); } return displayProgress; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getDisplayProgress AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left progress AST#identifier#Right AST#required_parameter#Right AST#)#Le...
function getDisplayProgress(progress): number { let displayProgress = 0; if (!isNaN(progress)) { displayProgress = (progress).toFixed(0); } return displayProgress; }
https://gitee.com/openharmony/update_update_app.git
c95cde4be6ca81d130343b7eeb5c1288b3489785
gitee
openharmony/applications_call
entry/src/main/ets/common/components/CallList.ets
arkts
getCallList
Three-way call list @return {boolean} - Three-way call list
getCallList() { let arr = this.callList.map((item) => { const obj = {}; return Object.assign({}, { ...obj, ...item }); }); return arr.filter((v) => v.callState !== CallStateConst.CALL_STATUS_WAITING); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getCallList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A...
getCallList() { let arr = this.callList.map((item) => { const obj = {}; return Object.assign({}, { ...obj, ...item }); }); return arr.filter((v) => v.callState !== CallStateConst.CALL_STATUS_WAITING); }
https://gitee.com/openharmony/applications_call.git
3c3d9ce2b744f5fff43ecd3464009cc40b98c0e7
gitee
Joker-x-dev/CoolMallArkTS
core/util/src/main/ets/storage/PreferencesUtil.ets
arkts
set
写入键值并立即 flush 持久化 @param {string} key 键 @param {preferences.ValueType} value 值(支持 string/number/boolean) @returns {Promise<void>} Promise<void>
async set(key: string, value: preferences.ValueType): Promise<void> { try { const prefs: preferences.Preferences = await this.getPrefs(); await prefs.put(key, value); await prefs.flush(); } catch (error) { throw this.wrapError(error, `写入键 ${key} 失败`); } }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#set#Left set AST#set#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left key AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined...
async set(key: string, value: preferences.ValueType): Promise<void> { try { const prefs: preferences.Preferences = await this.getPrefs(); await prefs.put(key, value); await prefs.flush(); } catch (error) { throw this.wrapError(error, `写入键 ${key} 失败`); } }
https://github.com/Joker-x-dev/CoolMallArkTS
405b1f4cb457a6d365e6f86d2bf669dab57a4405
github
wanrenhuifu/JLU
harmonyos-鸿蒙实训/jilinuniversity-homework/entry/src/main/ets/pages/SQTest.ets
arkts
aboutToAppear
页面构建前获取实例
aboutToAppear(): void { this.getjluDB() }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc...
aboutToAppear(): void { this.getjluDB() }
https://github.com/wanrenhuifu/JLU
2015e473488b1059a697a833dbcb74da7991e2b6
github
CLMC2025/Vignette
entry/src/main/ets/sync/DataExportImport.ets
arkts
mergeSameVersion
合並相同版本數據
private mergeSameVersion( importData: ExportData, currentVersion: VersionControl, result: SyncResult ): ImportResult { const importVersionControl = VersionControl.fromJSON(importData.versionControl); const importVersionInfo = importVersionControl.getCurrentVersion(); const currentVersionInfo...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left mergeSameVersion AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left importData AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi...
private mergeSameVersion( importData: ExportData, currentVersion: VersionControl, result: SyncResult ): ImportResult { const importVersionControl = VersionControl.fromJSON(importData.versionControl); const importVersionInfo = importVersionControl.getCurrentVersion(); const currentVersionInfo...
https://github.com/CLMC2025/Vignette
610178e192ae8280562c5049edd4c16ab04a1d83
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets
arkts
processChainedRuleWithJs
处理包含换行符和JS的链式规则 格式:selector\n<js>...</js>\nselector 例如:class.zw_txt\n<js>key=java.get("key");...</js>\na
private async processChainedRuleWithJs(ruleStr: string, jsContext?: JsContext): Promise<string[]> { // 性能优化:减少日志输出 // logger.debug(TAG, `processChainedRuleWithJs: 处理链式规则`); // 提取<js>...</js>部分 const jsMatch = ruleStr.match(/<js>([\s\S]*?)<\/js>/i); if (!jsMatch) { // 没有JS部分,按普通规则处理 ...
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 processChainedRuleWithJs AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left ruleStr AST#identifier#Right AST#ERROR#Left...
private async processChainedRuleWithJs(ruleStr: string, jsContext?: JsContext): Promise<string[]> { // 性能优化:减少日志输出 // logger.debug(TAG, `processChainedRuleWithJs: 处理链式规则`); // 提取<js>...</js>部分 const jsMatch = ruleStr.match(/<js>([\s\S]*?)<\/js>/i); if (!jsMatch) { // 没有JS部分,按普通规则处理 ...
https://github.com/DaLongZhuaZi/manxia
8203adfa7186aeb05c63a8a317552beb1e6c7c5f
github
openharmony-sig/applications_clock
common/src/main/ets/manager/ResourceManager.ets
arkts
preloadStringResources
读取字符串资源,放入缓存中 与 getStringById 配合使用,通过提前加载字符串资源,做到在同步方法中使用字符串资源 @param resourceIds 需要预加载的字符串资源的 ID
async preloadStringResources(resourceIds: number[]): Promise<void> { this.resourceCache = this.resourceCache || new Map<string, string>(); LogUtil.info(TAG, `resourceCache==> ${this.resourceCache}`); for (const id of resourceIds) { const stringKey = `${i18n.getSystemLocale()}_${id}`; if (!this...
AST#program#Left AST#expression_statement#Left AST#assignment_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left preloadStringResources AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#ident...
async preloadStringResources(resourceIds: number[]): Promise<void> { this.resourceCache = this.resourceCache || new Map<string, string>(); LogUtil.info(TAG, `resourceCache==> ${this.resourceCache}`); for (const id of resourceIds) { const stringKey = `${i18n.getSystemLocale()}_${id}`; if (!this...
https://gitee.com/openharmony-sig/applications_clock.git
8eb942f0128718c3e74cec8966723c1c1b7bc1d8
gitee
openharmony-sig/applications_clock
common/src/main/ets/utils/TimeUtil.ets
arkts
calculateRingTime
Calculate remaining ringing time @return The description of the time between the current and next ringing like '3 days 2 hours 1 minute”
static async calculateRingTime(ringTimeInMs: number): Promise<string> { const currentDate = new Date(); const leftTimeInMs = ringTimeInMs - currentDate.getTime(); if (leftTimeInMs <= 0) { return NO_ALARM_ENABLED; } const leftTime = new Date(leftTimeInMs); const leftMinutes = leftTime.get...
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 calculateRingTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left ringTimeInMs AST#identifier#Right AST#ERROR#Left AST#...
static async calculateRingTime(ringTimeInMs: number): Promise<string> { const currentDate = new Date(); const leftTimeInMs = ringTimeInMs - currentDate.getTime(); if (leftTimeInMs <= 0) { return NO_ALARM_ENABLED; } const leftTime = new Date(leftTimeInMs); const leftMinutes = leftTime.get...
https://gitee.com/openharmony-sig/applications_clock.git
a4e2bc23a85b115ba65e02f07e6b8b046a545afc
gitee
PollenWang6/HiXD
entry/src/main/ets/services/ExperimentService.ets
arkts
checkSysjLogin
===== sysj 登录状态检查 =====
async checkSysjLogin(): Promise<boolean> { try { const resp = await this.http.postRaw( SYSJ_BASE + '/xidian/StudentCurrWeekTimetable', 'weeks=1', 'application/x-www-form-urlencoded', { 'Content-Type': 'application/x-www-form-urlencoded' } ); const body = resp.body...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left checkSysjLogin AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#gener...
async checkSysjLogin(): Promise<boolean> { try { const resp = await this.http.postRaw( SYSJ_BASE + '/xidian/StudentCurrWeekTimetable', 'weeks=1', 'application/x-www-form-urlencoded', { 'Content-Type': 'application/x-www-form-urlencoded' } ); const body = resp.body...
https://github.com/PollenWang6/HiXD
fb3b1743c1dd18af0f4188e229d2feb6efa2755f
github
openharmony-sig/flutter_engine
shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/ohos/TouchEventTracker.ets
arkts
pop
Returns the MotionEvent corresponding to the eventId while discarding all the motion events that occurred prior to the event represented by the eventId. Returns null if this event was popped or discarded.
public pop(eventId : TouchEventId) : TouchEvent { // remove all the older events. while (this.unusedEvents.length != 0 && this.unusedEvents.getFirst() < eventId.getId()) { this.eventById.remove(this.unusedEvents.pop()); } // remove the current event from the heap if it exists. if (this.unus...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left pop AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left eventId AST#identifier#Right AST#:#Left : AST...
public pop(eventId : TouchEventId) : TouchEvent { // remove all the older events. while (this.unusedEvents.length != 0 && this.unusedEvents.getFirst() < eventId.getId()) { this.eventById.remove(this.unusedEvents.pop()); } // remove the current event from the heap if it exists. if (this.unus...
https://gitee.com/openharmony-sig/flutter_engine.git
7fc0170433b6613d53d57007ea3c453639be6da6
gitee
Cool_foolisher1/ArkTSRepository
RandomNumberSimulator/entry/src/main/ets/common/utils/PreferenceUtils.ets
arkts
get
获取数据 @param context 应用上下文 @param name 首选项文件名 @param key 键 @returns 数据
public static get(context: Context = new UIContext().getHostContext() as Context, name: string, key: string): preferences.ValueType { const preferences = PreferenceUtils.getPreferences(context, name) return preferences.getSync(key, {}) }
AST#program#Left AST#expression_statement#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#get#Left get AST#get#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#...
public static get(context: Context = new UIContext().getHostContext() as Context, name: string, key: string): preferences.ValueType { const preferences = PreferenceUtils.getPreferences(context, name) return preferences.getSync(key, {}) }
https://gitcode.com/Cool_foolisher1/ArkTSRepository
24d47d53888cd5b277ceb1c53f233cd7f2f82288
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/viewmodel/PcListActions.ets
arkts
handleComputerTap
处理电脑卡片点击
handleComputerTap(computer: ObservableComputer): void { if (!computer.isOnline) { return; // 调用方负责显示菜单 } if (computer.isPaired) { router.pushUrl({ url: 'pages/AppListPageV2', params: { computerId: computer.uuid } }); return; } this.pairWithComputer(computer); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left handleComputerTap AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left computer AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ObservableComputer AST#identifier#...
handleComputerTap(computer: ObservableComputer): void { if (!computer.isOnline) { return; // 调用方负责显示菜单 } if (computer.isPaired) { router.pushUrl({ url: 'pages/AppListPageV2', params: { computerId: computer.uuid } }); return; } this.pairWithComputer(computer); }
https://github.com/AlkaidLab/moonlight-harmony
6359ff45886b4876054d64cff38718da797f5e51
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/TypeShelfManager.ets
arkts
contentTypeToShelfContentType
将内容从ContentType转换为ShelfContentType
private contentTypeToShelfContentType(contentType: ContentType): ShelfContentType { switch (contentType) { case ContentType.MANGA: return ShelfContentType.MANGA; case ContentType.EBOOK: return ShelfContentType.EBOOK; case ContentType.NOVEL: return ShelfContentType.NOVEL; ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left contentTypeToShelfContentType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left contentType AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Ri...
private contentTypeToShelfContentType(contentType: ContentType): ShelfContentType { switch (contentType) { case ContentType.MANGA: return ShelfContentType.MANGA; case ContentType.EBOOK: return ShelfContentType.EBOOK; case ContentType.NOVEL: return ShelfContentType.NOVEL; ...
https://github.com/DaLongZhuaZi/manxia
f069f7d3cf01442e42a5af0f87ce7cbc97d7ad62
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Errors.ets
arkts
constructor
Constructs a new AggregateError instance with provided errors, message and error specific information @param { Iterable<Error> } errors - Errors to be aggregated @param { String } [message] - Error text @param { ErrorOptions } [options] - Error options @syscap SystemCapability.Utils.Lang @FaAndStageModel
constructor(errors: Iterable<Error>, message?: String, options?: ErrorOptions) { super("AggregateError", message, options) this.errors = Array.from<Error>(errors) }
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 errors AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identifie...
constructor(errors: Iterable<Error>, message?: String, options?: ErrorOptions) { super("AggregateError", message, options) this.errors = Array.from<Error>(errors) }
https://gitcode.com/iop123123/arkts-static-skills
dbdb4f9659c304a46915cf0c0156d4fff6aeac20
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Components/ThemeAware.ets
arkts
updateTheme
更新当前主题
public updateTheme(theme: ThemeType): void { this.currentTheme = theme; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left updateTheme AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left theme AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left The...
public updateTheme(theme: ThemeType): void { this.currentTheme = theme; }
https://github.com/DaLongZhuaZi/manxia
93c937f214009783c4f0000d721c82624192f77a
github
nyzhhd/HMMusic
entry/src/main/ets/Utils/AVPlayerManager.ets
arkts
release
释放播放器 和 播放数据
async release() { await this.player?.release() }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left release AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right ...
async release() { await this.player?.release() }
https://github.com/nyzhhd/HMMusic
e031e807f991920c997a7a1817bf480e36a23f27
github
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/BinaryEncodingVisitor.ets
arkts
visitMapStringInt64
访问 map<string, int64> 字段
visitMapStringInt64(value: Map<string, bigint>, fieldNumber: number): void { value.forEach((v, k) => { const entryWriter = this.writer.fork() entryWriter.tag(1, 2).string(k) entryWriter.tag(2, 0).int64(v) this.writer.tag(fieldNumber, 2).ldelim(entryWriter) }) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitMapStringInt64 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Map AST#identifie...
visitMapStringInt64(value: Map<string, bigint>, fieldNumber: number): void { value.forEach((v, k) => { const entryWriter = this.writer.fork() entryWriter.tag(1, 2).string(k) entryWriter.tag(2, 0).int64(v) this.writer.tag(fieldNumber, 2).ldelim(entryWriter) }) }
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
1c79d31956fc6451b0e78bccf97b287eec8a47a8
gitcode
CLMC2025/Vignette
entry/src/main/ets/sync/WebDavSyncManager.ets
arkts
downloadTemplatePack
==================== Offline Template Pack ====================
async downloadTemplatePack(): Promise<WebDavSyncResult> { const missing = this.requireConfigured(); if (missing !== null) return missing; this.status = WebDavSyncStatus.SYNCING; try { const client = this.createClient(); const preflight = await this.preflightRemoteRoot(client); if (p...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left downloadTemplatePack AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST...
async downloadTemplatePack(): Promise<WebDavSyncResult> { const missing = this.requireConfigured(); if (missing !== null) return missing; this.status = WebDavSyncStatus.SYNCING; try { const client = this.createClient(); const preflight = await this.preflightRemoteRoot(client); if (p...
https://github.com/CLMC2025/Vignette
7ab4ca88bbaeae318ae459bf23be70666b8ab6c5
github
Countly/countly-sdk-hos
library/src/main/ets/internal/modules/ModulePush.ets
arkts
isUrlAllowed
Allowlist check: an empty list means everything is allowed (per dev guide default). A non-empty list is matched by scheme prefix OR full-URL prefix.
private isUrlAllowed(url: string): boolean { if (this.allowedIntentTargets.length === 0) return true; for (let i = 0; i < this.allowedIntentTargets.length; i++) { const entry: string = this.allowedIntentTargets[i]; if (url.startsWith(entry)) return true; } return false; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left isUrlAllowed AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left s...
private isUrlAllowed(url: string): boolean { if (this.allowedIntentTargets.length === 0) return true; for (let i = 0; i < this.allowedIntentTargets.length; i++) { const entry: string = this.allowedIntentTargets[i]; if (url.startsWith(entry)) return true; } return false; }
https://github.com/Countly/countly-sdk-hos
e7dd2196ad32b8e62f51803e6f07a716bd74b4ca
github
Mydstiny/RemoteDeskHarmonyOS
entry/src/main/ets/services/DataCrypto.ets
arkts
getCryptoParams
从 cloudPrefs 读取密码学参数
getCryptoParams(): Record<string, string> | null { const salt = this.getCloudPref('crypto_salt'); const verifier = this.getCloudPref('crypto_verifier'); if (salt && verifier) { const result: Record<string, string> = {}; result['salt'] = salt; result['verifier'] = verifier; return r...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left getCryptoParams AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left ...
getCryptoParams(): Record<string, string> | null { const salt = this.getCloudPref('crypto_salt'); const verifier = this.getCloudPref('crypto_verifier'); if (salt && verifier) { const result: Record<string, string> = {}; result['salt'] = salt; result['verifier'] = verifier; return r...
https://github.com/Mydstiny/RemoteDeskHarmonyOS
933694ee924d6a35c82109a293ebfee1223a7ab5
github
HarmonyOS_Samples/guide-snippets
Ability/UIAbilityDataSync/entry/src/main/ets/entryability/EntryAbility.ets
arkts
onCreate
[StartExclude onDestroy]
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { // 获取eventHub let eventhub = this.context.eventHub; // 执行订阅操作 eventhub.on('event1', this.eventFunc); eventhub.on('event1', (data: string) => { // 触发事件,完成相应的业务操作 }); hilog.info(DOMAIN, TAG, '%{public}s', 'Ability o...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onCreate 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#,#Ri...
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void { // 获取eventHub let eventhub = this.context.eventHub; // 执行订阅操作 eventhub.on('event1', this.eventFunc); eventhub.on('event1', (data: string) => { // 触发事件,完成相应的业务操作 }); hilog.info(DOMAIN, TAG, '%{public}s', 'Ability o...
https://gitcode.com/HarmonyOS_Samples/guide-snippets
cf6531898cee75c7de30917fbf454e521cfcd0ce
gitcode
HarmonyOS_Samples/guide-snippets
ArkTS/ArkTSCompilationToolchain/ArkBytecode/FundamentalsAndNamingConventions/entry/src/main/ets/pages/Index.ets
arkts
foo2
新增语句,编译补丁
function foo2(): void { bar(); // 新增语句,编译补丁 }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left foo2 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 foo2(): void { bar(); // 新增语句,编译补丁 }
https://gitcode.com/HarmonyOS_Samples/guide-snippets
26a41f9a6c2aaa70671e694ebca23d3ac60ff5b6
gitcode
the-wwyang/kids-learning-app
src/main/ets/storage/DataStorageManager.ets
arkts
saveBoolean
保存布尔数据 @param storeName 存储文件名 @param key 键名 @param value 值
async saveBoolean(storeName: string, key: string, value: boolean): Promise<void> { try { const prefs = await this.getPreferences(storeName); await prefs.put(key, value); await prefs.flush(); console.log(`[DataStorageManager] Saved boolean: ${storeName}/${key}`); } catch (error) { ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left saveBoolean AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left storeName AST#identifier#Right AST#type_annotation#Left AST#:#Left ...
async saveBoolean(storeName: string, key: string, value: boolean): Promise<void> { try { const prefs = await this.getPreferences(storeName); await prefs.put(key, value); await prefs.flush(); console.log(`[DataStorageManager] Saved boolean: ${storeName}/${key}`); } catch (error) { ...
https://github.com/the-wwyang/kids-learning-app
c695de8a987d56b3abeed0697dc25f4b8b6afd3e
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Date.ets
arkts
getDate
The `getDate()` method returns the day of the month for the specified date according to local time. @see ECMA-262, 21.4.4.2 @returns An integer number, between 1 and 31, representing the day of the month for the given date according to local time.
public getDate(): byte { let localTime = this.ms - this.TZOffset * 60 * msPerSecond; let day: int = ecmaDayFromTime(localTime) - ecmaDayFromYear(ecmaYearFromTime(localTime)); let inLeapYear = ecmaInLeapYear(this.getFullYear()); let firstDay: int = getFirstDayInMonth(inLeapYear, ecmaM...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getDate 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 byte AST#ident...
public getDate(): byte { let localTime = this.ms - this.TZOffset * 60 * msPerSecond; let day: int = ecmaDayFromTime(localTime) - ecmaDayFromYear(ecmaYearFromTime(localTime)); let inLeapYear = ecmaInLeapYear(this.getFullYear()); let firstDay: int = getFirstDayInMonth(inLeapYear, ecmaM...
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
5941d88f3b8d7f36aab4ffad3875a568d57b2c04
gitee
SMAT-Lab/PhantomRendering
Harmoney_Next-Tiktok/entry/src/main/ets/utils/TikTokChatStore.ets
arkts
getVideoStore
单个视频单个仓库 存储信息 获取仓库 每个视频的仓库名不同 获取抖音视频仓库 单个仓库 @param {String} videoId 视频的id
getVideoStore(videoId: string) { return preferences.getPreferencesSync(this.context || getContext(), { name: `${this.TikTokCommentChatInfo}_${videoId}` //仓库名 }) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getVideoStore AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left videoId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#...
getVideoStore(videoId: string) { return preferences.getPreferencesSync(this.context || getContext(), { name: `${this.TikTokCommentChatInfo}_${videoId}` //仓库名 }) }
https://github.com/SMAT-Lab/PhantomRendering
8446d96b54c679db6238e0235c1c2693d805c7ef
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/06.conversions_and_contexts/05.casting_contexts/unboxing.ets
arkts
main
--- desc: Casting contexts allow the use of an unboxing conversion. ---
function main(): int { {%- for t in c['types'] %} let s{{loop.index}}: {{t.type}} = new {{t.type}}({{t.val}});
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#type_identifier#Left i...
function main(): int { {%- for t in c['types'] %} let s{{loop.index}}: {{t.type}} = new {{t.type}}({{t.val}});
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
86a6c692dd46b89c88396b5d4839868d36c207ee
gitee
Dabing-0x19d/berverage_HarmonyOS6.0
entry/src/main/ets/pages/cacender.ets
arkts
getSubTextColor
副文本颜色
getSubTextColor(): string { return '#8e8e93' }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getSubTextColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statem...
getSubTextColor(): string { return '#8e8e93' }
https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0
4ef2b35bd526fecbec3b130c7530bc03f4e94599
github
HarmonyOS_Samples/BestPracticeSnippets
ArkUI/Component_Reuse_Scenarios/entry/src/main/ets/segment/segment1.ets
arkts
build
[EndExclude Case1]
build() { Column() { List() { LazyForEach(this.dataSource, (item: string) => { ListItem() { CardView({ item: item }) } }, (item: string) => item) } } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#object#Left AST#{#Left { AST#{#Right AST#method_def...
build() { Column() { List() { LazyForEach(this.dataSource, (item: string) => { ListItem() { CardView({ item: item }) } }, (item: string) => item) } } }
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
2b098e812207bf7595af22f5f2b5629f253b121c
gitcode
Joker-x-dev/CoolMallArkTS
core/model/src/main/ets/entity/CategoryTree.ets
arkts
fromCategory
从 Category 转换为 CategoryTree
static fromCategory(category: Category): CategoryTree { return new CategoryTree({ id: category.id, name: category.name, parentId: category.parentId ?? null, sortNum: category.sortNum, pic: category.pic ?? null, status: category.status, createTime: category.createTime ?? n...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left fromCategory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left category AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left...
static fromCategory(category: Category): CategoryTree { return new CategoryTree({ id: category.id, name: category.name, parentId: category.parentId ?? null, sortNum: category.sortNum, pic: category.pic ?? null, status: category.status, createTime: category.createTime ?? n...
https://github.com/Joker-x-dev/CoolMallArkTS
35c88a022449320866a68b55a3488bb0cc7d030a
github
DaLongZhuaZi/manxia
entry/src/main/ets/EntryAbility.ets
arkts
loadSplashPage
加载启动页面
private loadSplashPage(windowStage: window.WindowStage): void { try { logger.info('EntryAbility', '🚀 开始加载SplashPage,主题初始化将由SplashPage负责'); windowStage.loadContent('pages/SplashPage', (err) => { if (err && err.code !== 0) { logger.error('EntryAbility', `❌ 加载SplashPage失败: ${JSON.stri...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left loadSplashPage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left windowStage AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right ...
private loadSplashPage(windowStage: window.WindowStage): void { try { logger.info('EntryAbility', '🚀 开始加载SplashPage,主题初始化将由SplashPage负责'); windowStage.loadContent('pages/SplashPage', (err) => { if (err && err.code !== 0) { logger.error('EntryAbility', `❌ 加载SplashPage失败: ${JSON.stri...
https://github.com/DaLongZhuaZi/manxia
dc08de52084fc58ad774d4d118559c8cfc7dc86e
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
internal
Checks if specified argument is in Uint8ClampedArray @param e search element @param fromIndex start index to search from @returns true if e is in Uint8ClampedArray, false otherwise public
/* public */ internal includes(e: number, fromIndex: int): boolean { for (let i = fromIndex; i < this.length; ++i) { if (this.at(i) == e) { return true } } return false }
AST#program#Left AST#comment#Left /* public */ AST#comment#Right AST#ERROR#Left AST#identifier#Left internal AST#identifier#Right AST#call_expression#Left AST#identifier#Left includes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left e AST#identifier#Right AST#:#Left : ...
/* public */ internal includes(e: number, fromIndex: int): boolean { for (let i = fromIndex; i < this.length; ++i) { if (this.at(i) == e) { return true } } return false }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
ae744ef92803eb1762053fb1b64d8d056eaa6b33
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Errors.ets
arkts
constructor
Constructs a new ArrayStoreError instance with provided message and error specific information @param { String | undefined } message - Error text @param { ErrorOptions | undefined } options - Error options @syscap SystemCapability.Utils.Lang
constructor(message?: String, options?: ErrorOptions) { super("ArrayStoreError", message, options) }
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 message AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#identifier#Left String AST#identi...
constructor(message?: String, options?: ErrorOptions) { super("ArrayStoreError", message, options) }
https://gitcode.com/iop123123/arkts-static-skills
1dd235b3c20b9433da492ed26851df627ad9dd07
gitcode
arkui-x/samples
CodeLab/Cases/feature/customscan/src/main/ets/components/CommonCodeLayout.ets
arkts
multiCodeBreathe
多二维码结果图案的呼吸动效
multiCodeBreathe(): void { this.multiCodeScale = 1; animateTo({ duration: 300, curve: curves.cubicBezierCurve(0.33, 0, 0.67, 1), // Animation curve. delay: 0, iterations: 4, playMode: PlayMode.Alternate, onFinish: () => { funcDelayer(() => { this.multiCode...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left multiCodeBreathe AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_b...
multiCodeBreathe(): void { this.multiCodeScale = 1; animateTo({ duration: 300, curve: curves.cubicBezierCurve(0.33, 0, 0.67, 1), // Animation curve. delay: 0, iterations: 4, playMode: PlayMode.Alternate, onFinish: () => { funcDelayer(() => { this.multiCode...
https://gitcode.com/arkui-x/samples
4f68d0e26326c5498914caad46995a757351b64d
gitcode
HarmonyOS_Samples/scankit-samplecode-clientdemo-arkts
products/phone/src/main/ets/pages/customScan/model/WindowService.ets
arkts
leaveCustomScanPage
Leave the custom barcode scanning page.
leaveCustomScanPage(): void { this.isCustomScanPage = false; Logger.info(TAG, `leave CustomScanPage. isCustomScanPage: ${this.isCustomScanPage}`); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left leaveCustomScanPage 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#statemen...
leaveCustomScanPage(): void { this.isCustomScanPage = false; Logger.info(TAG, `leave CustomScanPage. isCustomScanPage: ${this.isCustomScanPage}`); }
https://gitcode.com/HarmonyOS_Samples/scankit-samplecode-clientdemo-arkts
098c1b485d962a6ef3279b8568b19d031ca8b30a
gitcode
openharmony/web_webview
interfaces/kits/ani/webview/ets/@ohos.web.webview.ets
arkts
clearAllCookies
Remove all cookies Asynchronously. @returns { Promise<void> } - A promise resolved after the cookies have been deleted. @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. @syscap SystemCapability.Web.Webview.Core @crossplatform @atomicservice @since 20
static clearAllCookies(): Promise<void> { let pPromise = new Promise<void>((resolve: (v: undefined) => void, reject: (error: Error) => void): void => { let pPromise1 = taskpool.execute(():undefined => { WebCookieManage...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left clearAllCookies 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#instantiation_expressi...
static clearAllCookies(): Promise<void> { let pPromise = new Promise<void>((resolve: (v: undefined) => void, reject: (error: Error) => void): void => { let pPromise1 = taskpool.execute(():undefined => { WebCookieManage...
https://gitee.com/openharmony/web_webview.git
bbf209c71b817d2d3ed64c164e9f1523b4fce69e
gitee
ASweetBite/HarmonyPulse
entry/src/main/ets/utils/managers/AVSessionManager.ets
arkts
setPlaybackStatus
设置播放状态
setPlaybackStatus() { this.session?.setAVPlaybackState({ state: this.GlobalMusic.isPlay ? avSession.PlaybackState.PLAYBACK_STATE_PLAY : avSession.PlaybackState.PLAYBACK_STATE_PAUSE, speed: 1, position: { elapsedTime: this.GlobalMusic.time, updateTime: Date.now() }, duration: this.G...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setPlaybackStatus 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#...
setPlaybackStatus() { this.session?.setAVPlaybackState({ state: this.GlobalMusic.isPlay ? avSession.PlaybackState.PLAYBACK_STATE_PLAY : avSession.PlaybackState.PLAYBACK_STATE_PAUSE, speed: 1, position: { elapsedTime: this.GlobalMusic.time, updateTime: Date.now() }, duration: this.G...
https://github.com/ASweetBite/HarmonyPulse/blob/a7fcf153a20bafa29ac1fb8c25743dd5350dc54c/entry/src/main/ets/utils/managers/AVSessionManager.ets#L64-L73
ea3786580fbcdc1378e6790309550fc1497bf20e
github
ZestBox-18/kitebook-frontend
commons/data_core/src/main/ets/services/CategoryManager.ets
arkts
getCategoryById
按主键查询分类,供改名时同步历史账单使用。
static async getCategoryById(id: number): Promise<CategoryBean | null> { const predicates = new relationalStore.RdbPredicates(TABLE_NAME); predicates.equalTo('id', id); return new Promise<CategoryBean | null>((resolve, reject) => { dbManager.dbStore?.query(predicates) .then((result) => { ...
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 getCategoryById AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST...
static async getCategoryById(id: number): Promise<CategoryBean | null> { const predicates = new relationalStore.RdbPredicates(TABLE_NAME); predicates.equalTo('id', id); return new Promise<CategoryBean | null>((resolve, reject) => { dbManager.dbStore?.query(predicates) .then((result) => { ...
https://github.com/ZestBox-18/kitebook-frontend
df19149a064dbd425717521d6db70e718a32fb39
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/String.ets
arkts
replaceChar
Replaces all occurrences of the specified character with another specified character. If no specified character in this string is found then the original string will be returned @param { char } oldCh character which occurrences will be replaced @param { char }newCh character to replace @returns { String } new String wi...
public replaceChar(oldCh: char, newCh: char): String { let newChars: ValueArray<char> = this.getCharsImpl(0, this.getLength()); for (let i: int = 0; i < newChars.length; i++) { if (newChars[i] == oldCh) { newChars[i] = newCh; } } return new Str...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left replaceChar AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left oldCh AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left char AST#identifier...
public replaceChar(oldCh: char, newCh: char): String { let newChars: ValueArray<char> = this.getCharsImpl(0, this.getLength()); for (let i: int = 0; i < newChars.length; i++) { if (newChars[i] == oldCh) { newChars[i] = newCh; } } return new Str...
https://gitcode.com/iop123123/arkts-static-skills
80f5dea3f82edd49f41e309195007a2887b803b9
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/division/division_ulong.ets
arkts
main
--- desc: check division for unsigned long integer operands ---
function main(): void { const a: ulong = {{v.left}} const b: ulong = {{v.right}} assert (a / b) == {{v.result}}
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A...
function main(): void { const a: ulong = {{v.left}} const b: ulong = {{v.right}} assert (a / b) == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
39ad94acdab0ee7cdfa8f68b96649ffbad34b3fa
gitee
openharmony-sig/flutter_packages
packages/camera/camera_ohos/ohos/src/main/ets/io/flutter/plugins/camera/CameraUtils.ets
arkts
getExposureBiasStep
查询曝光补偿值步长
public static getExposureBiasStep(captureSession: camera.PhotoSession | camera.VideoSession): number { return 0.5; }
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 getExposureBiasStep AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#member_expression#Left AST#identifier#L...
public static getExposureBiasStep(captureSession: camera.PhotoSession | camera.VideoSession): number { return 0.5; }
https://gitee.com/openharmony-sig/flutter_packages.git
6c76f83f1a6b55b309b65eae108cfe018cfcdd15
gitee
LongLiveY96/chatcube
entry/src/main/ets/viewmodels/ChatViewModel.ets
arkts
getExtensionFromMimeType
根据 MIME 类型获取文件扩展名
private getExtensionFromMimeType(mimeType: string): string { const mimeToExt: Record<string, string> = { 'image/jpeg': '.jpg', 'image/png': '.png', 'image/gif': '.gif', 'image/webp': '.webp', 'image/bmp': '.bmp' } return mimeToExt[mimeType] || '.png' }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getExtensionFromMimeType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left mimeType AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left stri...
private getExtensionFromMimeType(mimeType: string): string { const mimeToExt: Record<string, string> = { 'image/jpeg': '.jpg', 'image/png': '.png', 'image/gif': '.gif', 'image/webp': '.webp', 'image/bmp': '.bmp' } return mimeToExt[mimeType] || '.png' }
https://github.com/LongLiveY96/chatcube
b0369a7b3e2a3ba87ba66ebe7fdea12ee030cee7
github
silence17/harmonydemo
common_lib/src/main/ets/common/ContainerPage.ets
arkts
aboutToAppear
组件即将出现时回调该接口,具体时机为在创建自定义组件的新实例后,在执行其build()函数之前执行。 https://docs.openharmony.cn/pages/v4.0/zh-cn/application-dev/reference/arkui-ts/ts-custom-component-lifecycle.md/#abouttoappear
aboutToAppear() { if (this.controller) { } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left...
aboutToAppear() { if (this.controller) { } }
https://github.com/silence17/harmonydemo
a601c1ca9e9fb4212af547dff2237f359196814f
github
DaLongZhuaZi/manxia
entry/src/main/ets/libs/htmlparser/HtmlEntities.ets
arkts
unescape
反转义 HTML 实体
static unescape(text: string): string { return HtmlEntities.decode(text); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left unescape 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 ...
static unescape(text: string): string { return HtmlEntities.decode(text); }
https://github.com/DaLongZhuaZi/manxia
65b16c2e6fdada58c0fa23e710c67598c76f2e35
github
2763981847/Clock-Alarm
entry/src/main/ets/viewmodel/AlarmClockViewModel.ets
arkts
getAlarmRepeatDayContent
获取闹钟任务的重复日期内容。 @param repeatDays Array<number> 重复日期数组 @return content string 重复日期内容字符串
public getAlarmRepeatDayContent(repeatDays: Array<number>): string { let content = AlarmClockConstants.DEFAULT_STRING_NULL; for (let i = 0; i < repeatDays.length; i++) { let repeatDay = repeatDays[i]; let repeatContent: string = CommonConstants.DEFAULT_STRING_MONDAY; switch (repeatDay) { ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getAlarmRepeatDayContent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left repeatDays AST#identifier#Right AST#ERROR#Left AST#:#Left :...
public getAlarmRepeatDayContent(repeatDays: Array<number>): string { let content = AlarmClockConstants.DEFAULT_STRING_NULL; for (let i = 0; i < repeatDays.length; i++) { let repeatDay = repeatDays[i]; let repeatContent: string = CommonConstants.DEFAULT_STRING_MONDAY; switch (repeatDay) { ...
https://github.com/2763981847/Clock-Alarm
a2792ff70854e5139b4cf6acd00e2fd380a299ac
github
NissonCX/CQU-HarmonyOS-APP-Dev-Final
entry/src/main/ets/pages/TrendsPage.ets
arkts
getUnit
获取度量单位
getUnit(): string { switch (this.selectedMetric) { case 'weight': return 'kg'; case 'heartRate': return 'bpm'; case 'bloodPressure': return 'mmHg'; case 'steps': return '步'; default: return ''; } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getUnit AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement_bloc...
getUnit(): string { switch (this.selectedMetric) { case 'weight': return 'kg'; case 'heartRate': return 'bpm'; case 'bloodPressure': return 'mmHg'; case 'steps': return '步'; default: return ''; } }
https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final
9275585c432f14687ae012d009fc7279b5066cad
github
offlinecat-dev/OCNetORM
src/main/ets/mapping/TypeConverter.ets
arkts
dateToTimestamp
Date 转换为时间戳(毫秒) @param date Date 对象 @returns Unix 时间戳(毫秒)
static dateToTimestamp(date: Date): number { return date.getTime() }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left dateToTimestamp AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left date AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ...
static dateToTimestamp(date: Date): number { return date.getTime() }
https://github.com/offlinecat-dev/OCNetORM
cfc45e2e45bc88272666b79e70864559a17ee97c
github
openharmony/applications_app_samples
code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/customcomponents/CustomShareDlg.ets
arkts
onDownloadFinish
下载完成后事件
onDownloadFinish(isSuccess: boolean, filePath: string) { logger.info(TAG, 'downloadFinish, localPath is:' + filePath); let srcFileUris: string[] = [ this.context.cacheDir + filePath ]; this.saveVideo(srcFileUris); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onDownloadFinish AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isSuccess AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Ri...
onDownloadFinish(isSuccess: boolean, filePath: string) { logger.info(TAG, 'downloadFinish, localPath is:' + filePath); let srcFileUris: string[] = [ this.context.cacheDir + filePath ]; this.saveVideo(srcFileUris); }
https://github.com/openharmony/applications_app_samples
6758748948792d6792e392356b12f44730befabf
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets
arkts
readFloatBE
Reads a 32-bit float from the buffer at the specified offset using big-endian format @param {int} [offset=0] - Number of bytes to skip before reading @returns {double} The read value
public readFloatBE(offset: int = 0): double { let lengthOffset: int = this.length - 4; if (offset < 0 || offset > lengthOffset) { throw createBusinessError(OutOfBoundsErrorCodeId, `The value of "offset" is out of range. ` + `It must be >= 0 and <= ${le...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left readFloatBE AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left offset AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_express...
public readFloatBE(offset: int = 0): double { let lengthOffset: int = this.length - 4; if (offset < 0 || offset > lengthOffset) { throw createBusinessError(OutOfBoundsErrorCodeId, `The value of "offset" is out of range. ` + `It must be >= 0 and <= ${le...
https://gitcode.com/iop123123/arkts-static-skills
cb7d0adb6f87443d7ac78df097e07190ee2debbe
gitcode
CPF-ApplicationTPC/openharmony_tpc_samples
SwipeMenuListView/library/src/main/ets/model/SwipeMenu.ets
arkts
getViewType
获取视图类型 @returns 视图类型
public getViewType(): number { return this.viewType; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getViewType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#num...
public getViewType(): number { return this.viewType; }
https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples
7f052e499c4d3214c7dcd01586107ce3bcc7d65e
gitcode
Dabing-0x19d/berverage_HarmonyOS6.0
entry/src/main/ets/common/utils/PreferencesUtil.ets
arkts
removeMonthFormId
删除月数据卡片的 formId
removeMonthFormId(preferences: preferences.Preferences, formId: string): void { try { let formIds = this.getMonthFormIds(preferences); const index = formIds.indexOf(formId); if (index !== -1) { formIds.splice(index, 1); this.preferencesPut(preferences, 'monthFormIdList', formIds)...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left removeMonthFormId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left preferences AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Left pref...
removeMonthFormId(preferences: preferences.Preferences, formId: string): void { try { let formIds = this.getMonthFormIds(preferences); const index = formIds.indexOf(formId); if (index !== -1) { formIds.splice(index, 1); this.preferencesPut(preferences, 'monthFormIdList', formIds)...
https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0
38e502cd7a36d32c14179ad634800dd5c96b4c38
github
YANGZX22/Voot
entry/src/main/ets/storage/AsrModelStorage.ets
arkts
loadConfig
加载 ASR 模型配置
static async loadConfig(ctx: common.UIAbilityContext): Promise<AsrModelConfig> { const prefs = await AsrModelStorage.getPrefs(ctx); const serialized = await prefs.get(AsrModelStorage.CONFIG_KEY, '') as string; if (!serialized || serialized.length === 0) { const defaultConfig = AsrModelStorage.getDe...
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 loadConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ctx AST#identifier#Right AST#:#Left : AST#:#R...
static async loadConfig(ctx: common.UIAbilityContext): Promise<AsrModelConfig> { const prefs = await AsrModelStorage.getPrefs(ctx); const serialized = await prefs.get(AsrModelStorage.CONFIG_KEY, '') as string; if (!serialized || serialized.length === 0) { const defaultConfig = AsrModelStorage.getDe...
https://github.com/YANGZX22/Voot
ddab8f67de4ff7f605fb3902f44c6a6289ed6ed1
github
tdcare/tdwebrtc
src/main/ets/CameraCapture.ets
arkts
handleImageArrival
处理 ImageReceiver 帧到达 官方文档标准流程: 1. readNextImage() 获取图像 2. getComponent(ComponentType.JPEG) 获取原始帧数据 3. 检查 rowStride 与 width 的关系,去除对齐填充 4. 将 NV21 数据转换为 NV12 格式(交换 UV 分量) 5. 通过 onVideoFrame 回调传递给编码器
private handleImageArrival(): void { if (this.imageReceiver === null || !this.isRunning) { return; } this.imageReceiver.readNextImage((readErr: BusinessError, img: image.Image) => { if (readErr || img === undefined) { if (this.frameCount <= 5) { LogUtil.warn(`[CameraCapture]...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleImageArrival 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#...
private handleImageArrival(): void { if (this.imageReceiver === null || !this.isRunning) { return; } this.imageReceiver.readNextImage((readErr: BusinessError, img: image.Image) => { if (readErr || img === undefined) { if (this.frameCount <= 5) { LogUtil.warn(`[CameraCapture]...
https://github.com/tdcare/tdwebrtc
759ab0a97603fc607c8c038891e596966bbbb990
github
offlinecat-dev/OCNetORM
src/main/ets/query/QueryBuilder.ets
arkts
getRelationQueryOptions
获取关联过滤配置 @param relationPath 关联路径 @returns 过滤配置,不存在时返回 null
getRelationQueryOptions(relationPath: string): RelationQueryOptions | null { const options = this.relationQueryOptions.get(this.normalizeRelationPath(relationPath)) if (options === undefined) { return null } return options.clone() }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getRelationQueryOptions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left relationPath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left st...
getRelationQueryOptions(relationPath: string): RelationQueryOptions | null { const options = this.relationQueryOptions.get(this.normalizeRelationPath(relationPath)) if (options === undefined) { return null } return options.clone() }
https://github.com/offlinecat-dev/OCNetORM
9655c01fa99a813489b4f7e6037474014048cee8
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ArrayList.ets
arkts
removeByIndex
Find an element based on its index, and delete it when it is returned. @param index - the index. @returns the deleted element.
public removeByIndex(index: int): T { this.checkEmptyContainer(); this.checkIndex(index, this.length - 1); let delItem: T = this.buffer[index]; for (let i: int = index + 1; i < this.length; i++) { this.buffer[i - 1] = this.buffer[i]; } this.buffer.length...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left removeByIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left index AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifie...
public removeByIndex(index: int): T { this.checkEmptyContainer(); this.checkIndex(index, this.length - 1); let delItem: T = this.buffer[index]; for (let i: int = index + 1; i < this.length; i++) { this.buffer[i - 1] = this.buffer[i]; } this.buffer.length...
https://gitcode.com/iop123123/arkts-static-skills
227141805a73a00293e4a07799fecb9a9f092ac7
gitcode
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test43_original_index.ets
arkts
testFindIndex
=== Round 43: Array.findIndex, enum-const pattern, merge sort, String.trim, optional chaining with nullish coalescing, Set intersection/difference, ArrayBuffer operations === --- Array.findIndex ---
function testFindIndex(): string { let items: string[] = ['apple', 'banana', 'cherry', 'date']; let idx: number = items.findIndex((s: string): boolean => { return s.startsWith('c'); }); let notFound: number = items.findIndex((s: string): boolean => { return s.startsWith('z'); }); return String(idx) ...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testFindIndex 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_ty...
function testFindIndex(): string { let items: string[] = ['apple', 'banana', 'cherry', 'date']; let idx: number = items.findIndex((s: string): boolean => { return s.startsWith('c'); }); let notFound: number = items.findIndex((s: string): boolean => { return s.startsWith('z'); }); return String(idx) ...
https://github.com/miaochiahao/ark-ghidra
52fce9d7ee8aab111c6fc55c8696cd0d34e73855
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/ConcurrentSet.ets
arkts
constructor
Constructs a ConcurrentSet from ArrayLike @param { ArrayLike<T> } values initial ArrayLike
constructor(values: ArrayLike<T> ) { this.elements = new ConcurrentHashMap<T, T>(); for (let i = 0; i < values.length; ++i) { this.elements.set(values[i], values[i]); } }
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 values AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identifie...
constructor(values: ArrayLike<T> ) { this.elements = new ConcurrentHashMap<T, T>(); for (let i = 0; i < values.length; ++i) { this.elements.set(values[i], values[i]); } }
https://gitcode.com/iop123123/arkts-static-skills
7e18564a616424b0664656ee539d6a2ad597996d
gitcode
LJ666-ui/harmony-health-care
entry/src/main/ets/rag/Reranker.ets
arkts
rerank
重排序 @param query 查询文本 @param candidates 候选文档 @param topK 返回数量 @returns 重排序后的结果
async rerank( query: string, candidates: RetrievalResult[], topK: number ): Promise<RetrievalResult[]> { console.info('[Reranker] 开始重排序, 候选数:', candidates.length); try { // 1. 计算重排序得分 const scored = await Promise.all( candidates.map(async (candidate) => { const rer...
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left rerank AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left query AST#identifier#Right AST#type_annotation#Left AST#:#Left ...
async rerank( query: string, candidates: RetrievalResult[], topK: number ): Promise<RetrievalResult[]> { console.info('[Reranker] 开始重排序, 候选数:', candidates.length); try { // 1. 计算重排序得分 const scored = await Promise.all( candidates.map(async (candidate) => { const rer...
https://github.com/LJ666-ui/harmony-health-care
c77797fc2aadc755bdc6b24ce0b26f888de646bc
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoJsExtensions.ets
arkts
base64DecodeToByteArray
==================== 加密解密增强 ==================== Base64解码到字节数组
base64DecodeToByteArray(str: string): Uint8Array | null { if (!str) return null; try { const decoder = new util.Base64Helper(); return decoder.decodeSync(str); } catch (error) { logger.warn(TAG, `base64DecodeToByteArray失败: ${String(error)}`); return null; } }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left base64DecodeToByteArray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif...
base64DecodeToByteArray(str: string): Uint8Array | null { if (!str) return null; try { const decoder = new util.Base64Helper(); return decoder.decodeSync(str); } catch (error) { logger.warn(TAG, `base64DecodeToByteArray失败: ${String(error)}`); return null; } }
https://github.com/DaLongZhuaZi/manxia
e43b9d06de5dd7d67d833369132e5051fa1d64a1
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/ThemeManager.ets
arkts
isDarkThemeSync
判断是否为深色主题(同步)
public isDarkThemeSync(): boolean { return this.getActualThemeSync() === ThemeType.DARK; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isDarkThemeSync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean A...
public isDarkThemeSync(): boolean { return this.getActualThemeSync() === ThemeType.DARK; }
https://github.com/DaLongZhuaZi/manxia
908af28bf6a90bf3b824dbab840e96082bd964fa
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Jsonx.ets
arkts
tryGetElement
Attempts to get a JSON element from an object by key. Returns undefined if the key is not found or if this element is not an object. @param {string} key - The key to look up @returns {JsonElement | undefined} The JSON element if found, undefined otherwise
tryGetElement(key: string): JsonElement | undefined { return this.jsonType == JsonType.JsonObject ? this.maybeObjectValues!.get(key) : undefined }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left tryGetElement AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left s...
tryGetElement(key: string): JsonElement | undefined { return this.jsonType == JsonType.JsonObject ? this.maybeObjectValues!.get(key) : undefined }
https://gitcode.com/iop123123/arkts-static-skills
5c6175cdd89abf90d8f851a2c0acd055a58ab948
gitcode
ZestBox-18/kitebook-frontend
features/home/src/main/ets/pages/Index.ets
arkts
onMonthBillGroupsChanged
月账单变化后同步刷新预算和收支摘要。
onMonthBillGroupsChanged(): void { this.updateMonthlySummary(); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onMonthBillGroupsChanged 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#sta...
onMonthBillGroupsChanged(): void { this.updateMonthlySummary(); }
https://github.com/ZestBox-18/kitebook-frontend
e7255fa21014045d382b51be3473b3e91de70217
github
OpenHarmonyPCDeveloper/GitNext
entry/src/main/ets/utils/DebounceSingletonUtil.ets
arkts
isOperationRunning
检查某项操作是否正在进行中(状态锁)
public isOperationRunning(operationName: string): boolean { return DebounceSingletonUtil.operationsLock.get(operationName) === true; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isOperationRunning AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left operationName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string A...
public isOperationRunning(operationName: string): boolean { return DebounceSingletonUtil.operationsLock.get(operationName) === true; }
https://gitcode.com/OpenHarmonyPCDeveloper/GitNext
0580f6404a7f4c58da907cb7e874bfa097dc8c01
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/libs/htmlparser/Matcher.ets
arkts
parsePseudoClass
解析伪类选择器
private static parsePseudoClass(selector: string, startIndex: number): PseudoClassResult | null { let i = startIndex; const len = selector.length; let name = ''; while (i < len && /[a-zA-Z0-9-]/.test(selector[i])) { name += selector[i]; i++; } if (!name) return null; let arg...
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 parsePseudoClass AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left selector AST#identifier#Right AST#ERROR#Left AST#:...
private static parsePseudoClass(selector: string, startIndex: number): PseudoClassResult | null { let i = startIndex; const len = selector.length; let name = ''; while (i < len && /[a-zA-Z0-9-]/.test(selector[i])) { name += selector[i]; i++; } if (!name) return null; let arg...
https://github.com/DaLongZhuaZi/manxia
73245668c59b80b4d20c7b4ba19c675ef95fac4a
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/GameManager.ets
arkts
addToRecentGames
添加游戏到最近列表
public async addToRecentGames(uri: string, path: string): Promise<void> { const fileName = this.extractFileName(path); const name = this.extractGameName(fileName); // 查找是否已存在 const existingIndex = this.recentGames.findIndex(game => game.uri === uri || game.path === path); if (existingIndex >= 0)...
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 addToRecentGames AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uri AST#identifier#Right AST#:#Left : A...
public async addToRecentGames(uri: string, path: string): Promise<void> { const fileName = this.extractFileName(path); const name = this.extractGameName(fileName); // 查找是否已存在 const existingIndex = this.recentGames.findIndex(game => game.uri === uri || game.path === path); if (existingIndex >= 0)...
https://github.com/richshaw2015/nds
47e640db45f69e42181e8917b1dfec709c0361ac
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Download/UnifiedDownloadManager.ets
arkts
downloadNovelChapter
下载单个小说章节
public async downloadNovelChapter( bookId: string, bookTitle: string, sourceId: string, chapter: LegadoChapter ): Promise<string> { return this.downloadNovelChapters({ bookId, bookTitle, sourceId, chapters: [chapter], startIndex: chapter.index, endIndex: chapt...
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 downloadNovelChapter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bookId AST#identifier#Right AST#:#L...
public async downloadNovelChapter( bookId: string, bookTitle: string, sourceId: string, chapter: LegadoChapter ): Promise<string> { return this.downloadNovelChapters({ bookId, bookTitle, sourceId, chapters: [chapter], startIndex: chapter.index, endIndex: chapt...
https://github.com/DaLongZhuaZi/manxia
4d0e28c2d6ed6298f9a2fdfcf430bdcc2eba365a
github