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
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/ComputerManager.ets
arkts
reconcileUuid
UUID 归一:当轮询/验证返回的真实 UUID 与条目的临时 UUID 不同时 合并到已有真实条目,或重新映射 UUID @returns 应继续更新的目标条目(可能是合并后的已有条目)
private reconcileUuid(computer: ComputerInfo, realUuid: string): ComputerInfo { const existingReal = this.computers.get(realUuid); // 临时 UUID 上可能已累积了轮询失败计数(如 mDNS 后 verifyOrPollComputer 首次失败), // 需要随 UUID 一起迁移,避免独立计数孤在旧 UUID 上、新 UUID 从 0 重新起算 const carriedCount = this.offlineCount.get(computer.uuid); ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left reconcileUuid AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left computer AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#...
private reconcileUuid(computer: ComputerInfo, realUuid: string): ComputerInfo { const existingReal = this.computers.get(realUuid); // 临时 UUID 上可能已累积了轮询失败计数(如 mDNS 后 verifyOrPollComputer 首次失败), // 需要随 UUID 一起迁移,避免独立计数孤在旧 UUID 上、新 UUID 从 0 重新起算 const carriedCount = this.offlineCount.get(computer.uuid); ...
https://github.com/AlkaidLab/moonlight-harmony
b724f558d848e16ca5d4fef170f3f5dc7238dbfe
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.collections.ets
arkts
setBitsByRange
Sets a range of bits in a bit vector to a particular element. @param { int } element - Element to be set (0 means 0, else means 1). @param { int } fromIndex - The starting position of the index, containing the value at that index position. @param { int } toIndex - The end of the index, excluding the value at that index...
public setBitsByRange(element: int, fromIndex: int, toIndex: int): void { this.checkRange(fromIndex, toIndex); let fromElem = this.computeElementIdAndBitId(fromIndex); let toElem = this.computeElementIdAndBitId(toIndex); if (fromElem.elementId === toElem.elemen...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setBitsByRange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left element AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identi...
public setBitsByRange(element: int, fromIndex: int, toIndex: int): void { this.checkRange(fromIndex, toIndex); let fromElem = this.computeElementIdAndBitId(fromIndex); let toElem = this.computeElementIdAndBitId(toIndex); if (fromElem.elementId === toElem.elemen...
https://gitcode.com/iop123123/arkts-static-skills
d26e265b3dd539487569de734caadcc3d80accb0
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelDataManager.ets
arkts
getBookGroups
==================== 书架管理 ==================== 获取所有书架分组
async getBookGroups(): Promise<string[]> { const store = this.getStore(); const rs = await store.querySql( 'SELECT DISTINCT groupName FROM novel_book WHERE isFavorite = 1 AND groupName != "" ORDER BY groupName' ); const groups: string[] = []; if (rs.goToFirstRow()) { do { group...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getBookGroups 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 getBookGroups(): Promise<string[]> { const store = this.getStore(); const rs = await store.querySql( 'SELECT DISTINCT groupName FROM novel_book WHERE isFavorite = 1 AND groupName != "" ORDER BY groupName' ); const groups: string[] = []; if (rs.goToFirstRow()) { do { group...
https://github.com/DaLongZhuaZi/manxia
eea10341a1257cfcd1060886f7fa523067bb935f
github
LJ666-ui/harmony-health-care
entry/src/main/ets/aiagent/MultiAgentOrchestrator.ets
arkts
registerAgents
批量注册智能体 @param agents 智能体列表
registerAgents(agents: MedicalAgent[]): void { for (const agent of agents) { this.registerAgent(agent); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left registerAgents AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left agents AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left MedicalAg...
registerAgents(agents: MedicalAgent[]): void { for (const agent of agents) { this.registerAgent(agent); } }
https://github.com/LJ666-ui/harmony-health-care
797b340ed41b2fe77680004da6dfbaa418a6d653
github
CLMC2025/Vignette
entry/src/main/ets/utils/WordDetailCache.ets
arkts
isCacheFresh
检查缓存数据是否比数据库数据更新 @param wordId 单词ID @param dbUpdatedAt 数据库中的更新时间 @returns true 如果缓存数据更新或相等
isCacheFresh(wordId: number, dbUpdatedAt: number): boolean { const index = this.keys.indexOf(wordId); if (index < 0) { return false; } const entry = this.values[index]; return entry.word.updatedAt >= dbUpdatedAt; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isCacheFresh AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left wordId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left , ...
isCacheFresh(wordId: number, dbUpdatedAt: number): boolean { const index = this.keys.indexOf(wordId); if (index < 0) { return false; } const entry = this.values[index]; return entry.word.updatedAt >= dbUpdatedAt; }
https://github.com/CLMC2025/Vignette
0c871f73417e73853a813f698f288e015283a7cd
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/MangaSourceEngine.ets
arkts
getParsedConfig
[优化] 获取解析后的 rawConfigJson,带缓存
private getParsedConfig(): Record<string, Object> | null { if (this.parsedConfigCache) { return this.parsedConfigCache; } if (!this.rawConfigJson) { return null; } try { this.parsedConfigCache = SafeUtils.parseObj(this.rawConfigJson) as Record<string, Object>; return this.p...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getParsedConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#L...
private getParsedConfig(): Record<string, Object> | null { if (this.parsedConfigCache) { return this.parsedConfigCache; } if (!this.rawConfigJson) { return null; } try { this.parsedConfigCache = SafeUtils.parseObj(this.rawConfigJson) as Record<string, Object>; return this.p...
https://github.com/DaLongZhuaZi/manxia
12c9f630191e0fa75351087980e0cfda71dca03e
github
openharmony/arkui_ace_engine
advanced_ui_component/treeview/source/treeview.ets
arkts
createCollapseImageNodeByType
create collapse image node by type @param type collapse image type @returns collapse image node
public createCollapseImageNodeByType(type: CollapseImageType): CollapseImageNode { let imageSource: Resource; switch (type) { case CollapseImageType.ARROW_RIGHT_WHITE: imageSource = ARROW_RIGHT_WITHE; break; case CollapseImageType.ARROW_RIGHT: imageSource = ARROW_RIGHT; ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left createCollapseImageNodeByType 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#id...
public createCollapseImageNodeByType(type: CollapseImageType): CollapseImageNode { let imageSource: Resource; switch (type) { case CollapseImageType.ARROW_RIGHT_WHITE: imageSource = ARROW_RIGHT_WITHE; break; case CollapseImageType.ARROW_RIGHT: imageSource = ARROW_RIGHT; ...
https://gitee.com/openharmony/arkui_ace_engine.git
0a78319a7212c749447de1b98e31f8a38107f5fb
gitee
youyeyejie/ZhiXing_ActHub
entry/src/main/ets/core/services/FocusTimerEngine.ets
arkts
saveFocusRecord
落库保存专注记录
private async saveFocusRecord(duration: number): Promise<void> { if (duration <= 0) return; try { const todoId = this.todoId; const now = Date.now(); const focus = new Focus(); focus.todoId = todoId > 0 ? todoId : 0; focus.duration = duration; focus.startTime = now - (durat...
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 saveFocusRecord AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left duration AST#identifier#Right AST#ERROR#Left AST#:#L...
private async saveFocusRecord(duration: number): Promise<void> { if (duration <= 0) return; try { const todoId = this.todoId; const now = Date.now(); const focus = new Focus(); focus.todoId = todoId > 0 ? todoId : 0; focus.duration = duration; focus.startTime = now - (durat...
https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/core/services/FocusTimerEngine.ets#L222-L238
0b5df64e80bfd403400c0c83f1b1c760bedfcff8
github
openharmony/applications_calendar_data
datamanager/src/main/ets/processor/instances/InstanceExpandHelper.ets
arkts
generateInstancesMapFromValues
根据日程信息,生成待插入的Instances列表数据 如果是重复日程,则列表中含多个Instances数据 如果不是重复日程,则列表中只含一个Instances数据 @param resultSet db.query结果集
function generateInstancesMapFromValues(resultSet: data_rdb.ResultSet) { const moveToFirstSuccessful: boolean = resultSet.goToFirstRow(); if (!moveToFirstSuccessful) { Log.error(TAG, "generateInstancesMapFromValues move to first failed"); return; } const instancesMap: InstancesMap = new InstancesMap(); ...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left generateInstancesMapFromValues AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left resultSet AST#identifier#Right AST#type_annotation#Left...
function generateInstancesMapFromValues(resultSet: data_rdb.ResultSet) { const moveToFirstSuccessful: boolean = resultSet.goToFirstRow(); if (!moveToFirstSuccessful) { Log.error(TAG, "generateInstancesMapFromValues move to first failed"); return; } const instancesMap: InstancesMap = new InstancesMap(); ...
https://gitee.com/openharmony/applications_calendar_data.git
5f6003ae0270e39a67b02aafaa6db3702989bc2e
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Animation/AnimationSettingsManager.ets
arkts
setBookOpenAnimationEnabled
设置书籍打开动画开关
public async setBookOpenAnimationEnabled(enabled: boolean): Promise<void> { if (this.currentSettings.bookOpenEnabled === enabled) { return; } this.currentSettings.bookOpenEnabled = enabled; await this.settingsManager.setBoolean(SettingKeys.ANIMATION_BOOK_OPEN_ENABLED, enabled); this.notifyL...
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 setBookOpenAnimationEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enabled AST#identifier#Right...
public async setBookOpenAnimationEnabled(enabled: boolean): Promise<void> { if (this.currentSettings.bookOpenEnabled === enabled) { return; } this.currentSettings.bookOpenEnabled = enabled; await this.settingsManager.setBoolean(SettingKeys.ANIMATION_BOOK_OPEN_ENABLED, enabled); this.notifyL...
https://github.com/DaLongZhuaZi/manxia
3ab839f52516bbee7347dbc86aa31abfc32ef1c3
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/BarLineChartBaseModel.ets
arkts
setAutoScaleMinMaxEnabled
Flag that indicates if auto scaling on the y axis is enabled. This is especially interesting for charts displaying financial data. @param enabled the y axis automatically adjusts to the min and max y values of the current x axis range whenever the viewport changes
public setAutoScaleMinMaxEnabled(enabled: boolean): void { this.mAutoScaleMinMaxEnabled = enabled; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setAutoScaleMinMaxEnabled 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#ide...
public setAutoScaleMinMaxEnabled(enabled: boolean): void { this.mAutoScaleMinMaxEnabled = enabled; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
832ce99ab83e17451f43114a0fca18e0561f9815
gitee
codelably/HCompass
core/network/src/main/ets/AxiosHttpClient.ets
arkts
updateConfig
更新配置 @param config 新配置
updateConfig(config: Partial<NetworkConfig>): void { this.config = ObjectAssign({} as NetworkConfig, this.config, config); // 更新 Axios 实例配置 if (config.baseUrl !== undefined) { this.axiosInstance.defaults.baseURL = config.baseUrl; } if (config.timeout !== undefined) { this.axiosInstance...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateConfig 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#instantiation_expression#Left AST#identifier#Left Partial...
updateConfig(config: Partial<NetworkConfig>): void { this.config = ObjectAssign({} as NetworkConfig, this.config, config); // 更新 Axios 实例配置 if (config.baseUrl !== undefined) { this.axiosInstance.defaults.baseURL = config.baseUrl; } if (config.timeout !== undefined) { this.axiosInstance...
https://github.com/codelably/HCompass
dde3da95d534e361a1f9216b020d0f9ad293db79
github
HarmonyOS_Samples/MusicHome
features/player/src/main/ets/util/ColorConversion.ets
arkts
dealColor
Maps input RGB to a tuned RGB triple for UI background tinting. @param rRGB Red channel 0–255. @param gRGB Green channel 0–255. @param bRGB Blue channel 0–255. @returns Tuple [r, g, b] each 0–255 after processing.
public static dealColor(rRGB: number, gRGB: number, bRGB: number ) { let max = Math.max(Math.max(rRGB, gRGB), bRGB); let min = Math.min(Math.min(rRGB, gRGB), bRGB); if (max - min < 1e-3) { const v = Math.max(0, Math.min(255, Math.floor(max))); return [v, v, v]; } let sHSB = max ==...
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 dealColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left rRGB AST#identifier#Right AST#:#Left : AST#:#...
public static dealColor(rRGB: number, gRGB: number, bRGB: number ) { let max = Math.max(Math.max(rRGB, gRGB), bRGB); let min = Math.min(Math.min(rRGB, gRGB), bRGB); if (max - min < 1e-3) { const v = Math.max(0, Math.min(255, Math.floor(max))); return [v, v, v]; } let sHSB = max ==...
https://gitcode.com/HarmonyOS_Samples/MusicHome
b558d3288058a0ad2142d23492344c42074eaaf1
gitcode
Countly/countly-sdk-hos
library/src/main/ets/internal/Utils.ets
arkts
mergeMaps
Shallow merge, b overrides a.
public static mergeMaps(a: SegmentationMap, b: SegmentationMap): SegmentationMap { const out: SegmentationMap = {}; const aKeys: string[] = Object.keys(a); for (let i = 0; i < aKeys.length; i++) out[aKeys[i]] = a[aKeys[i]]; const bKeys: string[] = Object.keys(b); for (let i = 0; i < bKeys.length; ...
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 mergeMaps AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left a AST#identifier#Right AST#:#Left : AST#:#Rig...
public static mergeMaps(a: SegmentationMap, b: SegmentationMap): SegmentationMap { const out: SegmentationMap = {}; const aKeys: string[] = Object.keys(a); for (let i = 0; i < aKeys.length; i++) out[aKeys[i]] = a[aKeys[i]]; const bKeys: string[] = Object.keys(b); for (let i = 0; i < bKeys.length; ...
https://github.com/Countly/countly-sdk-hos
5b49adbfad66c14cf3dccf0e6f9de2f3cbc03120
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Promise.ets
arkts
resolve
Create a resolved promise @param value value to resolve promise with @returns { Promise } resolved promise
static resolve<U>(value: PromiseLike<U>|U): Promise<Awaited<U>> { if (value instanceof Promise) { return value as Promise<Awaited<U>>; } let p = new Promise<Awaited<U>>(); p.doResolve(value); return p; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#binary_expression#Left AST#identifier#Left resolve AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left U AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right...
static resolve<U>(value: PromiseLike<U>|U): Promise<Awaited<U>> { if (value instanceof Promise) { return value as Promise<Awaited<U>>; } let p = new Promise<Awaited<U>>(); p.doResolve(value); return p; }
https://gitcode.com/iop123123/arkts-static-skills
21c979aa3bb66458c39b843d34a6b00f9cc2840f
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Debug/ConsolePanel.ets
arkts
getEntityNames
--- 数据获取方法 (新的数据源) ---
public getEntityNames(): string[] { // 移除对Game目录的依赖,返回空数组 return []; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getEntityNames 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 string ...
public getEntityNames(): string[] { // 移除对Game目录的依赖,返回空数组 return []; }
https://github.com/DaLongZhuaZi/manxia
49ff9bcad74c498941e2aea2e9ed6660f0e3b24d
github
751496032/ZRouter
RouterApi/src/main/ets/interceptions/InterceptorMgr.ets
arkts
runAsync
@deprecated @param stackName @param context @param isPush @param callback @returns
public async runAsync(stackName: string, context: InterceptorInfo, isPush: boolean = false, callback?: (it: IGlobalNavigateInterceptor) => void) { return Promise.resolve(this.run(stackName, context, isPush, callback)) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#identifier#Left runAsync AST#identifier#Right AST#(#Left ( AST#(#Right AST#identifier#Left stackName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#R...
public async runAsync(stackName: string, context: InterceptorInfo, isPush: boolean = false, callback?: (it: IGlobalNavigateInterceptor) => void) { return Promise.resolve(this.run(stackName, context, isPush, callback)) }
https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/interceptions/InterceptorMgr.ets#L106-L109
fbff16176237267c1fd6e645af529cac30a9ef09
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoUrlAnalyzer.ets
arkts
replaceKeyPageJsAsync
替换 {{...}} 内嵌JS/变量(异步版本)
private async replaceKeyPageJsAsync(ruleUrl: string): Promise<string> { let normalizedRuleUrl = this.replaceGetTokens(ruleUrl); if (!normalizedRuleUrl.includes('{{') || !normalizedRuleUrl.includes('}}')) { return normalizedRuleUrl; } return await this.innerRuleAsync(normalizedRuleUrl, '{{', '}}...
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 replaceKeyPageJsAsync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left ruleUrl AST#identifier#Right AST#ERROR#Left AS...
private async replaceKeyPageJsAsync(ruleUrl: string): Promise<string> { let normalizedRuleUrl = this.replaceGetTokens(ruleUrl); if (!normalizedRuleUrl.includes('{{') || !normalizedRuleUrl.includes('}}')) { return normalizedRuleUrl; } return await this.innerRuleAsync(normalizedRuleUrl, '{{', '}}...
https://github.com/DaLongZhuaZi/manxia
8292f71e998d8176281105edeb26756f77725639
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/input/DeviceSensorService.ets
arkts
hasGyroscope
检测设备是否有陀螺仪传感器
hasGyroscope(): boolean { this.checkAvailability(); return this.gyroAvailable; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasGyroscope AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statem...
hasGyroscope(): boolean { this.checkAvailability(); return this.gyroAvailable; }
https://github.com/AlkaidLab/moonlight-harmony
60e5f4f6020d3ca691b0141b0df7694433f49271
github
OHPG/FinMusic
entry/src/main/ets/data/Repository.ets
arkts
getPlayList
获取播放列表 @returns
public async getPlayList(): Promise<Array<BaseItemDto> | undefined> { let id = await this.getPlaylistIdInternal() if (!id) { return undefined } return this.requireApi().getPlayList(id) }
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 getPlayList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Le...
public async getPlayList(): Promise<Array<BaseItemDto> | undefined> { let id = await this.getPlaylistIdInternal() if (!id) { return undefined } return this.requireApi().getPlayList(id) }
https://github.com/OHPG/FinMusic
0e22b83f42207ea2336f0f73250a6fec7d51c45e
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/SmartCategoryDAO.ets
arkts
toggleActive
激活/禁用规则
static async toggleActive(ruleId: number, isActive: boolean): Promise<boolean> { try { const store = DatabaseManager.getDatabase(); const values: relationalStore.ValuesBucket = { is_active: isActive ? 1 : 0, updated_at: new Date().toISOString() }; const predicates = new re...
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 toggleActive AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ruleId AST#identifier#Right AST#:#Left : AS...
static async toggleActive(ruleId: number, isActive: boolean): Promise<boolean> { try { const store = DatabaseManager.getDatabase(); const values: relationalStore.ValuesBucket = { is_active: isActive ? 1 : 0, updated_at: new Date().toISOString() }; const predicates = new re...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
c4a45c2969a743d22326fca64df66dfd0f7a6ea3
github
offlinecat-dev/OCNetORM
src/main/ets/logging/Logger.ets
arkts
getLogHistory
获取日志历史(用于测试) @returns 日志历史数组
getLogHistory(): Array<string> { return [...this.logHistory] }
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getLogHistory 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#:#Lef...
getLogHistory(): Array<string> { return [...this.logHistory] }
https://github.com/offlinecat-dev/OCNetORM
a72d7c3ad3b804d86f79aaab4fb383d250987949
github
picklerick422/zju-learning-assistant-OH
entry/src/main/ets/services/PermissionService.ets
arkts
isGranted
校验某权限当前是否已授予。
static async isGranted(permission: Permissions): Promise<boolean> { const atManager = abilityAccessCtrl.createAtManager(); try { const info = await bundleManager.getBundleInfoForSelf( bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION); const tokenId = info.appInfo.accessTokenId; ...
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 isGranted AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left permission AST#identifier#Right AST#:#Left : A...
static async isGranted(permission: Permissions): Promise<boolean> { const atManager = abilityAccessCtrl.createAtManager(); try { const info = await bundleManager.getBundleInfoForSelf( bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION); const tokenId = info.appInfo.accessTokenId; ...
https://github.com/picklerick422/zju-learning-assistant-OH
98696ea2c69d7583280abd4c4787699b859fee9d
github
openharmony/applications_app_samples
code/BasicFeature/Media/Image/photomodify/src/main/ets/components/feature/ComputeFeature.ets
arkts
onDrag
拖拽三个边角 @param dx @param dy @param callback
onDrag(dx: number, dy: number, callback: (w: number, h: number, scale: number, fontSize: number) => void): void { let width: number = 0; let height: number = 0; switch (this.currentType) { case NodeType.RIGHT_TOP: width = this.dragStartWidth + 2 * dx; break; case NodeType.LEFT_...
AST#program#Left AST#ERROR#Left AST#identifier#Left onDrag AST#identifier#Right AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dx AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left , AST#,#Right AST#ERROR#Left AST#identifier#Left dy AST#...
onDrag(dx: number, dy: number, callback: (w: number, h: number, scale: number, fontSize: number) => void): void { let width: number = 0; let height: number = 0; switch (this.currentType) { case NodeType.RIGHT_TOP: width = this.dragStartWidth + 2 * dx; break; case NodeType.LEFT_...
https://github.com/openharmony/applications_app_samples
c44c2f6f33dd6afedc8d680e9c5bafbe6f6cc1e8
github
HarmonyOS_Samples/BestPracticeSnippets
TaskPoolPractice/entry/src/main/ets/pages/sample6/Sample6.ets
arkts
returnModule
[Start return_1] Sample6.ets
@Concurrent async function returnModule() { let module = await import('./a'); return module; }
AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Concurrent AST#identifier#Right AST#decorator#Right AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left returnModule AST#identifier#Right AST#formal_parameter...
@Concurrent async function returnModule() { let module = await import('./a'); return module; }
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
cc347e35253c5f494a2b43f5e5d5ed8cbcead805
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
fill
Fills the Int8Array with specified value @param { byte } value - new value @param { int } [start] - start index to begin fill from @param { int } [end] - last index to end fill from, excluded @returns { this } - modified Int8Array @syscap SystemCapability.Utils.Lang @FaAndStageModel
public fill(value: byte, start?: int, end?: int): this { const k = normalizeIndex(start ?? 0, this.lengthInt) const finalPos = normalizeIndex(end ?? this.lengthInt, this.lengthInt) this.fillInternal(value, k, finalPos) return this }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left fill AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ide...
public fill(value: byte, start?: int, end?: int): this { const k = normalizeIndex(start ?? 0, this.lengthInt) const finalPos = normalizeIndex(end ?? this.lengthInt, this.lengthInt) this.fillInternal(value, k, finalPos) return this }
https://gitcode.com/iop123123/arkts-static-skills
0870dd825cf7147d1dc2e2cf9ab9f207ce253ae2
gitcode
LJ666-ui/harmony-health-care
entry/src/main/ets/core/PermissionManager.ets
arkts
canControlDevice
检查是否可以控制设备
public canControlDevice(deviceId: string, deviceType: DeviceType, roomId: string): boolean { if (!this.currentUser) { console.warn('PermissionManager: No current user'); return false; } const role = this.currentUser.role; // 护士长可以控制所有设备 if (role === UserRole.HEAD_NURSE) { retur...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left canControlDevice AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left deviceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#stri...
public canControlDevice(deviceId: string, deviceType: DeviceType, roomId: string): boolean { if (!this.currentUser) { console.warn('PermissionManager: No current user'); return false; } const role = this.currentUser.role; // 护士长可以控制所有设备 if (role === UserRole.HEAD_NURSE) { retur...
https://github.com/LJ666-ui/harmony-health-care
fba98cbf276a995a4a029d9ab9dc8a3b03c17aff
github
HarmonyOS_Samples/component-collection
entry/src/main/ets/pages/animations/TransitionAnimations/floatingSample/FloatingWindowSample.ets
arkts
aboutToAppear
Touch end time
aboutToAppear() { display.getAllDisplays((err, data) => { // Get half of the screen width and height as the reference value this.displayHalfWidth = data[0].width / 2; this.displayHalfHeight = data[0].height / 2; // Convert the obtained px to vp Logger.info(TAG, `aboutToAppear getAllD...
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() { display.getAllDisplays((err, data) => { // Get half of the screen width and height as the reference value this.displayHalfWidth = data[0].width / 2; this.displayHalfHeight = data[0].height / 2; // Convert the obtained px to vp Logger.info(TAG, `aboutToAppear getAllD...
https://gitcode.com/HarmonyOS_Samples/component-collection
3e9bf4b2123e0a4ff7280388483d73cbefec4b96
gitcode
suibianqwe/Ehviewer_OHOS
entry/src/main/ets/shared/ListDataSource.ets
arkts
appendAndNotify
末尾追加单条并精确通知,避免 notifyReload 触发全量重建
appendAndNotify(item: T): void { this.items.push(item); const index = this.items.length - 1; for (let i = 0; i < this.listeners.length; i++) { this.listeners[i].onDataAdd(index); } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left appendAndNotify AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left item AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#Right AST#ERROR#Right AST#)#Left ) AST#...
appendAndNotify(item: T): void { this.items.push(item); const index = this.items.length - 1; for (let i = 0; i < this.listeners.length; i++) { this.listeners[i].onDataAdd(index); } }
https://github.com/suibianqwe/Ehviewer_OHOS
4c5d24396f3a4869ace19dbaa84c1527ea58b1cf
github
LJ666-ui/harmony-health-care
entry/src/main/ets/utils/AccessibilityUtils.ets
arkts
rgbToHex
RGB转HEX颜色 @param rgb RGB对象 @returns HEX颜色(如 #FFFFFF)
public static rgbToHex(rgb: RGB): string { const r = Math.round(rgb.r).toString(16).padStart(2, '0'); const g = Math.round(rgb.g).toString(16).padStart(2, '0'); const b = Math.round(rgb.b).toString(16).padStart(2, '0'); return `#${r}${g}${b}`.toUpperCase(); }
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 rgbToHex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left rgb AST#identifier#Right AST#:#Left : AST#:#Ri...
public static rgbToHex(rgb: RGB): string { const r = Math.round(rgb.r).toString(16).padStart(2, '0'); const g = Math.round(rgb.g).toString(16).padStart(2, '0'); const b = Math.round(rgb.b).toString(16).padStart(2, '0'); return `#${r}${g}${b}`.toUpperCase(); }
https://github.com/LJ666-ui/harmony-health-care
db2e7fd405a2d0ea20a7539aa121bf36cad99dc8
github
XHXYT/Pixark
entry/src/main/ets/common/utils/database/impl/IllustHistoryDao.ets
arkts
queryByPid
根据插画PID查询历史记录 @param pid 插画ID @returns 查找到的历史记录数组
async queryByPid(pid: string): Promise<IllustHistoryInfo[]> { logger.debug('queryByPid pid = ' + pid) return this.query(this.getPredicates().equalTo('pid', pid)) }
AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left queryByPid AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left pid AST#identifier#Right AST#type_annotation#Left AST#:#Lef...
async queryByPid(pid: string): Promise<IllustHistoryInfo[]> { logger.debug('queryByPid pid = ' + pid) return this.query(this.getPredicates().equalTo('pid', pid)) }
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/common/utils/database/impl/IllustHistoryDao.ets#L78-L81
ca38934f68b1a81d9c928aec881810fd4b03dfbe
github
fangmingtao/Ohs_ArkTs_Eyepetizer
entry/src/main/ets/datasource/BasicDataSource.ets
arkts
totalCount
返回数据源的长度
totalCount(): number { return this.dataSource == null ? 0 : this.dataSource.length; }
AST#program#Left AST#ERROR#Left 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#number#Right AST#ERROR#Right AST#statement_b...
totalCount(): number { return this.dataSource == null ? 0 : this.dataSource.length; }
https://gitcode.com/fangmingtao/Ohs_ArkTs_Eyepetizer
28a0c10c6a7a97ae44656cf828c13ff78c730913
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/BigInt.ets
arkts
constructor
Creates a new `BigInt` instance from internal components. @param { ValueArray<int> } v The array of digits. @param { int } sign The sign of the number. @syscap SystemCapability.Utils.Lang @FaAndStageModel
constructor(v: ValueArray<int>, sign: int) { this.bytes = BigInt.stripLeadingZeros(v) this.sign = this.bytes.length == 0 ? 0 : sign }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left v AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identifier#Lef...
constructor(v: ValueArray<int>, sign: int) { this.bytes = BigInt.stripLeadingZeros(v) this.sign = this.bytes.length == 0 ? 0 : sign }
https://gitcode.com/iop123123/arkts-static-skills
1cc1b17670af5d65343007d86cc951c576174b92
gitcode
YDYm233/EasyRandom_HarmonyNextApp
common/SystemUtils/src/main/ets/utils/VibratorManager.ets
arkts
setEnabled
设置应用内振动开关状态 同步写入 AppStorage(立即生效)并持久化到 Preferences @param enabled true 开启振动,false 关闭振动
static setEnabled(enabled: boolean): void { AppStorage.setOrCreate(STORAGE_KEY_VIBRATION, enabled) hilog.info(DOMAIN, TAG, `setEnabled: ${enabled}`) }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setEnabled 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#identifier#Left bo...
static setEnabled(enabled: boolean): void { AppStorage.setOrCreate(STORAGE_KEY_VIBRATION, enabled) hilog.info(DOMAIN, TAG, `setEnabled: ${enabled}`) }
https://github.com/YDYm233/EasyRandom_HarmonyNextApp
c54f144bf2ba9b3db8f2d00dc2ad29838a242054
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/model/AnomalyDetection.ets
arkts
calculatePercentile
计算百分位数
static calculatePercentile(value: number, mean: number, stdDev: number): number { if (stdDev === 0) { return 50; } const zScore = (value - mean) / stdDev; const t = 1 / (1 + 0.2316419 * Math.abs(zScore)); const d = 0.3989423 * Math.exp(-zScore * zScore / 2); const p = d * t * (0.3193815 ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left calculatePercentile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#...
static calculatePercentile(value: number, mean: number, stdDev: number): number { if (stdDev === 0) { return 50; } const zScore = (value - mean) / stdDev; const t = 1 / (1 + 0.2316419 * Math.abs(zScore)); const d = 0.3989423 * Math.exp(-zScore * zScore / 2); const p = d * t * (0.3193815 ...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
a43f9ac9197eb9b94a2902037091aefc89fa7fa4
github
AetheriumSimulator/qemu-hmos
entry/src/main/ets/entryability/EntryAbility.ets
arkts
onCreate
默认 density
onCreate(want: Want, launchParam: object): void { hilog.info(0x0000, 'EntryAbility', 'onCreate'); // 初始化 AppStorage 存储窗口状态 AppStorage.setOrCreate<boolean>('showCustomTitleBar', true); AppStorage.setOrCreate<number>('safeAreaTop', 0); AppStorage.setOrCreate<string>('windowMode', 'unknown'); ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onCreate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Want AST#identifier#Right AST#,#Left , AST#,#Ri...
onCreate(want: Want, launchParam: object): void { hilog.info(0x0000, 'EntryAbility', 'onCreate'); // 初始化 AppStorage 存储窗口状态 AppStorage.setOrCreate<boolean>('showCustomTitleBar', true); AppStorage.setOrCreate<number>('safeAreaTop', 0); AppStorage.setOrCreate<string>('windowMode', 'unknown'); ...
https://github.com/AetheriumSimulator/qemu-hmos
7a346e3d29eff23e55f4b54e4b0aa0a8db2e9124
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.LinkedList.ets
arkts
set
Replaces the element at the specified index with a new element. @param index The index of the element to replace. @param element The new element. @returns The replaced element, or undefined if the index is out of range.
public set(index: int, element: T): T { this.checkIndexType(index); this.checkEmptyContainer(); this.checkIndex(index, this.length - 1); let currentNode: ListNode<T> | undefined = this.getNode(index); currentNode!.element = element; return element; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left index AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#iden...
public set(index: int, element: T): T { this.checkIndexType(index); this.checkEmptyContainer(); this.checkIndex(index, this.length - 1); let currentNode: ListNode<T> | undefined = this.getNode(index); currentNode!.element = element; return element; }
https://gitcode.com/iop123123/arkts-static-skills
a4fda8e388e5727f4566708e9c9ecc40cb8b90d6
gitcode
midori52000/ArkPilot
Agent/entry/src/main/ets/skills/SkillsBackendService.ets
arkts
checkUpdates
================================================================ 更新检测 ================================================================
async checkUpdates(): Promise<SkillUpdateInfo[]> { const installed = (await this.getInstalled()) .filter((s: InstalledSkill): boolean => s.source === 'github' && s.repoOwner.length > 0 && s.repoName.length > 0); const updates: SkillUpdateInfo[] = []; const groups = new Map<string, InstalledSkill[]...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left checkUpdates AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic...
async checkUpdates(): Promise<SkillUpdateInfo[]> { const installed = (await this.getInstalled()) .filter((s: InstalledSkill): boolean => s.source === 'github' && s.repoOwner.length > 0 && s.repoName.length > 0); const updates: SkillUpdateInfo[] = []; const groups = new Map<string, InstalledSkill[]...
https://github.com/midori52000/ArkPilot
67d619b0e1fab3c2df38cfcc1cc8d789996fef10
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
some
/ === with element lambda functions === Checks that at least one element of Uint16Array satisfies the passed function @param fn check function @returns true if some element satisfies fn
public some(fn: (element: number, index: int, array: Uint16Array) => boolean): boolean { for (let i = 0; i < this.length; ++i) { if (fn(this.at(i), i, this)) { return true } } return false }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left some AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Righ...
public some(fn: (element: number, index: int, array: Uint16Array) => boolean): boolean { for (let i = 0; i < this.length; ++i) { if (fn(this.at(i), i, this)) { return true } } return false }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
217550cdc0fb2551a0a64e0bd5a9224e7f362f3a
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Data/BookshelfCategoryManager.ets
arkts
moveItemToCategory
将内容移动到分类
async moveItemToCategory(itemId: string, contentType: ContentType, categoryId: string): Promise<void> { const key = `${contentType}_${itemId}`; const existingItem = this.itemCategoryMap.get(key); if (existingItem) { existingItem.categoryId = categoryId; } else { const newItem: Categor...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left moveItemToCategory AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left itemId AST#identifier#Right AST#type_annotation#Left AST#:#L...
async moveItemToCategory(itemId: string, contentType: ContentType, categoryId: string): Promise<void> { const key = `${contentType}_${itemId}`; const existingItem = this.itemCategoryMap.get(key); if (existingItem) { existingItem.categoryId = categoryId; } else { const newItem: Categor...
https://github.com/DaLongZhuaZi/manxia
bca140b34cfe2bc8b11b054e18bbbe84665e03d7
github
YDYm233/EasyRandom_HarmonyNextApp
product/default/src/main/ets/sub_pages/metronome/MetronomePage.ets
arkts
aboutToDisappear
组件销毁时清理定时器
aboutToDisappear(): void { this.stopMetronome() }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToDisappear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_b...
aboutToDisappear(): void { this.stopMetronome() }
https://github.com/YDYm233/EasyRandom_HarmonyNextApp
4fdce71c1b5081b22162c9936d6c8716362c88e0
github
bluedeer000/HarmonyCalendar
entry/src/main/ets/services/CalDavSourceAdapter.ets
arkts
createSourceCollection
-------- 日历集合管理 --------
async createSourceCollection( account: CalendarAccount, homeSetUrl: string, name: string, color: string ): Promise<DiscoveredSource> { const client = buildDavClient(account); const remote: DiscoveredCalendarSource = await client.createCalendarCollection(homeSetUrl, name, color); return t...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left createSourceCollection AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left account AST#identifier#Right AST#type_annotation#Left AS...
async createSourceCollection( account: CalendarAccount, homeSetUrl: string, name: string, color: string ): Promise<DiscoveredSource> { const client = buildDavClient(account); const remote: DiscoveredCalendarSource = await client.createCalendarCollection(homeSetUrl, name, color); return t...
https://github.com/bluedeer000/HarmonyCalendar
646f051631dc8948e6fe8d7f5fa4c4e8aceb0acc
github
dingzhilin1990/zhilinclaw
src/security/SecurityFilter.ets
arkts
maskSensitiveData
脱敏敏感数据
private maskSensitiveData(text: string): string { let masked = text; // 脱敏邮箱地址 masked = masked.replace(/\b[\w.-]+@[\w.-]+\.\w+\b/g, '[EMAIL_REDACTED]'); // 脱敏电话号码(中国格式) masked = masked.replace(/(\+?86)?\s*1[3-9]\d{2}\s*\d{4}\s*\d{4}/g, '[PHONE_REDACTED]'); // 脱敏身份证号 masked = masked.repl...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left maskSensitiveData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#...
private maskSensitiveData(text: string): string { let masked = text; // 脱敏邮箱地址 masked = masked.replace(/\b[\w.-]+@[\w.-]+\.\w+\b/g, '[EMAIL_REDACTED]'); // 脱敏电话号码(中国格式) masked = masked.replace(/(\+?86)?\s*1[3-9]\d{2}\s*\d{4}\s*\d{4}/g, '[PHONE_REDACTED]'); // 脱敏身份证号 masked = masked.repl...
https://github.com/dingzhilin1990/zhilinclaw
649ed315ea4bc3e184e3cdf46003214a444802b3
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/service/CloudSyncService.ets
arkts
collectLocalData
收集本地数据
private static async collectLocalData(options: SyncOptions): Promise<CloudDataPackage> { const dataTypes: string[] = options.dataTypes.length > 0 ? options.dataTypes : ['accounts', 'bills', 'categories', 'budgets']; let accounts: Account[] = []; let bills: Bill[] = []; let categories: Category[] = [];...
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 collectLocalData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Lef...
private static async collectLocalData(options: SyncOptions): Promise<CloudDataPackage> { const dataTypes: string[] = options.dataTypes.length > 0 ? options.dataTypes : ['accounts', 'bills', 'categories', 'budgets']; let accounts: Account[] = []; let bills: Bill[] = []; let categories: Category[] = [];...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
00e1b07fd67915f302d27f092dc52e239d0be4e6
github
somnio-software/my-bot-pal
entry/src/main/ets/utils/VibratorManager.ets
arkts
triggerTimedVibration
Trigger a time-based vibration @param duration - Vibration duration in milliseconds @param usage - Context of vibration
static async triggerTimedVibration( duration: number, usage: VibrationUsage = VibrationUsage.UNKNOWN ): Promise<void> { return new Promise((resolve, reject) => { try { vibrator.startVibration({ type: 'time', duration: duration }, { usage: usage ...
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 triggerTimedVibration AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left duration AST#identifier#Right AST#ERROR#Left AST#...
static async triggerTimedVibration( duration: number, usage: VibrationUsage = VibrationUsage.UNKNOWN ): Promise<void> { return new Promise((resolve, reject) => { try { vibrator.startVibration({ type: 'time', duration: duration }, { usage: usage ...
https://github.com/somnio-software/my-bot-pal
e9c41891433317bc9f7cfe0c86890f7935bd263a
github
DaLongZhuaZi/manxia
entry/src/main/ets/pages/EpubWebViewReaderPage.ets
arkts
aboutToAppear
──── 生命周期 ────
aboutToAppear(): void { this.isPageVisible = true; this.themeManager = ThemeManager.getInstance(); this.settingsManager = SettingsManager.getInstance(); eventBus.subscribe(GameEvent.READ_ALOUD_STATE_CHANGED, this.onReadAloudStateChanged); AppStorage.setOrCreate('ReadAloudCurrentHostPage', 'EpubWeb...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc...
aboutToAppear(): void { this.isPageVisible = true; this.themeManager = ThemeManager.getInstance(); this.settingsManager = SettingsManager.getInstance(); eventBus.subscribe(GameEvent.READ_ALOUD_STATE_CHANGED, this.onReadAloudStateChanged); AppStorage.setOrCreate('ReadAloudCurrentHostPage', 'EpubWeb...
https://github.com/DaLongZhuaZi/manxia
500f79aebb8a09c9a348e75cf8b81ccd78f0c672
github
openharmony-tpc/XmlGraphicsBatik
library/src/main/ets/batik/svggen/SVGRect.ets
arkts
getHeight
获取矩形高度
public getHeight(): number{ return this._height; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getHeight 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#numbe...
public getHeight(): number{ return this._height; }
https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git
b4186b714e0df6c15b70956da6618ed78555301d
gitee
RoooyHe/toona-ohos
toona/src/main/ets/utils/ToastUtils.ets
arkts
long
长 Toast(约 3s)
static long(message: string): void { WdkitToast.longToast(message); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left long AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left message AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#s...
static long(message: string): void { WdkitToast.longToast(message); }
https://github.com/RoooyHe/toona-ohos
c300fa4b0d2566cbee3911e3b52d34f05b475155
github
openharmony/applications_mms
entry/src/main/ets/utils/MmsPreferences.ets
arkts
getValueOfDeliveryReportSwitch
Obtains the value of the delivery report switch.
public getValueOfDeliveryReportSwitch(): string { return <string> this.getValueFromMap(common.string.KEY_OF_DELIVERY_REPORT_SWITCH, common.DELIVERY_REPORTS.DISABLED); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getValueOfDeliveryReportSwitch 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#...
public getValueOfDeliveryReportSwitch(): string { return <string> this.getValueFromMap(common.string.KEY_OF_DELIVERY_REPORT_SWITCH, common.DELIVERY_REPORTS.DISABLED); }
https://gitee.com/openharmony/applications_mms.git
77d1bca447861af2984d94b67047f3933da7798c
gitee
aimilin6688/KeePassHO
entry/src/main/ets/services/template/TemplateConstants.ets
arkts
getAllTemplates
获取所有预置模板
static getAllTemplates(): IPresetTemplate[] { return [ // 通用 TemplateConstants.GENERAL, TemplateConstants.WEBSITE, TemplateConstants.EMAIL, // 身份 TemplateConstants.ID_CARD, TemplateConstants.PASSPORT, TemplateConstants.DRIVER_LICENSE, TemplateConstants.SOCIAL_...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getAllTemplates 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 IPrese...
static getAllTemplates(): IPresetTemplate[] { return [ // 通用 TemplateConstants.GENERAL, TemplateConstants.WEBSITE, TemplateConstants.EMAIL, // 身份 TemplateConstants.ID_CARD, TemplateConstants.PASSPORT, TemplateConstants.DRIVER_LICENSE, TemplateConstants.SOCIAL_...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/template/TemplateConstants.ets#L544-L578
54c3163cd717bd78462c0d21143e443c4a018d48
github
XHXYT/Pixark
entry/src/main/ets/viewmodel/FavoriteViewModel.ets
arkts
handleMainTabChange
--- 交互逻辑 ---
handleMainTabChange(index: number) { if (this.mainTabIndex === index) return; this.mainTabIndex = index; this.loadCurrentTabData(); }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left handleMainTabChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifie...
handleMainTabChange(index: number) { if (this.mainTabIndex === index) return; this.mainTabIndex = index; this.loadCurrentTabData(); }
https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/viewmodel/FavoriteViewModel.ets#L328-L332
16cd379d3c40896f61cfa9b7e3376c75a38c5ac9
github
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/services/RdpSessionManager.ets
arkts
handleNetworkLost
Handle network lost
private handleNetworkLost(): void { if (!isSessionActive) { return; } console.warn(`${TAG}: Handling network lost`); // Update notification if (backgroundService && RdpBackgroundService.isServiceRunning()) { backgroundService.updateNotification('网络已断开,等待重连...'); } ...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleNetworkLost 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 AS...
private handleNetworkLost(): void { if (!isSessionActive) { return; } console.warn(`${TAG}: Handling network lost`); // Update notification if (backgroundService && RdpBackgroundService.isServiceRunning()) { backgroundService.updateNotification('网络已断开,等待重连...'); } ...
https://github.com/tangwengang-del/freerdp-harmonyos
871021637af58d8d6328c5c35856c11f79dbe707
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoSourceParser.ets
arkts
parseSearchRule
解析搜索规则
private parseSearchRule(obj: ESObject): LegadoSearchRule | undefined { if (!obj) { return undefined; } return { checkKeyWord: obj.checkKeyWord ? String(obj.checkKeyWord) : undefined, bookList: obj.bookList ? String(obj.bookList) : undefined, name: obj.name ? String(obj.name) : und...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseSearchRule AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef...
private parseSearchRule(obj: ESObject): LegadoSearchRule | undefined { if (!obj) { return undefined; } return { checkKeyWord: obj.checkKeyWord ? String(obj.checkKeyWord) : undefined, bookList: obj.bookList ? String(obj.bookList) : undefined, name: obj.name ? String(obj.name) : und...
https://github.com/DaLongZhuaZi/manxia
f51dcc38cb9b80aa7306c7ede2ba35254711f820
github
Cool_foolisher1/ArkTSRepository
GuardianAssistant/entry/src/main/ets/pages/Test/PermissionsTestPage.ets
arkts
checkAccessToken
官方文档:https://docs.openharmony.cn/pages/v4.1/zh-cn/application-dev/security/AccessToken/request-user-authorization.md 如何化简官方文档的例子: 以 向用户申请授权 -> 开发步骤 -> 2.校验当前是否已经授权 为例, 官方文档示例有 40 行,优化后核心代码其实只有 3 行 化简代码步骤: 1. 删除非必要的类型定义 2. 删除非必要的 try catch 和 console 3. 合并冗余代码,优化代码
function checkAccessToken(permission: Permissions) { let atManager = abilityAccessCtrl.createAtManager() let bundleInfo = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION) return atManager.checkAccessTokenSync(bundleInfo.appInfo.accessTokenId, permission) }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left checkAccessToken AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left permission AST#identifier#Right AST#type_annotation#Left AST#:#Left :...
function checkAccessToken(permission: Permissions) { let atManager = abilityAccessCtrl.createAtManager() let bundleInfo = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION) return atManager.checkAccessTokenSync(bundleInfo.appInfo.accessTokenId, permission) }
https://gitcode.com/Cool_foolisher1/ArkTSRepository
ff365cf5f177bd3582591449e7668c1d9d10a378
gitcode
Mydstiny/RemoteDeskHarmonyOS
entry/src/main/ets/services/CloudStore.ets
arkts
onCloudChange
注册云端数据变更回调 (供 Service 层使用)
onCloudChange(callback: () => void): void { this.onChangeCallbacks.push(callback); }
AST#program#Left AST#ERROR#Left AST#identifier#Left onCloudChange AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#argu...
onCloudChange(callback: () => void): void { this.onChangeCallbacks.push(callback); }
https://github.com/Mydstiny/RemoteDeskHarmonyOS
237bd8aa665e2a938e765091fccfe1342bd327ca
github
openharmony-sig/commons-cli
library/src/main/ets/components/cli/Options.ets
arkts
hasShortOption
Returns whether the named {@link Option} is a member of this {@link Options}. @param opt short name of the {@link Option} @return true if the named {@link Option} is a member of this {@link Options} @since 1.3
public hasShortOption(opt: string): boolean { opt = Util.stripLeadingHyphens(opt); return this.shortOpts.containsKey(opt); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left hasShortOption AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left opt AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left st...
public hasShortOption(opt: string): boolean { opt = Util.stripLeadingHyphens(opt); return this.shortOpts.containsKey(opt); }
https://gitee.com/openharmony-sig/commons-cli.git
3350f8026ee269d73cdb10bcf37ca856178c89f1
gitee
LambdaYH/ScrcpyForHarmonyOS
app/src/main/ets/client/tools/NativeStreamClient.ets
arkts
start
Start the session
async start(serverJarData: ArrayBuffer | null, surfaceId: string): Promise<void> { try { // 1. Prepare the server and reuse the connected ADB session. this.adbId = await this.clientStream.prepareServerForNative(this.context, serverJarData, () => { if (this.listener && this.listener.onWaitAut...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left start AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left serverJarData AST#identifier#Right AST#type_annotation#Left AST#:#Left : ...
async start(serverJarData: ArrayBuffer | null, surfaceId: string): Promise<void> { try { // 1. Prepare the server and reuse the connected ADB session. this.adbId = await this.clientStream.prepareServerForNative(this.context, serverJarData, () => { if (this.listener && this.listener.onWaitAut...
https://github.com/LambdaYH/ScrcpyForHarmonyOS
1fbe93a89601bda4b90f7ca85728ccb804a5d080
github
OnceWeWere/Weather_HarmonyOS
entry/src/main/ets/pages/Index.ets
arkts
onRefreshCityInfoChanged
监听城市刷新信息变化
onRefreshCityInfoChanged() { setTimeout(() => { if (this.refreshCityInfo && this.refreshCityInfo.adcode && this.refreshCityInfo.adcode !== '') { console.info("Debug: [@Watch] 检测到城市切换"); const adcode = this.refreshCityInfo.adcode; const cityName = this.refreshCityInfo.cityName; ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onRefreshCityInfoChanged 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...
onRefreshCityInfoChanged() { setTimeout(() => { if (this.refreshCityInfo && this.refreshCityInfo.adcode && this.refreshCityInfo.adcode !== '') { console.info("Debug: [@Watch] 检测到城市切换"); const adcode = this.refreshCityInfo.adcode; const cityName = this.refreshCityInfo.cityName; ...
https://github.com/OnceWeWere/Weather_HarmonyOS
439c5c4be3c774e1cf6bc93f959fc9565f125999
github
Your-USTC/DailyNic_HMOS
entry/src/main/ets/utils/Classes/ScheduleManager.ets
arkts
rebuildDisplayIndex
根据课程列表重建课表页面展示的周索引 @param classes 课程列表 @returns undefined,但如果发生错误则返回错误信息的字符串
private rebuildDisplayIndex(classes: classAttribute[]): string | undefined { try { this.displayIndex.clear(); for (const classItem of classes) { if (!classItem) { continue; // 跳过无效的课程项 } for (const week of classItem.weekOfTerm) { let items = this.displayInde...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left rebuildDisplayIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left classes AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscr...
private rebuildDisplayIndex(classes: classAttribute[]): string | undefined { try { this.displayIndex.clear(); for (const classItem of classes) { if (!classItem) { continue; // 跳过无效的课程项 } for (const week of classItem.weekOfTerm) { let items = this.displayInde...
https://github.com/Your-USTC/DailyNic_HMOS
a0fb93ba392b459b16f0d6e2795d28bc4db45a9f
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/SourceUpdateManager.ets
arkts
clearUpdateFlag
清除更新标记
public async clearUpdateFlag(): Promise<void> { this.hasUpdate = false; await this.saveSettings(); }
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 clearUpdateFlag AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#...
public async clearUpdateFlag(): Promise<void> { this.hasUpdate = false; await this.saveSettings(); }
https://github.com/DaLongZhuaZi/manxia
17038c19754678f6f3122742e10a91303d675689
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/microphone/MicrophoneConfig.ets
arkts
getOpusBitrateKbps
获取当前配置的 Opus 比特率 (Kbps)
static getOpusBitrateKbps(): number { return MicrophoneConfig.opusBitrateKbps; }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getOpusBitrateKbps 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 ...
static getOpusBitrateKbps(): number { return MicrophoneConfig.opusBitrateKbps; }
https://github.com/AlkaidLab/moonlight-harmony
4c7c282d4ad2c92def7bd59e6356d5fcd5e5695b
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
map
Creates a new Int8Array using fn(arr[i]) over all elements of current Int8Array. @param fn a function to apply for each element of current Int8Array @returns a new Int8Array where for each element from current Int8Array fn was applied
public map(fn: (val: byte, index: int) => byte): Int8Array { let resBuf = new ArrayBuffer(this.length * Int8Array.BYTES_PER_ELEMENT) let res = new Int8Array(resBuf) for (let i = 0; i < this.length; ++i) { res.set(i, fn(this.at(i), i)) } return res }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left map 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#Right...
public map(fn: (val: byte, index: int) => byte): Int8Array { let resBuf = new ArrayBuffer(this.length * Int8Array.BYTES_PER_ELEMENT) let res = new Int8Array(resBuf) for (let i = 0; i < this.length; ++i) { res.set(i, fn(this.at(i), i)) } return res }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
f3f71eb1af8fd9cfe45f822a596847e076a4958c
gitee
Octo-o-o-o/harmonyos-ai-workspace
samples/templates/scan-qrcode/ScanPlugin.ets
arkts
scan
触发一次扫码。 同一时间只允许一个 scan inflight —— 二次点击 await 同一个 promise。 用户主动取消 / 权限被拒 / SDK 不可用都不会 throw;只有真意外才 throw。
async scan(): Promise<ScanOutcome> { if (this.inflight !== null) return this.inflight this.inflight = this.runScan() try { return await this.inflight } finally { this.inflight = null } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left scan 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 ...
async scan(): Promise<ScanOutcome> { if (this.inflight !== null) return this.inflight this.inflight = this.runScan() try { return await this.inflight } finally { this.inflight = null } }
https://github.com/Octo-o-o-o/harmonyos-ai-workspace
ed5942fcc9507c49d329f900c87a47f7a5827fa4
github
Cool_foolisher1/ArkTSRepository
GuardianAssistant/entry/src/main/ets/pages/Hardware/HardwareIndexPage.ets
arkts
getNetBearType
获取网络类型(以太网、WIFI、蜂窝)
getNetBearType() { // 1. 获取默认网络 const netHandle = connection.getDefaultNetSync() // 2. 获取网络能力信息 const netCapabilities = connection.getNetCapabilitiesSync(netHandle) // 3. 判断网络类型(按优先级展示: 以太网网络 > Wi-Fi网络 > 窝网络) if (netCapabilities.bearerTypes.includes(connection.NetBearType.BEARER_ETHERNET)) { ...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getNetBearType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Lef...
getNetBearType() { // 1. 获取默认网络 const netHandle = connection.getDefaultNetSync() // 2. 获取网络能力信息 const netCapabilities = connection.getNetCapabilitiesSync(netHandle) // 3. 判断网络类型(按优先级展示: 以太网网络 > Wi-Fi网络 > 窝网络) if (netCapabilities.bearerTypes.includes(connection.NetBearType.BEARER_ETHERNET)) { ...
https://gitcode.com/Cool_foolisher1/ArkTSRepository
af77cb185d240822b1fc4b6497afaee49550e9a7
gitcode
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test54_original_index.ets
arkts
mergeSort
=== Round 54: Merge sort, binary search tree, LRU cache, sliding window, two-pointer technique === --- Merge sort ---
function mergeSort(arr: number[]): number[] { if (arr.length <= 1) { return arr; } let mid: number = Math.floor(arr.length / 2); let left: number[] = mergeSort(arr.slice(0, mid)); let right: number[] = mergeSort(arr.slice(mid)); return merge(left, right); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left mergeSort AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left arr AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right A...
function mergeSort(arr: number[]): number[] { if (arr.length <= 1) { return arr; } let mid: number = Math.floor(arr.length / 2); let left: number[] = mergeSort(arr.slice(0, mid)); let right: number[] = mergeSort(arr.slice(mid)); return merge(left, right); }
https://github.com/miaochiahao/ark-ghidra
310a2b2f5938b06c2ba61514ba844c224d58dd30
github
terryma2024/happyword
harmonyos/entry/src/main/ets/services/MultipartBuilder.ets
arkts
generateBoundary
RFC 7578 only forbids the boundary inside the parts, so any unguessable random string of safe characters is fine. We use a hyphen-prefixed hex string so it's easy to spot in network logs.
function generateBoundary(): string { let hex: string = ''; for (let i = 0; i < 16; i++) { const b: number = Math.floor(Math.random() * 256); const s: string = b.toString(16); hex += s.length === 1 ? `0${s}` : s; } return `----HappyWordBoundary${hex}`; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left generateBoundary 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...
function generateBoundary(): string { let hex: string = ''; for (let i = 0; i < 16; i++) { const b: number = Math.floor(Math.random() * 256); const s: string = b.toString(16); hex += s.length === 1 ? `0${s}` : s; } return `----HappyWordBoundary${hex}`; }
https://github.com/terryma2024/happyword
410fca090ec8334da7a4a7a84e4f2e3972c5c72f
github
openharmony-sig/ohos_videocompressor
videoCompressor/src/main/ets/components/mainpage/VideoCompressor.ets
arkts
compressVideo
@param context 上下文 @param inputFilePath 需要压缩的视频路径 @param quality 压缩视频质量
compressVideo(context: Context, inputFilePath: string, quality: CompressQuality): Promise<CompressorResponse> { try { if (!context) { console.info("videoCompressor context is null"); return new Promise((resolve, reject) => { reject(new Error("context is null")); }); }...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left compressVideo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ER...
compressVideo(context: Context, inputFilePath: string, quality: CompressQuality): Promise<CompressorResponse> { try { if (!context) { console.info("videoCompressor context is null"); return new Promise((resolve, reject) => { reject(new Error("context is null")); }); }...
https://gitee.com/openharmony-sig/ohos_videocompressor.git
d79bbbd4476f408fc21fe6697dc73821c47574a9
gitee
openharmony-sig/applications_filemanager
entry/src/main/ets/pages/video_player.ets
arkts
aboutToAppear
是否是重复进来
aboutToAppear() { globalThis.appS = AppStorage console.log("playerSource="+this.playerSource) globalThis.requestPermissions().then((isAuth) => { this.isAuth = isAuth }) display.getDefaultDisplay((err, data) => { if (!err.code) { globalThis.display = data; } }); }
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() { globalThis.appS = AppStorage console.log("playerSource="+this.playerSource) globalThis.requestPermissions().then((isAuth) => { this.isAuth = isAuth }) display.getDefaultDisplay((err, data) => { if (!err.code) { globalThis.display = data; } }); }
https://gitee.com/openharmony-sig/applications_filemanager.git
8a1d7aed355a068b259f5c9441d418a8a798c5a2
gitee
openharmony-sig/flutter_engine
shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/systemchannels/PlatformViewsChannel.ets
arkts
setPlatformViewsHandler
Sets the {@link PlatformViewsHandler} which receives all events and requests that are parsed from the underlying platform views channel.
public setPlatformViewsHandler(handler: PlatformViewsHandler | null): void { this.handler = handler; this.parsingHandler.handler = handler; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setPlatformViewsHandler AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left handler AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binar...
public setPlatformViewsHandler(handler: PlatformViewsHandler | null): void { this.handler = handler; this.parsingHandler.handler = handler; }
https://gitee.com/openharmony-sig/flutter_engine.git
327c76d1dde531bc545c2267dcefb514c43eecf2
gitee
HarmonyOS_Samples/BestPracticeSnippets
JSCrash/entry/src/main/ets/pages/utils.ets
arkts
showInfo
Outputs info-level logs. @param tag Identifies the log tag. @param format Indicates the log format string. @param args Indicates the log parameters. @since 7
static showInfo(tag: string): void { if (Log.isLoggable(tag, hilog.LogLevel.INFO)) { hilog.info(DOMAIN, TAG, tag + SYMBOL); } }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left showInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tag AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string A...
static showInfo(tag: string): void { if (Log.isLoggable(tag, hilog.LogLevel.INFO)) { hilog.info(DOMAIN, TAG, tag + SYMBOL); } }
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
a818565ab63dc07759337a2c175e7b97fc05bd81
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/libs/htmlparser/LegadoHtmlBridge.ets
arkts
parseChainRuleToElements
解析 Legado 链式规则,返回元素列表
parseChainRuleToElements(rule: string): HTMLElement[] { if (!this.root) return []; const rules = this.splitByAt(rule); if (rules.length === 0) return []; let elements: HTMLElement[] = [this.root]; for (const r of rules) { const newElements: HTMLElement[] = []; for (const elem of ele...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left parseChainRuleToElements AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left rule AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#ident...
parseChainRuleToElements(rule: string): HTMLElement[] { if (!this.root) return []; const rules = this.splitByAt(rule); if (rules.length === 0) return []; let elements: HTMLElement[] = [this.root]; for (const r of rules) { const newElements: HTMLElement[] = []; for (const elem of ele...
https://github.com/DaLongZhuaZi/manxia
afba6129240d7b73245a6dd902320767d1bbca87
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test27_original_index.ets
arkts
withDefault
--- Default value via helper ---
function withDefault(val: string | undefined, def: string): string { if (val !== undefined) { return val; } return def; }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left withDefault AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left val AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right...
function withDefault(val: string | undefined, def: string): string { if (val !== undefined) { return val; } return def; }
https://github.com/miaochiahao/ark-ghidra
143fdca26146c25db514c26d27dd88840a0b8918
github
HateCodingHateCoding/Bullying-detection-system-v2-public
frontend/AnQ/entry/src/main/ets/common/WaterFlowDataSource.ets
arkts
registerDataChangeListener
注册改变数据的控制器
registerDataChangeListener(listener: DataChangeListener): void { if (this.listeners.indexOf(listener) < 0) { this.listeners.push(listener) } }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left registerDataChangeListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left listener AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left DataChangeListener AST#id...
registerDataChangeListener(listener: DataChangeListener): void { if (this.listeners.indexOf(listener) < 0) { this.listeners.push(listener) } }
https://github.com/HateCodingHateCoding/Bullying-detection-system-v2-public
76dc590b6c18f234bf084bac98ab1501acd8a7b1
github
cpdd5201314/harmonyOS-music-app
products/phone/src/main/ets/pages/PlaylistManager.ets
arkts
addToFavorite
添加到收藏
addToFavorite(music: MusicInfo): boolean { if (this.isFavorite(music)) { return false; } this.favoriteList.push(music); this.saveData(); return true; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addToFavorite AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left music AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left MusicInfo AST#identifier#Right AST#)#Left...
addToFavorite(music: MusicInfo): boolean { if (this.isFavorite(music)) { return false; } this.favoriteList.push(music); this.saveData(); return true; }
https://github.com/cpdd5201314/harmonyOS-music-app
1894dd19c139013321fa2c0816bfe4720d145d66
github
2763981847/Clock-Alarm
entry/src/main/ets/model/ReminderService.ets
arkts
addReminder
添加或修改提醒。 @param alarmItem ReminderItem @param callback 回调函数,可选参数,用于返回提醒的 ID
public addReminder(alarmItem: ReminderItem, callback?: (reminderId: number) => void) { let reminder = this.initReminder(alarmItem); reminderAgent.publishReminder(reminder, (_err, reminderId: number) => { if (callback != null) { callback(reminderId); } }); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left addReminder AST#identifier#Right AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left alarmItem AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ReminderItem AST#identifier#Right AST#,#Lef...
public addReminder(alarmItem: ReminderItem, callback?: (reminderId: number) => void) { let reminder = this.initReminder(alarmItem); reminderAgent.publishReminder(reminder, (_err, reminderId: number) => { if (callback != null) { callback(reminderId); } }); }
https://github.com/2763981847/Clock-Alarm
7de25f9d4577ca45b2465ce473967a45e3da3637
github
wuba/omni-ui
omni_component/src/main/ets/components/filterbar/bean/OmniFilterItemBean.ets
arkts
selectedList
/ 获取当前节点的所有选中的子节点,支持 more 类型
selectedList(): OmniFilterItemBean[] { //TODO 更多类型(更多类型可不同子项间多选,这里需要特殊处理) let results: OmniFilterItemBean[] = []; let firstColumn = OmniFilterUtil.currentSelectListForEntity(this); results = results.concat(firstColumn); if (firstColumn.length > 0) { for (let firstEntity of firstColumn)...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left selectedList 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#identifier#Left Omn...
selectedList(): OmniFilterItemBean[] { //TODO 更多类型(更多类型可不同子项间多选,这里需要特殊处理) let results: OmniFilterItemBean[] = []; let firstColumn = OmniFilterUtil.currentSelectListForEntity(this); results = results.concat(firstColumn); if (firstColumn.length > 0) { for (let firstEntity of firstColumn)...
https://github.com/wuba/omni-ui
2a7a01d89a9bfd3f163561098b0386caa2ccedb2
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test28_original_index.ets
arkts
testArrayDestructure
--- Array destructuring manual ---
function testArrayDestructure(): string { let arr: number[] = [100, 200, 300]; let a: number = arr[0]; let b: number = arr[1]; let c: number = arr[2]; return String(a + b + c); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testArrayDestructure 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#predef...
function testArrayDestructure(): string { let arr: number[] = [100, 200, 300]; let a: number = arr[0]; let b: number = arr[1]; let c: number = arr[2]; return String(a + b + c); }
https://github.com/miaochiahao/ark-ghidra
33f9a47f3d07fc6cc593f9bf94a910b0e2c83058
github
YANGZX22/Voot
entry/src/main/ets/services/ModelDownloadService.ets
arkts
getState
获取当前下载状态
public getState(): DownloadState { return this.currentState; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getState 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 DownloadState...
public getState(): DownloadState { return this.currentState; }
https://github.com/YANGZX22/Voot
250ba6b3a17cd0875ee0fe78ccc82e40b44755b4
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
sort
Sorts in-place according to the numeric ordering @returns sorted Uint32Array
public sort(): Uint32Array { let newF: (a: number, b: number) => number = (a: number, b: number): number => { throw new Error("not implemented") } return this.sort(newF) }
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#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Righ...
public sort(): Uint32Array { let newF: (a: number, b: number) => number = (a: number, b: number): number => { throw new Error("not implemented") } return this.sort(newF) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
53036bc6421e96b310a7512c20a7f2e67e1bddeb
gitee
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/dao/TagDAO.ets
arkts
update
更新标签信息 @param tag 标签对象
static async update(tag: Tag): Promise<void> { if (!tag.validate()) { throw new Error('[TagDAO] 无效标签数据'); } const store = DatabaseManager.getDatabase(); const now = new Date().toISOString(); const sql = ` UPDATE tags SET name = ?, color = ?, updated_at = ?, is_deleted = ? W...
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 update AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tag AST#identifier#Right AST#:#Left : AST#:#Right...
static async update(tag: Tag): Promise<void> { if (!tag.validate()) { throw new Error('[TagDAO] 无效标签数据'); } const store = DatabaseManager.getDatabase(); const now = new Date().toISOString(); const sql = ` UPDATE tags SET name = ?, color = ?, updated_at = ?, is_deleted = ? W...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
2d50b8e571a47abb206c8fc09db4f729addcdead
github
aimilin6688/KeePassHO
entry/src/main/ets/services/store/DistributedKVService.ets
arkts
put
调用put()方法向键值数据库中插入数据 @param key @param value @returns
public static put(key: string, value: Uint8Array | string | number | boolean): Promise<void> { hilog.debug(DOMAIN, TAG, `KVStore put data. Key:${key}`); return new Promise((resolve, reject) => { if (!DistributedKVService.kvStore) { reject(new Error('KVStore is not initialized')); return;...
AST#program#Left AST#expression_statement#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left put AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Righ...
public static put(key: string, value: Uint8Array | string | number | boolean): Promise<void> { hilog.debug(DOMAIN, TAG, `KVStore put data. Key:${key}`); return new Promise((resolve, reject) => { if (!DistributedKVService.kvStore) { reject(new Error('KVStore is not initialized')); return;...
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/store/DistributedKVService.ets#L264-L280
9438b36770af71e83bfcfcb6bc4831ca906b08f7
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
some
Checks that at least one element of Float32Array satisfies the passed function @param fn check function @returns true if some element satisfies fn
public some(fn: (element: float) => boolean): boolean { let newF: (element: float, index: int, array: Float32Array) => boolean = (element: float, index: int, array: Float32Array): boolean => { return fn(element) } return this.some(newF) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left some AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Righ...
public some(fn: (element: float) => boolean): boolean { let newF: (element: float, index: int, array: Float32Array) => boolean = (element: float, index: int, array: Float32Array): boolean => { return fn(element) } return this.some(newF) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
dcb7c31e7452b95d877b625613fe04d4aade2c0c
gitee
ohosgg/rnoh
tester/harmony/rnoh/src/main/ets/RNOHCorePackage/components/RNImage.ets
arkts
getResizeMode
enum class ImageResizeMode { Cover, Contain, Stretch, Center, Repeat }
getResizeMode(resizeMode: number) { switch(resizeMode) { case 0: return ImageFit.Cover; case 1: return ImageFit.Contain; case 2: return ImageFit.Fill; case 3: case 4: return ImageFit.None; default: return ImageFit.Cover; } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getResizeMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left resizeMode AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right A...
getResizeMode(resizeMode: number) { switch(resizeMode) { case 0: return ImageFit.Cover; case 1: return ImageFit.Contain; case 2: return ImageFit.Fill; case 3: case 4: return ImageFit.None; default: return ImageFit.Cover; } }
https://github.com/ohosgg/rnoh
ee3ad35b43698a7316950fe3396cbce9e714bed2
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Services/DataService.ets
arkts
getPopularComics
获取热门漫画
public async getPopularComics(options?: PopularComicsOptions): Promise<ComicInfo[]> { try { const sourceId = options?.sourceId; const limit = options?.limit || 20; // 这里可以根据阅读量、收藏量等指标排序 // 暂时按最后更新时间排序 const comics = await this.dataManager.searchComics('', sourceId); retu...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left getPopularComics AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left options AST#identifier#Right AST#?#Left...
public async getPopularComics(options?: PopularComicsOptions): Promise<ComicInfo[]> { try { const sourceId = options?.sourceId; const limit = options?.limit || 20; // 这里可以根据阅读量、收藏量等指标排序 // 暂时按最后更新时间排序 const comics = await this.dataManager.searchComics('', sourceId); retu...
https://github.com/DaLongZhuaZi/manxia
9e2e82a6a53b97305089b0b136eeecefae7020ad
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
$_set
Assigns val as element on index. @param { int } index - index to change @param { number } val - value to set @throws { RangeError } - If the index exceeds the array range, throw an exception @syscap SystemCapability.Utils.Lang @FaAndStageModel
public $_set(index: int, val: number): void { this.$_set(index, Int8Array.doubleToInt(val)) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left $_set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left index AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#id...
public $_set(index: int, val: number): void { this.$_set(index, Int8Array.doubleToInt(val)) }
https://gitcode.com/iop123123/arkts-static-skills
e9c0e3d49a2f89b3c6e2a769da6dcb19da541c43
gitcode
LJ666-ui/harmony-health-care
entry/src/main/ets/ar/VoiceGuide.ets
arkts
isMutedState
获取静音状态
public isMutedState(): boolean { return this.isMuted; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isMutedState 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 isMutedState(): boolean { return this.isMuted; }
https://github.com/LJ666-ui/harmony-health-care
01b060703921077110b6acf3e7b06e5a6ececa39
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
from
Creates an array from an array-like or iterable object. @param { Iterable<number> } arrayLike - An array-like or iterable object to convert to an array. @param { function } [mapfn] - A mapping function to call on every element of the array. @returns { Float32Array } - A new Float32Array @static @syscap SystemCapability...
public static from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number): Float32Array { if (mapfn == undefined) { mapfn = (v: number, k: number): number => { return v } } let iter = arrayLike.$_iterator() // NOTE (templin.konstantin): This code section ...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#from#Left from AST#from#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arrayLike AST#identifie...
public static from(arrayLike: Iterable<number>, mapfn?: (v: number, k: number) => number): Float32Array { if (mapfn == undefined) { mapfn = (v: number, k: number): number => { return v } } let iter = arrayLike.$_iterator() // NOTE (templin.konstantin): This code section ...
https://gitcode.com/iop123123/arkts-static-skills
95b9e2db51ae1de237f7347f59fabda6fd4677cc
gitcode
LongLiveY96/chatcube
entry/src/main/ets/services/registry/matcher.ets
arkts
isRegexSpec
判断 token spec 是否为正则模式(以 ^ 开头或 $ 结尾)
function isRegexSpec(spec: string): boolean { return spec.startsWith('^') || spec.endsWith('$') }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left isRegexSpec AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left spec AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Righ...
function isRegexSpec(spec: string): boolean { return spec.startsWith('^') || spec.endsWith('$') }
https://github.com/LongLiveY96/chatcube
0646c6aa1521c8dc289e7f145c7a3df5da7c84fb
github
m-harmongos/harmongos-projects
AlarmClock/entry/src/main/ets/viewmodel/MainViewModel.ets
arkts
queryAlarmsTasker
查询提醒任务监听者
public queryAlarmsTasker(callback: (alarms: Array<AlarmItem>) => void) { this.queryDatabaseAlarms(callback); let preference = GlobalContext.getContext().getObject('preference') as PreferencesHandler; if (preference) { preference.addPreferencesListener({ onDataChanged: () => { this....
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left queryAlarmsTasker AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#call_expression#Left AST#member_expression#Left AST#call_expression#Le...
public queryAlarmsTasker(callback: (alarms: Array<AlarmItem>) => void) { this.queryDatabaseAlarms(callback); let preference = GlobalContext.getContext().getObject('preference') as PreferencesHandler; if (preference) { preference.addPreferencesListener({ onDataChanged: () => { this....
https://github.com/m-harmongos/harmongos-projects
ecfa5ae8f240573500d17c40deb8a4aa73471f14
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/greater_or_equal/greater_or_equal_short.ets
arkts
main
--- desc: check greater or equal for two short integers ---
function main(): void { const a: short = {{v.left}} const b: short = {{v.right}} assert (a >= b) == {{v.result}}
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A...
function main(): void { const a: short = {{v.left}} const b: short = {{v.right}} assert (a >= b) == {{v.result}}
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
9b7717fbc019ef46ac42de7713aa63f07ec523b6
gitee
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets
arkts
matchXPathStepWithAxis
匹配XPath步骤(支持轴选择器)
private matchXPathStepWithAxis(html: string, step: XPathStep, fullContent: string): string[] { // 检查是否有轴选择器 const axisMatch = step.tag.match(/^([a-z-]+)::(.+)$/); if (axisMatch) { const axis = axisMatch[1]; const tag = axisMatch[2]; return this.matchXPathAxis(html, axis, tag, step.predic...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left matchXPathStepWithAxis 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#identi...
private matchXPathStepWithAxis(html: string, step: XPathStep, fullContent: string): string[] { // 检查是否有轴选择器 const axisMatch = step.tag.match(/^([a-z-]+)::(.+)$/); if (axisMatch) { const axis = axisMatch[1]; const tag = axisMatch[2]; return this.matchXPathAxis(html, axis, tag, step.predic...
https://github.com/DaLongZhuaZi/manxia
0bbb0fd67e4c7bda1d100b0c9eee837d1308c20f
github
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/JsonEncodingVisitor.ets
arkts
visitRepeatedBool
访问 repeated bool 字段 JSON: array of boolean
visitRepeatedBool(value: boolean[], fieldNumber: number): void { const fieldName = this.getFieldName(fieldNumber) this.json[fieldName] = [...value] as Object }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitRepeatedBool AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left boolean...
visitRepeatedBool(value: boolean[], fieldNumber: number): void { const fieldName = this.getFieldName(fieldNumber) this.json[fieldName] = [...value] as Object }
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
5ab3b3427332d873f73a2a2ebd1e1581597ec40e
gitcode
HarmonyOS_Samples/hmosworld
HMOSWorld/Application/features/login/src/main/ets/service/LoginNetFunc.ets
arkts
login
@param UserAccount
public login(userAccount: UserAccount): Promise<UserAccount> { return new Promise((resolve: (value: UserAccount | PromiseLike<UserAccount>) => void, reject: (reason?: Object) => void) => { Logger.info(TAG, 'login----------------------'); Request.call(LoginTrigger.LOGIN, userAcc...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left login AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#ident...
public login(userAccount: UserAccount): Promise<UserAccount> { return new Promise((resolve: (value: UserAccount | PromiseLike<UserAccount>) => void, reject: (reason?: Object) => void) => { Logger.info(TAG, 'login----------------------'); Request.call(LoginTrigger.LOGIN, userAcc...
https://gitcode.com/HarmonyOS_Samples/hmosworld
39b33c75b87107eed516b459f609c9bc8b7d5bb9
gitcode
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.LinkedList.ets
arkts
forEach
Iterates over each element in the linked list, executing the provided callback function for each element. @param callbackfn - A function that accepts up to two arguments. @param callbackfn.value - The current element being processed in the linked list. @param callbackfn.index - The index of the current element being pr...
public forEach(callbackfn: LinkedListForEachCb<T>): void { let index: int = 0; let currentNode: ListNode<T> | undefined = this.head; while (currentNode !== undefined) { callbackfn(currentNode!.element, index++, this); currentNode = currentNode?.next; } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left forEach AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callbackfn AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expr...
public forEach(callbackfn: LinkedListForEachCb<T>): void { let index: int = 0; let currentNode: ListNode<T> | undefined = this.head; while (currentNode !== undefined) { callbackfn(currentNode!.element, index++, this); currentNode = currentNode?.next; } }
https://gitcode.com/iop123123/arkts-static-skills
32a1738d9d57d88cd575f88af14b2609de1c4560
gitcode
xiaofenger_705/protobuf-arkts-generator
test/Address.ets
arkts
decodeFrom
Decode from Reader
protected decodeFrom(r: Reader, len?: number): void { const endPos = len === undefined ? r.len : r.pos + len while (r.pos < endPos) { const tag = r.uint32() const fieldNum = tag >>> 3 switch (fieldNum) { case 1: this.street = r.string() break case 2: ...
AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left decodeFrom AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left r AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left...
protected decodeFrom(r: Reader, len?: number): void { const endPos = len === undefined ? r.len : r.pos + len while (r.pos < endPos) { const tag = r.uint32() const fieldNum = tag >>> 3 switch (fieldNum) { case 1: this.street = r.string() break case 2: ...
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
4701edffd9a48adbac520692f989f7074b7c9680
gitcode
codelably/tuniao-ui
packages/main/src/main/ets/viewmodel/TnIconViewModel.ets
arkts
getTypeIcons
获取主题颜色类型展示列表 @returns {IconTypeItem[]} 主题颜色类型项数组
getTypeIcons(): IconTypeItem[] { return [ new IconTypeItem("primary", "home-capsule-fill"), new IconTypeItem("success", "success-circle-fill"), new IconTypeItem("warning", "warning-fill"), new IconTypeItem("danger", "close-circle"), new IconTypeItem("info", "notice-fill"), ]; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getTypeIcons AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left IconTypeItem AST#identifier#Right ...
getTypeIcons(): IconTypeItem[] { return [ new IconTypeItem("primary", "home-capsule-fill"), new IconTypeItem("success", "success-circle-fill"), new IconTypeItem("warning", "warning-fill"), new IconTypeItem("danger", "close-circle"), new IconTypeItem("info", "notice-fill"), ]; }
https://github.com/codelably/tuniao-ui
fc6b378ce57c11fb65f2d25ce56b851ff8023851
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
values
Returns array values iterator @returns { IterableIterator<Number> } - an iterator @syscap SystemCapability.Utils.Lang @FaAndStageModel
public values(): IterableIterator<Number> { return new Int8ArrayIterator(this) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left values 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_stat...
public values(): IterableIterator<Number> { return new Int8ArrayIterator(this) }
https://gitcode.com/iop123123/arkts-static-skills
ad7c6a98960fe5dbcb4cb9c027cff6ef8f508257
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/EnhancedBackupManager.ets
arkts
restoreNovelLibrary
恢复小说库 [重构] 使用文件夹结构,更新封面路径
private async restoreNovelLibrary(items: NovelBackupItem[]): Promise<void> { logger.info(TAG, `正在恢复小说库: ${items.length} 项`); const downloadDirPath = AppStorage.get<string>('downloadSyncDirPath'); const baseDir = downloadDirPath ? `${downloadDirPath}/novel` : `${this.sandboxManager.getDirectory('files...
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 restoreNovelLibrary AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left items AST#identifier#Right AST#:#...
private async restoreNovelLibrary(items: NovelBackupItem[]): Promise<void> { logger.info(TAG, `正在恢复小说库: ${items.length} 项`); const downloadDirPath = AppStorage.get<string>('downloadSyncDirPath'); const baseDir = downloadDirPath ? `${downloadDirPath}/novel` : `${this.sandboxManager.getDirectory('files...
https://github.com/DaLongZhuaZi/manxia
9a1494869e5b67477742ec3f2005557e99debf5c
github
DaLongZhuaZi/manxia
entry/src/main/ets/Utils/MetadataXmlGenerator.ets
arkts
generateNovelMetadataXml
生成小说元数据XML
static generateNovelMetadataXml(metadata: NovelMetadata): string { const lines: string[] = []; lines.push('<?xml version="1.0" encoding="UTF-8"?>'); lines.push('<NovelInfo>'); lines.push(` <Id>${MetadataXmlGenerator.escapeXml(metadata.id)}</Id>`); lines.push(` <Name>${MetadataXmlGenerator.e...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left generateNovelMetadataXml AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left metadata AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ide...
static generateNovelMetadataXml(metadata: NovelMetadata): string { const lines: string[] = []; lines.push('<?xml version="1.0" encoding="UTF-8"?>'); lines.push('<NovelInfo>'); lines.push(` <Id>${MetadataXmlGenerator.escapeXml(metadata.id)}</Id>`); lines.push(` <Name>${MetadataXmlGenerator.e...
https://github.com/DaLongZhuaZi/manxia
43814fca2fe949d83aa5537946d272c9d78e8846
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.LinkedList.ets
arkts
clone
Creates a shallow copy of the list. @returns A new LinkedList instance with the same elements.
public clone(): LinkedList<T> { let cloneList: LinkedList<T> = new LinkedList<T>(); let currentNode: ListNode<T> | undefined = this.head; while (currentNode !== undefined) { cloneList.add(currentNode!.element); currentNode = currentNode!.next; } return...
AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left clone AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right...
public clone(): LinkedList<T> { let cloneList: LinkedList<T> = new LinkedList<T>(); let currentNode: ListNode<T> | undefined = this.head; while (currentNode !== undefined) { cloneList.add(currentNode!.element); currentNode = currentNode!.next; } return...
https://gitcode.com/iop123123/arkts-static-skills
7cd014b0da7ccb86cf3f304d040eb881fb9bbea0
gitcode