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
Harrisonls2004/WaterFlow
entry/src/main/ets/common/utils/OrderManager.ets
arkts
saveOrders
Save orders to persistent storage
private static async saveOrders(): Promise<void> { if (!orderPreferences || !currentOrderUsername) return; const key = `orders_${currentOrderUsername}`; try { await orderPreferences.put(key, JSON.stringify(cachedOrderList)); await orderPreferences.flush(); // 同步到 AppStorage 供 UI 响应式...
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 saveOrders AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#...
private static async saveOrders(): Promise<void> { if (!orderPreferences || !currentOrderUsername) return; const key = `orders_${currentOrderUsername}`; try { await orderPreferences.put(key, JSON.stringify(cachedOrderList)); await orderPreferences.flush(); // 同步到 AppStorage 供 UI 响应式...
https://github.com/Harrisonls2004/WaterFlow
11d9ce53798b5947c5a295b70401260e5ca2a7db
github
OHPG/FinSdk
jellyfin/src/main/ets/api/DevicesApi.ets
arkts
getDeviceOptions
getDeviceOptions @summary Get options for a device. @param {DevicesApiGetDeviceOptionsRequest} requestParameters Request parameters. @throws {RequiredError} @memberof DevicesApi
public async getDeviceOptions(requestParameters: DevicesApiGetDeviceOptionsRequest): Promise<DeviceOptions> { return this.apiClient.get({path: "/Devices/Options", parameters: requestParameters}) }
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 getDeviceOptions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right ...
public async getDeviceOptions(requestParameters: DevicesApiGetDeviceOptionsRequest): Promise<DeviceOptions> { return this.apiClient.get({path: "/Devices/Options", parameters: requestParameters}) }
https://github.com/OHPG/FinSdk
38f72eaafe5a5f0219f2a8d756a224d544795574
github
picklerick422/zju-learning-assistant-OH
entry/src/main/ets/services/DownloadHistoryService.ets
arkts
record
记录一个终态任务(done/failed/canceled);进行中的忽略。按 id 去重,限量保存。
static async record(task: DownloadTask): Promise<void> { if (task.status === 'downloading' || task.status === 'pending') { return; } if (!DownloadHistoryService.pref) { return; } const list = DownloadHistoryService.readRaw(); const rec: HistoryRecord = { id: task.id, fileName: task.fileNam...
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 record AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left task AST#identifier#Right AST#:#Left : AST#:#Righ...
static async record(task: DownloadTask): Promise<void> { if (task.status === 'downloading' || task.status === 'pending') { return; } if (!DownloadHistoryService.pref) { return; } const list = DownloadHistoryService.readRaw(); const rec: HistoryRecord = { id: task.id, fileName: task.fileNam...
https://github.com/picklerick422/zju-learning-assistant-OH
7c88202986d0309dc9856fc983a1270ac0f154fd
github
LongLiveY96/chatcube
entry/src/main/ets/services/AIApiService.ets
arkts
emitStreamContentWithTools
发送流式内容(支持工具调用回调)
private emitStreamContentWithTools( apiStyle: ApiStyle, useOpenAIResponses: boolean, json: object, onData: (content: string) => void, onError: (error: string) => void, onReasoningData?: (content: string) => void, onImageData?: (base64Data: string, mimeType: string, isPartial: boolean) => v...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left emitStreamContentWithTools AST#identifier#Right AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left apiStyle AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ApiStyle AST#identifier#Ri...
private emitStreamContentWithTools( apiStyle: ApiStyle, useOpenAIResponses: boolean, json: object, onData: (content: string) => void, onError: (error: string) => void, onReasoningData?: (content: string) => void, onImageData?: (base64Data: string, mimeType: string, isPartial: boolean) => v...
https://github.com/LongLiveY96/chatcube
325206dfab23bf37f47fd478b8017b4544d6996f
github
wuba/omni-ui
omni_component/src/main/ets/components/guide/core/Controller.ets
arkts
resetLabel
重置组件标签,即重置组件显示次数为0 @param 组件标签
public resetLabel(label?: string): void { if (!label) { if (this.builder) { label = this.builder.label; } else { label = ''; } } this.savePreferencesData(label, 0); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left resetLabel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left label AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right...
public resetLabel(label?: string): void { if (!label) { if (this.builder) { label = this.builder.label; } else { label = ''; } } this.savePreferencesData(label, 0); }
https://github.com/wuba/omni-ui
079c9808efb8fc11cc27eda736e0079436ffddb0
github
wblxr408/SEU-SE-HarmonyExpense-App-
entry/src/main/ets/common/utils/DAOHelper.ets
arkts
convertToUserSpendingBaseline
转换为UserSpendingBaseline
static convertToUserSpendingBaseline(resultSet: relationalStore.ResultSet): UserSpendingBaseline { const baseline = new UserSpendingBaseline(); baseline.baselineId = DAOHelper.getNumberValue(resultSet, 'baseline_id'); baseline.userId = DAOHelper.getNumberValue(resultSet, 'user_id'); baseline.avgDailyS...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left convertToUserSpendingBaseline AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resultSet AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right A...
static convertToUserSpendingBaseline(resultSet: relationalStore.ResultSet): UserSpendingBaseline { const baseline = new UserSpendingBaseline(); baseline.baselineId = DAOHelper.getNumberValue(resultSet, 'baseline_id'); baseline.userId = DAOHelper.getNumberValue(resultSet, 'user_id'); baseline.avgDailyS...
https://github.com/wblxr408/SEU-SE-HarmonyExpense-App-
12fe9948df1d4dc06ed940c0908c625c5fdc0126
github
who7708/harmonyos-codelabs
HmosWorld/features/mine/src/main/ets/model/UserModel.ets
arkts
getInstance
Get user model instance. @returns discover model instance.
public static getInstance(): UserModel { if (!AppStorage.get<UserModel>(USER_MODEL)) { AppStorage.setOrCreate(USER_MODEL, new UserModel()); } return AppStorage.get<UserModel>(USER_MODEL) as UserModel; }
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 getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L...
public static getInstance(): UserModel { if (!AppStorage.get<UserModel>(USER_MODEL)) { AppStorage.setOrCreate(USER_MODEL, new UserModel()); } return AppStorage.get<UserModel>(USER_MODEL) as UserModel; }
https://github.com/who7708/harmonyos-codelabs
0736e4301ec279ad44809802da3497414d1d92be
github
offlinecat-dev/OCNetORM
src/main/ets/query/QueryExecutor.ets
arkts
getPaginated
执行分页查询 返回分页结果,包含当前页数据、总数、页码、每页数量和总页数 @returns Promise<PaginatedResult> Requirements: 2.4, 2.5, 2.6
async getPaginated(): Promise<PaginatedResult> { return await this.withStoreLease(async () => { this.ensureEntityQueryMode('SELECT') const startTime = Date.now() const subQueryContext = this.createSubQueryExecutionContext() await DatabaseManager.getInstance().acquireQuerySlot() try {...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getPaginated 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 getPaginated(): Promise<PaginatedResult> { return await this.withStoreLease(async () => { this.ensureEntityQueryMode('SELECT') const startTime = Date.now() const subQueryContext = this.createSubQueryExecutionContext() await DatabaseManager.getInstance().acquireQuerySlot() try {...
https://github.com/offlinecat-dev/OCNetORM
5c0bcf84a3fe6dd5852896bae8075ca17cce55d7
github
ibestservices/ibest-ui
library/src/main/ets/components/dialog/index.ets
arkts
visibleChange
visible 变化
visibleChange() { if (this.visible) { this.open() } else { this.promptAction.closeCustomDialog(this.dialogId) } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left visibleChange 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...
visibleChange() { if (this.visible) { this.open() } else { this.promptAction.closeCustomDialog(this.dialogId) } }
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/dialog/index.ets#L318-L324
f675f69c6b084ceda6fcf6cef77ebf839ebdad45
github
lidaixian999/Smart_Car
entry/src/main/ets/model/SsapManager.ets
arkts
registerDeviceFoundCallback
注册设备发现回调
private registerDeviceFoundCallback(): void { try { scan.on('deviceFound', (data: Array<scan.ScanResults>) => { hilog.info(this.domainId, this.logTag, `Device found: ${data.length} devices`); data.forEach((device, index) => { console.log(`发现设备 ${index + 1}: 名称 = ${device.deviceNam...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left registerDeviceFoundCallback 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#R...
private registerDeviceFoundCallback(): void { try { scan.on('deviceFound', (data: Array<scan.ScanResults>) => { hilog.info(this.domainId, this.logTag, `Device found: ${data.length} devices`); data.forEach((device, index) => { console.log(`发现设备 ${index + 1}: 名称 = ${device.deviceNam...
https://github.com/lidaixian999/Smart_Car
f683e715e33a420bf35ae023cce13c4100cddfe7
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/WebViewImageLoader.ets
arkts
notifyLoadError
通知加载失败
private notifyLoadError(request: ImageRequestInfo, error: string): void { this.loadListeners.forEach(listener => { try { listener.onLoadError(request, error); } catch (error) { logger.error(TAG, `通知加载失败失败: ${error instanceof Error ? error.message : String(error)}`); } }); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left notifyLoadError AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left request AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier...
private notifyLoadError(request: ImageRequestInfo, error: string): void { this.loadListeners.forEach(listener => { try { listener.onLoadError(request, error); } catch (error) { logger.error(TAG, `通知加载失败失败: ${error instanceof Error ? error.message : String(error)}`); } }); }
https://github.com/DaLongZhuaZi/manxia
4af8fb046fb3ceaf8cacbb50889408c59ef5fbfb
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.ArrayList.ets
arkts
getLastIndexOf
Get the index of the specified element when it last appeared. @param element - the specified element. @returns the index if the specified element is included, otherwise, -1.
public getLastIndexOf(element: T): int { return this.buffer.findLastIndex((item: T): boolean => { return item == element; }) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getLastIndexOf 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 T AST#identifi...
public getLastIndexOf(element: T): int { return this.buffer.findLastIndex((item: T): boolean => { return item == element; }) }
https://gitcode.com/iop123123/arkts-static-skills
9945ad58609134b378d55a83bf3ddcd61773a15b
gitcode
CPF-ApplicationTPC/openharmony_tpc_samples
SwipeMenuListView/library/src/main/ets/utils/SwipeMenuListUtils.ets
arkts
getColor
获取颜色资源 @param context 上下文对象 @param resId 颜色资源ID @returns Promise<string> 颜色值(十六进制字符串)
public static async getColor(context: common.UIAbilityContext, resId: number): Promise<string> { try { return await context.resourceManager.getStringValue(resId); } catch (error) { logger.warn(`Failed to get color resource ${resId}:`, error); return '#000000'; } }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left getColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context A...
public static async getColor(context: common.UIAbilityContext, resId: number): Promise<string> { try { return await context.resourceManager.getStringValue(resId); } catch (error) { logger.warn(`Failed to get color resource ${resId}:`, error); return '#000000'; } }
https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples
48048dc5a680925ad7b864ab7a9f8865017c5f6e
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Short.ets
arkts
toByte
Returns value of this instance @returns { byte } value as short @syscap SystemCapability.Utils.Lang @FaAndStageModel
public override toByte(): byte { return (this.value).toByte(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left toByte AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left...
public override toByte(): byte { return (this.value).toByte(); }
https://gitcode.com/iop123123/arkts-static-skills
ab595878273cd2f9ae2cd0c1ba6cc3dd79355acd
gitcode
codelably/HCompass
core/network/src/main/ets/AxiosHttpClient.ets
arkts
delete
DELETE 请求 @param url 请求地址 @param options 请求选项 @returns 响应数据
async delete<T>(url: string, options?: RequestOptions): Promise<T> { this.logRequest('DELETE', url, options); const response: AxiosResponse<T> = await this.axiosInstance.delete<T>(url, { headers: options?.headers, timeout: options?.timeout, params: options?.params }); this.logRespons...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left delete AST#identifier#Right AST#type_parameters#Left AST#<#Left < AST#<#Right AST#type_parameter#Left AST#type_identifier#Left T AST#type_i...
async delete<T>(url: string, options?: RequestOptions): Promise<T> { this.logRequest('DELETE', url, options); const response: AxiosResponse<T> = await this.axiosInstance.delete<T>(url, { headers: options?.headers, timeout: options?.timeout, params: options?.params }); this.logRespons...
https://github.com/codelably/HCompass
2169ef73c2fcf5baa6f7cf9d1a92ec30c392293b
github
xblLab/HarmonyProjectTemplate
features/course/src/main/ets/viewmodels/Calendar.ets
arkts
getCalendar
获取指定年月的日历数据 @param year 年份 @param month 月份 (1-12) @returns 日历数据数组,包含前一个月和后一个月的补全日期
static getCalendar(year: number, month: number): CalendarItem[] { const calendar: CalendarItem[] = []; // 获取当前日期用于标记今天 const today = new Date(); const currentYear = today.getFullYear(); const currentMonth = today.getMonth() + 1; const currentDay = today.getDate(); // 获取当前月的第一天 const ...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getCalendar AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left year AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left numb...
static getCalendar(year: number, month: number): CalendarItem[] { const calendar: CalendarItem[] = []; // 获取当前日期用于标记今天 const today = new Date(); const currentYear = today.getFullYear(); const currentMonth = today.getMonth() + 1; const currentDay = today.getDate(); // 获取当前月的第一天 const ...
https://github.com/xblLab/HarmonyProjectTemplate
3d5a741008d9a4fbce12bbbc2d03911df902a187
github
openharmony/codelabs
Data/PersonalAssistantPro/entry/src/main/ets/common/utils/DateUtils.ets
arkts
getEndOfDay
获取今天的结束时间戳 (23:59:59)
public static getEndOfDay(timestamp: number = Date.now()): number { const date = new Date(timestamp); date.setHours(23, 59, 59, 999); return date.getTime(); }
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 getEndOfDay AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left timestamp AST#identifier#Right AST#:#Left :...
public static getEndOfDay(timestamp: number = Date.now()): number { const date = new Date(timestamp); date.setHours(23, 59, 59, 999); return date.getTime(); }
https://gitcode.com/openharmony/codelabs
25d2e9c6bbf1002525f9a2cabf9aa2f9dcc8d418
gitcode
LongLiveY96/chatcube
entry/src/main/ets/utils/SearchQueryUtils.ets
arkts
hasExplicitDateInQuery
搜索查询通用工具:用于统一查询清洗和时间归一。
function hasExplicitDateInQuery(text: string): boolean { return /(\d{4})[年\/\-.](\d{1,2})[月\/\-.]?(\d{1,2})日?/.test(text) }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left hasExplicitDateInQuery AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left text AST#identifier#Right AST#type_annotation#Left AST#:#Left :...
function hasExplicitDateInQuery(text: string): boolean { return /(\d{4})[年\/\-.](\d{1,2})[月\/\-.]?(\d{1,2})日?/.test(text) }
https://github.com/LongLiveY96/chatcube
0724330ffe28f525aab54836957a1c2be66e4b2d
github
openharmony/codelabs
ETSUI/LifeTrack/entry/src/main/ets/dao/EventDao.ets
arkts
deleteEventInstance
删除指定实例
async deleteEventInstance(instanceId: string): Promise<boolean> { const rdbStore = await this.initDatabase(); try { const predicates = new relationalStore.RdbPredicates('event_instances'); predicates.equalTo('id', instanceId); const deletedRows = await rdbStore.delete(predicates); re...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left deleteEventInstance AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left instanceId AST#identifier#Right AST#type_annotation#Left AS...
async deleteEventInstance(instanceId: string): Promise<boolean> { const rdbStore = await this.initDatabase(); try { const predicates = new relationalStore.RdbPredicates('event_instances'); predicates.equalTo('id', instanceId); const deletedRows = await rdbStore.delete(predicates); re...
https://gitcode.com/openharmony/codelabs
15f03acbaee9f63408a00ecd6299dea8c76af68e
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/Array.ets
arkts
constructor
TODO: make private Creates a new empty instance of Array
public constructor() { this.data = new T[0]; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { A...
public constructor() { this.data = new T[0]; }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
b9fca000a3e0812497d01d425824e4cd521e5a22
gitee
bhengubv/aether-protocol
harmonyos/teal/entry/src/main/ets/service/NearLinkTransportService.ets
arkts
assertAvailable
── Internal helpers ─────────────────────────────────────────────────────
private assertAvailable(caller: string): void { if (!this._available) { throw new Error( `Aether Teal NearLink is not available on this device (${caller}). ` + 'Requires HarmonyOS 5.0.1+ with NearLink silicon. Call probeAvailability() first.' ); } }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left assertAvailable AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left caller AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#...
private assertAvailable(caller: string): void { if (!this._available) { throw new Error( `Aether Teal NearLink is not available on this device (${caller}). ` + 'Requires HarmonyOS 5.0.1+ with NearLink silicon. Call probeAvailability() first.' ); } }
https://github.com/bhengubv/aether-protocol
b09d3479c65deae188fd9465c721f4962586a585
github
erosTeam/NextE
shared/src/main/ets/theme/ThemeConstants.ets
arkts
BRAND_PRIMARY
Brand — user-selectable accent (ThemeColorSettings). A getter so every reader re-reads the @Trace color and recolors when the user picks a new theme color; default 'system' returns $r('sys.color.brand').
static get BRAND_PRIMARY(): ResourceColor { return ThemeColorSettings.currentColor() }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left get AST#identifier#Right AST#call_expression#Left AST#identifier#Left BRAND_PRIMARY AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Le...
static get BRAND_PRIMARY(): ResourceColor { return ThemeColorSettings.currentColor() }
https://github.com/erosTeam/NextE
1353097f5a59e7067d0cb001fbbc74f86360178b
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/service/CryptoService.ets
arkts
ensureHuksKey
── v1: HUKS 兼容(仅解密旧文件)── 确保 HUKS 中存在 AES-256 密钥
private static async ensureHuksKey(): Promise<void> { try { const exists = await huks.isKeyItemExist(KEY_ALIAS, { properties: [] }); if (exists) return; } catch { // 密钥不存在 } const properties: huks.HuksParam[] = [ { tag: huks.HuksTag.HUKS_TAG_ALGORITHM, value: huks.HuksKeyAlg.H...
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 ensureHuksKey AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#argumen...
private static async ensureHuksKey(): Promise<void> { try { const exists = await huks.isKeyItemExist(KEY_ALIAS, { properties: [] }); if (exists) return; } catch { // 密钥不存在 } const properties: huks.HuksParam[] = [ { tag: huks.HuksTag.HUKS_TAG_ALGORITHM, value: huks.HuksKeyAlg.H...
https://github.com/AlkaidLab/moonlight-harmony
8167e514f33ee5c612b78832950286d8750ba493
github
tdcare/tdwebrtc
src/main/ets/MediaStream.ets
arkts
startVideoCapture
启动视频采集
public async startVideoCapture(): Promise<boolean> { LogUtil.info('[MediaStream] 开始启动视频采集'); // 先启动 Rust 层内部编码器 if (this.videoEncoderCreated) { const ok: boolean = WebRTC.startVideoEncoder(); LogUtil.info(`[MediaStream] Rust 视频编码器启动: ${ok}`); // H264 OH_AVCodec 是异步的,需要等待 Buffer 队列就绪...
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 startVideoCapture AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS...
public async startVideoCapture(): Promise<boolean> { LogUtil.info('[MediaStream] 开始启动视频采集'); // 先启动 Rust 层内部编码器 if (this.videoEncoderCreated) { const ok: boolean = WebRTC.startVideoEncoder(); LogUtil.info(`[MediaStream] Rust 视频编码器启动: ${ok}`); // H264 OH_AVCodec 是异步的,需要等待 Buffer 队列就绪...
https://github.com/tdcare/tdwebrtc
94cfe4d8b347a1ddf46eff8eebc0563e93e38ad6
github
openharmony-tpc/ohos_mpchart
library/src/main/ets/components/charts/RadarChartModel.ets
arkts
setWebAlpha
Sets the transparency (alpha) value for all web lines, default: 150, 255 = 100% opaque, 0 = 100% transparent @param alpha
public setWebAlpha(alpha: number): void { this.mWebAlpha = alpha; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setWebAlpha AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left alpha AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left num...
public setWebAlpha(alpha: number): void { this.mWebAlpha = alpha; }
https://gitee.com/openharmony-tpc/ohos_mpchart.git
9dc29ed7f858c9af22de3b3c694ac98ed515b0b6
gitee
aimilin6688/KeePassHO
entry/src/main/ets/storage/cache/CacheStorage.ets
arkts
closeFileSafely
安全关闭文件 @param file 文件对象,可为 null
private async closeFileSafely(file: fs.File | null): Promise<void> { if (file) { try { await fs.close(file.fd); } catch { // ignore } } }
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 closeFileSafely AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#member_expression#Left AST#identifier#Lef...
private async closeFileSafely(file: fs.File | null): Promise<void> { if (file) { try { await fs.close(file.fd); } catch { // ignore } } }
https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/cache/CacheStorage.ets#L199-L207
126567626e5065bc0bba1d00275b7ac1f162ee6a
github
miaochiahao/ark-ghidra
data/test_hap/arkts-decompile-test15_original_index.ets
arkts
testArrayFill
--- Array.fill ---
function testArrayFill(): string { let arr: number[] = new Array(5); for (let i: number = 0; i < arr.length; i++) { arr[i] = 0; } for (let i: number = 0; i < arr.length; i++) { arr[i] = i * 10; } return String(arr[0]) + ',' + String(arr[2]) + ',' + String(arr[4]); }
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testArrayFill AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_ty...
function testArrayFill(): string { let arr: number[] = new Array(5); for (let i: number = 0; i < arr.length; i++) { arr[i] = 0; } for (let i: number = 0; i < arr.length; i++) { arr[i] = i * 10; } return String(arr[0]) + ',' + String(arr[2]) + ',' + String(arr[4]); }
https://github.com/miaochiahao/ark-ghidra
853705306357ae1b46dc2aee1d15536d88463af3
github
offlinecat-dev/OCNetORM
src/main/ets/repository/TransactionOptions.ets
arkts
withRetry
创建带重试的事务选项 @param retries 重试次数 @param retryDelay 重试延迟(毫秒) @returns 带重试的事务选项
static withRetry(retries: number, retryDelay: number = 100): TransactionOptions { const options = new TransactionOptions() options.retries = retries options.retryDelay = retryDelay return options }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left withRetry AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left retries AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right...
static withRetry(retries: number, retryDelay: number = 100): TransactionOptions { const options = new TransactionOptions() options.retries = retries options.retryDelay = retryDelay return options }
https://github.com/offlinecat-dev/OCNetORM
3f9867ffc90b1fe17a99c30a3ef34a2c7bf98684
github
killetom/ktretrofit
ktretrofit/src/main/ets/retrofit/response/Response.ets
arkts
getNotNullBody
Get the response body, ensuring it is not null and the request was successful. @returns The non-null response body. @throws Error if the request was not successful or the body is null.
getNotNullBody(): T { if (!this.isSuccessful) { throw new Error(`Request failed with status code: ${this.code}, message: ${this.message}`); } if (this.body === null) { throw new Error('Response body is null'); } return this.body; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getNotNullBody 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 T AST#identifier#Right AST#ERROR#Right AST#stat...
getNotNullBody(): T { if (!this.isSuccessful) { throw new Error(`Request failed with status code: ${this.code}, message: ${this.message}`); } if (this.body === null) { throw new Error('Response body is null'); } return this.body; }
https://github.com/killetom/ktretrofit
10c6e1304eab163d946db821a5942fb842e99aac
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets
arkts
findLastIndex
Finds an index of the last element in the Uint32Array that satisfies the condition @param { function } fn - condition @returns { int } - the index of the last element that satisfies fn, -1 otherwise @syscap SystemCapability.Utils.Lang @FaAndStageModel
public findLastIndex(fn: (val: number, index: int, array: Uint32Array) => boolean): int { for (let i = this.lengthInt - 1; i >= 0; i--) { if (fn(this.getUnsafe(i).toDouble(), i, this)) { return i } } return -1 }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left findLastIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : ...
public findLastIndex(fn: (val: number, index: int, array: Uint32Array) => boolean): int { for (let i = this.lengthInt - 1; i >= 0; i--) { if (fn(this.getUnsafe(i).toDouble(), i, this)) { return i } } return -1 }
https://gitcode.com/iop123123/arkts-static-skills
e33e3a54b11375f99347ca5f6a6d65f61165b2ea
gitcode
killetom/ktretrofit
entry/src/main/ets/example/RetrofitConfigExample.ets
arkts
searchUsersExample
Example with query map
searchUsersExample(queryParams: Record<string, string>): User[] { try { const userService = this.createUserService(); const call = userService.searchUsers(queryParams); const response = call.execute(); console.log('Users search results:', response.body); return response.getNo...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left searchUsersExample AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left queryParams AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Le...
searchUsersExample(queryParams: Record<string, string>): User[] { try { const userService = this.createUserService(); const call = userService.searchUsers(queryParams); const response = call.execute(); console.log('Users search results:', response.body); return response.getNo...
https://github.com/killetom/ktretrofit
295593b4f7d8b9da7fbdac7e71a5f5e6ffda448f
github
XJTUWYD/ArkDiff
entry/src/main/ets/viewmodel/DiffSessionViewModel.ets
arkts
isLineInHighlightedBlock
判断某行是否属于当前高亮的差异块
isLineInHighlightedBlock(lineIndex: number): boolean { const block = this.getHighlightedBlock(); if (!block) return false; return lineIndex >= block.startIndex && lineIndex <= block.endLine; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isLineInHighlightedBlock AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left lineIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#...
isLineInHighlightedBlock(lineIndex: number): boolean { const block = this.getHighlightedBlock(); if (!block) return false; return lineIndex >= block.startIndex && lineIndex <= block.endLine; }
https://github.com/XJTUWYD/ArkDiff
7a447484097026b41aaffec0e61707a528d0c6bd
github
Gramony/Gramony
features/home/src/main/ets/viewmodel/Chat/AnimationProperties.ets
arkts
calculateData
获取需要跨节点迁移的组件的位置,及迁移前后节点的公共父节点的位置,用以计算做动画组件的动画参数
public calculateData(key: string): void { let clickedImageInfo = this.getRectInfoById(key); let rootStackInfo = this.getRectInfoById('rootStack'); this.positionX = px2vp(clickedImageInfo.left - rootStackInfo.left); this.positionY = px2vp(clickedImageInfo.top - rootStackInfo.top); this.calculatedTr...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left calculateData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left str...
public calculateData(key: string): void { let clickedImageInfo = this.getRectInfoById(key); let rootStackInfo = this.getRectInfoById('rootStack'); this.positionX = px2vp(clickedImageInfo.left - rootStackInfo.left); this.positionY = px2vp(clickedImageInfo.top - rootStackInfo.top); this.calculatedTr...
https://github.com/Gramony/Gramony
25254625b5543271709ff04849f3269c8a14102d
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/ArrayAsListInt.ets
arkts
reserve
Increases capacity if passed argument is greater than current capacity @param capacity
public reserve(capacity: int): void { if (this.data.length < capacity) { let newData : ValueArray<int> = new ValueArray<int>(capacity); for (let i = 0; i < this.curSize; ++i) { newData[i] = this.data[i]; } this.data = ne...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left reserve AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left capacity AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#R...
public reserve(capacity: int): void { if (this.data.length < capacity) { let newData : ValueArray<int> = new ValueArray<int>(capacity); for (let i = 0; i < this.curSize; ++i) { newData[i] = this.data[i]; } this.data = ne...
https://gitcode.com/iop123123/arkts-static-skills
d46b4de21fbe7eb107078d3e9f3e8f3c537b242e
gitcode
openharmony-tpc/ImageKnife
library/src/main/ets/utils/FileUtils.ets
arkts
writeData
异步向path写入数据 @param path 文件绝对路径 @param content 文件内容
async writeData(path: string, content: ArrayBuffer | string): Promise<boolean> { try { let fd = (await fs.open(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE)).fd let stat = await fs.stat(path) await fs.write(fd, content, { offset: stat.size }) await fs.close(fd) return true }...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left writeData AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left path AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:...
async writeData(path: string, content: ArrayBuffer | string): Promise<boolean> { try { let fd = (await fs.open(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE)).fd let stat = await fs.stat(path) await fs.write(fd, content, { offset: stat.size }) await fs.close(fd) return true }...
https://gitee.com/openharmony-tpc/ImageKnife.git
22b93b6d3f9b771218cffd2077e1c007091ca796
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
toString
Returns a string representation of the Int8Array @returns { string } - a string representation of the Int8Array @syscap SystemCapability.Utils.Lang @FaAndStageModel
public override toString(): string { return this.join(",") }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left toString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Le...
public override toString(): string { return this.join(",") }
https://gitcode.com/iop123123/arkts-static-skills
688868cbf04e1fd26b19091b76b5a51c2fcc69a7
gitcode
openharmony/applications_mms
entry/src/main/ets/pages/conversation/conversationController.ets
arkts
judgeSendBtnCanClicked
Check whether the sending icon can be highlighted.
judgeSendBtnCanClicked() { if (MmsPreferences.getInstance().haveSimCardReady() && (this.mmsEditList.length != 0 || this.textValue != common.string.EMPTY_STR || this.textareaDatasource.length !== 0)) { if (this.isNewMsg) { if ((this.receiveContactValue !== '' && this.isPhoneNumber(this.receiveC...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left judgeSendBtnCanClicked 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_b...
judgeSendBtnCanClicked() { if (MmsPreferences.getInstance().haveSimCardReady() && (this.mmsEditList.length != 0 || this.textValue != common.string.EMPTY_STR || this.textareaDatasource.length !== 0)) { if (this.isNewMsg) { if ((this.receiveContactValue !== '' && this.isPhoneNumber(this.receiveC...
https://gitee.com/openharmony/applications_mms.git
6ff32d51c9463193613f441ef136853674d77e05
gitee
offlinecat-dev/OCNetORM
src/main/ets/mapping/ResultSetUtils.ets
arkts
safeClose
安全关闭 ResultSet @param resultSet 结果集
static safeClose(resultSet: relationalStore.ResultSet | null): void { if (resultSet !== null) { try { resultSet.close() } catch (e) { // 忽略关闭错误 } } }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left safeClose AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resultSet AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression...
static safeClose(resultSet: relationalStore.ResultSet | null): void { if (resultSet !== null) { try { resultSet.close() } catch (e) { // 忽略关闭错误 } } }
https://github.com/offlinecat-dev/OCNetORM
f51b83edd3b680021fc546329d411bdc851bda3f
github
LJ666-ui/harmony-health-care
entry/src/main/ets/ar/VoiceGuide.ets
arkts
setPitch
设置音调 @param pitch 音调(0.5-2.0)
public setPitch(pitch: number): void { this.pitch = Math.max(0.5, Math.min(2.0, pitch)); console.log('[VoiceGuide] 音调:', this.pitch); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setPitch AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pitch AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number...
public setPitch(pitch: number): void { this.pitch = Math.max(0.5, Math.min(2.0, pitch)); console.log('[VoiceGuide] 音调:', this.pitch); }
https://github.com/LJ666-ui/harmony-health-care
3eea96cc8cb16547716a6e8922abb6980b49d41e
github
silence17/harmonydemo
common_lib/src/main/ets/utils/axios/HttpClient.ets
arkts
post
POST请求
post(postParam: RequestParam<T>) { this._processParam(postParam, "post"); return this._doPost(postParam) }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left post AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left postParam AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expression#Left AST#identifier#Le...
post(postParam: RequestParam<T>) { this._processParam(postParam, "post"); return this._doPost(postParam) }
https://github.com/silence17/harmonydemo
28630ec6889695eeedd7db37460f7006f34720e2
github
openharmony/codelabs
Card/MovieCard/entry/src/main/ets/common/utils/CommonUtils.ets
arkts
getListData
Get Movie data list. @return {listMovieData} return list movie data
getListData(): MovieDataBean[] { let listMovieData = GlobalContext.getContext().getObject('listMovieData') as MovieDataBean[]; if (this.isEmptyArr(listMovieData)) { listMovieData = MOVIE_LIST_DATA; GlobalContext.getContext().setObject('listMovieData', listMovieData); } return listMovieData...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getListData 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 MovieDataBean AST#identifier#Right AST#[#Left [ AS...
getListData(): MovieDataBean[] { let listMovieData = GlobalContext.getContext().getObject('listMovieData') as MovieDataBean[]; if (this.isEmptyArr(listMovieData)) { listMovieData = MOVIE_LIST_DATA; GlobalContext.getContext().setObject('listMovieData', listMovieData); } return listMovieData...
https://gitee.com/openharmony/codelabs.git
c6a983c1a0d2160ace3c71a2639aab2eb0d9e3eb
gitee
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.xml.ets
arkts
endElement
Handles the end of an XML element during parsing.
public endElement(): void { let stringBuilder = new StringBuilder(); if (this.type == XmlType.START_AND_ATTRIBUTES) { this.spliceNamespace(stringBuilder); stringBuilder.append('/>'); this.type = XmlType.OTHERS; this.depth--;...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left endElement 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#Rig...
public endElement(): void { let stringBuilder = new StringBuilder(); if (this.type == XmlType.START_AND_ATTRIBUTES) { this.spliceNamespace(stringBuilder); stringBuilder.append('/>'); this.type = XmlType.OTHERS; this.depth--;...
https://gitcode.com/iop123123/arkts-static-skills
b9121ba6e80523e1057805d02306b695201edb2e
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Managers/AppInitializationManager.ets
arkts
getState
获取当前状态(返回副本)
getState(): InitializationState { return { currentPhase: this.state.currentPhase, progress: this.state.progress, displayText: this.state.displayText, isCompleted: this.state.isCompleted, isFailed: this.state.isFailed, failedPhase: this.state.failedPhase, errorMessage: thi...
AST#program#Left AST#ERROR#Left 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 InitializationState AST#identifier#Right AST#ERROR#Ri...
getState(): InitializationState { return { currentPhase: this.state.currentPhase, progress: this.state.progress, displayText: this.state.displayText, isCompleted: this.state.isCompleted, isFailed: this.state.isFailed, failedPhase: this.state.failedPhase, errorMessage: thi...
https://github.com/DaLongZhuaZi/manxia
35fdee645b50f076ff71cfff13a23636ba66e351
github
HarmonyOS_Samples/MusicHome
features/recommendation/src/main/ets/util/RecommendDataUtil.ets
arkts
getRecommendPlaylists
Fetches recommendation playlists from the music DB and maps them to UI models. @returns Playlist card UI list for “For you” and similar strips.
public static getRecommendPlaylists(): RecommendCardUi[] { return MusicDbApi.getInstance().getRecommendPlaylists() .map((dto) => RecommendDataUtil.mapRecommendCardDtoToUi(dto)); }
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 getRecommendPlaylists AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Rig...
public static getRecommendPlaylists(): RecommendCardUi[] { return MusicDbApi.getInstance().getRecommendPlaylists() .map((dto) => RecommendDataUtil.mapRecommendCardDtoToUi(dto)); }
https://gitcode.com/HarmonyOS_Samples/MusicHome
6633d02301f9e1a0fb43053a08020723e8cc2b5e
gitcode
midori52000/ArkPilot
Agent/entry/src/main/ets/apim/ApiManagementService.ets
arkts
probeChatEndpoint
========== 端点测速 ==========
private async probeChatEndpoint( baseUrl: string, apiKey: string, model: string, wireApi: string ): Promise<ChatProbeResult> { const trimmedUrl = cleanBaseUrl(baseUrl); const effectiveModel: string = model.length > 0 ? model : 'gpt-4o-mini'; let chatUrl: string = ''; let body: string = ''; ...
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 probeChatEndpoint AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left baseUrl AST#identifier#Right AST#ERROR#Left AST#:#...
private async probeChatEndpoint( baseUrl: string, apiKey: string, model: string, wireApi: string ): Promise<ChatProbeResult> { const trimmedUrl = cleanBaseUrl(baseUrl); const effectiveModel: string = model.length > 0 ? model : 'gpt-4o-mini'; let chatUrl: string = ''; let body: string = ''; ...
https://github.com/midori52000/ArkPilot
697a0d86995d0be9b94a23c32d74c31ae3c84f68
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/WebView/MangaSourceSelectorEngine.ets
arkts
executeCSSSelector
执行CSS选择器
private async executeCSSSelector( selector: Selector, context: SelectorContext, executeJS: (script: string) => Promise<Object> ): Promise<SelectorResult> { // 类型守卫:确保是CSS选择器 if (selector.type !== SelectorType.CSS) { return { found: false, count: 0, error: 'Invalid s...
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 executeCSSSelector AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left selector AST#identifier#Right AST#...
private async executeCSSSelector( selector: Selector, context: SelectorContext, executeJS: (script: string) => Promise<Object> ): Promise<SelectorResult> { // 类型守卫:确保是CSS选择器 if (selector.type !== SelectorType.CSS) { return { found: false, count: 0, error: 'Invalid s...
https://github.com/DaLongZhuaZi/manxia
5dbc80d41a8ea8b8abba849303c764b0bb5717ab
github
webabcd/HarmonyDemo
entry/src/main/ets/pages/background/ReminderTaskDemo.ets
arkts
requestEnableNotification
请求通知授权
requestEnableNotification() { let context = getContext(this) as common.UIAbilityContext; // 判断是否有通知授权 notificationManager.isNotificationEnabled().then((isNotificationEnabled: boolean) => { this.message = `isNotificationEnabled: ${isNotificationEnabled}`; if (!isNotificationEnabled) { /...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left requestEnableNotification 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#statemen...
requestEnableNotification() { let context = getContext(this) as common.UIAbilityContext; // 判断是否有通知授权 notificationManager.isNotificationEnabled().then((isNotificationEnabled: boolean) => { this.message = `isNotificationEnabled: ${isNotificationEnabled}`; if (!isNotificationEnabled) { /...
https://github.com/webabcd/HarmonyDemo
0087e24430612d52b869760331b3b23054d5b4f0
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets
arkts
getChildElementsWithTag
获取子元素(带标签过滤)
private getChildElementsWithTag(element: string, tag: string): string[] { const innerHtml = this.extractInnerHtml(element); if (tag === '*') { return this.findDirectChildren(innerHtml); } return this.findDirectChildrenByTag(innerHtml, tag); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getChildElementsWithTag 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#string#Left string...
private getChildElementsWithTag(element: string, tag: string): string[] { const innerHtml = this.extractInnerHtml(element); if (tag === '*') { return this.findDirectChildren(innerHtml); } return this.findDirectChildrenByTag(innerHtml, tag); }
https://github.com/DaLongZhuaZi/manxia
bd093fb82b553a90c95936597fb2dfb1dcb332da
github
openharmony/applications_filepicker
entry/src/main/ets/base/utils/FilePickerUtil.ets
arkts
checkFileMimetype
校验选中的文件mimetype @param fileName 文件名称 @return 条件满足返回true
function checkFileMimetype(fileName: string, startModeOptions: StartModeOptions): boolean { if (!fileName) { return false; } let keyPickTypeList: string[] = startModeOptions.phonePickerTypeList; // 输入的类型全转换成小写,避免大小敏感问题 keyPickTypeList.forEach(item => item.toLowerCase()); // 类型列表为空或包含*或*/*时,可选择所有文件 if ...
AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left checkFileMimetype AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left fileName AST#identifier#Right AST#type_annotation#Left AST#:#Left : ...
function checkFileMimetype(fileName: string, startModeOptions: StartModeOptions): boolean { if (!fileName) { return false; } let keyPickTypeList: string[] = startModeOptions.phonePickerTypeList; // 输入的类型全转换成小写,避免大小敏感问题 keyPickTypeList.forEach(item => item.toLowerCase()); // 类型列表为空或包含*或*/*时,可选择所有文件 if ...
https://gitee.com/openharmony/applications_filepicker.git
85129cf672911dd0a5bd6d646aced507567cc8f2
gitee
Cool_foolisher1/ArkTSRepository
MultiCalculator/features/calculator/src/main/ets/components/Calculator.ets
arkts
aboutToDisappear
解除断点监听
aboutToDisappear() { breakpointSystem.unregister() }
AST#program#Left AST#expression_statement#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#expression_statement#Right AST#statement_block#L...
aboutToDisappear() { breakpointSystem.unregister() }
https://gitcode.com/Cool_foolisher1/ArkTSRepository
6f43eac13f58a29d4f9d9625d53c610d86adc819
gitcode
AGenUI/AGenUI
playground/harmony/entry/src/main/ets/utils/PlaygroundRuntimeLogger.ets
arkts
setLogCallback
Set the log callback for UI display
public setLogCallback(callback: (level: number, tag: string, func: string, line: number, message: string) => void): void { this.logCallback = callback; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left setLogCallback 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#...
public setLogCallback(callback: (level: number, tag: string, func: string, line: number, message: string) => void): void { this.logCallback = callback; }
https://github.com/AGenUI/AGenUI
0bbd72e4cd2958d117560dd15a13ab032d146e3d
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/utils/CryptoUtil.ets
arkts
buildTbsCertificate
构造 TBS Certificate
private static buildTbsCertificate( serialNumber: Uint8Array, notBefore: string, notAfter: string, cn: string, pubKeyDer: Uint8Array ): Uint8Array { // Version (v3 = 2) const versionInner = CryptoUtil.asn1Integer(new Uint8Array([2])); const version = new Uint8Array(1 + CryptoUtil.enc...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left buildTbsCertificate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left serialNumber AST#identifier#Right AST#ERROR#Lef...
private static buildTbsCertificate( serialNumber: Uint8Array, notBefore: string, notAfter: string, cn: string, pubKeyDer: Uint8Array ): Uint8Array { // Version (v3 = 2) const versionInner = CryptoUtil.asn1Integer(new Uint8Array([2])); const version = new Uint8Array(1 + CryptoUtil.enc...
https://github.com/AlkaidLab/moonlight-harmony
3202504ded7eece8505655ec8fdd8f1c421f3a80
github
jiahaozheng406/huawei-travel-app-HarmonyOS
entry/src/main/ets/common/constants/WaterFlowDataSource.ets
arkts
notifyDataAdd
通知控制器数据增加
notifyDataAdd(index: number): void { this.listeners.forEach(listener => { listener.onDataAdded(index) }) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left notifyDataAdd AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) ...
notifyDataAdd(index: number): void { this.listeners.forEach(listener => { listener.onDataAdded(index) }) }
https://github.com/jiahaozheng406/huawei-travel-app-HarmonyOS
0434e5e3cdcba61acbb77d1b0ef652eb5e0504b6
github
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/std/core/Console.ets
arkts
println
Prints a int to the console and puts newline @param i value to print
public println(i: int): void { this.print(i); this.println(); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left println AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left i AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left int AST#ide...
public println(i: int): void { this.print(i); this.println(); }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
eec6e00ec036d6a72ecfad951a9dbcfa68a7cf25
gitee
LJ666-ui/harmony-health-care
entry/src/main/ets/smartward/core/checkers/TimeChecker.ets
arkts
getInstance
获取时间检测器单例实例
public static getInstance(): TimeChecker { if (!TimeChecker.instance) { TimeChecker.instance = new TimeChecker(); } return TimeChecker.instance; }
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 getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L...
public static getInstance(): TimeChecker { if (!TimeChecker.instance) { TimeChecker.instance = new TimeChecker(); } return TimeChecker.instance; }
https://github.com/LJ666-ui/harmony-health-care
879325abe5af9d6eb4e875d9662f2a9e135ea4c2
github
AlkaidLab/moonlight-harmony
entry/src/main/ets/utils/HttpClient.ets
arkts
postBinary
执行 POST 请求(二进制 body)。
static async postBinary(url: string, body: ArrayBuffer | Uint8Array, config?: HttpClientConfig): Promise<HttpResponse> { const connectTimeout = config?.connectTimeout ?? HttpClient.DEFAULT_CONNECT_TIMEOUT; const transferTimeout = config?.transferTimeout ?? HttpClient.DEFAULT_TRANSFER_TIMEOUT; const skipVa...
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 postBinary AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#R...
static async postBinary(url: string, body: ArrayBuffer | Uint8Array, config?: HttpClientConfig): Promise<HttpResponse> { const connectTimeout = config?.connectTimeout ?? HttpClient.DEFAULT_CONNECT_TIMEOUT; const transferTimeout = config?.transferTimeout ?? HttpClient.DEFAULT_TRANSFER_TIMEOUT; const skipVa...
https://github.com/AlkaidLab/moonlight-harmony
700d4df59ee15df1959958993813ffd5b629ec5c
github
richshaw2015/nds
ohos/entry/src/main/ets/types/MelonDSNative.ets
arkts
clearCheats
清除所有金手指
static clearCheats(): boolean { return MelonDSNative.native.clearCheats(); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left clearCheats 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#b...
static clearCheats(): boolean { return MelonDSNative.native.clearCheats(); }
https://github.com/richshaw2015/nds
cc5e6a5104aa1f3904d5f7f5018dd1c352e5fcd2
github
xiaofenger_705/protobuf-arkts-generator
runtime/arkpb/Reader.ets
arkts
sint32
Read sint32 (zigzag)
sint32(): number { const v = this.uint32(); return (v >>> 1) ^ (-(v & 1)) }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left sint32 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_block...
sint32(): number { const v = this.uint32(); return (v >>> 1) ^ (-(v & 1)) }
https://gitcode.com/xiaofenger_705/protobuf-arkts-generator
70ebf5359146ca1cce1eebb3acf6c336f0f38ac7
gitcode
HarmonyCandies/image_cropper
image_cropper/src/main/ets/model/Geometry.ets
arkts
shortestSide
Shortest and longest sides
get shortestSide(): number { return Math.min(Math.abs(this.width), Math.abs(this.height)); }
AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left shortestSide 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#Righ...
get shortestSide(): number { return Math.min(Math.abs(this.width), Math.abs(this.height)); }
https://github.com/HarmonyCandies/image_cropper/blob/dd3664946b413166307b736a5763f998084364e1/image_cropper/src/main/ets/model/Geometry.ets#L220-L222
c22ce6b6512319ac7b69ee197df2963506d221e9
github
openharmony-sig/fluttertpc_qr_code_scanner
ohos/ohos/src/main/ets/components/plugin/libs/CameraService.ets
arkts
isTorchModeSupported
支持设置手电筒
isTorchModeSupported(torchMode: camera.TorchMode): boolean { let isSupported = this.cameraManager!.isTorchModeSupported(torchMode); return isSupported; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isTorchModeSupported AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left torchMode AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left camera AST#identifi...
isTorchModeSupported(torchMode: camera.TorchMode): boolean { let isSupported = this.cameraManager!.isTorchModeSupported(torchMode); return isSupported; }
https://gitee.com/openharmony-sig/fluttertpc_qr_code_scanner.git
3c9bae0004bf93940db0998ed0797538c8e7f9ff
gitee
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/String.ets
arkts
concat
concat @param { String } s1 @param { String } s2 @param { String } s3 @returns { String } @syscap SystemCapability.Utils.Lang @FaAndStageModel
public concat(s1: String, s2: String, s3: String): String { return String.concat4(this, s1, s2, s3); }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left concat AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left s1 AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left String AST#...
public concat(s1: String, s2: String, s3: String): String { return String.concat4(this, s1, s2, s3); }
https://gitcode.com/iop123123/arkts-static-skills
cd5b36a9c0f788c481d3a722133d69825980f99a
gitcode
openharmony/arkui_ace_engine
examples/ComponentSnapshot/entry/src/main/ets/common/ImageUtils.ets
arkts
getSnapshotArea
[Start get_snapshot_area] Read the screenshot PixelMap object into the buffer area @param {PixelMap} pixelMap - Screenshot PixelMap @param {number[]} scrollYOffsets - Component scrolls an array of y-axis offsets @param {number} listWidth - List component width @param {number} listHeight - List component height @returns...
static async getSnapshotArea(pixelMap: PixelMap, scrollYOffsets: number[], listWidth: number, listHeight: number): Promise<image.PositionArea>{ // Gets the number of bytes per line of image pixels. let stride = pixelMap.getBytesNumberPerRow(); // Get the total number of bytes of image pixels. let ...
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 getSnapshotArea AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pixelMap AST#identifier#Right AST#:#Left...
static async getSnapshotArea(pixelMap: PixelMap, scrollYOffsets: number[], listWidth: number, listHeight: number): Promise<image.PositionArea>{ // Gets the number of bytes per line of image pixels. let stride = pixelMap.getBytesNumberPerRow(); // Get the total number of bytes of image pixels. let ...
https://gitcode.com/openharmony/arkui_ace_engine
0345f2f5dfba284f25d74c5d198fb65c570e2fc2
gitcode
webabcd/HarmonyDemo
entry/src/main/ets/pages/security/CryptoDemo.ets
arkts
getHmacSymKey
将 hmac 的秘钥数据转为 cryptoFramework.SymKey 对象
public static getHmacSymKey(keyData: Uint8Array): cryptoFramework.SymKey { let symKeyBlob: cryptoFramework.DataBlob = { data: keyData }; let symKeyGenerator = cryptoFramework.createSymKeyGenerator('HMAC'); let symKey = symKeyGenerator.convertKeySync(symKeyBlob); return symKey }
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 getHmacSymKey AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left keyData AST#identifier#Right AST#:#Left :...
public static getHmacSymKey(keyData: Uint8Array): cryptoFramework.SymKey { let symKeyBlob: cryptoFramework.DataBlob = { data: keyData }; let symKeyGenerator = cryptoFramework.createSymKeyGenerator('HMAC'); let symKey = symKeyGenerator.convertKeySync(symKeyBlob); return symKey }
https://github.com/webabcd/HarmonyDemo
297602e932bd11c2d6077cd74fb42e8817bee293
github
Mydstiny/RemoteDeskHarmonyOS
entry/src/main/ets/services/DataCrypto.ets
arkts
lock
清除内存 DEK (切后台时调用) — 保留云端盐值+验证器, 回前台后可解锁恢复
lock(): void { if (this.dek) { this.dek.fill(0); // 覆写内存 } this.dek = null; this.ready = false; hilog.info(DOMAIN, TAG, 'DEK 已清除 (lock)'); }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left lock AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#v...
lock(): void { if (this.dek) { this.dek.fill(0); // 覆写内存 } this.dek = null; this.ready = false; hilog.info(DOMAIN, TAG, 'DEK 已清除 (lock)'); }
https://github.com/Mydstiny/RemoteDeskHarmonyOS
8be5c77d9c65e46cfd40e301d482ac08224cb900
github
tdcare/tdwebrtc
src/main/ets/WebRTCManager.ets
arkts
codecToMime
将编解码器名称转换为 MIME 类型
public codecToMime(kind: string, codec: string): string { if (kind === 'video') { if (codec === 'VP8') return 'video/VP8'; if (codec === 'VP9') return 'video/VP9'; if (codec === 'H264') return 'video/H264'; if (codec === 'H265') return 'video/H265'; return `video/${codec}`; } ...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left codecToMime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left kind AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left stri...
public codecToMime(kind: string, codec: string): string { if (kind === 'video') { if (codec === 'VP8') return 'video/VP8'; if (codec === 'VP9') return 'video/VP9'; if (codec === 'H264') return 'video/H264'; if (codec === 'H265') return 'video/H265'; return `video/${codec}`; } ...
https://github.com/tdcare/tdwebrtc
d69c2e680667c95941721d91fb441e2628859003
github
openharmony/update_update_app
feature/ota/src/main/ets/manager/OtaUpdateManager.ets
arkts
handleWant
处理推送消息 @param want 推送数据 @param context 上下文
public async handleWant(want: Want, context: common.Context): Promise<void> { let action: string = want?.action ?? ''; if (await NotificationManager.handleAction(action, context)) { this.log('handleWant:' + FormatUtils.stringify(want)); return; } let eventInfo = this.wantParser(want); ...
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 handleWant AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#...
public async handleWant(want: Want, context: common.Context): Promise<void> { let action: string = want?.action ?? ''; if (await NotificationManager.handleAction(action, context)) { this.log('handleWant:' + FormatUtils.stringify(want)); return; } let eventInfo = this.wantParser(want); ...
https://gitee.com/openharmony/update_update_app.git
8330c3432d1d765c8464efc4892a155ca84b32f5
gitee
Countly/countly-sdk-hos
library/src/main/ets/internal/RequestQueue.ets
arkts
classify
Decide what to do with a completed HTTP response: 'success', 2xx — for the ingest `/i` endpoint the body MUST contain `{"result": "Success"}` (a 2xx without it is a broken proxy; dropping prevents infinite retry). Every other endpoint (`/o/sdk*`, `/feedback/widget`) returns arbitrary application payload (RC values, SBS...
private static classify(logger: Logger, endpoint: string, result: HttpResult): string { const code: number = result.statusCode; if (code >= 200 && code < 300) { // Strict body validation ONLY for the ingest endpoint. Other // endpoints carry arbitrary application data in the response. if (en...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left classify AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left logger AST#identifier#Right AST#:#Left : AS...
private static classify(logger: Logger, endpoint: string, result: HttpResult): string { const code: number = result.statusCode; if (code >= 200 && code < 300) { // Strict body validation ONLY for the ingest endpoint. Other // endpoints carry arbitrary application data in the response. if (en...
https://github.com/Countly/countly-sdk-hos
fcebda0d6981357dc45df78fc3f8ba159f0e7de2
github
richshaw2015/nds
ohos/entry/src/main/ets/utils/LayoutConfigManager.ets
arkts
hasVariantForOrientation
检查布局配置是否有指定方向的已保存变体 用于 GameView 判断是否应使用内置布局而非生成默认布局
hasVariantForOrientation(config: LayoutConfiguration, orientation: Orientation): boolean { const keys = Object.keys(config.layoutVariants); for (const k of keys) { const v = keyToVariant(k); if (v && v.orientation === orientation) return true; } return false; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasVariantForOrientation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left LayoutConfiguration AST#ident...
hasVariantForOrientation(config: LayoutConfiguration, orientation: Orientation): boolean { const keys = Object.keys(config.layoutVariants); for (const k of keys) { const v = keyToVariant(k); if (v && v.orientation === orientation) return true; } return false; }
https://github.com/richshaw2015/nds
e445b1087c5ac5b6bf038152ffda799b472ccc6a
github
youyeyejie/ZhiXing_ActHub
entry/src/main/ets/core/services/FocusTimerEngine.ets
arkts
getFormattedRemainingTime
获取格式化的剩余时间字符串 (例如 "25:00")
getFormattedRemainingTime(): string { const minutes = Math.floor(this.remainingSeconds / 60); const seconds = this.remainingSeconds % 60; return `${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`; }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getFormattedRemainingTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right ...
getFormattedRemainingTime(): string { const minutes = Math.floor(this.remainingSeconds / 60); const seconds = this.remainingSeconds % 60; return `${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`; }
https://github.com/youyeyejie/ZhiXing_ActHub/blob/869a378eba0782e97a38aecf259bce457d267b44/entry/src/main/ets/core/services/FocusTimerEngine.ets#L273-L277
4441a61a37cb88fbac4441f6b69ef81fc03d2fb4
github
iop123123/arkts-static-skills
cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.uri.ets
arkts
encodedAuthority
Sets the encoded authority component from this URI. @param { string } input
set encodedAuthority(input: string) { this.uriEntry.setAuthority(input); }
AST#program#Left AST#ERROR#Left AST#set#Left set AST#set#Right AST#call_expression#Left AST#identifier#Left encodedAuthority AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left input AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string ...
set encodedAuthority(input: string) { this.uriEntry.setAuthority(input); }
https://gitcode.com/iop123123/arkts-static-skills
3acbff24228194dfe77b8fcc9b87330c02b8cbb0
gitcode
AlkaidLab/moonlight-harmony
entry/src/main/ets/utils/BackgroundImageUtil.ets
arkts
preloadAndCacheImage
预加载并缓存当前背景图数据 优先从本地缓存文件读取,确保下载保存的图片与显示的一致
async preloadAndCacheImage(): Promise<void> { try { // 优先从本地缓存文件读取 if (this.localCachePath) { try { const stat = fileIo.statSync(this.localCachePath); if (stat && stat.size > 0) { const file = fileIo.openSync(this.localCachePath, fileIo.OpenMode.READ_ONLY); ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left preloadAndCacheImage AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST...
async preloadAndCacheImage(): Promise<void> { try { // 优先从本地缓存文件读取 if (this.localCachePath) { try { const stat = fileIo.statSync(this.localCachePath); if (stat && stat.size > 0) { const file = fileIo.openSync(this.localCachePath, fileIo.OpenMode.READ_ONLY); ...
https://github.com/AlkaidLab/moonlight-harmony
c3dc7ca7c1ed42d2ac3465f60cbc0e711dc02150
github
PollenWang6/HiXD
entry/src/main/ets/services/AttendanceService.ets
arkts
stripTags
去掉 HTML 标签辅助
private stripTags(s: string): string { return s.replace(/<[^>]+>/g, '').trim(); }
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left stripTags AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left s AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string...
private stripTags(s: string): string { return s.replace(/<[^>]+>/g, '').trim(); }
https://github.com/PollenWang6/HiXD
195c68e4f947c36c6921334797024fd2de57549d
github
arkui-x/samples
CodeLab/Cases/feature/imageviewer/src/main/ets/view/PicturePreviewImage.ets
arkts
setCurrentOffsetXY
设置对应轴方向的数据
setCurrentOffsetXY(direction: ImageFitType.TYPE_WIDTH | ImageFitType.TYPE_HEIGHT, offset: number) { if (direction === ImageFitType.TYPE_WIDTH) { this.imageOffsetInfo.currentX = offset; } else { this.imageOffsetInfo.currentY = offset; } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setCurrentOffsetXY AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left direction AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#member...
setCurrentOffsetXY(direction: ImageFitType.TYPE_WIDTH | ImageFitType.TYPE_HEIGHT, offset: number) { if (direction === ImageFitType.TYPE_WIDTH) { this.imageOffsetInfo.currentX = offset; } else { this.imageOffsetInfo.currentY = offset; } }
https://gitcode.com/arkui-x/samples
967e8788e854f80ba96f954157b4568bca0612bf
gitcode
openharmony/applications_calendar_data
datamanager/src/main/ets/processor/alerts/AlertsObserver.ets
arkts
getAlertTimerId
返回上一次定时器的ID
public getAlertTimerId(): number { return this.mAlertTimerId; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getAlertTimerId 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...
public getAlertTimerId(): number { return this.mAlertTimerId; }
https://gitee.com/openharmony/applications_calendar_data.git
879a6c3777a65dadf2804fb3f4f459c0787c5a4b
gitee
ibestservices/ibest-ui
library/src/main/ets/components/pickerGroup/index.ets
arkts
onConfirmClick
确认按钮点击
onConfirmClick(){ if(this.nextStepText && this.swiperIndex < this.tabsList.length - 1){ this.currentName = this.swiperIndex+1 this.tabChange(this.swiperIndex+1) }else{ this.onConfirm() } }
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onConfirmClick 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...
onConfirmClick(){ if(this.nextStepText && this.swiperIndex < this.tabsList.length - 1){ this.currentName = this.swiperIndex+1 this.tabChange(this.swiperIndex+1) }else{ this.onConfirm() } }
https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/pickerGroup/index.ets#L90-L97
457930805cb80e9c310bb81b99d9179a9fec672f
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Source/SuwayomiSource.ets
arkts
sortMangas
本地排序漫画列表
private sortMangas(mangas: ComicInfo[], sortType: MangaSortType, sortDirection: SortDirection): ComicInfo[] { const sorted = [...mangas]; const multiplier = sortDirection === 'ASC' ? 1 : -1; sorted.sort((a: ComicInfo, b: ComicInfo): number => { // 转换为扩展接口获取排序数据 const extA = a as SuwayomiComic...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left sortMangas AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left mangas AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expres...
private sortMangas(mangas: ComicInfo[], sortType: MangaSortType, sortDirection: SortDirection): ComicInfo[] { const sorted = [...mangas]; const multiplier = sortDirection === 'ASC' ? 1 : -1; sorted.sort((a: ComicInfo, b: ComicInfo): number => { // 转换为扩展接口获取排序数据 const extA = a as SuwayomiComic...
https://github.com/DaLongZhuaZi/manxia
692a0080aceca87a407bca9c114a24009784255c
github
LJ666-ui/harmony-health-care
entry/src/main/ets/common/utils/HttpUtil.ets
arkts
getAdminToken
获取管理员Token 管理员使用独立的Token存储,避免与普通用户Token混淆
static getAdminToken(): string | null { try { const tokenFromAppStorage: string | undefined = AppStorage.get<string>('adminToken'); if (tokenFromAppStorage && tokenFromAppStorage.length > 0) { return tokenFromAppStorage; } return null; } catch (error) { console.error('[Ht...
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getAdminToken AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left A...
static getAdminToken(): string | null { try { const tokenFromAppStorage: string | undefined = AppStorage.get<string>('adminToken'); if (tokenFromAppStorage && tokenFromAppStorage.length > 0) { return tokenFromAppStorage; } return null; } catch (error) { console.error('[Ht...
https://github.com/LJ666-ui/harmony-health-care
51f8eeff6f885ce746617e1f8e2c7b501a5df7bf
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
fill
Fills the Float32Array with specified value @param { number } 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 Float32Array @syscap SystemCapability.Utils.Lang @FaAndStageModel
public fill(value: number, start?: int, end?: int): this { this.fill(value.toFloat(), start, end) 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#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERR...
public fill(value: number, start?: int, end?: int): this { this.fill(value.toFloat(), start, end) return this }
https://gitcode.com/iop123123/arkts-static-skills
22259ba707e120a6bc896e4a1d3b1f4a6790a0d9
gitcode
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedArrays.ets
arkts
with
Creates a copy with replaced value on index @param index @param value @returns an BigInt64Array with replaced value on index
public with(index: number, value: BigInt): BigInt64Array { return this.with(index as int, value.getLong()) }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#ERROR#Right AST#with_statement#Left AST#with#Left with AST#with#Right AST#parenthesized_expression#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST...
public with(index: number, value: BigInt): BigInt64Array { return this.with(index as int, value.getLong()) }
https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git
82c2535be5bf4dc5381f014479b46b590c91d40b
gitee
openharmony/codelabs
ETSUI/LifeHub/entry/src/main/ets/model/LifeHubData.ets
arkts
addTag
==================== 标签模块方法 ====================
async addTag(tag: Tag): Promise<number> { await this.ensureDatabaseReady(); if (!this.rdbStore) { throw new Error('数据库未初始化'); } const valuesBucket: relationalStore.ValuesBucket = { name: tag.name, color: tag.color, category: tag.category, createTime: tag.createTime || Da...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left addTag AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left tag AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Rig...
async addTag(tag: Tag): Promise<number> { await this.ensureDatabaseReady(); if (!this.rdbStore) { throw new Error('数据库未初始化'); } const valuesBucket: relationalStore.ValuesBucket = { name: tag.name, color: tag.color, category: tag.category, createTime: tag.createTime || Da...
https://gitcode.com/openharmony/codelabs
51df6a7611abfd239052b71153116e49da27bac0
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Jsonx.ets
arkts
setBigInt
Sets a current JsonElement to a bigint value.
setBigInt(value: bigint): void { this.setUndefined() this.maybeBigIntValue = value }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setBigInt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left bigint AST#identifier#Right AST#)#Left ) AST#...
setBigInt(value: bigint): void { this.setUndefined() this.maybeBigIntValue = value }
https://gitcode.com/iop123123/arkts-static-skills
88397a49e4ab7f57946d55baaa9332a598803fe3
gitcode
openharmony-sig/flutter_engine
shell/platform/ohos/flutter_embedding/flutter/src/main/ets/util/ByteBuffer.ets
arkts
setString
Sets a string. @param byteOffset The byte offset. @param value The string. @param byteEncoding The byte encoding. @returns The byte length.
setString(byteOffset: number, value: string, byteEncoding?: string, write?: boolean): number { if (byteEncoding && byteEncoding !== "utf-8") { throw new TypeError("String encoding '" + byteEncoding + "' is not supported") } const encoder = new util.TextEncoder() const byteLength = Math.min(this....
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left byteOffset AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , AST#,#R...
setString(byteOffset: number, value: string, byteEncoding?: string, write?: boolean): number { if (byteEncoding && byteEncoding !== "utf-8") { throw new TypeError("String encoding '" + byteEncoding + "' is not supported") } const encoder = new util.TextEncoder() const byteLength = Math.min(this....
https://gitee.com/openharmony-sig/flutter_engine.git
c00b3a129f543e63aa82021b194214c4dd44358e
gitee
openharmony-sig/arkcompiler_runtime_core
plugins/ets/stdlib/escompat/TypedUArrays.ets
arkts
some
/ === with element lambda functions === Checks that at least one element of Uint8Array satisfies the passed function @param fn check function @returns true if some element satisfies fn
public some(fn: (element: number, index: int, array: Uint8Array) => 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: Uint8Array) => 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
6d184c9ad67b16c4613bd8d88f2b483a4b4f9596
gitee
lidaixian999/Smart_Car
entry/src/main/ets/model/SsapManager.ets
arkts
setPropertyNotification
设置属性通知
public setPropertyNotification(): Promise<void> { return new Promise((resolve, reject) => { if (!this.client) { const errorMsg = 'Client not initialized'; hilog.error(this.domainId, this.logTag, errorMsg); reject(new Error(errorMsg)); return; } hilog.info(this.do...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setPropertyNotification AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#instantiation_...
public setPropertyNotification(): Promise<void> { return new Promise((resolve, reject) => { if (!this.client) { const errorMsg = 'Client not initialized'; hilog.error(this.domainId, this.logTag, errorMsg); reject(new Error(errorMsg)); return; } hilog.info(this.do...
https://github.com/lidaixian999/Smart_Car
00878738f4aeddce1fff799048a8f692cf340f66
github
CLMC2025/Vignette
entry/src/main/ets/database/repositories/WordRepository.ets
arkts
getLearningWords
Get learning/relearning words
async getLearningWords(limit: number, excludeWord: string): Promise<WordItem[]> { this.ensureInitialized(); const now = Date.now(); // 1 minute cooldown for learning steps const cooldownMs = 60 * 1000; const predicates = new relationalStore.RdbPredicates(TABLE_WORDS); predicates.notEqual...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getLearningWords AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left l...
async getLearningWords(limit: number, excludeWord: string): Promise<WordItem[]> { this.ensureInitialized(); const now = Date.now(); // 1 minute cooldown for learning steps const cooldownMs = 60 * 1000; const predicates = new relationalStore.RdbPredicates(TABLE_WORDS); predicates.notEqual...
https://github.com/CLMC2025/Vignette
a811c8ae7e3d55fd8719cfcd606b6f471fa770da
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets
arkts
toSorted
Creates a sorted copy @returns { BigInt64Array } - a sorted copy @syscap SystemCapability.Utils.Lang @FaAndStageModel
public toSorted(): BigInt64Array { return new BigInt64Array(this).sort() }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toSorted AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left BigInt64Array...
public toSorted(): BigInt64Array { return new BigInt64Array(this).sort() }
https://gitcode.com/iop123123/arkts-static-skills
7384b5588eec1f2638499f5506df5a6f939c2d83
gitcode
LongLiveY96/chatcube
entry/src/main/ets/services/AIApiService.ets
arkts
getAccumulatedToolCalls
获取累积的工具调用(流式响应完成后调用)
getAccumulatedToolCalls(): ToolCall[] { const result: ToolCall[] = [] this.streamToolCalls.forEach((toolCall, index) => { const normalizedId = this.normalizeToolCallId(toolCall.id, index) const normalizedName = this.normalizeToolFunctionName(toolCall.functionName) const normalizedArgs = this...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getAccumulatedToolCalls 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 ToolCall AST#identifier...
getAccumulatedToolCalls(): ToolCall[] { const result: ToolCall[] = [] this.streamToolCalls.forEach((toolCall, index) => { const normalizedId = this.normalizeToolCallId(toolCall.id, index) const normalizedName = this.normalizeToolFunctionName(toolCall.functionName) const normalizedArgs = this...
https://github.com/LongLiveY96/chatcube
ed5645ab07510069228a64c64aee2038ec5fce5b
github
HarmonyOS_Samples/BestPracticeSnippets
ScreenFlickerSolution/entry/src/main/ets/pages/ClickError.ets
arkts
build
Control zoom
build() { Stack() { Stack() { Text('click') .fontSize(45) .fontColor(Color.White) } .borderRadius(50) .width(100) .height(100) .backgroundColor('#e6cfe6') .scale({ x: this.scaleValue, y: this.scaleValue }) .onClick(() => { // When...
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST...
build() { Stack() { Stack() { Text('click') .fontSize(45) .fontColor(Color.White) } .borderRadius(50) .width(100) .height(100) .backgroundColor('#e6cfe6') .scale({ x: this.scaleValue, y: this.scaleValue }) .onClick(() => { // When...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
d510819898d42aa8a41c097a4569919da75c2883
gitcode
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Cache/SmartPreloadStrategy.ets
arkts
getPreloadRange
获取预加载范围(供MangaViewer使用)
public getPreloadRange(isWebtoon: boolean): number { const config = this.configManager.getPreloadConfig(); if (!config.enabled) { return 0; } // 条漫模式使用配置的条漫范围 if (isWebtoon) { return config.rangeWebtoon; } // 普通模式使用智能策略的向前范围 return this.currentStrategy.forwar...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getPreloadRange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isWebtoon AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#bo...
public getPreloadRange(isWebtoon: boolean): number { const config = this.configManager.getPreloadConfig(); if (!config.enabled) { return 0; } // 条漫模式使用配置的条漫范围 if (isWebtoon) { return config.rangeWebtoon; } // 普通模式使用智能策略的向前范围 return this.currentStrategy.forwar...
https://github.com/DaLongZhuaZi/manxia
c24982a314fb3683a1704e6a438dd8ce6b338cb2
github
DaLongZhuaZi/manxia
entry/src/main/ets/Framework/Novel/NovelLoginManager.ets
arkts
buildCookieLookupCandidates
构建Cookie查找候选ID(兼容带附加标识的书源ID)
private buildCookieLookupCandidates(sourceId: string): string[] { const candidates: string[] = []; this.pushUniqueCandidate(candidates, sourceId.trim()); const normalizedSourceId = this.normalizeSourceId(sourceId); this.pushUniqueCandidate(candidates, normalizedSourceId); const domainOnlyId = th...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildCookieLookupCandidates AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left s...
private buildCookieLookupCandidates(sourceId: string): string[] { const candidates: string[] = []; this.pushUniqueCandidate(candidates, sourceId.trim()); const normalizedSourceId = this.normalizeSourceId(sourceId); this.pushUniqueCandidate(candidates, normalizedSourceId); const domainOnlyId = th...
https://github.com/DaLongZhuaZi/manxia
9bab718a4055ea337658ecb31904f69d699adc1c
github
Joker-x-dev/CoolMallArkTS
core/database/src/main/ets/datasource/cart/CartLocalDataSourceImpl.ets
arkts
parseSpecs
解析规格 JSON 字符串为规格列表 @param {string | undefined} specJson 规格 JSON @returns {CartGoodsSpec[]} 规格列表
private parseSpecs(specJson?: string): CartGoodsSpec[] { if (!specJson) { return []; } try { const raw: CartGoodsSpec[] | undefined = JSON.parse(specJson) as CartGoodsSpec[]; if (Array.isArray(raw)) { return raw.map((item: CartGoodsSpec) => new CartGoodsSpec(item as Partial<CartG...
AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseSpecs AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left specJson AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#strin...
private parseSpecs(specJson?: string): CartGoodsSpec[] { if (!specJson) { return []; } try { const raw: CartGoodsSpec[] | undefined = JSON.parse(specJson) as CartGoodsSpec[]; if (Array.isArray(raw)) { return raw.map((item: CartGoodsSpec) => new CartGoodsSpec(item as Partial<CartG...
https://github.com/Joker-x-dev/CoolMallArkTS
ff4505a490516707fd449825cc84ed46b9a6c4e1
github
HarmonyOS_Samples/BestPracticeSnippets
HDRVivid/AVPlayer/MediaService/src/main/ets/controller/AvPlayerController.ets
arkts
playVideo
[Start set_video]
public playVideo() { // [StartExclude set_video] if (this.avPlayer) { if (this.avPlayer.state !== AVPlayerState.PREPARED && this.avPlayer.state !== AVPlayerState.PAUSED && this.avPlayer.state !== AVPlayerState.COMPLETED) { return; } this.avSessionController.setAVMetadata(this...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left playVideo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST...
public playVideo() { // [StartExclude set_video] if (this.avPlayer) { if (this.avPlayer.state !== AVPlayerState.PREPARED && this.avPlayer.state !== AVPlayerState.PAUSED && this.avPlayer.state !== AVPlayerState.COMPLETED) { return; } this.avSessionController.setAVMetadata(this...
https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets
53c917a523d0787afa745515fa0905551b80f0e7
gitcode
tangwengang-del/freerdp-harmonyos
entry/src/main/ets/utils/ClipboardManager.ets
arkts
clearLocalClipboard
Clear local clipboard
async clearLocalClipboard(): Promise<void> { try { const systemPasteboard = pasteboard.getSystemPasteboard(); await systemPasteboard.clearData(); this.lastLocalData = ''; console.info(`${TAG}: Local clipboard cleared`); } catch (error) { const err = error as BusinessError; ...
AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left clearLocalClipboard AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#...
async clearLocalClipboard(): Promise<void> { try { const systemPasteboard = pasteboard.getSystemPasteboard(); await systemPasteboard.clearData(); this.lastLocalData = ''; console.info(`${TAG}: Local clipboard cleared`); } catch (error) { const err = error as BusinessError; ...
https://github.com/tangwengang-del/freerdp-harmonyos
5d51aaf55e01e02b03ff7270dd361ba2cf513dd5
github
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/WeakSet.ets
arkts
constructor
The WeakSet() constructor creates WeakSet objects @param { K[] | null } [elements] - Optional initial object array to initialize the WeakSet @syscap SystemCapability.Utils.Lang
constructor(elements?: K[] | null) { if (elements != null) { for (const element of elements) { this.add(element) } } }
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#binary_expression#Left AST#identifier#Left elements AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ident...
constructor(elements?: K[] | null) { if (elements != null) { for (const element of elements) { this.add(element) } } }
https://gitcode.com/iop123123/arkts-static-skills
8eabbe920cb29aa1037e7b2be82248b3c1505517
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets
arkts
setHours
Sets the hours for a specified date according to local time. @param { int } value new hours @param { int } min @param { int } sec @returns { long } get new date value @syscap SystemCapability.Utils.Lang @FaAndStageModel
public setHours(value: int, min: int, sec: int): long { this.setHours(value); this.setMinutes(min); this.setSeconds(sec); return this.ms; }
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setHours AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#Rig...
public setHours(value: int, min: int, sec: int): long { this.setHours(value); this.setMinutes(min); this.setSeconds(sec); return this.ms; }
https://gitcode.com/iop123123/arkts-static-skills
8c26cdc9b15157386f6120d8e7e5f5f6deae6e2a
gitcode
openharmony/codelabs
Media/AudioPlayer/entry/src/main/ets/controller/PlayBarController.ets
arkts
switchPlayState
Switching the Playback Status. @param playState
switchPlayState(playState: number) { let playController = GlobalContext.getContext().getObject('audioPlayerController') as AudioPlayerController; if (playState === PlayState.PLAY) { this.playBarModel.playState = PlayState.PAUSE; this.playBarModel.playStateIcon = $r('app.media.ic_pause'); pla...
AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left switchPlayState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left playState AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right ...
switchPlayState(playState: number) { let playController = GlobalContext.getContext().getObject('audioPlayerController') as AudioPlayerController; if (playState === PlayState.PLAY) { this.playBarModel.playState = PlayState.PAUSE; this.playBarModel.playStateIcon = $r('app.media.ic_pause'); pla...
https://gitee.com/openharmony/codelabs.git
1467eedbc7168b7521c50013e86c13f8ba251e71
gitee
OMGCA/sakipay
sakipay_hmos/main/src/main/ets/viewmodels/SettingsViewModel.ets
arkts
recalibrateWorkingDays
Recomputes the calibrated working day count for the current month, accounting for the Chinese holiday calendar and any user overrides.
public recalibrateWorkingDays(): void { const hc: HolidayCalendarData | null = HolidayCalendarService.getInstance().currentCalendar() const today: Date = new Date() const year: number = today.getFullYear() const month: number = today.getMonth() const daysInMonth: number = new Date(year, month + 1,...
AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left recalibrateWorkingDays 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...
public recalibrateWorkingDays(): void { const hc: HolidayCalendarData | null = HolidayCalendarService.getInstance().currentCalendar() const today: Date = new Date() const year: number = today.getFullYear() const month: number = today.getMonth() const daysInMonth: number = new Date(year, month + 1,...
https://github.com/OMGCA/sakipay
31f33efab74ef9b5ce3d37e245bf1acadb74b2da
github
Explore-In-HMOS-Wearable/how-to-use-weather-kit
entry/src/main/ets/constants/WearableLayout.ets
arkts
getResponsiveSpacing
Calculate responsive spacing
static getResponsiveSpacing(baseSpacing: number, screenSize: number): number { const scale = WearableResponsiveLayout.getSpacing(screenSize) / WeatherLayout.ITEM_SPACING; return Math.round(baseSpacing * scale); }
AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getResponsiveSpacing AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left baseSpacing AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number A...
static getResponsiveSpacing(baseSpacing: number, screenSize: number): number { const scale = WearableResponsiveLayout.getSpacing(screenSize) / WeatherLayout.ITEM_SPACING; return Math.round(baseSpacing * scale); }
https://github.com/Explore-In-HMOS-Wearable/how-to-use-weather-kit
121e4593dc66f6fa8aac1dc1ef23bfe2f5b49b91
github
HarmonyOS_Samples/MusicHome
features/playlist/src/main/ets/util/PlaylistDataUtil.ets
arkts
loadPlaylistSongUis
Loads UI song models for a playlist from the local music database API. @param playlistId Playlist primary key to query. @returns Array of {@link PlaylistSongUi} rows for list binding.
public static loadPlaylistSongUis(playlistId: number): PlaylistSongUi[] { return MusicDbApi.getInstance().getPlaylistSongItems(playlistId) .map((dto) => PlaylistDataUtil.mapSongDtoToUi(dto)); }
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 loadPlaylistSongUis AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left playlistId AST#identifier#Right AST#ERROR#Left AST...
public static loadPlaylistSongUis(playlistId: number): PlaylistSongUi[] { return MusicDbApi.getInstance().getPlaylistSongItems(playlistId) .map((dto) => PlaylistDataUtil.mapSongDtoToUi(dto)); }
https://gitcode.com/HarmonyOS_Samples/MusicHome
727f101c959cbd5ffb54268896c07823db96169f
gitcode
iop123123/arkts-static-skills
docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Jsonx.ets
arkts
setLong
Sets a current JsonElement to an integer value. @param {long} value - The long value to set
setLong(value: long): void { this.setUndefined() this.maybeLongValue = value }
AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setLong AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left long AST#identifier#Right AST#ERROR#Right AST#)#Left ) AST#)#Ri...
setLong(value: long): void { this.setUndefined() this.maybeLongValue = value }
https://gitcode.com/iop123123/arkts-static-skills
f4c40b3b8c5c6322b2d0a676dd48f4382d23cf23
gitcode