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
honjow/Next2V
feature/node/src/main/ets/viewmodel/NodeViewModel.ets
arkts
loadNodeTopics
Load topics under the specified node
async loadNodeTopics(nodeName: string, options?: NodeTopicPageOneLoadOptions): Promise<boolean> { const loadOptions = options || {} const requestId = loadOptions.requestId || 0 const source: NodeTopicPageOneSource = loadOptions.source || 'web' this.isLoading = true this.errorMessage = '' this....
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left loadNodeTopics AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left nodeName AST#identifier#Right AST#type_annotation#Left AST#:#Lef...
async loadNodeTopics(nodeName: string, options?: NodeTopicPageOneLoadOptions): Promise<boolean> { const loadOptions = options || {} const requestId = loadOptions.requestId || 0 const source: NodeTopicPageOneSource = loadOptions.source || 'web' this.isLoading = true this.errorMessage = '' this....
https://github.com/honjow/Next2V
2cfe90cd5a2c793c44e6dbfb6d98e9f6e8b24f91
github
XJTUWYD/ArkDiff
entry/src/main/ets/viewmodel/DiffSessionViewModel.ets
arkts
copyToClipboard
复制到剪贴板
copyToClipboard(text: string, callback?: () => void): void { try { const pasteData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, text); const sysPasteboard = pasteboard.getSystemPasteboard(); sysPasteboard.setData(pasteData).then(() => { if (callback) callback(); }).catch...
AST#program#Left AST#ERROR#Left AST#identifier#Left copyToClipboard AST#identifier#Right 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 AST#identifier#Right AST#,#Left , AST#,#Right AST#call_expression#Left AST#id...
copyToClipboard(text: string, callback?: () => void): void { try { const pasteData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, text); const sysPasteboard = pasteboard.getSystemPasteboard(); sysPasteboard.setData(pasteData).then(() => { if (callback) callback(); }).catch...
https://github.com/XJTUWYD/ArkDiff
3f22e9dc5e59d10e9999c6ab57dcbbabcb1d108f
github
openharmony/codelabs
Data/PersonalAssistantPro/entry/src/main/ets/viewmodel/EventViewModel.ets
arkts
getEventStatusInfo
📝 [修改] 获取日程的状态信息 原方法名: getEventStatusText -> 建议改为 getEventStatusInfo @param event @returns EventStatusInfo 包含资源Key和参数
public getEventStatusInfo(event: Event): EventStatusInfo { const now = Date.now(); if (now > event.endTime) { // 对应: "已结束" -> calendar_status_ended return { key: 'calendar_status_ended' }; } else if (now >= event.startTime && now <= event.endTime) { // 对应: "进行中" -> calendar_status_ongoi...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getEventStatusInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L...
public getEventStatusInfo(event: Event): EventStatusInfo { const now = Date.now(); if (now > event.endTime) { // 对应: "已结束" -> calendar_status_ended return { key: 'calendar_status_ended' }; } else if (now >= event.startTime && now <= event.endTime) { // 对应: "进行中" -> calendar_status_ongoi...
https://gitcode.com/openharmony/codelabs
940d7b2eb4fe9ce8949cec313d7f37a48ca922f9
gitcode
openharmony/arkui_ace_engine
advanced_ui_component_static/assembled_advanced_ui_component/@ohos.arkui.advanced.GridObjectSortComponent.ets
arkts
getAddAreaItemTranslate
Add area movement function
getAddAreaItemTranslate(index: Int): TranslateOptions { // When an item is removed, the added area is moved rightward. if (this.clickRemoveBtn) { let addItemRightMove = this.getAddItemRightMove(index); return { x: addItemRightMove.x, y: addItemRightMove.y }; } // Mov...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getAddAreaItemTranslate 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#identifier#Right AST#ERROR#Right AST#)#...
getAddAreaItemTranslate(index: Int): TranslateOptions { // When an item is removed, the added area is moved rightward. if (this.clickRemoveBtn) { let addItemRightMove = this.getAddItemRightMove(index); return { x: addItemRightMove.x, y: addItemRightMove.y }; } // Mov...
https://gitcode.com/openharmony/arkui_ace_engine
8324aeb8d069242754953bdd2ed664e519826c60
gitcode
Countly/countly-sdk-hos
library/src/main/ets/internal/modules/ModuleUserProfile.ets
arkts
scheduleAutoSave
Mutation auto-trigger: when properties change while events are pending, flush the events queue so the wire ordering puts events before any later user_details. Does NOT enqueue a `user_details` request, that only ships on explicit `save()` or a save-triggering callsite (recordEvent prelude, begin/end session, heartbeat,...
private scheduleAutoSave(): Promise<void> { const next: Promise<void> = this.chain.then((): Promise<void> => this.gatedEventsFlushOnly()); this.chain = next.catch((err: Object): void => { this.config.logger.e(`[ModuleUserProfile] auto events flush failed: ${err}`); }); return next; }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left scheduleAutoSave 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_expr...
private scheduleAutoSave(): Promise<void> { const next: Promise<void> = this.chain.then((): Promise<void> => this.gatedEventsFlushOnly()); this.chain = next.catch((err: Object): void => { this.config.logger.e(`[ModuleUserProfile] auto events flush failed: ${err}`); }); return next; }
https://github.com/Countly/countly-sdk-hos
3331a38494a810c562ddc79ba7d741b1eeea52af
github
OHPG/FinSdk
emby/src/main/ets/api/UserApi.ets
arkts
getUserById
getUserById @summary Gets a user by Id. @param userId requestParameters Request parameters. @throws {RequiredError} @memberof UserApi
public async getUserById(userId: string): Promise<UserDto> { return this.apiClient.get({ path: `/Users/${userId}` }) }
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 getUserById AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : AST...
public async getUserById(userId: string): Promise<UserDto> { return this.apiClient.get({ path: `/Users/${userId}` }) }
https://github.com/OHPG/FinSdk
8261c1de1a39d3cc7534497fff1c5a5d4f29e624
github
openharmony/applications_settings
product/phone/src/main/ets/pages/system/languageSettings/languageAndRegion/selectRegion.ets
arkts
totalCount
获取数据源列表长度
public totalCount(): number { return this.regionArray.length; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left totalCount 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#numb...
public totalCount(): number { return this.regionArray.length; }
https://gitee.com/openharmony/applications_settings.git
b36b3e948f557edc84f47c51f5e8b70f99630866
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Debug/HidebugPerformanceCollector.ets
arkts
collectPerformanceDataSync
同步收集性能数据(用于getCurrentData)
private collectPerformanceDataSync(): HidebugPerformanceData | null { const startTime = Date.now(); try { const data: HidebugPerformanceData = { timestamp: startTime, memory: this.collectMemoryInfoSync(), cpu: this.collectCpuInfoSync(), gc: this.collectGcInfoSync(), ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left collectPerformanceDataSync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_e...
private collectPerformanceDataSync(): HidebugPerformanceData | null { const startTime = Date.now(); try { const data: HidebugPerformanceData = { timestamp: startTime, memory: this.collectMemoryInfoSync(), cpu: this.collectCpuInfoSync(), gc: this.collectGcInfoSync(), ...
https://github.com/DaLongZhuaZi/manxia
16049957af164ae6553769698773e68d5915d371
github
offlinecat-dev/OCNetORM
src/main/ets/mapping/EntityDataInput.ets
arkts
keys
获取所有键 @returns 键数组
keys(): Array<string> { const result: Array<string> = [] this.data.forEach((_, key) => { result.push(key) }) return result }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left keys AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#binary_expression#Left AST#...
keys(): Array<string> { const result: Array<string> = [] this.data.forEach((_, key) => { result.push(key) }) return result }
https://github.com/offlinecat-dev/OCNetORM
daacf34f4d22ebe1e4665c6bad5b30d3cdf3c6f9
github
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/hosts/app/tabs/classes/meowTabInfo.ets
arkts
requestDestroyNode
Request the web to destroy itself (Majorly its nodes).
requestDestroyNode() { this.node?.detachWeb(); this.node?.dispose(); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left requestDestroyNode 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...
requestDestroyNode() { this.node?.detachWeb(); this.node?.dispose(); }
https://github.com/awaLiny2333/LinysBrowser_NEXT
dc307e020c0557ff807fd8a640098362c2ff8f78
github
openharmony-tpc/ImageKnife
library/src/main/ets/utils/FileUtils.ets
arkts
exist
判断path文件是否存在 @param path 文件绝对路径
exist(path: string): boolean { try { if (fs.accessSync(path)) { let stat = fs.statSync(path) return stat.isFile() } else { return false } } catch (error) { let err: BusinessError = error as BusinessError; LogUtil.error('FileUtils exist failed with error me...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left exist AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)#Rig...
exist(path: string): boolean { try { if (fs.accessSync(path)) { let stat = fs.statSync(path) return stat.isFile() } else { return false } } catch (error) { let err: BusinessError = error as BusinessError; LogUtil.error('FileUtils exist failed with error me...
https://gitee.com/openharmony-tpc/ImageKnife.git
abf181f143a561362c358107401f488ef1d2b3fc
gitee
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/renderer/DataRenderer.ets
arkts
drawValue
Draws the value of the given entry by using the provided IValueFormatter. @param c canvas @param formatter formatter for custom value-formatting @param value the value to be drawn @param entry the entry the value belongs to @param dataSetIndex the index of the DataSet the drawn Entry belongs...
public drawValue(c: CanvasRenderingContext2D, formatter: IValueFormatter, value: number, entry: EntryOhos, dataSetIndex: number, x: number, y: number, color: number, isHorizontalFlip: boolean = false): void { if (isHorizontalFlip) { c.save(); c.scale(-1, 1); } this.mValuePaint.setColor(color);...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left drawValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left c AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left CanvasRen...
public drawValue(c: CanvasRenderingContext2D, formatter: IValueFormatter, value: number, entry: EntryOhos, dataSetIndex: number, x: number, y: number, color: number, isHorizontalFlip: boolean = false): void { if (isHorizontalFlip) { c.save(); c.scale(-1, 1); } this.mValuePaint.setColor(color);...
https://gitee.com/openharmony-tpc/ohos_mpchart.git
ab8f0662c9a286d827aff37c3fa06777e79917c4
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/DataManager.ets
arkts
getAllCachedMangas
[新增] 获取所有有缓存的漫画列表(不限图源) 通过检查online_page表的localPath字段来判断是否已缓存 @returns 有缓存页面的漫画信息列表
async getAllCachedMangas(): Promise<CachedMangaInfo[]> { try { // 从数据库查询所有有缓存页面的漫画(不限图源) // 注意:HarmonyOS数据库可能不支持别名,直接选择原始字段 const sql = ` SELECT DISTINCT oci.id, oci.title, oci.sourceId FROM online_comic_info oci INNER JOIN online_chapter oc...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getAllCachedMangas 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#g...
async getAllCachedMangas(): Promise<CachedMangaInfo[]> { try { // 从数据库查询所有有缓存页面的漫画(不限图源) // 注意:HarmonyOS数据库可能不支持别名,直接选择原始字段 const sql = ` SELECT DISTINCT oci.id, oci.title, oci.sourceId FROM online_comic_info oci INNER JOIN online_chapter oc...
https://github.com/DaLongZhuaZi/manxia
b047c0ff8b257f87807ca00efaf6b28f6d845642
github
openharmony-sig/qr-code-generator
library/src/main/ets/components/MainPage/qrcodegen.ets
arkts
finderPenaltyTerminateAndCount
Must be called at the end of a line (row or column) of modules. A helper function for getPenaltyScore().
private finderPenaltyTerminateAndCount(currentRunColor: boolean, currentRunLength: int, runHistory: Array<int>): int { if (currentRunColor) { // Terminate black run this.finderPenaltyAddHistory(currentRunLength, runHistory); currentRunLength = 0; } currentRunLength += this.size; //...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left finderPenaltyTerminateAndCount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left currentRunColor AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boo...
private finderPenaltyTerminateAndCount(currentRunColor: boolean, currentRunLength: int, runHistory: Array<int>): int { if (currentRunColor) { // Terminate black run this.finderPenaltyAddHistory(currentRunLength, runHistory); currentRunLength = 0; } currentRunLength += this.size; //...
https://gitee.com/openharmony-sig/qr-code-generator.git
ea82ef48da8238995b714324735f181cc128c83e
gitee
terryma2024/happyword
harmonyos/entry/src/main/ets/services/GlobalPackService.ets
arkts
warmFromCache
Pre-load the in-memory cache from preferences.
async warmFromCache(): Promise<Pack[]> { const env: CachedEnvelope | null = await this.readCache(); if (env === null) { this.memoryPacks = []; this.memoryEnvelope = null; return []; } this.memoryEnvelope = env; this.memoryPacks = GlobalPackService.parsePacks(env.body); return...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left warmFromCache AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generi...
async warmFromCache(): Promise<Pack[]> { const env: CachedEnvelope | null = await this.readCache(); if (env === null) { this.memoryPacks = []; this.memoryEnvelope = null; return []; } this.memoryEnvelope = env; this.memoryPacks = GlobalPackService.parsePacks(env.body); return...
https://github.com/terryma2024/happyword
8e54a31093a21438040baa9ea0390c7557aa60bf
github
aimilin6688/KeePassHO
entry/src/main/ets/common/utils/CommonUtils.ets
arkts
getExistsFileDialog
获取已存在文件弹框 @returns
public static getExistsFileDialog(): promptAction.ShowDialogOptions { return { title: $r('app.string.dialog_prompt_title'), message: $r('app.string.dialog_exists_file_message'), buttons: [ { text: $r('app.string.cancel_button_text'), color: $r('app.color.text_secondar...
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 getExistsFileDialog AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right...
public static getExistsFileDialog(): promptAction.ShowDialogOptions { return { title: $r('app.string.dialog_prompt_title'), message: $r('app.string.dialog_exists_file_message'), buttons: [ { text: $r('app.string.cancel_button_text'), color: $r('app.color.text_secondar...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/CommonUtils.ets#L123-L138
f4a103c8fe63d12dd386e11332344096b467c9ca
github
Joker-x-dev/CoolMallArkTS
entry/src/main/ets/adapter/WindowAdapter.ets
arkts
initSafeAreaObserver
初始化安全区监听 @param {window.Window} windowClass - 当前窗口 @returns {void} 无返回值
private initSafeAreaObserver(windowClass: window.Window): void { const displayId = this.getDisplayId(); if (displayId === undefined) { console.error("Failed to obtain displayId for safe area."); return; } const navigationArea = windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_NAVIG...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left initSafeAreaObserver AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left windowClass AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#...
private initSafeAreaObserver(windowClass: window.Window): void { const displayId = this.getDisplayId(); if (displayId === undefined) { console.error("Failed to obtain displayId for safe area."); return; } const navigationArea = windowClass.getWindowAvoidArea(window.AvoidAreaType.TYPE_NAVIG...
https://github.com/Joker-x-dev/CoolMallArkTS
441e41ed5ae77c51b002f88da3beb86db4672a4d
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Components/ThemeAware.ets
arkts
getSemanticColorWithAlpha
获取带透明度的语义化主题色 @param role 颜色角色 @param alpha 透明度 (0-1) @returns 带透明度的颜色字符串
public static getSemanticColorWithAlpha(role: ColorRole, alpha: number): string { return AppColors.withAlpha(role, alpha); }
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 getSemanticColorWithAlpha AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left role AST#identifier#Right AST...
public static getSemanticColorWithAlpha(role: ColorRole, alpha: number): string { return AppColors.withAlpha(role, alpha); }
https://github.com/DaLongZhuaZi/manxia
6b3bea34116c0a83642b86b75996e831091d2444
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/LocalImageCacheManager.ets
arkts
isLoading
检查是否正在加载
public isLoading(pageId: string): boolean { return this.loadingTasks.has(pageId); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isLoading AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pageId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left stri...
public isLoading(pageId: string): boolean { return this.loadingTasks.has(pageId); }
https://github.com/DaLongZhuaZi/manxia
0177a34005bd4445a5db2a644260f5ab3fdfc8e5
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/SharedLedgerService.ets
arkts
logActivity
==================== 活动日志 ==================== 记录活动
private static async logActivity( ledgerId: number, userId: number, userName: string, activityType: string, description: string, metadata: ActivityMetadata ): Promise<boolean> { try { const activity = new MemberActivity(); activity.ledgerId = ledgerId; activity.userId =...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left logActivity AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left ledgerId AST#ident...
private static async logActivity( ledgerId: number, userId: number, userName: string, activityType: string, description: string, metadata: ActivityMetadata ): Promise<boolean> { try { const activity = new MemberActivity(); activity.ledgerId = ledgerId; activity.userId =...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
abd70fff4fce76a53d4c2b9adbbcbcdec787f1e4
github
terryma2024/happyword
harmonyos/entry/src/main/ets/services/ImageCompressor.ets
arkts
createSource
Wrap the synchronous `image.createImageSource` call so a malformed buffer surfaces as our typed `ImageCompressionError` instead of a generic `BusinessError` that would punt the user to the catch-all "上传失败" path.
private static createSource(bytes: ArrayBuffer): image.ImageSource { try { return image.createImageSource(bytes); } catch (e) { const be: BusinessError = e as BusinessError; throw new ImageCompressionError( 'DECODE_FAILED', `createImageSource failed: ${JSON.stringify(be)}`, ...
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 createSource AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bytes AST#identifier#Right AST#:#Left :...
private static createSource(bytes: ArrayBuffer): image.ImageSource { try { return image.createImageSource(bytes); } catch (e) { const be: BusinessError = e as BusinessError; throw new ImageCompressionError( 'DECODE_FAILED', `createImageSource failed: ${JSON.stringify(be)}`, ...
https://github.com/terryma2024/happyword
f804e3b24b63041f4a9b5c72062b0f5e84172a55
github
aimilin6688/KeePassHO
entry/src/main/ets/storage/googledrive/GoogleOAuth2Provider.ets
arkts
sendHttpRequestWithAuth
发送带有认证的HTTP请求 @param url 请求URL @param method 请求方法 @param accessToken 访问令牌 @return Promise<Record<string, Object>> 响应数据 @throws 如果请求失败则抛出异常
private async sendHttpRequestWithAuth(url: string, method: http.RequestMethod, accessToken: string): Promise<Record<string, Object>> { const httpRequest = http.createHttp(); try { const options: http.HttpRequestOptions = { method: method, connectTimeout: this.requestTimeout, ...
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 sendHttpRequestWithAuth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#...
private async sendHttpRequestWithAuth(url: string, method: http.RequestMethod, accessToken: string): Promise<Record<string, Object>> { const httpRequest = http.createHttp(); try { const options: http.HttpRequestOptions = { method: method, connectTimeout: this.requestTimeout, ...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/googledrive/GoogleOAuth2Provider.ets#L88-L124
57f7ca6d7ad4f9ab7b707c1e554805b8882a7ae9
github
mybricks/comlib-harmony-normal
packages/rt-arkts/comlib/src/main/ets/audio/AudioCapturer.ets
arkts
addEventListener
注册事件监听
addEventListener(key: string, listener: (value: ESObject) => void) { if (!this.eventListener.get(key)) { this.eventListener.set(key, new Set()); } this.eventListener.get(key)!.add(listener); }
AST#program#Left AST#ERROR#Left AST#identifier#Left addEventListener AST#identifier#Right AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Right AST#call_expression#Left AST#me...
addEventListener(key: string, listener: (value: ESObject) => void) { if (!this.eventListener.get(key)) { this.eventListener.set(key, new Set()); } this.eventListener.get(key)!.add(listener); }
https://github.com/mybricks/comlib-harmony-normal
b6e6ec5fe2f82ac87ce8cf3874483c98fddeb696
github
tdcare/tdwebrtc
src/main/ets/SignalingClient.ets
arkts
sendVideoHangup
发送视频挂断
public sendVideoHangup(toMac: string, roomId: string): void { LogUtil.info(`${TAG} sendVideoHangup: from_mac=${this.mac}, to_mac=${toMac}, room_id=${roomId}`); const env = this.buildForwardEnvelope(toMac); const data: SignalingData = { action: CmdAction.ACTION_VIDEO_HANGUP, room_id: roomId, ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left sendVideoHangup AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left toMac AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left...
public sendVideoHangup(toMac: string, roomId: string): void { LogUtil.info(`${TAG} sendVideoHangup: from_mac=${this.mac}, to_mac=${toMac}, room_id=${roomId}`); const env = this.buildForwardEnvelope(toMac); const data: SignalingData = { action: CmdAction.ACTION_VIDEO_HANGUP, room_id: roomId, ...
https://github.com/tdcare/tdwebrtc
939aa17a0dc75f18239e16b8b12a3a63e49f0dd3
github
openharmony-tpc/openharmony_tpc_samples
OhosVideoCache/entry/src/main/ets/AvPlayManager.ets
arkts
videoRelease
释放视频资源
async videoRelease(): Promise<void> { if (this.avPlayer === null) { Logger.info(this.tag, 'avPlayer has not init'); return; } this.avPlayer.release((err) => { if (err === null) { Logger.info(this.tag, 'videoRelease release success'); } else { Logger.error(this.tag, ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left videoRelease AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AS...
async videoRelease(): Promise<void> { if (this.avPlayer === null) { Logger.info(this.tag, 'avPlayer has not init'); return; } this.avPlayer.release((err) => { if (err === null) { Logger.info(this.tag, 'videoRelease release success'); } else { Logger.error(this.tag, ...
https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git
ab7626acd02c65e7efe6927ecb9622551649ce40
gitee
ZestBox-18/kitebook-frontend
features/home/src/main/ets/utils/HomeIndexCalculator.ets
arkts
buildMonthlySummary
计算首页预算卡和收支卡所需的月度摘要数据。
static buildMonthlySummary(monthBillGroups: BillGroup[], defaultMonthBudget: number): HomeMonthlySummary { const summary: HomeMonthlySummary = new HomeMonthlySummary(); summary.currentMonthText = HomeIndexCalculator.getCurrentMonthText(); let totalExpense: number = 0; let totalIncome: number = 0; ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left buildMonthlySummary AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left monthBillGroups AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left B...
static buildMonthlySummary(monthBillGroups: BillGroup[], defaultMonthBudget: number): HomeMonthlySummary { const summary: HomeMonthlySummary = new HomeMonthlySummary(); summary.currentMonthText = HomeIndexCalculator.getCurrentMonthText(); let totalExpense: number = 0; let totalIncome: number = 0; ...
https://github.com/ZestBox-18/kitebook-frontend
53a57be870f3a1050549c077b678e892df54ee6b
github
offlinecat-dev/OCNetORM
src/main/ets/query/PredicateBuilder.ets
arkts
build
从 QueryBuilder 构建 RdbPredicates @param queryBuilder 查询构建器 @returns 构建结果
static build(queryBuilder: QueryBuilder): PredicateBuildResult { try { const tableName = queryBuilder.getTableName() const predicates = new relationalStore.RdbPredicates(tableName) const descriptions: Array<string> = [] descriptions.push(`表名: ${tableName}`) // 应用 WHERE 条件(包括软删除条件) ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left build AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left queryBuilder AST#identifier#Right AST#:#Left : AST#:#Right...
static build(queryBuilder: QueryBuilder): PredicateBuildResult { try { const tableName = queryBuilder.getTableName() const predicates = new relationalStore.RdbPredicates(tableName) const descriptions: Array<string> = [] descriptions.push(`表名: ${tableName}`) // 应用 WHERE 条件(包括软删除条件) ...
https://github.com/offlinecat-dev/OCNetORM
43324172e8a6ff3fb15cc19a916625dc7e11b304
github
offlinecat-dev/OCNetORM
src/main/ets/query/RelationLoadResult.ets
arkts
getFormattedError
获取格式化的错误信息 @returns 格式化的错误信息
getFormattedError(): string { if (this.success) { return '' } return `关联 '${this.relationName}' 加载失败: ${this.errorMessage}` }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getFormattedError 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#stat...
getFormattedError(): string { if (this.success) { return '' } return `关联 '${this.relationName}' 加载失败: ${this.errorMessage}` }
https://github.com/offlinecat-dev/OCNetORM
8e10e0ff983e1cee89640031eb1f21aaa39c71a0
github
LZZLHY/hlib
entry/src/main/ets/utils/PublicDownloadDir.ets
arkts
ensurePublicDirPath
确保拿到一个可写的公共下载目录的**原始路径**,返回该目录路径;失败 / 取消返回空串。 调用方据此用 `<目录>/<文件名>` 落盘。须在 UI 交互时机调用(下载入口 / 导出)。 平板:申请权限 → Environment 路径。 手机:复用已持久化并激活的目录;否则 DOWNLOAD 模式静默取目录并持久化。
static async ensurePublicDirPath(ctx: common.UIAbilityContext): Promise<string> { if (PublicDownloadDir.isTabletSilent()) { const granted: boolean = await PublicDownloadDir.requestDownloadPerm(ctx); return granted ? PublicDownloadDir.resolveDir() : ''; } return await PublicDownloadDir.ensurePh...
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 ensurePublicDirPath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ctx AST#identifier#Right AST#:#Left ...
static async ensurePublicDirPath(ctx: common.UIAbilityContext): Promise<string> { if (PublicDownloadDir.isTabletSilent()) { const granted: boolean = await PublicDownloadDir.requestDownloadPerm(ctx); return granted ? PublicDownloadDir.resolveDir() : ''; } return await PublicDownloadDir.ensurePh...
https://github.com/LZZLHY/hlib
3cee5689340cb6a194ddc2c1a6795b4ff80f5f82
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
every
Determines whether the specified callback function returns true for all elements of an array. @param { function } predicate - A function that accepts three arguments. The every method calls the predicate function for each element in the array until the predicate returns a false, or until the end of the array. @returns ...
public every(predicate: (element: number, index: int, array: Int8Array) => boolean): boolean { for (let i = 0; i < this.lengthInt; ++i) { if (!predicate((this.getUnsafe(i)).toDouble(), i, this)) { return false } } return true }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left every AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left predicate AST#identif...
public every(predicate: (element: number, index: int, array: Int8Array) => boolean): boolean { for (let i = 0; i < this.lengthInt; ++i) { if (!predicate((this.getUnsafe(i)).toDouble(), i, this)) { return false } } return true }
https://gitcode.com/iop123123/arkts-static-skills
c79b4bd2ad64b6524e229eb72d34117e548306b9
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/GamepadVibrationService.ets
arkts
triggerDeviceVibrate
触发设备震动(后备方案) 关键改进: 1. 使用 continuous 长振(而非 transient 瞬态)实现持续震动 2. 强度变化时立即停止旧震动再启动新震动 3. 使用 stopVibrationSync 同步停止确保即时性
private triggerDeviceVibrate(lowFreqMotor: number, highFreqMotor: number): void { if (!this.vibrationFeedbackEnabled || this.gameVibrationStrength <= 0) return; // 停止震动 if (lowFreqMotor === 0 && highFreqMotor === 0) { if (this.isVibrating) { this.stopVibrationImmediate(); this.lastL...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left triggerDeviceVibrate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left lowFreqMotor AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left numb...
private triggerDeviceVibrate(lowFreqMotor: number, highFreqMotor: number): void { if (!this.vibrationFeedbackEnabled || this.gameVibrationStrength <= 0) return; // 停止震动 if (lowFreqMotor === 0 && highFreqMotor === 0) { if (this.isVibrating) { this.stopVibrationImmediate(); this.lastL...
https://github.com/AlkaidLab/moonlight-harmony
635e3e132701f40109d2645552f586c15ffd10ec
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/streaming/NvHttp.ets
arkts
doHttpsRequestWithFrpRetry
执行 HTTPS 请求,超时且使用自定义端口时按 Sunshine 规则(httpPort - 5)重试 适用场景:frp/端口转发下,缓存的 httpsPort 是服务端本地端口,与外部转发端口不同 应用范围:getAppList / launchApp / resumeApp / quitApp 等仅 HTTPS 的请求 @param path API 路径(如 'applist', 'launch') @param options 可选查询参数和超时配置
private async doHttpsRequestWithFrpRetry(path: string, options?: NvHttpPathRequestOptions): Promise<string> { const transferTimeout = options?.transferTimeout ?? NvHttp.READ_TIMEOUT; const connectTimeout = options?.connectTimeout ?? NvHttp.CONNECTION_TIMEOUT; return this.doHttpsWithFrpRetry(path, options?...
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 doHttpsRequestWithFrpRetry AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right ...
private async doHttpsRequestWithFrpRetry(path: string, options?: NvHttpPathRequestOptions): Promise<string> { const transferTimeout = options?.transferTimeout ?? NvHttp.READ_TIMEOUT; const connectTimeout = options?.connectTimeout ?? NvHttp.CONNECTION_TIMEOUT; return this.doHttpsWithFrpRetry(path, options?...
https://github.com/AlkaidLab/moonlight-harmony
32c9122e2871e83c2d066a367b6b0f41e2856374
github
HarmonyOS_Samples/BestPracticeSnippets
AppFreeze/entry/src/main/ets/pages/appfreezecase.ets
arkts
xxxFunction1
这部分逻辑如果较为耗时,执行次数多,总时长就是发生冻屏的耗时操作 [End appfreeze_advise2] 最佳实践:应用冻屏优化建议 [Start appfreeze_advise3]
function xxxFunction1(fileUris : string[]): void { // ... for (const fileuri of fileUris) { let file = fileIo.openSync(fileuri, fileIo.OpenMode.READ_ONLY); // ... } // ... } // 如果使用同步操作,需要考虑到容器弱网或无网等极端情况发生
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left xxxFunction1 AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left fileUris AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:...
function xxxFunction1(fileUris : string[]): void { // ... for (const fileuri of fileUris) { let file = fileIo.openSync(fileuri, fileIo.OpenMode.READ_ONLY); // ... } // ... } // 如果使用同步操作,需要考虑到容器弱网或无网等极端情况发生
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
2d656f7446a0d1bdc6ea4ca9ce41f5b366da3d41
gitcode
openharmony-sig/online_event
college_growth_program/homework/三期成长打卡作业/2022_0127/crusie/陈星霖-作业&笔记-0127/MyApplication6/entry/src/main/ets/MainAbility/pages/index.ets
arkts
onPlayOrPauseMusic
指针播放和唱盘动画 playAnimation() { // if (this.turntableTimer) { // return // } // 唱盘转动动画 let fun = () => { animateTo({ duration: 1500, curve: Curve.Linear, playMode: PlayMode.Normal }, () => { this.turntableAngle = this.turntableAngle + 90; }) } fun() // this.turntableTimer = setInterval(fun, 1500) // 唱盘指针下拨动...
onPlayOrPauseMusic() { if (this.isSwitching) { CommonLog.info('onPlayOrPauseMusic ignored, isSwitching') } this.isSwitching = true // 暂停播放 if (this.isPlaying) { CommonLog.info("Start to pause music") this.playerManager.pause() this.pauseAnimation() } else { /...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onPlayOrPauseMusic 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...
onPlayOrPauseMusic() { if (this.isSwitching) { CommonLog.info('onPlayOrPauseMusic ignored, isSwitching') } this.isSwitching = true // 暂停播放 if (this.isPlaying) { CommonLog.info("Start to pause music") this.playerManager.pause() this.pauseAnimation() } else { /...
https://gitee.com/openharmony-sig/online_event.git
e6099a1b852a881c26546e300cf7082d9e11b8a8
gitee
Nekofox-POT/LinMusic
entry/src/main/ets/package/files_manager/class_files_manager.ets
arkts
load_data
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 初始化 // //////// 初始化数据库 //
async load_data() { this.download_manager!.load_data() await this.external_manager!.scan_data() this.update_data() }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left load_data 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#{#Righ...
async load_data() { this.download_manager!.load_data() await this.external_manager!.scan_data() this.update_data() }
https://github.com/Nekofox-POT/LinMusic
247340b24bfc94910f93d980ab514c97ec0db15f
github
openharmony-sig/flutter_packages
packages/local_auth/local_auth_ohos/ohos/src/main/ets/io/flutter/plugins/localauth/AuthenticationHelper.ets
arkts
stopAuthentication
Cancels the biometric authentication.
stopAuthentication(): void { try { this.userAuthInstance?.cancel(); Log.i(TAG, 'auth cancel success'); } catch (error) { Log.e(TAG, 'auth catch error: ' + JSON.stringify(error)); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left stopAuthentication 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...
stopAuthentication(): void { try { this.userAuthInstance?.cancel(); Log.i(TAG, 'auth cancel success'); } catch (error) { Log.e(TAG, 'auth catch error: ' + JSON.stringify(error)); } }
https://gitee.com/openharmony-sig/flutter_packages.git
5ca3c55cdb352bf6de44fb7bf78949bb7feea12d
gitee
Joker-x-dev/CoolMallArkTS
core/network/src/main/ets/datasource/userinfo/UserInfoNetworkDataSourceImpl.ets
arkts
updatePassword
修改密码 @param {Record<string, string>} params - 修改密码参数 @returns {Promise<NetworkResponse<Unknown>>} 修改结果
async updatePassword(params: Record<string, string>): Promise<NetworkResponse<Unknown>> { const resp: AxiosResponse<NetworkResponse<Unknown>> = await NetworkClient.http.post("user/info/updatePassword", params); return resp.data; }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left updatePassword AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left params AST#identifier#Right AST#type_annotation#Left AST#:#Left ...
async updatePassword(params: Record<string, string>): Promise<NetworkResponse<Unknown>> { const resp: AxiosResponse<NetworkResponse<Unknown>> = await NetworkClient.http.post("user/info/updatePassword", params); return resp.data; }
https://github.com/Joker-x-dev/CoolMallArkTS
acb03ee523e33d0be84229f69b948dcd95545c74
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/MangaSourceEngine.ets
arkts
getTaskExecutor
获取任务执行器(供外部直接使用)
getTaskExecutor(): TaskExecutor | null { return this.taskExecutor; }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getTaskExecutor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ident...
getTaskExecutor(): TaskExecutor | null { return this.taskExecutor; }
https://github.com/DaLongZhuaZi/manxia
2515385273543b2c24cbbe5fb8b62d5a373f99de
github
David8Idira/AI-OA
packages/harmonyos/commons/src/main/ets/services/IMService.ets
arkts
pinConversation
置顶会话 @param conversationId 会话ID
async pinConversation(conversationId: string): Promise<ApiResponse<any>> { return this.client.post<any>(`/api/v1/im/conversations/${conversationId}/pin`, {}) }
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left pinConversation AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left conversationId AST#identifier#Right AST#type_annotation#Left AS...
async pinConversation(conversationId: string): Promise<ApiResponse<any>> { return this.client.post<any>(`/api/v1/im/conversations/${conversationId}/pin`, {}) }
https://github.com/David8Idira/AI-OA
7261cfdc27c8fad2e9f0f165755f77aa1ce4c867
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test56_original_index.ets
arkts
swapPair
--- Array destructuring (manual swap and extraction) ---
function swapPair(pair: number[]): number[] { let first: number = pair[0]; let second: number = pair[1]; let result: number[] = [second, first]; return result; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left swapPair AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left pair AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right A...
function swapPair(pair: number[]): number[] { let first: number = pair[0]; let second: number = pair[1]; let result: number[] = [second, first]; return result; }
https://github.com/miaochiahao/ark-ghidra
069a9764ca3c8529adb50b05731921bcaffc16ff
github
751496032/DSBridge-HarmonyOS
library/src/main/ets/core/WebViewControllerProxy.ets
arkts
webviewController
获取webview控制器 @returns
get webviewController(): webview.WebviewController { return this.controller }
AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left webviewController 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#member_expression#Left AST#id...
get webviewController(): webview.WebviewController { return this.controller }
https://github.com/751496032/DSBridge-HarmonyOS/blob/6e69923a816e400710e23c8bab549fe790545bc6/library/src/main/ets/core/WebViewControllerProxy.ets#L169-L171
ebb2940c79e81fdb75c4673f6b602dd39928ccbc
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/bitwise_xor/bitwise_xor_ubyte.ets
arkts
main
--- desc: check bitwise XOR of two unsigned bytes ---
function main(): void { const a: ubyte = {{v.left}} const b: ubyte = {{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: ubyte = {{v.left}} const b: ubyte = {{v.right}} assert (a ^ b) == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
39e00834e6b6f993f82c6216d8512ecf7db6ab35
gitee
LongLiveY96/chatcube
entry/src/main/ets/viewmodels/AppStateManager.ets
arkts
loadState
加载保存的状态
async loadState(): Promise<void> { this.currentModelId = await this.preferencesService.getCurrentModelId() this.currentModelName = await this.preferencesService.getCurrentModelName() this.currentProviderId = await this.preferencesService.getCurrentProviderId() }
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 loadState AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Rig...
async loadState(): Promise<void> { this.currentModelId = await this.preferencesService.getCurrentModelId() this.currentModelName = await this.preferencesService.getCurrentModelName() this.currentProviderId = await this.preferencesService.getCurrentProviderId() }
https://github.com/LongLiveY96/chatcube
2145d08f823aeeec0089bb23bcea53c158f66bc7
github
LZZLHY/hlib
entry/src/main/ets/utils/QrLoginParser.ets
arkts
parse
失败返回 null。成功 userId/userKey 都非空。
static parse(raw: string | undefined | null): QrCredential | null { if (raw === undefined || raw === null) { return null; } const text: string = raw.trim(); if (text.length === 0) { return null; } // 1) JSON if (text.startsWith('{') && text.endsWith('}')) { const fromJso...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left parse AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left raw AST#identifi...
static parse(raw: string | undefined | null): QrCredential | null { if (raw === undefined || raw === null) { return null; } const text: string = raw.trim(); if (text.length === 0) { return null; } // 1) JSON if (text.startsWith('{') && text.endsWith('}')) { const fromJso...
https://github.com/LZZLHY/hlib
c840838cfe416013f01a827c63e7b6caedacf329
github
openharmony-sig/flutter_flutter
packages/integration_test/ohos/src/main/ets/components/integration_test/FlutterDeviceScreenshot.ets
arkts
convertFlutterSurfaceToImage
Converts the Flutter surface to an image view. This allows to render the view hierarchy to a bitmap since {@code FlutterSurfaceView} and {@code FlutterTextureView} cannot be rendered to a bitmap. @param activity typically {@code FlutterActivity}.
static convertFlutterSurfaceToImage(ability: UIAbility): void { }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left convertFlutterSurfaceToImage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ability AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#...
static convertFlutterSurfaceToImage(ability: UIAbility): void { }
https://gitee.com/openharmony-sig/flutter_flutter.git
f111e6fa02a09537d2ae5a6d509d653f8660b7b2
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
valueOf
Returns the object itself @returns { BigInt64Array } @syscap SystemCapability.Utils.Lang @FaAndStageModel
public valueOf(): BigInt64Array { return this }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left valueOf AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left BigInt64Array ...
public valueOf(): BigInt64Array { return this }
https://gitcode.com/iop123123/arkts-static-skills
c64dbda57a612339e6b0057d98f204d11945132d
gitcode
LJ666-ui/harmony-health-care
entry/src/main/ets/mock/smartwardMock_realdata.ets
arkts
generateAutomationRules
获取5条真实自动化规则
public generateAutomationRules(): ExtendedAutomationRule[] { return [ { ruleId: 'RULE_NIGHT_001', ruleName: '夜间安静模式(22:00-06:00)', description: '每晚22点自动将病房调整为夜间模式:灯光调暗、空调静音、窗帘关闭、电视待机', isEnabled: true, triggerType: 'TIME_BASED', triggerCondition: { t...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left generateAutomationRules 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#Lef...
public generateAutomationRules(): ExtendedAutomationRule[] { return [ { ruleId: 'RULE_NIGHT_001', ruleName: '夜间安静模式(22:00-06:00)', description: '每晚22点自动将病房调整为夜间模式:灯光调暗、空调静音、窗帘关闭、电视待机', isEnabled: true, triggerType: 'TIME_BASED', triggerCondition: { t...
https://github.com/LJ666-ui/harmony-health-care
ce763c1e8ed99031b4ba8879d9a6148a30a873c4
github
ZestBox-18/kitebook-frontend
commons/data_core/src/main/ets/services/AccountManager.ets
arkts
buildDefaultAccounts
构建默认账户列表,供空库时回填基础数据。
private static buildDefaultAccounts(): AccountBean[] { const seeds: AccountSeed[] = [ new AccountSeed('支付宝', 8650.35, AccountTypeEnum.ASSET, 'creditcard'), new AccountSeed('微信', 3268.50, AccountTypeEnum.ASSET, 'house'), new AccountSeed('银行卡', 42180.00, AccountTypeEnum.ASSET, 'creditcard'), ...
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 buildDefaultAccounts AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#R...
private static buildDefaultAccounts(): AccountBean[] { const seeds: AccountSeed[] = [ new AccountSeed('支付宝', 8650.35, AccountTypeEnum.ASSET, 'creditcard'), new AccountSeed('微信', 3268.50, AccountTypeEnum.ASSET, 'house'), new AccountSeed('银行卡', 42180.00, AccountTypeEnum.ASSET, 'creditcard'), ...
https://github.com/ZestBox-18/kitebook-frontend
6e2b844a50342347336797196c746ab8d250a72d
github
awaLiny2333/Spaceow
woof/src/main/ets/components/GridSpace.ets
arkts
constructor
Side length
constructor(f: meowFile, x: number, y: number, a: number) { this.file = f; this.x = x; this.y = y; this.a = a; }
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 f AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left meowFile AST#identifier#Right AS...
constructor(f: meowFile, x: number, y: number, a: number) { this.file = f; this.x = x; this.y = y; this.a = a; }
https://github.com/awaLiny2333/Spaceow/blob/d256e91c0feb34459ecf81ce388c749d614c3bfa/woof/src/main/ets/components/GridSpace.ets#L21-L26
3206b7b82f51c3d188bb81bef496f4c841099a5a
github
Explore-In-HMOS-Wearable/unit-calculator
entry/src/main/ets/services/PreferencesService.ets
arkts
parseList
─── Private helpers ───────────────────────────────────────────────────────
private static parseList(raw: string | undefined): ConversionRecord[] { if (!raw) { return []; } try { const parsed = JSON.parse(raw) as SerializedRecord[]; if (!Array.isArray(parsed)) { return []; } return parsed.map((plain: SerializedRecord) => PreferencesService.hy...
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 parseList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left raw AST#identifier#Right AST#:#Left : AST#...
private static parseList(raw: string | undefined): ConversionRecord[] { if (!raw) { return []; } try { const parsed = JSON.parse(raw) as SerializedRecord[]; if (!Array.isArray(parsed)) { return []; } return parsed.map((plain: SerializedRecord) => PreferencesService.hy...
https://github.com/Explore-In-HMOS-Wearable/unit-calculator
d9e33a2984ef286134f51dda70241be1ef5a1ed0
github
arkui-x/samples
CodeLab/Cases/feature/calendarswitch/src/main/ets/customcalendar/utils/StyleUtils.ets
arkts
getColor
获取公历日期字体颜色(仅用于月视图和周视图) @param day 日期信息 @param month 月份 @param currentSelectDay 当前选择的日期 @param calendarViewType 日历视图类型 @param CalendarStyle 自定义日历样式 @returns 返回颜色
static getColor(day: Day, month: number, currentSelectDay: DayInfo, calendarViewType: CalendarViewType, CalendarStyle: CalendarStyle): Color | number | string | Resource { const IS_SELECT_DAY: boolean = currentSelectDay.year === day.dayInfo.year && currentSelectDay.month === day.dayInfo.month && ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left day AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Day AST#...
static getColor(day: Day, month: number, currentSelectDay: DayInfo, calendarViewType: CalendarViewType, CalendarStyle: CalendarStyle): Color | number | string | Resource { const IS_SELECT_DAY: boolean = currentSelectDay.year === day.dayInfo.year && currentSelectDay.month === day.dayInfo.month && ...
https://gitcode.com/arkui-x/samples
78a04459e46a097f754df33f22e4c55f3cc8ce6d
gitcode
the-wwyang/kids-learning-app
src/main/ets/services/DataBackupService.ets
arkts
restoreBackupData
恢复备份数据
private async restoreBackupData(backupData: BackupData): Promise<number> { let restoredCount = 0; try { // 恢复学习进度 for (const progress of backupData.learningProgress) { const progressData = progress as Record<string, string | number>; await appStorage.updateLearningProgress({ ...
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 restoreBackupData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left backupData AST#identifier#Right AST...
private async restoreBackupData(backupData: BackupData): Promise<number> { let restoredCount = 0; try { // 恢复学习进度 for (const progress of backupData.learningProgress) { const progressData = progress as Record<string, string | number>; await appStorage.updateLearningProgress({ ...
https://github.com/the-wwyang/kids-learning-app
4bdf5c96727d5e0f03c218bed672c7aa13cf7b11
github
awaLiny2333/LinysBrowser_NEXT
home/src/main/ets/hosts/userdata/bookmarks/classes/meowBookmarkStash.ets
arkts
exportHTMLtoDocuments
Export bookmarks to HTML file in documents. @param folder The folder to export.
async exportHTMLtoDocuments(folder: meowBookmarkItem = this.root) { const htmlText = await parseToHTMLConcurrent(folder); if (!htmlText) { meow(`Failed to export HTML to documents. htmlText is empty!`, 'meowBookmarkStash][exportHTMLtoDocuments', meowLevel.WARN); return false; } await fileD...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left exportHTMLtoDocuments AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left folder AST#identifier#Right AST#type_annotation#Left AST#...
async exportHTMLtoDocuments(folder: meowBookmarkItem = this.root) { const htmlText = await parseToHTMLConcurrent(folder); if (!htmlText) { meow(`Failed to export HTML to documents. htmlText is empty!`, 'meowBookmarkStash][exportHTMLtoDocuments', meowLevel.WARN); return false; } await fileD...
https://github.com/awaLiny2333/LinysBrowser_NEXT
0ba242b10fcb098d527de2cee43f4eb9acd270a3
github
arkui-x/samples
CodeLab/Cases/feature/customdialog/src/main/ets/view/CustomDialog.ets
arkts
aboutToAppear
初始化SubWindowApi对象
aboutToAppear() { if (this.windowStage) { this.SubWindowApi = new api.SubWindowApi(); } showApiSubWindow(this.SubWindowApi, this.windowStage); }
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.windowStage) { this.SubWindowApi = new api.SubWindowApi(); } showApiSubWindow(this.SubWindowApi, this.windowStage); }
https://gitcode.com/arkui-x/samples
59db2d8db575d1f8d5b5c8eedd5ffa11ee4b073c
gitcode
richshaw2015/nds
ohos/entry/src/main/ets/utils/NdsRomCache.ets
arkts
bytes
创建字节单位
static bytes(value: number): SizeUnit { return new SizeUnit(value); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left bytes AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ER...
static bytes(value: number): SizeUnit { return new SizeUnit(value); }
https://github.com/richshaw2015/nds
3d3c28a99082982e1fec91c3cc99003fa5537db2
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
sort
Sorts in-place @param fn comparator @returns sorted Uint32Array
public sort(fn: (a: number, b: number) => number): Uint32Array { let arr: number[] = new number[this.length] for (let i = 0; i < this.length; ++i) { arr[i] = this.at(i) } // TODO(ivan-tyulyandin): unresolved reference i in for loop, blocked by internal issue 12961 ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left sort AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Righ...
public sort(fn: (a: number, b: number) => number): Uint32Array { let arr: number[] = new number[this.length] for (let i = 0; i < this.length; ++i) { arr[i] = this.at(i) } // TODO(ivan-tyulyandin): unresolved reference i in for loop, blocked by internal issue 12961 ...
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
d76d749d8858edf8afeb5ac7a266d2d0436552de
gitee
honjow/Next2V
shared/src/main/ets/parser/V2exNodeParser.ets
arkts
extractFavoriteNodes
从 /my/nodes HTML 中提取收藏节点(name + title)
static extractFavoriteNodes(html: string): V2exFavoriteNode[] { if (!html) { return [] } const nodes: V2exFavoriteNode[] = [] const seen: Set<string> = new Set() const linkRe = /<a[^>]+href=['"]\/go\/([a-zA-Z0-9_-]+)['"][^>]*>([\s\S]*?)<\/a>/gi let m: RegExpExecArray | null = linkRe.exec...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left extractFavoriteNodes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left html AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#...
static extractFavoriteNodes(html: string): V2exFavoriteNode[] { if (!html) { return [] } const nodes: V2exFavoriteNode[] = [] const seen: Set<string> = new Set() const linkRe = /<a[^>]+href=['"]\/go\/([a-zA-Z0-9_-]+)['"][^>]*>([\s\S]*?)<\/a>/gi let m: RegExpExecArray | null = linkRe.exec...
https://github.com/honjow/Next2V
2ea7fca967b96d91fcf37f65c3488f7d0e208600
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Theme/UserThemeConfig.ets
arkts
notifyChange
通知配置变化
private notifyChange(): void { const profile = this.getCurrentProfile(); this.changeCallbacks.forEach(callback => { try { callback(profile); } catch (error) { logger.error(TAG, '配置变化回调执行失败', error); } }); // 同步配置值到AppStorage以触发声明式UI刷新 this.syncToAppStorage();...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left notifyChange 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#voi...
private notifyChange(): void { const profile = this.getCurrentProfile(); this.changeCallbacks.forEach(callback => { try { callback(profile); } catch (error) { logger.error(TAG, '配置变化回调执行失败', error); } }); // 同步配置值到AppStorage以触发声明式UI刷新 this.syncToAppStorage();...
https://github.com/DaLongZhuaZi/manxia
7317a9c1235ab72b90daab0b1395e178c91d68cd
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/model/AnomalyDetection.ets
arkts
detectTimeAnomaly
检测时间异常(非正常时间消费) @param bill 账单 @param normalStartHour 正常消费开始时间(小时) @param normalEndHour 正常消费结束时间(小时)
static detectTimeAnomaly( bill: Bill, normalStartHour: number = 7, normalEndHour: number = 23 ): AnomalyDetectionResult { const dateTime = new Date(bill.transactionDate); const hour = dateTime.getHours(); const isUnusualTime = hour < normalStartHour || hour > normalEndHour; const resul...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left detectTimeAnomaly AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bill AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
static detectTimeAnomaly( bill: Bill, normalStartHour: number = 7, normalEndHour: number = 23 ): AnomalyDetectionResult { const dateTime = new Date(bill.transactionDate); const hour = dateTime.getHours(); const isUnusualTime = hour < normalStartHour || hour > normalEndHour; const resul...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
0d06f10c16c6b083527007611d807eb851e40b26
github
openharmony/arkui_ace_engine
examples/Accessibility/ActionOptionsSliderStatic/entry/src/main/ets/pages/slider004.ets
arkts
build
@State modifier3 : Slider_Modifier3 = new Slider_Modifier3()
build() { Column({ space: 8 } as ColumnOptions) { Text('outset slider').fontSize(9).fontColor(0xCCCCCC).width('90%').margin(15) Row() { Slider({ value: this.outSetValueOne, min: 0, max: 100, step: 10, style: SliderStyle.OutSet }) ...
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() { Column({ space: 8 } as ColumnOptions) { Text('outset slider').fontSize(9).fontColor(0xCCCCCC).width('90%').margin(15) Row() { Slider({ value: this.outSetValueOne, min: 0, max: 100, step: 10, style: SliderStyle.OutSet }) ...
https://gitcode.com/openharmony/arkui_ace_engine
acaf399abbf8e7bbb06e06b5bc7b0c7a8ff0f3a5
gitcode
CPF-ApplicationTPC/openharmony_tpc_samples
SwipeMenuListView/library/src/main/ets/model/TouchConfig.ets
arkts
sensitive
敏感配置(容易触发滑动)
static sensitive(): TouchConfig { let config = new TouchConfig(); config.minSwipeDistance = 3; // 距离 config.minFlingVelocity = 200; // 速度阈值 config.menuOpenThreshold = 0.2; // 20%打开 return config; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left sensitive 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 TouchConfig ...
static sensitive(): TouchConfig { let config = new TouchConfig(); config.minSwipeDistance = 3; // 距离 config.minFlingVelocity = 200; // 速度阈值 config.menuOpenThreshold = 0.2; // 20%打开 return config; }
https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples
cd406b08cef4366c3a7133e1a276cdf3fe74fa22
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Array.ets
arkts
toSorted
Copying version of the sort() method. It returns a new array with the elements sorted in ascending order. @param comparator function to compare to elements of the Array @returns sorted copy of the current instance comparator
public toSorted(comparator: (a: T, b: T) => int): Array<T> { let arr = new Array<T>(this.data) arr.doSort(this.data, 0, this.data.length, comparator) return arr }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toSorted AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left comparator AST#identifier#Right AST#ERROR#Left AST#:#Left...
public toSorted(comparator: (a: T, b: T) => int): Array<T> { let arr = new Array<T>(this.data) arr.doSort(this.data, 0, this.data.length, comparator) return arr }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
d0289c6b7c28c9540e4ff9a2a3ff5c628660eed5
gitee
openharmony-sig/commons-cli
library/src/main/ets/components/cli/HelpFormatter.ets
arkts
setNewLine
Sets the 'newLine'. @param newline the new value of 'newLine'
public setNewLine(newline:string):void { this.defaultNewLine = newline; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setNewLine AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left newline AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Righ...
public setNewLine(newline:string):void { this.defaultNewLine = newline; }
https://gitee.com/openharmony-sig/commons-cli.git
0fa03f3f3d6cb87cf0d47dc64155b1a7b159f7e7
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/WelcomeGuideManager.ets
arkts
nextStep
进入下一步
public async nextStep(): Promise<GuideStep> { try { if (!this.isInitialized) { await this.initialize(); } if (this.currentStep !== GuideStep.COMPLETED) { this.currentStep = this.normalizeStep(this.getNextStepForCurrentStep(this.currentStep)); await this.saveGuideState(); ...
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 nextStep AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left ...
public async nextStep(): Promise<GuideStep> { try { if (!this.isInitialized) { await this.initialize(); } if (this.currentStep !== GuideStep.COMPLETED) { this.currentStep = this.normalizeStep(this.getNextStepForCurrentStep(this.currentStep)); await this.saveGuideState(); ...
https://github.com/DaLongZhuaZi/manxia
6798f17f3a78cf31ce2c70aad266a3f223514068
github
webabcd/HarmonyDemo
entry/src/main/ets/pages/component/common/ModifierDemo.ets
arkts
applyContent
返回指定的自定义 Checkbox
applyContent() : WrappedBuilder<[CheckBoxConfiguration]> { return wrapBuilder(buildCheckbox) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left applyContent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#instantiation_expre...
applyContent() : WrappedBuilder<[CheckBoxConfiguration]> { return wrapBuilder(buildCheckbox) }
https://github.com/webabcd/HarmonyDemo
7ed935f48e40ece600729b3749a2fbc7b04d5798
github
imperson123/-
Harmonyos-Application/entry/src/main/ets/pages/ChatStore.ets
arkts
loadHistory
加载历史消息
private loadHistory() { // 实际应用中应从数据库或Preferences加载 const saved = AppStorage.Get('chat_history') as Message[]; if (saved && Array.isArray(saved)) { this.messages = saved; } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left loadHistory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left ...
private loadHistory() { // 实际应用中应从数据库或Preferences加载 const saved = AppStorage.Get('chat_history') as Message[]; if (saved && Array.isArray(saved)) { this.messages = saved; } }
https://github.com/imperson123/-
a34fd03bf72d6aea0bcdb02f354fa5fd06073c54
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Intl.ets
arkts
setCachedLocale
Cache locale data for a given tag @param tag The BCP47 language tag to use as cache key @param data The parsed locale data to cache
private static setCachedLocale(tag: string, data: ParsedLocaleData): void { ConcurrencyHelpers.lockGuard(Locale.localeCacheMutex, () => { Locale.lastParsedTag = tag; Locale.lastParsedResult = data; }); }
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 setCachedLocale AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tag AST#identifier#Right AST#:#Left ...
private static setCachedLocale(tag: string, data: ParsedLocaleData): void { ConcurrencyHelpers.lockGuard(Locale.localeCacheMutex, () => { Locale.lastParsedTag = tag; Locale.lastParsedResult = data; }); }
https://gitcode.com/iop123123/arkts-static-skills
187b01674322b3f6a29f120ec726c082f136b5e7
gitcode
openharmony/applications_permission_manager
permissionmanager/src/main/ets/common/permissionGroupManager/PermissionGroupManager.ets
arkts
getGroupNameByPermission
根据权限获取所在权限组名 @param permission 权限 @param allConfigs return
public getGroupNameByPermission( permission: Permission, allConfigs: PermissionGroupConfig[] ): PermissionGroup | undefined { for (let index = 0; index < allConfigs.length; index++) { const element = allConfigs[index]; if (element.permissions.includes(permission)) { return element.groupN...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getGroupNameByPermission AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left permission AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#i...
public getGroupNameByPermission( permission: Permission, allConfigs: PermissionGroupConfig[] ): PermissionGroup | undefined { for (let index = 0; index < allConfigs.length; index++) { const element = allConfigs[index]; if (element.permissions.includes(permission)) { return element.groupN...
https://gitee.com/openharmony/applications_permission_manager.git
d0e611f4ddf58d25bac2479f19f0629ccfe51137
gitee
richshaw2015/nds
ohos/entry/src/main/ets/types/MelonDSNative.ets
arkts
setConsoleType
============================================================================ DSi 模式支持接口 ============================================================================ 设置主机类型 @param type 主机类型 (0=NDS, 1=DSi) @returns 设置是否成功
static setConsoleType(type: number): boolean { return MelonDSNative.native.setConsoleType(type); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setConsoleType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left n...
static setConsoleType(type: number): boolean { return MelonDSNative.native.setConsoleType(type); }
https://github.com/richshaw2015/nds
74adc16f4a188973bbc85f1980fc394176c20e29
github
openharmony/multimedia_camera_framework
frameworks/js/camera_napi/demo/entry/src/main/ets/views/ModeSwitchPage.ets
arkts
countTakeVideoFn
倒计时拍照和录像
countTakeVideoFn(): void { if (this.countdownNum) { // 清除定时器 if (this.countTimerOut) { clearTimeout(this.countTimerOut); } if (this.countTimerInt) { clearInterval(this.countTimerInt); } // 开启定时器 this.countTimerOut = setTimeout(() => { // 判断是录像还是拍照模...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left countTakeVideoFn AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expressio...
countTakeVideoFn(): void { if (this.countdownNum) { // 清除定时器 if (this.countTimerOut) { clearTimeout(this.countTimerOut); } if (this.countTimerInt) { clearInterval(this.countTimerInt); } // 开启定时器 this.countTimerOut = setTimeout(() => { // 判断是录像还是拍照模...
https://gitee.com/openharmony/multimedia_camera_framework.git
fd252fe4715a8c0f1013ec4df0e018d60c9c720b
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Errors.ets
arkts
constructor
Constructs a new ArrayIndexOutOfBoundsError 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(message, options) this.name = "ArrayIndexOutOfBoundsError" }
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(message, options) this.name = "ArrayIndexOutOfBoundsError" }
https://gitcode.com/iop123123/arkts-static-skills
cb495611b5943ede3a10c85be6a6dc0238c0a360
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/MangaSourceConfigParser.ets
arkts
buildSearchByIdActions
==================== 搜索增强方法 ==================== 构建ID搜索操作序列 @param config 图源配置 @param illustId 作品ID @returns 操作序列,如果工作流不存在则返回空数组
buildSearchByIdActions(config: MangaSourceConfig, illustId: string): Action[] { const workflow = this.getWorkflow(config, 'searchById'); if (!workflow) { logger.info(TAG, 'searchById工作流不存在,返回空数组'); return []; } return this.processActions(workflow, { illustId, mangaId: illustId } as Partial...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left buildSearchByIdActions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left MangaSourceConfi...
buildSearchByIdActions(config: MangaSourceConfig, illustId: string): Action[] { const workflow = this.getWorkflow(config, 'searchById'); if (!workflow) { logger.info(TAG, 'searchById工作流不存在,返回空数组'); return []; } return this.processActions(workflow, { illustId, mangaId: illustId } as Partial...
https://github.com/DaLongZhuaZi/manxia
ffa7787eed330eec08d56ce1e82a233bfc367173
github
DaLongZhuaZi/manxia
entry/src/main/ets/pages/MainMenuPage.ets
arkts
showBatchDeleteConfirmDialog
显示批量删除确认对话框
private showBatchDeleteConfirmDialog(): void { this.getUIContext().showAlertDialog({ title: '确认删除', message: `您确定要删除选中的 ${this.mangaMultiSelect.selectedIds.size} 部漫画吗?\n\n此操作将删除这些漫画的所有数据和文件,包括阅读进度、书签等,且不可恢复。`, autoCancel: true, alignment: DialogAlignment.Center, primaryButton: { ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left showBatchDeleteConfirmDialog 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#...
private showBatchDeleteConfirmDialog(): void { this.getUIContext().showAlertDialog({ title: '确认删除', message: `您确定要删除选中的 ${this.mangaMultiSelect.selectedIds.size} 部漫画吗?\n\n此操作将删除这些漫画的所有数据和文件,包括阅读进度、书签等,且不可恢复。`, autoCancel: true, alignment: DialogAlignment.Center, primaryButton: { ...
https://github.com/DaLongZhuaZi/manxia
ac4129911e2f3fd2d7cc503b594c5498dc68ba3b
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/SparseArray.ets
arkts
from
Creates a new `SparseArray` instance from an iterable or array-like object. @param { ArrayLike<T> | Iterable<T> } iterable An iterable or array-like object to convert to an array. @returns { SparseArray<T> } A new SparseArray instance containing the elements from the iterable. @static @syscap SystemCapability.Utils.Lan...
public static from<T>(iterable: ArrayLike<T> | Iterable<T>): SparseArray<T> { const ret: SparseArray<T> = new SparseArray<T>() let idx: int = 0 iteratorForEach<T>(iterable.$_iterator(), (x: T): void => { ret.buffer.set(idx++, x) }) if (idx > ret.maxLength) { ...
AST#program#Left AST#ERROR#Left AST#binary_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#from#Left from AST#from#Right AST#ERROR#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#...
public static from<T>(iterable: ArrayLike<T> | Iterable<T>): SparseArray<T> { const ret: SparseArray<T> = new SparseArray<T>() let idx: int = 0 iteratorForEach<T>(iterable.$_iterator(), (x: T): void => { ret.buffer.set(idx++, x) }) if (idx > ret.maxLength) { ...
https://gitcode.com/iop123123/arkts-static-skills
95ec1cd58227a4c2b45e9b866b80cda1899bab9f
gitcode
openharmony/applications_calendar_data
rrule/src/main/ets/RecurrenceSet.ets
arkts
hasRecurrence
是否含重复规则 @return true 含重复规则 false 不含重复规则
public hasRecurrence(): boolean { return false; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left hasRecurrence AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST...
public hasRecurrence(): boolean { return false; }
https://gitee.com/openharmony/applications_calendar_data.git
23a217559028c67d5dedd55b3dd6dc36f78e96b3
gitee
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/data/LineScatterCandleRadarDataSet.ets
arkts
setDrawHighlightIndicators
Enables / disables both vertical and horizontal highlight-indicators. @param enabled
public setDrawHighlightIndicators(enabled: boolean): void { this.setDrawVerticalHighlightIndicator(enabled); this.setDrawHorizontalHighlightIndicator(enabled); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setDrawHighlightIndicators 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 setDrawHighlightIndicators(enabled: boolean): void { this.setDrawVerticalHighlightIndicator(enabled); this.setDrawHorizontalHighlightIndicator(enabled); }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
8d20f1f39178d7192b7d6e9acec1e90e04859687
gitee
HarmonyOS_Samples/BestPracticeSnippets
ComponentReuse/entry/src/main/ets/pages/Index.ets
arkts
build
[EndExclude example]
build() { Column() { // [StartExclude example] Navigation(this.pageInfos) { List({ space: this.LIST_SPACE }) { ForEach(this.navDestinationData, (item: NavDestinationItem) => { ListItem() { Button(item.detail) .width(Constants.LAYOUT_MAX) ...
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() { // [StartExclude example] Navigation(this.pageInfos) { List({ space: this.LIST_SPACE }) { ForEach(this.navDestinationData, (item: NavDestinationItem) => { ListItem() { Button(item.detail) .width(Constants.LAYOUT_MAX) ...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
af60738e92403ad463cb3e0423aa00d8499ff8a2
gitcode
AGenUI/AGenUI
platforms/harmony/agenui/src/main/ets/agenui/AGenEngineUI.ets
arkts
unregisterFunction
Unregisters a function
static unregisterFunction(name: string): void { FunctionManager.getInstance().unregisterFunction(name); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left unregisterFunction AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le...
static unregisterFunction(name: string): void { FunctionManager.getInstance().unregisterFunction(name); }
https://github.com/AGenUI/AGenUI
6b31e4f6406f344c3da6591c72a89de12cd44c68
github
XHXYT/Pixark
entry/src/main/ets/services/MockData.ets
arkts
getTrendingTags
模拟:获取热门标签 (SearchViewModel 用)
static async getTrendingTags(): Promise<PixivTrendingTag[]> { /*await MockData.delay(); const tags: string[] = ['原创', '原神', '风景', '女の子', 'R-18', '机甲', '猫', '和风', 'pixiv', '插画']; const result: PixivTrendingTag[] = []; for (let i = 0; i < 20; i++) { const randomTag = tags[Math.floor(Math.random(...
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 getTrendingTags AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#...
static async getTrendingTags(): Promise<PixivTrendingTag[]> { /*await MockData.delay(); const tags: string[] = ['原创', '原神', '风景', '女の子', 'R-18', '机甲', '猫', '和风', 'pixiv', '插画']; const result: PixivTrendingTag[] = []; for (let i = 0; i < 20; i++) { const randomTag = tags[Math.floor(Math.random(...
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/services/MockData.ets#L17-L60
6ff1541894ba7e19b0dd480086e69a1a52cc703f
github
openharmony/applications_contacts
entry/src/main/ets/presenter/favorite/EditFavoriteListPresenter.ets
arkts
addAllFavoriteSelectInfo
Add Select All Data @param favoriteId
addAllFavoriteSelectInfo(favoriteList: FavoriteBean[]): string[] { HiLog.i(TAG, 'addAllFavoriteSelectInfo start.'); let isEditList: string[] = []; for (let i = 0;i < favoriteList.length; i++) { favoriteList[i].isEditSelect = true; isEditList.push(favoriteList[i].contactId); if (1 === fav...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left addAllFavoriteSelectInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left favoriteList AST#identifier#Right AST#:#Left : AST#...
addAllFavoriteSelectInfo(favoriteList: FavoriteBean[]): string[] { HiLog.i(TAG, 'addAllFavoriteSelectInfo start.'); let isEditList: string[] = []; for (let i = 0;i < favoriteList.length; i++) { favoriteList[i].isEditSelect = true; isEditList.push(favoriteList[i].contactId); if (1 === fav...
https://gitee.com/openharmony/applications_contacts.git
7687290cbc5c73743e8556036e674d78231fadc2
gitee
openharmony/vendor_unionman
unionpi_tiger/sample_hzu/Ward_Manage/entry/src/main/ets/MainAbility/pages/index.ets
arkts
constructor
构造函数中更新时间
constructor() { this.updateTime(); // 每分钟更新一次时间 setInterval(() => { this.updateTime(); }, 60000); }
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#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A...
constructor() { this.updateTime(); // 每分钟更新一次时间 setInterval(() => { this.updateTime(); }, 60000); }
https://gitee.com/openharmony/vendor_unionman.git
f7d00a7e7f0366dffcc64d5891fb4d1a1a36e555
gitee
CongDuang/PlayHarmony
entry/src/main/ets/utils/HttpUtil.ets
arkts
post
post 请求 @param url @param data @returns
post<Resp, Data>(url: string, data: Data): Promise<AxiosResponse<BaseResp<Resp>, Data>> { return HttpUtil.axiosInstance!.post<Resp, AxiosResponse<BaseResp<Resp>, Data>, Data>(url, data) }
AST#program#Left AST#expression_statement#Left AST#sequence_expression#Left AST#binary_expression#Left AST#identifier#Left post AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left Resp AST#identifier#Right AST#binary_expression#Right AST#,#Left , AST#,#Right AST#binary_expression#Left AST#member_expressio...
post<Resp, Data>(url: string, data: Data): Promise<AxiosResponse<BaseResp<Resp>, Data>> { return HttpUtil.axiosInstance!.post<Resp, AxiosResponse<BaseResp<Resp>, Data>, Data>(url, data) }
https://github.com/CongDuang/PlayHarmony/blob/7ccbad93bb99503665f6d6fbe3452a6286327dfa/entry/src/main/ets/utils/HttpUtil.ets#L58-L60
d2826b771ad5f911c827445456d84c37175b681f
github
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/model/BookmarkBase.ets
arkts
getDisplayLabel
Get display label (hostname if no label set)
getDisplayLabel(): string { return this.label || this.hostname || 'Unknown'; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getDisplayLabel 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...
getDisplayLabel(): string { return this.label || this.hostname || 'Unknown'; }
https://github.com/tangwengang-del/freerdp-harmonyos
118d1e58e7bc61c0ccd70f11fabb1f946cf76f37
github
zhui1234/Navix
entry/src/main/ets/store/NavixStore.ets
arkts
getExportJson
============================================================ 导出/导入 ============================================================
getExportJson(): string { return MapIO.exportMap( this.currentMapType, this.params, this.mapData, this.startPos, this.endPos, this.graphNodes, this.graphEdges, this.graphVisualRows, this.graphVisualCols, this.graphNextNodeId, this.graphNextEdgeId, ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getExportJson 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#statemen...
getExportJson(): string { return MapIO.exportMap( this.currentMapType, this.params, this.mapData, this.startPos, this.endPos, this.graphNodes, this.graphEdges, this.graphVisualRows, this.graphVisualCols, this.graphNextNodeId, this.graphNextEdgeId, ...
https://github.com/zhui1234/Navix/blob/df5c3b4c83baa8ecdc9bf26350f9e16492c24d2b/entry/src/main/ets/store/NavixStore.ets#L2707-L2723
31f4f85bc610e3a307fe63b3e4914a1b759f60c6
github
arkui-x/samples
CodeLab/Cases/feature/customdialog/src/main/ets/components/Dialog.ets
arkts
onChange
当visible的值变化时触发回调
onChange(): void{ if (this.visible) { this.controller.open(); } else { this.controller.close(); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left A...
onChange(): void{ if (this.visible) { this.controller.open(); } else { this.controller.close(); } }
https://gitcode.com/arkui-x/samples
af38f35e95dd4d9b10de78b054cd7e3a957f3726
gitcode
Tlntin/home-cloud-shield
entry/src/main/ets/serviceextability/MyVpnExtAbility.ets
arkts
queryUnderlyingDnsServers
Read the DNS servers of the current default (physical) network. Called just before create(), while the underlying network is still the default, so on Wi-Fi this returns the DHCP-pushed resolver(s) (e.g. the gateway). Best effort: any failure (e.g. missing permission) degrades to public resolvers only.
private async queryUnderlyingDnsServers(): Promise<string[]> { const result: string[] = []; try { const netHandle: connection.NetHandle = await connection.getDefaultNet(); if (netHandle.netId === 0) { return result; } const props: connection.ConnectionProperties = await connect...
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 queryUnderlyingDnsServers AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expressi...
private async queryUnderlyingDnsServers(): Promise<string[]> { const result: string[] = []; try { const netHandle: connection.NetHandle = await connection.getDefaultNet(); if (netHandle.netId === 0) { return result; } const props: connection.ConnectionProperties = await connect...
https://github.com/Tlntin/home-cloud-shield/blob/bfd8d549ccb3e55bdfc30fa7687b31d52e4c1cc0/entry/src/main/ets/serviceextability/MyVpnExtAbility.ets#L642-L661
da95e60feb55ec15f7e0eb3f82e876776ac85a4f
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test18_original_index.ets
arkts
caesarEncrypt
--- Caesar cipher ---
function caesarEncrypt(text: string, shift: number): string { let result: string = ''; for (let i: number = 0; i < text.length; i++) { let code: number = text.charCodeAt(i); if (code >= 65 && code <= 90) { code = 65 + (code - 65 + shift) % 26; } else if (code >= 97 && code <= 122) { code = 9...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left caesarEncrypt AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left text AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Ri...
function caesarEncrypt(text: string, shift: number): string { let result: string = ''; for (let i: number = 0; i < text.length; i++) { let code: number = text.charCodeAt(i); if (code >= 65 && code <= 90) { code = 65 + (code - 65 + shift) % 26; } else if (code >= 97 && code <= 122) { code = 9...
https://github.com/miaochiahao/ark-ghidra
d795b2e3917a1d7c9c93996c2d873a06e9a53c65
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/FTP/FTPNativeClient.ets
arkts
list
获取目录列表
async list(remotePath: string = '/'): Promise<FTPFileInfo[]> { if (!this.initialized) { await this.initialize(); } if (!nativeModule) { logger.warn(TAG, 'FTP Native模块未加载'); return []; } try { logger.info(TAG, `获取目录列表: ${remotePath}`); const result = nativeModule.ftp...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left list AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left remotePath AST#identifier#Right AST#type...
async list(remotePath: string = '/'): Promise<FTPFileInfo[]> { if (!this.initialized) { await this.initialize(); } if (!nativeModule) { logger.warn(TAG, 'FTP Native模块未加载'); return []; } try { logger.info(TAG, `获取目录列表: ${remotePath}`); const result = nativeModule.ftp...
https://github.com/DaLongZhuaZi/manxia
de9545523a1ca7daf09ba21bcf4c817016a9e032
github
aimilin6688/KeePassHO
entry/src/main/ets/common/utils/KdbxUtils.ets
arkts
getIcon
获取图标 @param iconId 图标id @param customIcon 自定义图标
public static getIcon(iconId: number | undefined, customIcon: KdbxUuid | undefined, defaultResource: Resource, kdbxMeta?: KdbxMeta | undefined): ResourceStr { if (iconId === undefined && customIcon === undefined) { return defaultResource; } if (kdbxMeta == undefined) { kdbxMeta = FileServi...
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 getIcon AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left iconId AST#identifier#Right AST#:#Left : AST#:#...
public static getIcon(iconId: number | undefined, customIcon: KdbxUuid | undefined, defaultResource: Resource, kdbxMeta?: KdbxMeta | undefined): ResourceStr { if (iconId === undefined && customIcon === undefined) { return defaultResource; } if (kdbxMeta == undefined) { kdbxMeta = FileServi...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/KdbxUtils.ets#L259-L274
ba37f6165b8dbc858eef22b72118337ab491c10e
github
LongLiveY96/chatcube
entry/src/main/ets/services/ShareService.ets
arkts
shareText
分享文本内容
async shareText(content: string, title: string = '分享对话'): Promise<ShareResult> { if (this.context === null) { console.error('ShareService', '[shareText] 服务未初始化') return { success: false, errorMessage: '服务未初始化' } } try { console.info('ShareService', `[shareText] 开始分享文本,内容长度: ${content.le...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left shareText AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left content AST#identifier#Right AST#ty...
async shareText(content: string, title: string = '分享对话'): Promise<ShareResult> { if (this.context === null) { console.error('ShareService', '[shareText] 服务未初始化') return { success: false, errorMessage: '服务未初始化' } } try { console.info('ShareService', `[shareText] 开始分享文本,内容长度: ${content.le...
https://github.com/LongLiveY96/chatcube
ee5cb4d9bf9180b1d4b64e6fb3ada35488f4481a
github
heeh02/superconnect
harmony/entry/src/main/ets/input/GestureController.ets
arkts
fireZoom
Zoom (magnify gesture): scrollY = per-frame magnification delta (ratio; + = zoom in), x/y = centroid (cursor anchor), buttons = phase (1=began, 0=changed, 2=ended).
private fireZoom(delta: number, c: Pt, phase: number): void { this.emit({ type: InputType.Zoom, tool: InputTool.Finger, buttons: phase, x: c.x, y: c.y, scrollX: 0, scrollY: delta }); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left fireZoom AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left delta AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left num...
private fireZoom(delta: number, c: Pt, phase: number): void { this.emit({ type: InputType.Zoom, tool: InputTool.Finger, buttons: phase, x: c.x, y: c.y, scrollX: 0, scrollY: delta }); }
https://github.com/heeh02/superconnect
33b447ee860c7e23a1e2e9274af79a1a4ddda802
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/EnhancedBackupManager.ets
arkts
restoreAllSettings
恢复整个设置表
private async restoreAllSettings(allSettings: SettingItemBackup[]): Promise<void> { if (!allSettings || allSettings.length === 0) { logger.info(TAG, '没有设置表数据需要恢复'); return; } try { const dataManager = (await import('../Data/DataManager')).DataManager.getInstance(); let success...
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 restoreAllSettings AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left allSettings AST#identifier#Right A...
private async restoreAllSettings(allSettings: SettingItemBackup[]): Promise<void> { if (!allSettings || allSettings.length === 0) { logger.info(TAG, '没有设置表数据需要恢复'); return; } try { const dataManager = (await import('../Data/DataManager')).DataManager.getInstance(); let success...
https://github.com/DaLongZhuaZi/manxia
a6ccbc3bd2830b0d4b69d4216755a89a8a2dd7f6
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Value.ets
arkts
getFieldsNum
Returns number of fields of this value @returns number of fields
public getFieldsNum(): long { return this.typ.getFieldsNum() }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getFieldsNum 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 long AST#...
public getFieldsNum(): long { return this.typ.getFieldsNum() }
https://gitcode.com/iop123123/arkts-static-skills
f5c449ac2f8dfd17fb681cfbf73bff45a459c43c
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Short.ets
arkts
isLessEqualThan
Checks if this instance value is less than or equal to value of provided instance @param { Short } other Right hand side of the comparison @returns { boolean } true if this value is less than or equal to provided, false otherwise @syscap SystemCapability.Utils.Lang @FaAndStageModel
public isLessEqualThan(other: Short): boolean { return this.value <= other.toShort(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isLessEqualThan AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left...
public isLessEqualThan(other: Short): boolean { return this.value <= other.toShort(); }
https://gitcode.com/iop123123/arkts-static-skills
5917c5cb9e1574af7e5f7ae99d91b749a87f114b
gitcode
HarmonyOS_Samples/MultiPictureBeautification
features/multipicturebrowsing/src/main/ets/viewmodel/AlbumListViewModel.ets
arkts
updateGridColumns
Update grid columns if different from current value
updateGridColumns(newColumns: string): boolean { if (this.gridColumns !== newColumns) { this.gridColumns = newColumns; return true; } return false; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateGridColumns AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left newColumns AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left )...
updateGridColumns(newColumns: string): boolean { if (this.gridColumns !== newColumns) { this.gridColumns = newColumns; return true; } return false; }
https://gitcode.com/HarmonyOS_Samples/MultiPictureBeautification
31db03de57f7e843a0d428baba1d2c0e0d56b22a
gitcode
honjow/Next2V
shared/src/main/ets/parser/V2exAccountParser.ets
arkts
extractLatestDailyReward
Reward amount (铜币) of the most recent "每日登录" entry on the /balance table, used for the post check-in toast. V2EX's balance table row is [time, 每日登录…, delta, balance]; the delta cell right after the description is the reward. Returns 0 when not found (toast falls back to a plain success).
static extractLatestDailyReward(html: string): number { const rowRe = /<tr[^>]*>([\s\S]*?)<\/tr>/gi let row: RegExpExecArray | null = rowRe.exec(html) while (row) { if (row[1].indexOf('每日登录') >= 0) { const cells: string[] = [] const cellRe = /<td[^>]*>([\s\S]*?)<\/td>/gi let ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left extractLatestDailyReward AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left html AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif...
static extractLatestDailyReward(html: string): number { const rowRe = /<tr[^>]*>([\s\S]*?)<\/tr>/gi let row: RegExpExecArray | null = rowRe.exec(html) while (row) { if (row[1].indexOf('每日登录') >= 0) { const cells: string[] = [] const cellRe = /<td[^>]*>([\s\S]*?)<\/td>/gi let ...
https://github.com/honjow/Next2V
cb0ddab15fcce9232f4dc42fae51b299494ab58b
github
LongLiveY96/chatcube
entry/src/main/ets/services/DatabaseService.ets
arkts
getMessages
获取会话的所有消息
async getMessages(sessionId: string): Promise<ChatMessage[]> { await this.waitForInitialization() if (this.rdbStore === null) { return [] } const predicates = new relationalStore.RdbPredicates(TableNames.MESSAGES) predicates.equalTo('session_id', sessionId) predicates.orderByAsc('timesta...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getMessages AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sessionId AST#identifier#Right AST#type_annotation#Left AST#:#Left ...
async getMessages(sessionId: string): Promise<ChatMessage[]> { await this.waitForInitialization() if (this.rdbStore === null) { return [] } const predicates = new relationalStore.RdbPredicates(TableNames.MESSAGES) predicates.equalTo('session_id', sessionId) predicates.orderByAsc('timesta...
https://github.com/LongLiveY96/chatcube
db6c489dbb2cfd88603eb88cd4798f60b9e098f4
github
zcg741/chengyu-game
entry/src/main/ets/viewmodel/GameViewModel.ets
arkts
handleWrongAnswer
处理错误答案
private async handleWrongAnswer(): Promise<void> { this.session.wrongCount++; this.session.consecutiveCorrect = 0; // 记录答题结果(用于动态难度调整) this.recentResults.push(false); if (this.recentResults.length > this.RECENT_RESULTS_MAX) { this.recentResults.shift(); } // 闯关模式下扣除生命值 if (this...
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 handleWrongAnswer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right...
private async handleWrongAnswer(): Promise<void> { this.session.wrongCount++; this.session.consecutiveCorrect = 0; // 记录答题结果(用于动态难度调整) this.recentResults.push(false); if (this.recentResults.length > this.RECENT_RESULTS_MAX) { this.recentResults.shift(); } // 闯关模式下扣除生命值 if (this...
https://github.com/zcg741/chengyu-game
9dab408980659d70df2b349304722feba640ce3e
github
HarmonyOS_Samples/MusicHome
features/player/src/main/ets/view/LrcView.ets
arkts
build
Canvas host wired to size changes for layout and touch forwarding.
build() { Canvas(this.context) .onAreaChange((oldArea: Area, newArea: Area) => { this.viewWidth = Number.parseFloat(newArea.width.toString()); this.viewHeight = Number.parseFloat(newArea.height.toString()); if (oldArea.width.toString() !== newArea.width.toString()) { this.c...
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() { Canvas(this.context) .onAreaChange((oldArea: Area, newArea: Area) => { this.viewWidth = Number.parseFloat(newArea.width.toString()); this.viewHeight = Number.parseFloat(newArea.height.toString()); if (oldArea.width.toString() !== newArea.width.toString()) { this.c...
https://gitcode.com/HarmonyOS_Samples/MusicHome
32d42a50a89f23f2c54ce898bb2fb8d654e26c6c
gitcode
CLMC2025/Vignette
entry/src/main/ets/sync/VersionControl.ets
arkts
hasConflict
检查版本冲突
hasConflict(otherVersion: VersionInfo): boolean { return this.currentVersion.version !== otherVersion.version && this.currentVersion.timestamp !== otherVersion.timestamp; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasConflict AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left otherVersion AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left VersionInfo AST#identifier#Right AST#ERROR#Right AST...
hasConflict(otherVersion: VersionInfo): boolean { return this.currentVersion.version !== otherVersion.version && this.currentVersion.timestamp !== otherVersion.timestamp; }
https://github.com/CLMC2025/Vignette
31856ab6d9a5e69ad3ca9b1763808c7e30fd16e3
github