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 |
|---|---|---|---|---|---|---|---|---|---|---|
offlinecat-dev/OCNetORM | src/main/ets/query/PaginationParams.ets | arkts | constructor | 构造函数
@param page 页码(从 1 开始),默认为 1
@param pageSize 每页数量,默认为 20 | constructor(page: number = 1, pageSize: number = 20) {
// 确保页码至少为 1
this.page = page >= 1 ? page : 1
// 确保每页数量至少为 1
this.pageSize = pageSize >= 1 ? pageSize : 20
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left page AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#identifier#Lef... | constructor(page: number = 1, pageSize: number = 20) {
// 确保页码至少为 1
this.page = page >= 1 ? page : 1
// 确保每页数量至少为 1
this.pageSize = pageSize >= 1 ? pageSize : 20
} | https://github.com/offlinecat-dev/OCNetORM | 8d0314f725905f0a9908b505ad151cbbd8eb642d | github |
huaweicloud/huaweicloud-iot-device-sdk-arkts | huaweicloud_iot_device_library/src/main/ets/service/AbstractDevice.ets | arkts | onDeviceMessage | 消息回调,由SDK自动调用
@param message 消息 | public onDeviceMessage(message: DeviceMessage): void {
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left onDeviceMessage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left message AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | public onDeviceMessage(message: DeviceMessage): void {
} | https://github.com/huaweicloud/huaweicloud-iot-device-sdk-arkts | ef7574f12ac52a86db863990d356f9410ab961db | github |
CsCesium/KantaiHomo | entry/src/main/ets/infra/web/interceptors/Interceptor.ets | arkts | shouldWrap | reserved for future | function shouldWrap(url: string): boolean {
if (url.length === 0) return false;
if (/[?&]kcwrap=1(&|$)/i.test(url)) return false; // 已包装 → 放行
return /^https?:\/\/osapi\.dmm\.com\/gadgets\/ifr/i.test(url); // ★ 只拦 osapi
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left shouldWrap AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left url AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right ... | function shouldWrap(url: string): boolean {
if (url.length === 0) return false;
if (/[?&]kcwrap=1(&|$)/i.test(url)) return false; // 已包装 → 放行
return /^https?:\/\/osapi\.dmm\.com\/gadgets\/ifr/i.test(url); // ★ 只拦 osapi
} | https://github.com/CsCesium/KantaiHomo | 27fffcd96c4e95b240d25e57a4128fafec1b36d0 | github |
jjjjjjava/ffmpeg_tools | src/main/ets/ffmpeg/FFMpegUtils.ets | arkts | showLog | 启用或禁用 FFmpeg 日志输出
@param show true 显示日志,false 不显示 | static showLog(show: boolean): void {
try {
libAddon.showLog(show);
console.info(`[FFMpegUtils] FFmpeg logging ${show ? 'enabled' : 'disabled'}`);
} catch (e) {
console.error(`[FFMpegUtils] Failed to set logging:`, e);
}
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left showLog AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left show AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean ... | static showLog(show: boolean): void {
try {
libAddon.showLog(show);
console.info(`[FFMpegUtils] FFmpeg logging ${show ? 'enabled' : 'disabled'}`);
} catch (e) {
console.error(`[FFMpegUtils] Failed to set logging:`, e);
}
} | https://github.com/jjjjjjava/ffmpeg_tools | 1a22462b9920d269a7036d37fec3aab4f0fc2241 | github |
the-wwyang/kids-learning-app | src/main/ets/services/QuestionCacheService.ets | arkts | getPoolKey | ========== 私有辅助方法 ==========
生成题目池的键 | private getPoolKey(type: QuestionType, difficulty: Difficulty): string {
return `${type}_${difficulty}`;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getPoolKey AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Qu... | private getPoolKey(type: QuestionType, difficulty: Difficulty): string {
return `${type}_${difficulty}`;
} | https://github.com/the-wwyang/kids-learning-app | 66f0d6c51e1558921b44eec553b45cc2c51e6a78 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Parsers/EBookParser.ets | arkts | extractCover | 提取电子书封面
@param filePath 电子书文件路径
@param savePath 封面保存路径
@returns 提取结果 | public static async extractCover(filePath: string, savePath: string): Promise<EBookCoverExtractionResult> {
try {
logger.info(EBookCoverExtractor.TAG, `开始提取电子书封面: ${filePath}`);
// 检查是否为 PDF 格式
if (filePath.toLowerCase().endsWith('.pdf')) {
return await EBookCoverExtractor.extractPdfCov... | 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 extractCover AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath AST#identif... | public static async extractCover(filePath: string, savePath: string): Promise<EBookCoverExtractionResult> {
try {
logger.info(EBookCoverExtractor.TAG, `开始提取电子书封面: ${filePath}`);
// 检查是否为 PDF 格式
if (filePath.toLowerCase().endsWith('.pdf')) {
return await EBookCoverExtractor.extractPdfCov... | https://github.com/DaLongZhuaZi/manxia | 17456baa65d070e095ee9e4223f06290c3bc4cc2 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/SparseArray.ets | arkts | isArray | Checks whether the passed value is an SparseArray.
@param { Any } o The value to be checked.
@returns { boolean } True if the value is an SparseArray; otherwise, false.
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static isArray(o: Any): boolean {
return o instanceof SparseArray
} | 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 isArray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left o AST#identifier#Right AST#:#Left : AST#:#Right... | public static isArray(o: Any): boolean {
return o instanceof SparseArray
} | https://gitcode.com/iop123123/arkts-static-skills | 0c1ab27171a060936f231e0f78982495c1d0d236 | gitcode |
openharmony/codelabs | Media/ImageEdit/entry/src/main/ets/viewModel/CropShow.ets | arkts | fixLeftBottomInFixedMode | In fixed mode, fix left bottom conner.
@param offsetHypot
@param isEnlarge | private fixLeftBottomInFixedMode(offsetHypot: number, isEnlarge: boolean) {
let crop = this.getCropRect();
let rate = this.ratio.getRate();
let rect = new RectF();
if (isEnlarge) {
let limit = this.limitRect;
let size = MathUtils.getMaxFixedRectSize(rate, crop.right - limit.left, limit.bot... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left fixLeftBottomInFixedMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left offsetHypot AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left n... | private fixLeftBottomInFixedMode(offsetHypot: number, isEnlarge: boolean) {
let crop = this.getCropRect();
let rate = this.ratio.getRate();
let rect = new RectF();
if (isEnlarge) {
let limit = this.limitRect;
let size = MathUtils.getMaxFixedRectSize(rate, crop.right - limit.left, limit.bot... | https://gitee.com/openharmony/codelabs.git | b2d3069fedd666b30bcc9b4aacedf039bf5db9b7 | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/FinancialHealth.ets | arkts | assessFinancialHealthFromBills | 从账单和预算生成完整的财务健康评分
@param bills 账单列表
@param budgets 预算列表
@param userId 用户ID
@param essentialCategoryIds 必要消费分类ID列表 | static assessFinancialHealthFromBills(
bills: Bill[],
budgets: Budget[],
userId: number,
essentialCategoryIds: number[] = []
): FinancialHealthScore {
const now = new Date();
const currentMonth = now.toISOString().substring(0, 7);
// 计算各维度评分
const savingsRate = HealthScoreUtils.calc... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left assessFinancialHealthFromBills AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bills AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#... | static assessFinancialHealthFromBills(
bills: Bill[],
budgets: Budget[],
userId: number,
essentialCategoryIds: number[] = []
): FinancialHealthScore {
const now = new Date();
const currentMonth = now.toISOString().substring(0, 7);
// 计算各维度评分
const savingsRate = HealthScoreUtils.calc... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 7bd09bb419062d5880ca7cf368c5ade24ffa7bd9 | github |
openharmony/codelabs | ETSUI/ItemManagerAPP/entry/src/main/ets/store/ItemStore.ets | arkts | onItemCountChange | 监听物品数量变化 | onItemCountChange(callback: (count: number) => void): void {
console.info('ItemStore: 添加物品数量监听器');
this.listeners.push(callback);
} | AST#program#Left AST#ERROR#Left AST#identifier#Left onItemCountChange AST#identifier#Right AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AS... | onItemCountChange(callback: (count: number) => void): void {
console.info('ItemStore: 添加物品数量监听器');
this.listeners.push(callback);
} | https://gitcode.com/openharmony/codelabs | 349bf3a3db8d7e57659bad39e2c1660b9e4eb093 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Console.ets | arkts | dir | @section Console.dir* API
Prints a formatted representation of an object to stdout
Filters out properties containing 'field#' in their keys
@param {Any} obj - The object to inspect
@returns {void} | public dir(obj?: Any): void {
if (obj == null || obj == undefined) {
return
}
// NOTE (templin.konstantin): Internal Fields Filtering
//
// In the current language implementation, objects have an internal representation
// where some fields are duplicat... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left dir AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left... | public dir(obj?: Any): void {
if (obj == null || obj == undefined) {
return
}
// NOTE (templin.konstantin): Internal Fields Filtering
//
// In the current language implementation, objects have an internal representation
// where some fields are duplicat... | https://gitcode.com/iop123123/arkts-static-skills | b6f2edc52b48c319ba5eeff7e78b278f63218731 | gitcode |
openharmony/arkui_ace_engine | examples/Overlay/entry/src/main/ets/pages/components/dialog/page/CustomDialogTestLevel0_6.ets | arkts | aboutToDisappear | 在自定义组件即将析构销毁时将dialogController置空 | aboutToDisappear() {
this.dialogController = null
this.dialogControllerSetBorder = null
this.dialogControllerSetSize = null
this.dialogControllerSetShadow = null
} | 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() {
this.dialogController = null
this.dialogControllerSetBorder = null
this.dialogControllerSetSize = null
this.dialogControllerSetShadow = null
} | https://gitee.com/openharmony/arkui_ace_engine.git | a63710153899fda62636e97138f9cafafa34c31b | gitee |
Dabing-0x19d/berverage_HarmonyOS6.0 | entry/src/main/ets/utils/ShareUtil.ets | arkts | getSharedJsonFromWant | 从Want中获取分享的JSON数据
@param want 分享传入的want
@returns Promise<string> JSON字符串 | static async getSharedJsonFromWant(want: Want): Promise<string | null> {
try {
const sharedData = await systemShare.getSharedData(want);
const records = sharedData.getRecords();
for (let i = 0; i < records.length; i++) {
const record = records[i];
// 尝试读取文本内容
if (record.... | 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 getSharedJsonFromWant AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Le... | static async getSharedJsonFromWant(want: Want): Promise<string | null> {
try {
const sharedData = await systemShare.getSharedData(want);
const records = sharedData.getRecords();
for (let i = 0; i < records.length; i++) {
const record = records[i];
// 尝试读取文本内容
if (record.... | https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0 | db21938a3ceb8df403e0a87eb860c962574c3977 | github |
HarmonyOS_Samples/MusicHome | common/musicbasic/src/main/ets/util/MusicDbApi.ets | arkts | constructor | Wires this API to the shared {@link MusicMemoryStore}. | private constructor() {
this.store = MusicMemoryStore.getInstance();
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#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 ... | private constructor() {
this.store = MusicMemoryStore.getInstance();
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | fbf5adef8f59a060d8f74b092f74ab63d6def9fa | gitcode |
codelably/tuniao-ui | core/tuniaoui/src/main/ets/components/toast/TnToast.ets | arkts | hide | 关闭轻提示 | public hide(): void {
this.clearTimer();
if (this.contentNode !== null && this.uiContext !== null) {
const node: ComponentContent<TnToastParams> = this.contentNode;
try {
this.uiContext.getPromptAction().closeCustomDialog(node);
} catch (_e) {
// 对话框可能已关闭
this.content... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left hide AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Righ... | public hide(): void {
this.clearTimer();
if (this.contentNode !== null && this.uiContext !== null) {
const node: ComponentContent<TnToastParams> = this.contentNode;
try {
this.uiContext.getPromptAction().closeCustomDialog(node);
} catch (_e) {
// 对话框可能已关闭
this.content... | https://github.com/codelably/tuniao-ui | fd7e6cead041770359f5222e88baa0f254823d95 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/ComputerManager.ets | arkts | reloadFromPersistence | 从持久化存储重新加载电脑列表到内存。
备份恢复后调用,确保使用恢复的配对数据而非轮询覆盖的旧数据。 | async reloadFromPersistence(): Promise<void> {
this.computers = await ComputerPersistence.loadComputers();
console.info(`ComputerManager: 从持久化存储重新加载 ${this.computers.size} 台电脑`);
this.notifyListChanged();
} | AST#program#Left AST#expression_statement#Left AST#assignment_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left reloadFromPersistence AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_pa... | async reloadFromPersistence(): Promise<void> {
this.computers = await ComputerPersistence.loadComputers();
console.info(`ComputerManager: 从持久化存储重新加载 ${this.computers.size} 台电脑`);
this.notifyListChanged();
} | https://github.com/AlkaidLab/moonlight-harmony | 205dcd13399692e7462d3997387c63834db05c33 | github |
openharmony-sig/flutter_engine | shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/dart/DartExecutor.ets | arkts | getBinaryMessenger | Returns a {@link BinaryMessenger} that can be used to send messages to, and receive messages
from, Dart code that this {@code DartExecutor} is executing. | getBinaryMessenger(): BinaryMessenger {
return this.binaryMessenger;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getBinaryMessenger 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 BinaryMessenger AST#identifier#Right AST#ER... | getBinaryMessenger(): BinaryMessenger {
return this.binaryMessenger;
} | https://gitee.com/openharmony-sig/flutter_engine.git | 9471c12129376895246a3f1472c71a6384f31b07 | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/UserDAO.ets | arkts | updateProfile | 更新用户资料(昵称和头像) | static async updateProfile(userId: number, nickname: string, avatarPath: string): Promise<void> {
const store = DatabaseManager.getDatabase();
const now = new Date().toISOString();
const sql = `
UPDATE users
SET nickname = ?, avatar_path = ?, updated_at = ?
WHERE user_id = ? AND is_delet... | 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 updateProfile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : A... | static async updateProfile(userId: number, nickname: string, avatarPath: string): Promise<void> {
const store = DatabaseManager.getDatabase();
const now = new Date().toISOString();
const sql = `
UPDATE users
SET nickname = ?, avatar_path = ?, updated_at = ?
WHERE user_id = ? AND is_delet... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | cdb90ee25399ee6aea9bd6cfb19aa6f4853441d4 | github |
holg/eulumdat-rs | EulumdatHarmonyOS/Eulumdat/entry/src/main/ets/model/EulumdatEngine.ets | arkts | bugSvg | Generate BUG (Backlight, Uplight, Glare) rating diagram SVG
@param width SVG width in pixels
@param height SVG height in pixels
@param theme Light or Dark theme
@returns SVG string | public bugSvg(width: number = 400, height: number = 350, theme: SvgTheme = SvgTheme.Light): string {
return eulumdat_napi.bugSvg(width, height, theme);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left bugSvg AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left width AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Le... | public bugSvg(width: number = 400, height: number = 350, theme: SvgTheme = SvgTheme.Light): string {
return eulumdat_napi.bugSvg(width, height, theme);
} | https://github.com/holg/eulumdat-rs | de0e448e87efcc0111b96bd27ec1e55bc1a44adc | github |
openharmony/codelabs | ETSUI/MemoTime/entry/src/main/ets/service/DataService.ets | arkts | initializeDefaultTags | 初始化默认标签 | private async initializeDefaultTags(): Promise<void> {
if (!this.rdbStore) {
return
}
try {
const predicates = new relationalStore.RdbPredicates(AppConstants.TABLE_TAG)
const resultSet = await this.rdbStore.query(predicates, ['id'])
const count = resultSet.rowCount
resultSet... | 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 initializeDefaultTags AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#R... | private async initializeDefaultTags(): Promise<void> {
if (!this.rdbStore) {
return
}
try {
const predicates = new relationalStore.RdbPredicates(AppConstants.TABLE_TAG)
const resultSet = await this.rdbStore.query(predicates, ['id'])
const count = resultSet.rowCount
resultSet... | https://gitcode.com/openharmony/codelabs | f3aad8c40fd74b442222165f9c4a0c7215905baf | gitcode |
openharmony/arkui_ace_engine | examples/ScrollableComponentTest/entry/src/main/ets/pages/List/Table/CommonDataSource.ets | arkts | registerDataChangeListener | 注册一个数据变化监听器 | registerDataChangeListener(listener: DataChangeListener): void {
if (this.listeners.indexOf(listener) < 0) {
this.listeners.push(listener);
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left registerDataChangeListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left listener AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left DataChangeListener AST#id... | registerDataChangeListener(listener: DataChangeListener): void {
if (this.listeners.indexOf(listener) < 0) {
this.listeners.push(listener);
}
} | https://gitee.com/openharmony/arkui_ace_engine.git | 85561c4ff31e9081f77409a8061564d23b47d6f1 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Source/SuwayomiCacheManager.ets | arkts | hashString | 生成文件名安全的哈希值 | private hashString(str: string): string {
let hash = 0;
for (let i = 0; i < str.length; i++) {
const char = str.charCodeAt(i);
hash = ((hash << 5) - hash) + char;
hash = hash & hash;
}
return Math.abs(hash).toString(16);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left hashString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left str... | private hashString(str: string): string {
let hash = 0;
for (let i = 0; i < str.length; i++) {
const char = str.charCodeAt(i);
hash = ((hash << 5) - hash) + char;
hash = hash & hash;
}
return Math.abs(hash).toString(16);
} | https://github.com/DaLongZhuaZi/manxia | 66a45d5b83acd0903db8662ceb709eda20c9cb6d | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/common/utils/TokenManager.ets | arkts | getUserToken | 获取普通用户Token | static getUserToken(): string | null {
return SettingsUtil.get('token');
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getUserToken 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 AS... | static getUserToken(): string | null {
return SettingsUtil.get('token');
} | https://github.com/LJ666-ui/harmony-health-care | c5d86b7d58f82fb183e3c9ce5c337a1eab8b33a9 | github |
offlinecat-dev/OCNetORM | src/main/ets/query/RelationLoader.ets | arkts | loadOneToOneSourceSide | 加载 ONE_TO_ONE 关联数据(外键在源实体侧)
根据源实体的外键值查询目标实体
@param entities 主实体数据数组
@param relation 关联关系元数据
@returns 带有关联数据的实体数组 | private async loadOneToOneSourceSide(
entities: Array<EntityData>,
relation: RelationMetadata,
options: RelationQueryOptions | null = null
): Promise<Array<EntityData>> {
return await this.oneToOneSupport.loadOneToOneSourceSide(entities, relation, options)
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left loadOneToOneSourceSide AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left entities AS... | private async loadOneToOneSourceSide(
entities: Array<EntityData>,
relation: RelationMetadata,
options: RelationQueryOptions | null = null
): Promise<Array<EntityData>> {
return await this.oneToOneSupport.loadOneToOneSourceSide(entities, relation, options)
} | https://github.com/offlinecat-dev/OCNetORM | 505b7962a9702f7b9f31a6c645fd332a8f9e1772 | github |
honjow/Next2V | shared/src/main/ets/settings/AccountSessionCoordinator.ets | arkts | removeActiveAccount | Remove/sign out the currently active account as one state-machine operation.
This is the page-safe logout entry point: it removes the active AccountStore
record, switches to a remaining account through removeAccount(), or clears
active id + cookie/session runtime state if no account remains. | static async removeActiveAccount(context: common.UIAbilityContext): Promise<void> {
await AccountStore.migrateFromSingletonIfNeeded(context)
await AccountStore.restoreActiveId(context)
let activeId = AccountStore.getActiveId()
if (!activeId) {
const records = await AccountStore.getAll(context)
... | 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 removeActiveAccount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#L... | static async removeActiveAccount(context: common.UIAbilityContext): Promise<void> {
await AccountStore.migrateFromSingletonIfNeeded(context)
await AccountStore.restoreActiveId(context)
let activeId = AccountStore.getActiveId()
if (!activeId) {
const records = await AccountStore.getAll(context)
... | https://github.com/honjow/Next2V | 20ace9dd70bc6e906f22d833d0f0e084ab96e7fd | github |
SMAT-Lab/PhantomRendering | Harmoney_Next-Tiktok/entry/src/main/ets/utils/PlaySpeedManager.ets | arkts | getSpeedOption | 获取速度选项信息 | getSpeedOption(speed: number): SpeedOption | null {
const option = PlaySpeedManager.SPEED_OPTIONS.find(opt => opt.value === speed)
return option || null
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getSpeedOption AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left speed AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | getSpeedOption(speed: number): SpeedOption | null {
const option = PlaySpeedManager.SPEED_OPTIONS.find(opt => opt.value === speed)
return option || null
} | https://github.com/SMAT-Lab/PhantomRendering | 590eed7ed3c7f85dc9d74b400e613819a6bb7171 | github |
hhtczengjing/ohos_quickjs | quickjs/src/main/ets/JSValue.ets | arkts | valueWithUndefined | ==================== Factory Methods ==================== | static valueWithUndefined(ctx: JSContext): JSValue {
const handle = qjs.createUndefined(ctx.engineHandle);
return new JSValue(ctx, handle);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left valueWithUndefined AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ctx AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | static valueWithUndefined(ctx: JSContext): JSValue {
const handle = qjs.createUndefined(ctx.engineHandle);
return new JSValue(ctx, handle);
} | https://github.com/hhtczengjing/ohos_quickjs | d0142f1a8e4e17da340daff562061e4a03b3368c | github |
openharmony-sig/applications_calculator | common/src/main/ets/util/RdbHelper.ets | arkts | delOldestRecord | delete oldest record. | async delOldestRecord(): Promise<void> {
await this.getRdbStore();
if (this.rdbStore === null) {
LogUtil.error(TAG, 'rdbStore is null, delOldestRecord fail.');
return;
}
try {
let res: relationalStore.ResultSet = await this.rdbStore.querySql(DB.queryMinRecord);
res.goToFirstRow... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left delOldestRecord 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#gene... | async delOldestRecord(): Promise<void> {
await this.getRdbStore();
if (this.rdbStore === null) {
LogUtil.error(TAG, 'rdbStore is null, delOldestRecord fail.');
return;
}
try {
let res: relationalStore.ResultSet = await this.rdbStore.querySql(DB.queryMinRecord);
res.goToFirstRow... | https://gitee.com/openharmony-sig/applications_calculator.git | 53ad84f4dfc073d3f2530da944e7beacdfc37502 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebDAV/WebDAVClient.ets | arkts | createDirectory | 创建目录
注意:HarmonyOS不支持MKCOL方法,使用PUT上传空文件的方式触发目录创建
或者依赖服务器在PUT时自动创建父目录 | async createDirectory(remotePath: string): Promise<void> {
const url = this.getFullUrl(remotePath);
logger.info(TAG, `创建目录: ${url}`);
// 方法1:尝试使用PUT上传一个占位文件来创建目录
// 某些WebDAV服务器会在PUT时自动创建父目录
const placeholderUrl = url.endsWith('/') ? `${url}.manxia_placeholder` : `${url}/.manxia_placeholder`;
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left createDirectory AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left remotePath AST#identifier#Right AST#type_annotation#Left AST#:#... | async createDirectory(remotePath: string): Promise<void> {
const url = this.getFullUrl(remotePath);
logger.info(TAG, `创建目录: ${url}`);
// 方法1:尝试使用PUT上传一个占位文件来创建目录
// 某些WebDAV服务器会在PUT时自动创建父目录
const placeholderUrl = url.endsWith('/') ? `${url}.manxia_placeholder` : `${url}/.manxia_placeholder`;
... | https://github.com/DaLongZhuaZi/manxia | 2acbc5f2c6a74b07de400bb5e4017e9e462bed90 | github |
openharmony/applications_app_samples | code/BasicFeature/Connectivity/MultipleFilesDownload/casesfeature/multiplefilesdownload/src/main/ets/view/FileDownloadItem.ets | arkts | getFileStatusAndTime | 文件下载成功时更改文件状态与时间;下载失败时更改文件的状态 | getFileStatusAndTime(status: number, time?: number) {
this.fileDataInfo.fileStatus = status;
if (time) {
this.fileDataInfo.downloadTime = time;
// 下载成功加入到下载历史列表
this.historyArray.push(this.fileDataInfo);
// 下载列表删除下载成功的数据
this.downloadFileArray = this.downloadFileArray.filter((ite... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getFileStatusAndTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left status AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identif... | getFileStatusAndTime(status: number, time?: number) {
this.fileDataInfo.fileStatus = status;
if (time) {
this.fileDataInfo.downloadTime = time;
// 下载成功加入到下载历史列表
this.historyArray.push(this.fileDataInfo);
// 下载列表删除下载成功的数据
this.downloadFileArray = this.downloadFileArray.filter((ite... | https://github.com/openharmony/applications_app_samples | 7460655db71ff4c261d24a248f2bc4673dc8e327 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/SharedLedgerDAO.ets | arkts | softDelete | 软删除成员(按账本ID和用户ID) | static async softDelete(ledgerId: number, userId: number): Promise<boolean> {
try {
const store = DatabaseManager.getDatabase();
const values: relationalStore.ValuesBucket = {
is_deleted: 1,
updated_at: new Date().toISOString()
};
const predicates = new relationalStore.Rdb... | 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 softDelete AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left ledgerId AST#identifier#Right AST#ERROR#Left AST#:#Left : AS... | static async softDelete(ledgerId: number, userId: number): Promise<boolean> {
try {
const store = DatabaseManager.getDatabase();
const values: relationalStore.ValuesBucket = {
is_deleted: 1,
updated_at: new Date().toISOString()
};
const predicates = new relationalStore.Rdb... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | a55cb3f2b2a84f4cdf1866c1b6c548791f183de6 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/ThemeManager.ets | arkts | getCustomThemePrimaryColor | 获取当前自定义主题的主色调 | public getCustomThemePrimaryColor(): string {
return AppStorage.get<string>(CUSTOM_THEME_KEYS.PRIMARY_COLOR) || '';
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCustomThemePrimaryColor 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... | public getCustomThemePrimaryColor(): string {
return AppStorage.get<string>(CUSTOM_THEME_KEYS.PRIMARY_COLOR) || '';
} | https://github.com/DaLongZhuaZi/manxia | 4f5f82a712be44c9593f559908a2aeac15df5870 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Annotations/UnifiedAnnotationManager.ets | arkts | getContentAnnotations | List annotations for one content item. | async getContentAnnotations(
contentType: UnifiedContentType,
contentId: string,
annotationType?: UnifiedAnnotationType,
chapterId?: string,
chapterIndex?: number
): Promise<UnifiedAnnotationRecord[]> {
await this.ensureSchema();
const conditions: string[] = ['isDeleted = 0', 'contentTy... | 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 getContentAnnotations AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#L... | async getContentAnnotations(
contentType: UnifiedContentType,
contentId: string,
annotationType?: UnifiedAnnotationType,
chapterId?: string,
chapterIndex?: number
): Promise<UnifiedAnnotationRecord[]> {
await this.ensureSchema();
const conditions: string[] = ['isDeleted = 0', 'contentTy... | https://github.com/DaLongZhuaZi/manxia | fbd5b0d4ee777e9859f7c32a709535fea1927918 | github |
ibestservices/ibest-ui | library/src/main/ets/components/countTo/index.ets | arkts | reStart | 暂定状态,重新再开始滚动;或者滚动状态下,暂停 | reStart() {
this.startTime = 0
this.localDuration = this.remaining
this.localStartVal = this.current
this.countTo()
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left reStart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST... | reStart() {
this.startTime = 0
this.localDuration = this.remaining
this.localStartVal = this.current
this.countTo()
} | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/countTo/index.ets#L92-L97 | 11b73637d7a88125818adbf4224547ed29040c65 | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/TypeDefined.ets | arkts | getAllTypes | 获取所有认证方式 | public static getAllTypes(): AuthTypeInfo[] {
return [
AuthType.PASSWORD,
AuthType.KEYFILE,
AuthType.PASSWORD_KEYFILE,
// AuthType.PASSWORD_OTP,
// AuthType.PASSWORD_OTP_RECOVERY,
// AuthType.PASSWORD_CHALLENGE_RESPONSE,
// AuthType.PASSWORD_CHALLENGE_RESPONSE_RECOVERY,
... | 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 getAllTypes 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 getAllTypes(): AuthTypeInfo[] {
return [
AuthType.PASSWORD,
AuthType.KEYFILE,
AuthType.PASSWORD_KEYFILE,
// AuthType.PASSWORD_OTP,
// AuthType.PASSWORD_OTP_RECOVERY,
// AuthType.PASSWORD_CHALLENGE_RESPONSE,
// AuthType.PASSWORD_CHALLENGE_RESPONSE_RECOVERY,
... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/TypeDefined.ets#L225-L237 | cc31b248263ff389007339b14ebdbe6977943382 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/services/WebSocketService.ets | arkts | sendChatMessage | 发送聊天消息 | sendChatMessage(chatMessage: ChatMessage): void {
const message: WSMessage = {
type: MessageType.SEND_MESSAGE,
data: JSON.stringify(chatMessage),
senderId: this.userId,
senderRole: this.userRole
};
this.send(message);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left sendChatMessage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left chatMessage AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ChatMessage AST#identifier#Right ... | sendChatMessage(chatMessage: ChatMessage): void {
const message: WSMessage = {
type: MessageType.SEND_MESSAGE,
data: JSON.stringify(chatMessage),
senderId: this.userId,
senderRole: this.userRole
};
this.send(message);
} | https://github.com/LJ666-ui/harmony-health-care | 938d230dc571585a8107feda7c8f59ad3024bb4f | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | internal | Creates a copy with replaced value on index
@param index
@param value
@returns an Uint8Array with replaced value on index
public | /* public */ internal with(index: int, value: number): Uint8Array {
let res = new Uint8Array(this)
res.set(index, value)
return res
} | AST#program#Left AST#comment#Left /* public */ AST#comment#Right AST#ERROR#Left AST#identifier#Left internal AST#identifier#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#R... | /* public */ internal with(index: int, value: number): Uint8Array {
let res = new Uint8Array(this)
res.set(index, value)
return res
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | b59db605ea3dbae6dcef0c85a56d01525d2cbb2a | gitee |
azhu0001/localsend-harmony | serve/src/main/ets/http/ContentType.ets | arkts | getBoundary | 返回content-type中的边界分隔符 | public getBoundary(): string {
return this.boundary;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getBoundary 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#str... | public getBoundary(): string {
return this.boundary;
} | https://gitcode.com/azhu0001/localsend-harmony | 9ef0c3c05b97257272aa863f17bbc628d7cc6d3a | gitcode |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/BattleAnswerRecorder.ets | arkts | markDailyReviewWordIfNeeded | Moved from BattlePage.markDailyReviewWordIfNeeded — review battles tick
the answered word off today's review plan. | markDailyReviewWordIfNeeded(wordId: string): void {
if (!this.isReviewMode || wordId.length === 0) {
return;
}
this.dailyStateService.markReviewedWords(Date.now(), [wordId])
.catch((err: BusinessError): void => {
console.error(`BattleAnswerRecorder: markReviewedWords failed: ${JSON.str... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left markDailyReviewWordIfNeeded AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left wordId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Righ... | markDailyReviewWordIfNeeded(wordId: string): void {
if (!this.isReviewMode || wordId.length === 0) {
return;
}
this.dailyStateService.markReviewedWords(Date.now(), [wordId])
.catch((err: BusinessError): void => {
console.error(`BattleAnswerRecorder: markReviewedWords failed: ${JSON.str... | https://github.com/terryma2024/happyword | da4a4b28b6b5533eb1578feaa40cb3186d0d0029 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/animation/ChartAnimator.ets | arkts | setPhaseY | Sets the Y axis phase of the animation.
@param phase float value between 0 - 1 | public setPhaseY(phase: number) {
if (phase > 1) {
phase = 1;
} else if (phase < 0) {
phase = 0;
}
this.mPhaseY = phase;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setPhaseY AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left phase AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left numbe... | public setPhaseY(phase: number) {
if (phase > 1) {
phase = 1;
} else if (phase < 0) {
phase = 0;
}
this.mPhaseY = phase;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 679477bb9a5c634ab95afdd1868fe1b52cc52c3a | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/BookshelfCategoryManager.ets | arkts | isItemInCategory | 检查内容是否在指定分类中 | isItemInCategory(itemId: string, contentType: ContentType, categoryId: string): boolean {
const key = `${contentType}_${itemId}`;
const item = this.itemCategoryMap.get(key);
return item?.categoryId === categoryId;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isItemInCategory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left itemId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Lef... | isItemInCategory(itemId: string, contentType: ContentType, categoryId: string): boolean {
const key = `${contentType}_${itemId}`;
const item = this.itemCategoryMap.get(key);
return item?.categoryId === categoryId;
} | https://github.com/DaLongZhuaZi/manxia | a2c754a9115f4573674f54d2658ccecdec7ca36b | github |
bluedeer000/HarmonyCalendar | entry/src/main/ets/services/CalendarSourceAdapterRegistry.ets | arkts | listDiscoverableAdapters | 列出支持自动发现的适配器 | listDiscoverableAdapters(): AdapterRegistration[] {
return this.listAdapters().filter((reg: AdapterRegistration) => reg.capability.supportsDiscovery);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left listDiscoverableAdapters AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#argum... | listDiscoverableAdapters(): AdapterRegistration[] {
return this.listAdapters().filter((reg: AdapterRegistration) => reg.capability.supportsDiscovery);
} | https://github.com/bluedeer000/HarmonyCalendar | a1972c574d0e751b6895bd73738eab6ca63b4c03 | github |
Joker-x-dev/CoolMallArkTS | core/data/src/main/ets/repository/CartRepository.ets | arkts | constructor | 构造函数
@param {CartLocalDataSource} dataSource 可选的数据源实例 | constructor(dataSource: CartLocalDataSource = new CartLocalDataSourceImpl()) {
this.dataSource = dataSource;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dataSource AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#identifi... | constructor(dataSource: CartLocalDataSource = new CartLocalDataSourceImpl()) {
this.dataSource = dataSource;
} | https://github.com/Joker-x-dev/CoolMallArkTS | 32666a50ef7d63ab6b5c40ea46bb05379a7d8f30 | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test46_original_index.ets | arkts | testCompoundShift | --- Compound shift assignment (>>=, <<=) --- | function testCompoundShift(): string {
let flags: number = 0b11110000;
flags = flags >> 2;
let shifted: number = 0b00001111;
shifted = shifted << 4;
let combined: number = flags | shifted;
return String(flags) + ',' + String(shifted) + ',' + String(combined);
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testCompoundShift 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#predefine... | function testCompoundShift(): string {
let flags: number = 0b11110000;
flags = flags >> 2;
let shifted: number = 0b00001111;
shifted = shifted << 4;
let combined: number = flags | shifted;
return String(flags) + ',' + String(shifted) + ',' + String(combined);
} | https://github.com/miaochiahao/ark-ghidra | aa82275395218a03cc8b801dc81da6a8cc5aa014 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/json.ets | arkts | stringify | Converts long to JSON format
@param d: long - long to be converted to a JSON as a Number
@returns String - JSON representation of long | public static stringify(d: long): String {
return StringBuilder.toString(d)
} | 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 stringify AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left d AST#identifier#Right AST#:#Left : AST#:#Rig... | public static stringify(d: long): String {
return StringBuilder.toString(d)
} | https://gitcode.com/iop123123/arkts-static-skills | 1f7b6999515bfc13f55bf64e113b0e484fe6e9c1 | gitcode |
pangpang20/antennaPodHM | entry/src/main/ets/pages/PodcastDetailPage.ets | arkts | updateDisplayedEpisodes | 更新显示的单集列表(分页) | updateDisplayedEpisodes() {
const startIndex = 0;
const endIndex = this.currentPage * this.pageSize;
this.episodes = this.allEpisodes.slice(startIndex, endIndex);
this.hasMore = endIndex < this.allEpisodes.length;
console.info(`[PodcastDetailPage] Displaying ${this.episodes.length}/${this.allEpiso... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left updateDisplayedEpisodes 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_... | updateDisplayedEpisodes() {
const startIndex = 0;
const endIndex = this.currentPage * this.pageSize;
this.episodes = this.allEpisodes.slice(startIndex, endIndex);
this.hasMore = endIndex < this.allEpisodes.length;
console.info(`[PodcastDetailPage] Displaying ${this.episodes.length}/${this.allEpiso... | https://github.com/pangpang20/antennaPodHM | 3feb9c7215eed21a0ff9a25e88e85a6155acfb8b | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | getPagesByChapterId | 根据章节ID获取页面列表(别名方法,用于新的类型系统) | public async getPagesByChapterId(chapterId: string): Promise<PageInfo[]> {
return this.getChapterPages(chapterId);
} | 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 getPagesByChapterId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left chapterId AST#identifier#Right AST#ERROR#Left AST#:... | public async getPagesByChapterId(chapterId: string): Promise<PageInfo[]> {
return this.getChapterPages(chapterId);
} | https://github.com/DaLongZhuaZi/manxia | 88a199d0041ba4c1a22f9eeaaf89fe2b6b840cff | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets | arkts | abs | Return a new Decimal whose value is the absolute value of this Decimal.
@returns { Decimal } the Decimal type | public abs(): Decimal {
let x = new Decimal(this);
if (x.sign < 0) {
x.sign = 1;
}
return Utils.finaliseExternal(x);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left abs AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right... | public abs(): Decimal {
let x = new Decimal(this);
if (x.sign < 0) {
x.sign = 1;
}
return Utils.finaliseExternal(x);
} | https://gitcode.com/iop123123/arkts-static-skills | 92b15f1caff742d8f470be0954e17f0a3af482ee | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/components/PreloadManager.ets | arkts | updateDebugInfo | 更新调试信息 | private updateDebugInfo(): void {
if (this.onDebugInfoUpdate) {
this.onDebugInfoUpdate(this.getDebugInfo());
}
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left updateDebugInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#exp... | private updateDebugInfo(): void {
if (this.onDebugInfoUpdate) {
this.onDebugInfoUpdate(this.getDebugInfo());
}
} | https://github.com/DaLongZhuaZi/manxia | 4ef4b55e6926ab1c616fbc32ae6265899e734f56 | github |
arkui-x/samples | CodeLab/Cases/feature/chatwithexpression/src/main/ets/model/Emoji.ets | arkts | constructor | 表情所表示的含义 | constructor(imgSrc: Resource, meaning: string) {
this.imgSrc = imgSrc;
this.meaning = meaning;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left imgSrc AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Resource AST#identifier#Rig... | constructor(imgSrc: Resource, meaning: string) {
this.imgSrc = imgSrc;
this.meaning = meaning;
} | https://gitcode.com/arkui-x/samples | bd3f9012c803e50154d635da42941366dd19a005 | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/utils/SettingsUtil.ets | arkts | saveDoctorInfo | 保存医生信息 | async saveDoctorInfo(doctorInfo: object): Promise<void> {
if (this.dataPreferences === null) {
return;
}
try {
const jsonStr: string = JSON.stringify(doctorInfo);
await this.dataPreferences.put('doctor_info', jsonStr);
await this.dataPreferences.flush();
} catch (e) {
con... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left saveDoctorInfo AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left doctorInfo AST#identifier#Righ... | async saveDoctorInfo(doctorInfo: object): Promise<void> {
if (this.dataPreferences === null) {
return;
}
try {
const jsonStr: string = JSON.stringify(doctorInfo);
await this.dataPreferences.put('doctor_info', jsonStr);
await this.dataPreferences.flush();
} catch (e) {
con... | https://github.com/LJ666-ui/harmony-health-care | e5ab593e9d38eae9dd9695cb81d6397565eb6b00 | github |
openharmony/applications_contacts | entry/src/main/ets/presenter/dialer/DialerPresenter.ets | arkts | playAudio | Play different audio resources based on key digits. | playAudio(number: string) {
switch (number.toString()) {
case '1':
this.tonePlayer(audio.ToneType.TONE_TYPE_DIAL_1);
break;
case '2':
this.tonePlayer(audio.ToneType.TONE_TYPE_DIAL_2);
break;
case '3':
this.tonePlayer(audio.ToneType.TONE_TYPE_DIAL_3);
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left playAudio AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left number AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right A... | playAudio(number: string) {
switch (number.toString()) {
case '1':
this.tonePlayer(audio.ToneType.TONE_TYPE_DIAL_1);
break;
case '2':
this.tonePlayer(audio.ToneType.TONE_TYPE_DIAL_2);
break;
case '3':
this.tonePlayer(audio.ToneType.TONE_TYPE_DIAL_3);
... | https://gitee.com/openharmony/applications_contacts.git | cbf6ef244b75029884529c516eb601a326f27a55 | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/Array.ets | arkts | lastIndexOf | lastIndexOf(arr: boolean[], key: boolean, fromIndex: int) tries to find entry of key into arr which is not greater than fromIndex
@param arr array to find a key
@param key a value to find
@param fromIndex an index of arr to begin search with (including, search is performed backwards)
@returns last index of key if found... | function lastIndexOf(arr: boolean[], key: boolean, fromIndex: int): int throws {
return lastIndexOf(arr, key, -1, fromIndex)
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left lastIndexOf AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left arr AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right... | function lastIndexOf(arr: boolean[], key: boolean, fromIndex: int): int throws {
return lastIndexOf(arr, key, -1, fromIndex)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 6a804cebbd9c2d728d596de8496a9c3bee8acb59 | gitee |
offlinecat-dev/OCNetORM | src/main/ets/query/QueryBuilder.ets | arkts | onlyDeleted | 仅查询已删除的数据(软删除)
调用此方法后,查询将只返回已删除的数据
@returns 当前实例(支持链式调用) | onlyDeleted(): QueryBuilder {
this.onlyDeletedFlag = true
this.includeDeleted = false
return this
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onlyDeleted 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 QueryBuilder AST#identifier#Right AST#ERROR#Right ... | onlyDeleted(): QueryBuilder {
this.onlyDeletedFlag = true
this.includeDeleted = false
return this
} | https://github.com/offlinecat-dev/OCNetORM | efe3a455858cc2e734dbe1b20f8670b225430a6a | github |
codelably/tuniao-ui | packages/main/src/main/ets/viewmodel/TnCountDownViewModel.ets | arkts | onControlEnd | 手动控制倒计时结束 | onControlEnd(): void {
this.controlStatusText = "已结束";
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onControlEnd AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block... | onControlEnd(): void {
this.controlStatusText = "已结束";
} | https://github.com/codelably/tuniao-ui | 6b653f6dd8a49c3903420050d240685d578e3f7b | github |
openharmony-sig/ohos_easyui | easyui/src/main/ets/common/components/CustomSteps.ets | arkts | build | 是否是当前步骤 | build() {
Column(){
Flex({direction:FlexDirection.Row,justifyContent:FlexAlign.SpaceBetween}){
ForEach(this.steps,(item,index)=>{
if(this.currentStep==index){
Text(item)
.fontColor(this.successFontColor)
}else if(this.currentStep<index){
Text... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Column(){
Flex({direction:FlexDirection.Row,justifyContent:FlexAlign.SpaceBetween}){
ForEach(this.steps,(item,index)=>{
if(this.currentStep==index){
Text(item)
.fontColor(this.successFontColor)
}else if(this.currentStep<index){
Text... | https://gitee.com/openharmony-sig/ohos_easyui.git | 5369e7ce0fa12621ef2ebd47d2576e131da5aba3 | gitee |
tdcare/tdwebrtc | src/main/ets/utils/NetworkUtil.ets | arkts | getNetCapabilities | 获取netHandle对应的网络的能力信息
@param netHandle 默认激活的数据网络
@returns | static async getNetCapabilities(netHandle: connection.NetHandle = NetworkUtil.getDefaultNetSync()): Promise<connection.NetCapabilities> {
return connection.getNetCapabilities(netHandle);
} | 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 getNetCapabilities AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left netHandle AST#identifier#Right AST#:#... | static async getNetCapabilities(netHandle: connection.NetHandle = NetworkUtil.getDefaultNetSync()): Promise<connection.NetCapabilities> {
return connection.getNetCapabilities(netHandle);
} | https://github.com/tdcare/tdwebrtc | 393f19cf808d8d99f1068f40b3dd0c38c1405b64 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoJsExtensions.ets | arkts | base64Decode | Base64解码 | base64Decode(str: string): string {
try {
const decoder = new util.Base64Helper();
const uint8Array = decoder.decodeSync(str);
return new util.TextDecoder().decodeToString(uint8Array);
} catch (error) {
logger.warn(TAG, `base64Decode失败: ${String(error)}`);
return str;
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left base64Decode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST... | base64Decode(str: string): string {
try {
const decoder = new util.Base64Helper();
const uint8Array = decoder.decodeSync(str);
return new util.TextDecoder().decodeToString(uint8Array);
} catch (error) {
logger.warn(TAG, `base64Decode失败: ${String(error)}`);
return str;
}
} | https://github.com/DaLongZhuaZi/manxia | 0ff02d9194826ec777250ffe234a9f5ccf99b7c6 | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/beans/LocationParam.ets | arkts | getMode | 获取模式
@return LocationMode | public static getMode(): LocationMode {
return LocationParam.getInstance().mode;
} | 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 getMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left ... | public static getMode(): LocationMode {
return LocationParam.getInstance().mode;
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/beans/LocationParam.ets#L157-L159 | 4fe63363226a05f6a6b192b093a420b578782136 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/WebViewMangaLoader.ets | arkts | onLoadStart | ==================== WebViewImageLoadListener 实现 ====================
加载开始回调 | onLoadStart(request: ImageRequestInfo): void {
logger.debug(TAG, `图片开始加载: ${request.url}`);
// 转发给其他监听器
this.loadListeners.forEach(listener => {
try {
listener.onLoadStart(request);
} catch (error) {
logger.error(TAG, `通知加载开始失败: ${error instanceof Error ? error.message : S... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onLoadStart 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#Left ImageRequestInfo AST#identifier#Right AST... | onLoadStart(request: ImageRequestInfo): void {
logger.debug(TAG, `图片开始加载: ${request.url}`);
// 转发给其他监听器
this.loadListeners.forEach(listener => {
try {
listener.onLoadStart(request);
} catch (error) {
logger.error(TAG, `通知加载开始失败: ${error instanceof Error ? error.message : S... | https://github.com/DaLongZhuaZi/manxia | acb5b38709d9b19e6e47b052ce45809595e7f343 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets | arkts | isZero | Return true if the value of this Decimal is 0 or -0, otherwise return false.
@returns { boolean } the boolean type | public isZero(): boolean {
return !!this.digits && this.digits!.at(0) === 0;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isZero 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#boolea... | public isZero(): boolean {
return !!this.digits && this.digits!.at(0) === 0;
} | https://gitcode.com/iop123123/arkts-static-skills | 4558be12f8380d509da4b63762bb9b22854d50d5 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets | arkts | getClass | @returns {Class} Class of interface
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public getClass(): Class {
return this.cls
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getClass 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 Class AST#ide... | public getClass(): Class {
return this.cls
} | https://gitcode.com/iop123123/arkts-static-skills | e09582fe4b471148d474bfb39dc1d4e33578aa12 | gitcode |
arkui-x/samples | CodeLab/Cases/feature/calendarswitch/src/main/ets/customcalendar/utils/TimeUtils.ets | arkts | getNextYearMonth | 获取下个月的年份和月份
@param year 年
@param month 月
@returns 返回下个月的年份和月份 | static getNextYearMonth(year: number, month: number): string {
year = (month + 1 > 12) ? year + 1 : year;
month = (month + 1 > 12) ? 1 : month + 1;
return year + '-' + month;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getNextYearMonth 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... | static getNextYearMonth(year: number, month: number): string {
year = (month + 1 > 12) ? year + 1 : year;
month = (month + 1 > 12) ? 1 : month + 1;
return year + '-' + month;
} | https://gitcode.com/arkui-x/samples | 46d5c4031b7c684178b7d07435ec23e25cbeea04 | gitcode |
YANGZX22/Voot | entry/src/main/ets/services/PipSubtitleManager.ets | arkts | isRunning | Check if PiP is running | isRunning(): boolean {
return this.isPipRunning;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isRunning AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#statement... | isRunning(): boolean {
return this.isPipRunning;
} | https://github.com/YANGZX22/Voot | 2bd7018af658198005065b4311369d67d53fce45 | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test32_original_index.ets | arkts | compare | --- Array.sort and reverse --- | function compare(a: number, b: number): number {
return a - b;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left compare AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left a AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#p... | function compare(a: number, b: number): number {
return a - b;
} | https://github.com/miaochiahao/ark-ghidra | 4e3af4eff992ebfea3e544abf2acbb7f661fa0b1 | github |
aimilin6688/KeePassHO | entry/src/main/ets/storage/onedrive/OneDriveClient.ets | arkts | updateAccessToken | 更新访问令牌
@param accessToken 访问令牌 | public updateAccessToken(accessToken: string): void {
if (this.config && this.axiosInstance) {
this.config.accessToken = accessToken;
this.axiosInstance.defaults.headers['Authorization'] = `Bearer ${accessToken}`;
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left updateAccessToken AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left accessToken AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#... | public updateAccessToken(accessToken: string): void {
if (this.config && this.axiosInstance) {
this.config.accessToken = accessToken;
this.axiosInstance.defaults.headers['Authorization'] = `Bearer ${accessToken}`;
}
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/onedrive/OneDriveClient.ets#L193-L198 | d4d468ed2f736a83f687a728f63447c7d7c5fbc2 | github |
Explore-In-HMOS-Wearable/unit-calculator | entry/src/main/ets/utils/UnitConversion.ets | arkts | convertDataRate | DATA TRANSFER RATE
Base unit: bps (bits per second). All SI decimal prefixes. | static convertDataRate(value: number, from: DataRateUnit, to: DataRateUnit): number {
const toBps: Record<DataRateUnit, number> = {
[DataRateUnit.BPS]: 1,
[DataRateUnit.KBPS]: 1e3,
[DataRateUnit.MBPS]: 1e6,
[DataRateUnit.GBPS]: 1e9,
[DataRateUnit.TBPS]: 1e12
};
const decima... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left convertDataRate 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... | static convertDataRate(value: number, from: DataRateUnit, to: DataRateUnit): number {
const toBps: Record<DataRateUnit, number> = {
[DataRateUnit.BPS]: 1,
[DataRateUnit.KBPS]: 1e3,
[DataRateUnit.MBPS]: 1e6,
[DataRateUnit.GBPS]: 1e9,
[DataRateUnit.TBPS]: 1e12
};
const decima... | https://github.com/Explore-In-HMOS-Wearable/unit-calculator | b909bf795b7ab29b94b89a81ab5153b53a844afb | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Array.ets | arkts | flat | Creates a new Array with all sub-array elements concatenated
into it recursively up to the specified depth.
@param depth
@returns a flattened Array with respect to depth | public flat(depth: number): Array<Object | null> {
return this.flat(depth as int)
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left flat AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identi... | public flat(depth: number): Array<Object | null> {
return this.flat(depth as int)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | f0488e328fdd7d8f40199f29a099ac6c6afcc22b | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | findLast | / === with element lambda functions ===
Finds the last element in the Float32Array that satisfies the condition
@param { function } fn - condition
@returns { number } - the last element that satisfies fn
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public findLast(fn: (val: number) => boolean): number {
let newF: (val: number, index: int, array: Float32Array) => boolean =
(val: number, index: int, array: Float32Array): boolean => { return fn(val) }
return (this.findLast(newF)).toDouble()
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left findLast 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 : AST#:... | public findLast(fn: (val: number) => boolean): number {
let newF: (val: number, index: int, array: Float32Array) => boolean =
(val: number, index: int, array: Float32Array): boolean => { return fn(val) }
return (this.findLast(newF)).toDouble()
} | https://gitcode.com/iop123123/arkts-static-skills | d7b9099afa01e50045d1ad4d930be4fcf63e42b6 | gitcode |
aimilin6688/KeePassHO | entry/src/main/ets/services/template/strategies/UserTemplateStrategy.ets | arkts | applyTemplate | 应用用户模板到条目 | applyTemplate(entry: KdbxEntry, template: ITemplate, options?: TemplateApplyOptions): void {
if (!this.supports(template)) {
return;
}
const userTemplate = template as IUserTemplate;
const opts: TemplateApplyOptions = {
overwriteExisting: options?.overwriteExisting ?? DEFAULT_APPLY_OPTION... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left applyTemplate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left entry AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left KdbxEntry AST#identifier#Right AST#,#Left... | applyTemplate(entry: KdbxEntry, template: ITemplate, options?: TemplateApplyOptions): void {
if (!this.supports(template)) {
return;
}
const userTemplate = template as IUserTemplate;
const opts: TemplateApplyOptions = {
overwriteExisting: options?.overwriteExisting ?? DEFAULT_APPLY_OPTION... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/template/strategies/UserTemplateStrategy.ets#L206-L241 | fc0927eb79e8be2d7ffdaba2c135ce83017be364 | github |
openharmony/arkui_ace_engine | advanced_ui_component/dialog/source/dialog.ets | arkts | getTextAlign | get Text Align
@param maxWidth maxWidth
@param content textContent
@param fontSize fontSize
@returns textAlign | function getTextAlign(maxWidth: number, content: ResourceStr, fontSize: number | string | Resource): TextAlign {
let contentSize: SizeOptions = measure.measureTextSize({
textContent: content,
fontSize: fontSize,
constraintWidth: maxWidth,
});
let oneLineSize: SizeOptions = measure.measureTextSize({
... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getTextAlign AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left maxWidth AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:... | function getTextAlign(maxWidth: number, content: ResourceStr, fontSize: number | string | Resource): TextAlign {
let contentSize: SizeOptions = measure.measureTextSize({
textContent: content,
fontSize: fontSize,
constraintWidth: maxWidth,
});
let oneLineSize: SizeOptions = measure.measureTextSize({
... | https://gitee.com/openharmony/arkui_ace_engine.git | 78ad50b9a9225e80b51983d611112f779fd51e06 | gitee |
HarmonyOS_Samples/BestPracticeSnippets | SegmentedPhotograph/entry/src/main/ets/mode/CameraService.ets | arkts | registerCameraStatusChange | Registers the callback function for changing the camera status.
@param err - Error information
@param cameraStatusInfo - Camera status information
@returns No return value | registerCameraStatusChange(err: BusinessError, cameraStatusInfo: camera.CameraStatusInfo): void {
if (err) {
Logger.info(TAG, `registerCameraStatusChange err:${err.code}`)
return;
}
Logger.info(TAG, `cameraId: ${cameraStatusInfo.camera.cameraId},status: ${cameraStatusInfo.status}`);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left registerCameraStatusChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left err AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left BusinessError AST#identifier#R... | registerCameraStatusChange(err: BusinessError, cameraStatusInfo: camera.CameraStatusInfo): void {
if (err) {
Logger.info(TAG, `registerCameraStatusChange err:${err.code}`)
return;
}
Logger.info(TAG, `cameraId: ${cameraStatusInfo.camera.cameraId},status: ${cameraStatusInfo.status}`);
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 758369c9dfa84c7504ee66548f3d8e764a3f46c8 | gitcode |
jjjjjjava/ffmpeg_tools | src/main/ets/ffmpeg/FFMpegUtils.ets | arkts | downloadAndConvert | 便捷方法:从URL下载视频并转换
@param url 视频URL
@param outputPath 输出文件路径
@param onProgress 进度回调
@returns Promise | static downloadAndConvert(
url: string,
outputPath: string,
onProgress?: (progress: number) => void
): Promise<number> {
return FFMpegUtils.executeFFmpegCommand({
cmds: ['-i', url, '-c', 'copy', outputPath],
onFFmpegProgress: onProgress || ((progress) => {
console.log(`Download p... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left downloadAndConvert AST#identifier#Right AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , A... | static downloadAndConvert(
url: string,
outputPath: string,
onProgress?: (progress: number) => void
): Promise<number> {
return FFMpegUtils.executeFFmpegCommand({
cmds: ['-i', url, '-c', 'copy', outputPath],
onFFmpegProgress: onProgress || ((progress) => {
console.log(`Download p... | https://github.com/jjjjjjava/ffmpeg_tools | 0f12a073dcad5d4ebf919c6777bd6a4f7e9cdef0 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/AxisBase.ets | arkts | getSpaceMin | Gets extra spacing for `axisMinimum` to be added to automatically calculated `axisMinimum` | public getSpaceMin(): number {
return this.mSpaceMin;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getSpaceMin AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#num... | public getSpaceMin(): number {
return this.mSpaceMin;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | f51c68b9fd497720d551596096d5db93ce46325f | gitee |
arkui-x/samples | CodeLab/Cases/feature/bluetooth/src/main/ets/viewmodel/AdvertiserBluetoothViewModel.ets | arkts | stopAdvertiser | 停止蓝牙广播服务 | stopAdvertiser(): void {
Log.showInfo(TAG, `stopAdvertiser`);
if (this.mGattServer) {
try {
this.offConnectStateChange();
// TODO: 知识点 停止蓝牙广播服务
ble.stopAdvertising();
} catch (err) {
Log.showError(TAG, `stopAdvertiser: startAdvertising err = ${err}`);
}
} ... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left stopAdvertiser AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_blo... | stopAdvertiser(): void {
Log.showInfo(TAG, `stopAdvertiser`);
if (this.mGattServer) {
try {
this.offConnectStateChange();
// TODO: 知识点 停止蓝牙广播服务
ble.stopAdvertising();
} catch (err) {
Log.showError(TAG, `stopAdvertiser: startAdvertising err = ${err}`);
}
} ... | https://gitcode.com/arkui-x/samples | b640b0f933ad3069fb11aa11b8b113c59bbd40ae | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/SafeUtils.ets | arkts | parseArr | 安全解析JSON字符串为数组。解析失败返回空数组 []。 | static parseArr<T>(jsonStr: string | undefined | null): T {
if (!jsonStr || jsonStr.trim() === '') {
return [] as T;
}
try {
return JSON.parse(jsonStr) as T;
} catch (error) {
logger.error(TAG, `JSON parse error (Arr): ${String(error)}, prefix: ${jsonStr.substring(0, 100)}`);
r... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#binary_expression#Left AST#identifier#Left parseArr AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Righ... | static parseArr<T>(jsonStr: string | undefined | null): T {
if (!jsonStr || jsonStr.trim() === '') {
return [] as T;
}
try {
return JSON.parse(jsonStr) as T;
} catch (error) {
logger.error(TAG, `JSON parse error (Arr): ${String(error)}, prefix: ${jsonStr.substring(0, 100)}`);
r... | https://github.com/DaLongZhuaZi/manxia | 0c62c642f201d552926c14ae9a5f06bc04039d52 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Animation/GlobalAnimationSystem.ets | arkts | easeInOutBack | 回弹缓入缓出 | private static easeInOutBack(t: number): number {
const c1 = 1.70158;
const c2 = c1 * 1.525;
return t < 0.5
? (Math.pow(2 * t, 2) * ((c2 + 1) * 2 * t - c2)) / 2
: (Math.pow(2 * t - 2, 2) * ((c2 + 1) * (t * 2 - 2) + c2) + 2) / 2;
} | 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 easeInOutBack AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left t AST#identifier#Right AST#:#Left : AS... | private static easeInOutBack(t: number): number {
const c1 = 1.70158;
const c2 = c1 * 1.525;
return t < 0.5
? (Math.pow(2 * t, 2) * ((c2 + 1) * 2 * t - c2)) / 2
: (Math.pow(2 * t - 2, 2) * ((c2 + 1) * (t * 2 - 2) + c2) + 2) / 2;
} | https://github.com/DaLongZhuaZi/manxia | 7d4bbc231aaaaff9305530d34ad1c42c66dbd7b5 | github |
openharmony/applications_notes | common/utils/src/main/ets/default/baseUtil/NoteUtil.ets | arkts | unsetNoteChecked | unset Note with Checked status
@param checkedNoteArray - Checked status Note list
@param noteItem - note | unsetNoteChecked(checkedNoteArray: NoteData[], noteItem: NoteData) {
let index = checkedNoteArray.findIndex((note) => {
return note == noteItem
})
LogUtil.info(TAG, "index " + index.toString() + noteItem.uuid)
index == -1 ? null : checkedNoteArray.splice(index, 1)
AppStorage.Set('CheckedNote... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left unsetNoteChecked AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left checkedNoteArray AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left NoteData AST#identifier#Righ... | unsetNoteChecked(checkedNoteArray: NoteData[], noteItem: NoteData) {
let index = checkedNoteArray.findIndex((note) => {
return note == noteItem
})
LogUtil.info(TAG, "index " + index.toString() + noteItem.uuid)
index == -1 ? null : checkedNoteArray.splice(index, 1)
AppStorage.Set('CheckedNote... | https://gitee.com/openharmony/applications_notes.git | 3fe0f6c378ab450035ca9dcd2d2acc44ea7bbf03 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Double.ets | arkts | $_invoke | Creates a new instance of a Double
@returns { Number }A new Double instance
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | static $_invoke(): Number {
return new Double();
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left $_invoke 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 Number AST#id... | static $_invoke(): Number {
return new Double();
} | https://gitcode.com/iop123123/arkts-static-skills | 26918b2e86eee97cf5a1098d9750875a8436dc75 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Date.ets | arkts | setUTCSeconds | Sets the seconds for a specified date according to universal time.
@param value new seconds | public setUTCSeconds(value: byte): void {
assert value >= 0 && value < 60;
let sec = ecmaSecFromTime(this.ms);
this.ms -= sec * msPerSecond;
this.ms += value * msPerSecond;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setUTCSeconds 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 byte AST#identifi... | public setUTCSeconds(value: byte): void {
assert value >= 0 && value < 60;
let sec = ecmaSecFromTime(this.ms);
this.ms -= sec * msPerSecond;
this.ms += value * msPerSecond;
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | e5de06c522514a5b5075c24a32d4b92c8314b0c0 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/Atomics.ets | arkts | fetchAdd | Atomically adds the given value to the current value and returns the previous value.
This operation is performed as a single atomic action that cannot be interrupted by other threads.
@param { double } val - The value to add to the current atomic double value
@returns { double } The previous value before the addition w... | public fetchAdd(val: double): double {
let current: double = this.load();
let expected: double = 0;
do {
expected = current;
current = this.compareAndSwap(expected, expected + val);
} while(current != expected)
return expected;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left fetchAdd AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left val AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left double A... | public fetchAdd(val: double): double {
let current: double = this.load();
let expected: double = 0;
do {
expected = current;
current = this.compareAndSwap(expected, expected + val);
} while(current != expected)
return expected;
} | https://gitcode.com/iop123123/arkts-static-skills | 339c1ee7807e24f7d2b1211021138f7d27ed560d | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/GamepadManager.ets | arkts | stopAllVibration | 立即停止所有振动(设备马达 + USB 控制器马达) | stopAllVibration(): void {
this.vibrationService.stopAll();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left stopAllVibration AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_b... | stopAllVibration(): void {
this.vibrationService.stopAll();
} | https://github.com/AlkaidLab/moonlight-harmony | db98bcaf3434193fd6ce6d33ee667b34111b19d7 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | set | Copies elements from an ArrayLike object to the Float32Array.
@param { ArrayLike<number> } array - An ArrayLike object containing the elements to copy.
@param { int } [offset] - Optional. The offset into the target array at which to begin
writing values from the source array. The default value is 0.
@throws { RangeErro... | public set(array: ArrayLike<number>, offset: int = 0): void {
const insertPos = offset
if (insertPos < 0 || insertPos + array.length > this.lengthInt) {
throw new RangeError("offset is out of bounds")
}
for (let i = 0; i < array.length; ++i) {
this.setUnsafe(i... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left set AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left array AST#identifier#Right AST#:#Left : AST#:#Right AST#ERRO... | public set(array: ArrayLike<number>, offset: int = 0): void {
const insertPos = offset
if (insertPos < 0 || insertPos + array.length > this.lengthInt) {
throw new RangeError("offset is out of bounds")
}
for (let i = 0; i < array.length; ++i) {
this.setUnsafe(i... | https://gitcode.com/iop123123/arkts-static-skills | d5aed9a6fa23ff28b8595b60d41fbf4b7ddf8f53 | gitcode |
OSpark-Team/Free-PCM | library/src/main/ets/utils/AudioDecoderManager.ets | arkts | createPcmStreamDecoder | 创建一个流式 PCM 解码器对象
@description 适用于与 AudioRenderer 的 'writeData' 回调配合使用,实现边解码边播放。
@param {string} inputPathOrUri - 本地路径或网络 URL
@param {PcmStreamDecoderOptions} [options] - 解码配置项
@param {PcmStreamDecoderCallbacks} [callbacks] - 进度与错误回调
@returns {PcmStreamDecoder} | public createPcmStreamDecoder(
inputPathOrUri: string,
options?: PcmStreamDecoderOptions,
callbacks?: PcmStreamDecoderCallbacks
): PcmStreamDecoder {
// 调用 NAPI 创建解码器
return testNapi.createPcmStreamDecoder(inputPathOrUri, options, callbacks) as PcmStreamDecoder;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left createPcmStreamDecoder AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left inputPathOrUri AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left str... | public createPcmStreamDecoder(
inputPathOrUri: string,
options?: PcmStreamDecoderOptions,
callbacks?: PcmStreamDecoderCallbacks
): PcmStreamDecoder {
// 调用 NAPI 创建解码器
return testNapi.createPcmStreamDecoder(inputPathOrUri, options, callbacks) as PcmStreamDecoder;
} | https://github.com/OSpark-Team/Free-PCM/blob/3440e7220d07d28815d172b4b3237145434075ee/library/src/main/ets/utils/AudioDecoderManager.ets#L273-L280 | 5a781ba3f1acab50c11cc78f8d36a46ac4d6171b | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/EnhancedBackupManager.ets | arkts | exportBackupData | 导出备份数据(根据选项) | private async exportBackupData(options: BackupOptions): Promise<BackupData> {
const appInfoManager = AppInfoManager.getInstance();
const versionName = await appInfoManager.getVersionName();
const versionCode = await appInfoManager.getVersionCode();
const appVersion = `${versionName}(${versionCode})`;
... | 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 exportBackupData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left options AST#identifier#Right AST#:#L... | private async exportBackupData(options: BackupOptions): Promise<BackupData> {
const appInfoManager = AppInfoManager.getInstance();
const versionName = await appInfoManager.getVersionName();
const versionCode = await appInfoManager.getVersionCode();
const appVersion = `${versionName}(${versionCode})`;
... | https://github.com/DaLongZhuaZi/manxia | 05a3ab756a1f4c11fd85e159fb6af1f0d0f15af0 | github |
AGenUI/AGenUI | playground/harmony/entry/src/main/ets/pages/AGenUIDemoPage.ets | arkts | addAGenUIContainer | Mounts a new AGenUIContainer for the given surface.
Called by SurfaceListenerImpl when the native engine signals that a surface
has been created. Increments surfaceVersion to force ForEach recreation.
@param surfaceId - The identifier of the newly created surface. | addAGenUIContainer(surfaceId: string) {
hilog.info(DOMAIN, TAG, 'Adding AGenUIContainer, surfaceId: %{public}s', surfaceId);
this.surfaceVersion++;
this.currentSurfaceId = surfaceId;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left addAGenUIContainer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left surfaceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Rig... | addAGenUIContainer(surfaceId: string) {
hilog.info(DOMAIN, TAG, 'Adding AGenUIContainer, surfaceId: %{public}s', surfaceId);
this.surfaceVersion++;
this.currentSurfaceId = surfaceId;
} | https://github.com/AGenUI/AGenUI | 3b1d8027e2636f66b89f2be50be479a778ab760f | github |
PollenWang6/HiXD | entry/src/main/ets/services/CasLoginService.ets | arkts | base64ToUint8Array | Base64 → Uint8Array | private base64ToUint8Array(base64: string): Uint8Array {
const base64Helper: util.Base64Helper = new util.Base64Helper();
return base64Helper.decodeSync(base64);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left base64ToUint8Array AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left base64 AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi... | private base64ToUint8Array(base64: string): Uint8Array {
const base64Helper: util.Base64Helper = new util.Base64Helper();
return base64Helper.decodeSync(base64);
} | https://github.com/PollenWang6/HiXD | a3ee3c35a092cb993ee8f80e37d40a68cd0564ce | github |
Joker-x-dev/CoolMallArkTS | feature/user/src/main/ets/viewmodel/AddressListViewModel.ets | arkts | shouldShowBottomButton | 是否显示底部操作按钮
@returns {boolean} 是否显示 | shouldShowBottomButton(): boolean {
return this.uiState !== BaseNetWorkListUiState.LOADING
&& this.uiState !== BaseNetWorkListUiState.ERROR;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left shouldShowBottomButton AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right ... | shouldShowBottomButton(): boolean {
return this.uiState !== BaseNetWorkListUiState.LOADING
&& this.uiState !== BaseNetWorkListUiState.ERROR;
} | https://github.com/Joker-x-dev/CoolMallArkTS | 7035b65d705a8b7278ba7a33bd2bcb793c5e455a | github |
aimilin6688/KeePassHO | entry/src/main/ets/common/utils/UrlUtils.ets | arkts | getHost | 带协议的host地址
http://www.aimilin.net/a/b/c -> http://www.aimilin.net
@param url
@returns | public static getHost(urlString: string | undefined): string {
if (!urlString) {
return "";
}
try {
let parsedUrl = url.URL.parseURL(urlString);
return parsedUrl.protocol + "//" + parsedUrl.host;
} catch (e) {
hilog.warn(DOMAIN, TAG, "getHost error: " + e);
return "";
... | 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 getHost AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#identifier#Left urlString AST#identifier#Right AST#... | public static getHost(urlString: string | undefined): string {
if (!urlString) {
return "";
}
try {
let parsedUrl = url.URL.parseURL(urlString);
return parsedUrl.protocol + "//" + parsedUrl.host;
} catch (e) {
hilog.warn(DOMAIN, TAG, "getHost error: " + e);
return "";
... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/UrlUtils.ets#L17-L28 | 36a60a682900518935ed5c219397da72bf61160d | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/StreamingSession.ets | arkts | setBitrate | ---------------------------------------------------------------------------
服务器控制
---------------------------------------------------------------------------
动态调整码率 (kbps) | async setBitrate(bitrate: number): Promise<boolean> {
if (!this.nvHttp) return false;
try {
const success = await this.nvHttp.setBitrate(bitrate);
if (success && this.config) this.config.bitrate = bitrate;
return success;
} catch {
return false;
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left setBitrate AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left bitrate AST#identifier#Right AST#type_annotation#... | async setBitrate(bitrate: number): Promise<boolean> {
if (!this.nvHttp) return false;
try {
const success = await this.nvHttp.setBitrate(bitrate);
if (success && this.config) this.config.bitrate = bitrate;
return success;
} catch {
return false;
}
} | https://github.com/AlkaidLab/moonlight-harmony | 1ceacd35f16734860964bf6d4937b48693c7025b | github |
fbinba3955/Flymby | common/src/main/ets/video/VideoPlayerView.ets | arkts | onSliding | 滑动进度条 | onSliding(value: number): void {
this.centerTextShow = true;
this.centerText = this.formatTime(value) + "/" + this.formatTime(this.totalTime);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onSliding AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) AST#... | onSliding(value: number): void {
this.centerTextShow = true;
this.centerText = this.formatTime(value) + "/" + this.formatTime(this.totalTime);
} | https://github.com/fbinba3955/Flymby | df8058bb61fe6819ea89209f385370cf4c79abd5 | github |
LZZLHY/hlib | entry/src/main/ets/pages/ReaderPage.ets | arkts | aboutToDisappear | ── 阅读进度持久化 ──
退出页前保存 + 清理超时。 | aboutToDisappear(): void {
this.saveScroll();
this.clearLoadTimeout();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToDisappear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_b... | aboutToDisappear(): void {
this.saveScroll();
this.clearLoadTimeout();
} | https://github.com/LZZLHY/hlib | 6cf54b6cbf9b140b4c6ea22fd74e67b8df55a97b | github |
OHPG/FinSdk | jellyfin/src/main/ets/api/MediaInfoApi.ets | arkts | openLiveStream | openLiveStream
@summary Opens a media source.
@param {MediaInfoApiOpenLiveStreamRequest} requestParameters Request parameters.
@throws {RequiredError}
@memberof MediaInfoApi | public async openLiveStream(requestParameters: MediaInfoApiOpenLiveStreamRequest = {}): Promise<LiveStreamResponse> {
return this.apiClient.post({path: "/LiveStreams/Open", parameters: requestParameters, data: requestParameters.openLiveStreamDto, excludeParams: ['openLiveStreamDto']})
} | 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 openLiveStream AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left requestParameters AST#identifier#Right AS... | public async openLiveStream(requestParameters: MediaInfoApiOpenLiveStreamRequest = {}): Promise<LiveStreamResponse> {
return this.apiClient.post({path: "/LiveStreams/Open", parameters: requestParameters, data: requestParameters.openLiveStreamDto, excludeParams: ['openLiveStreamDto']})
} | https://github.com/OHPG/FinSdk | 4b48178ff8ed3ac750609343adfbd9f1d99f018d | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Parsers/ReaderKitParser.ets | arkts | buildEBookFromReaderKit | 从 Reader Kit 返回的信息构建 EBook 对象 | private buildEBookFromReaderKit(bookInfo: ReaderKitBookInfo): EBook {
const now = Date.now();
const bookId = `ebook_${this.format.toLowerCase()}_${now}_${Math.random().toString(36).substring(2, 9)}`;
const metadata: EBookMetadata = {
title: bookInfo.title,
author: bookInfo.author,
publi... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildEBookFromReaderKit AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bookInfo AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#i... | private buildEBookFromReaderKit(bookInfo: ReaderKitBookInfo): EBook {
const now = Date.now();
const bookId = `ebook_${this.format.toLowerCase()}_${now}_${Math.random().toString(36).substring(2, 9)}`;
const metadata: EBookMetadata = {
title: bookInfo.title,
author: bookInfo.author,
publi... | https://github.com/DaLongZhuaZi/manxia | cf176cadc84a53ab21e782a3f7da1ff25ffe408a | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Components/FontAware.ets | arkts | notifyAllCallbacks | 通知所有回调 | private static notifyAllCallbacks(): void {
FontAwareHelper.fontChangeCallbacks.forEach((callback) => {
try {
callback(FontAwareHelper.globalState);
} catch (error) {
logger.error(TAG, `字体变化回调执行失败: ${String(error)}`);
}
});
} | 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 notifyAllCallbacks AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Rig... | private static notifyAllCallbacks(): void {
FontAwareHelper.fontChangeCallbacks.forEach((callback) => {
try {
callback(FontAwareHelper.globalState);
} catch (error) {
logger.error(TAG, `字体变化回调执行失败: ${String(error)}`);
}
});
} | https://github.com/DaLongZhuaZi/manxia | bfe7692d2a266b2bebc5f779a335ae1e358a583d | github |
AGenUI/AGenUI | platforms/harmony/agenui/src/main/ets/agenui/bridge/AGenUIEngineSurfaceManagerBridge.ets | arkts | beginTextStream | MARK: - Data Transport
Begins a streaming data session | beginTextStream(): void {
nativeBeginTextStream(this.instanceId);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left beginTextStream AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bl... | beginTextStream(): void {
nativeBeginTextStream(this.instanceId);
} | https://github.com/AGenUI/AGenUI | 162c72145a421f30b2083acc6f14cd40a57a2822 | github |
Explore-In-HMOS-Wearable/how-to-use-weather-kit | entry/src/main/ets/components/TTSAnnouncementCard.ets | arkts | estimateDuration | Estimate speaking duration (rough approximation) | static estimateDuration(text: string, wordsPerMinute: number = 150): number {
const words = TTSTextProcessor.splitIntoWords(text);
return (words.length / wordsPerMinute) * 60 * 1000; // Return milliseconds
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left estimateDuration AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | static estimateDuration(text: string, wordsPerMinute: number = 150): number {
const words = TTSTextProcessor.splitIntoWords(text);
return (words.length / wordsPerMinute) * 60 * 1000; // Return milliseconds
} | https://github.com/Explore-In-HMOS-Wearable/how-to-use-weather-kit | 15bec84e0233dc1ecabe9726b474d2230c92b46a | github |
DaLongZhuaZi/NGF | ngf_framework/src/main/ets/utils/StringUtils.ets | arkts | removeSuffix | 移除字符串末尾的指定后缀;若不匹配则原样返回 | static removeSuffix(value: string, suffix: string): string {
if (suffix.length === 0) {
return value;
}
if (value.length >= suffix.length && value.substring(value.length - suffix.length) === suffix) {
return value.substring(0, value.length - suffix.length);
}
return value;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left removeSuffix 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 st... | static removeSuffix(value: string, suffix: string): string {
if (suffix.length === 0) {
return value;
}
if (value.length >= suffix.length && value.substring(value.length - suffix.length) === suffix) {
return value.substring(0, value.length - suffix.length);
}
return value;
} | https://github.com/DaLongZhuaZi/NGF | e269d0a4ffd0afd5a9698004e6e85bb7b3dd27da | github |
CPF-ApplicationTPC/openharmony_tpc_samples | SwipeMenuListView/library/src/main/ets/model/SwipeMenu.ets | arkts | addMenuItem | 添加菜单项 | addMenuItem(item: SwipeMenuItem): void {
this.items.push(item);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addMenuItem AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left item AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left SwipeMenuItem AST#identifier#Right AST#)#Lef... | addMenuItem(item: SwipeMenuItem): void {
this.items.push(item);
} | https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples | b8ea1652063c022291dc302406fbdc77d0658b28 | gitcode |
killetom/ktretrofit | ktretrofit/src/main/ets/retrofit/util/MetadataUtil.ets | arkts | definePartParameter | Define part parameter metadata | static definePartParameter(paramIndex: number, paramName: string, target: Object, propertyKey: string | symbol): void {
let partParams = this.getMetadata('retrofit:partParams', target, propertyKey) as Record<number, string> || {};
partParams[paramIndex] = paramName;
this.defineMetadata('retrofit:partParam... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left definePartParameter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left paramIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST... | static definePartParameter(paramIndex: number, paramName: string, target: Object, propertyKey: string | symbol): void {
let partParams = this.getMetadata('retrofit:partParams', target, propertyKey) as Record<number, string> || {};
partParams[paramIndex] = paramName;
this.defineMetadata('retrofit:partParam... | https://github.com/killetom/ktretrofit | 93d5b933cd6b7ab3ac6b1d36c78f943b3f46c7f4 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.