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 |
|---|---|---|---|---|---|---|---|---|---|---|
Gramony/Gramony | features/home/src/main/ets/views/Message/FmtEntities.ets | arkts | isLikelyUrl | 粗略判断文本是否可能为 URL | function isLikelyUrl(text: string): boolean {
if (!text) return false;
// 常见前缀或域名结构的简单判断
const lower = text.toLowerCase();
if (lower.startsWith('http://') || lower.startsWith('https://')) return true;
if (lower.startsWith('www.')) return true;
// 简单的域名匹配,如 example.com 或 sub.domain.io/path
const domainLike... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left isLikelyUrl AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left text AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Righ... | function isLikelyUrl(text: string): boolean {
if (!text) return false;
// 常见前缀或域名结构的简单判断
const lower = text.toLowerCase();
if (lower.startsWith('http://') || lower.startsWith('https://')) return true;
if (lower.startsWith('www.')) return true;
// 简单的域名匹配,如 example.com 或 sub.domain.io/path
const domainLike... | https://github.com/Gramony/Gramony | 6afe34f857a2100fad4da2c07c233e377a6b99b9 | github |
Vincent-Leon/zotero-harmony | entry/src/main/ets/data/ItemRepository.ets | arkts | clearAll | ---- cleanup ---- | async clearAll(): Promise<void> {
try {
const allItems = new relationalStore.RdbPredicates(TABLE_ITEMS);
await this.rdb.delete(allItems);
const allCols = new relationalStore.RdbPredicates(TABLE_COLLECTIONS);
await this.rdb.delete(allCols);
const allSync = new relationalStore.RdbPredi... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left clearAll AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_typ... | async clearAll(): Promise<void> {
try {
const allItems = new relationalStore.RdbPredicates(TABLE_ITEMS);
await this.rdb.delete(allItems);
const allCols = new relationalStore.RdbPredicates(TABLE_COLLECTIONS);
await this.rdb.delete(allCols);
const allSync = new relationalStore.RdbPredi... | https://github.com/Vincent-Leon/zotero-harmony | 86f850f55658286c804a014694bdcf24022c5ea3 | github |
tdcare/tdwebrtc | src/main/ets/WebRTCManager.ets | arkts | getCodecCapabilities | v36: 获取设备编解码能力(供外部诊断使用) | public getCodecCapabilities(): VideoCodecCapabilities | null {
return this.codecCapabilities;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCodecCapabilities 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... | public getCodecCapabilities(): VideoCodecCapabilities | null {
return this.codecCapabilities;
} | https://github.com/tdcare/tdwebrtc | 9795dc176a78cee7521db073892c099a2ee24f66 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets | arkts | getUTCSeconds | Returns the seconds in the specified date according to universal time.
@returns { int } the seconds in the specified date according to universal time.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public getUTCSeconds(): int {
return ecmaSecFromTime(this.ms);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getUTCSeconds 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 int AST#... | public getUTCSeconds(): int {
return ecmaSecFromTime(this.ms);
} | https://gitcode.com/iop123123/arkts-static-skills | 94bc396670c7e7f5b3226865da4edcec36dd2a3c | gitcode |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/TagDAO.ets | arkts | addTagToBill | 为账单添加标签
@param billId 账单ID
@param tagId 标签ID | static async addTagToBill(billId: number, tagId: number): Promise<void> {
const store = DatabaseManager.getDatabase();
const now = new Date().toISOString();
const sql = `
INSERT OR IGNORE INTO bill_tags (bill_id, tag_id, created_at)
VALUES (?, ?, ?)
`;
try {
await store.executeSq... | 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 addTagToBill AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left billId AST#identifier#Right AST#:#Left : AS... | static async addTagToBill(billId: number, tagId: number): Promise<void> {
const store = DatabaseManager.getDatabase();
const now = new Date().toISOString();
const sql = `
INSERT OR IGNORE INTO bill_tags (bill_id, tag_id, created_at)
VALUES (?, ?, ?)
`;
try {
await store.executeSq... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 48f3bf93b6cecd782838fa08d0ac1d85405b776d | github |
openharmony-tpc/mp4parser | library/src/main/ets/mp4parser/MP4Parser.ets | arkts | getMetaData | get video or audio meta data
@param startTime
@param endTime
@param sourcePath
@param outPath
@param callBack | static getMetaData(sourcePath: string, callBack: StringCallBack) {
mp4parser_napi.exeFFprobeCmd("ffprobe -v error -hide_banner -print_format json -show_format -show_streams -show_chapters -i " + sourcePath)
.then((result: string) => {
callBack.callBackResult(result)
});
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getMetaData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourcePath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#... | static getMetaData(sourcePath: string, callBack: StringCallBack) {
mp4parser_napi.exeFFprobeCmd("ffprobe -v error -hide_banner -print_format json -show_format -show_streams -show_chapters -i " + sourcePath)
.then((result: string) => {
callBack.callBackResult(result)
});
} | https://gitee.com/openharmony-tpc/mp4parser.git | 6914104b9731632f2829d2892960a20cfd281a6d | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/ImageCacheManager.ets | arkts | startCleanupTimer | 启动清理定时器 | private startCleanupTimer(): void {
if (this.cleanupTimerId >= 0) {
return;
}
// 每小时清理一次过期缓存
this.cleanupTimerId = setInterval(() => {
this.cleanupExpiredCache();
}, 60 * 60 * 1000) as number;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left startCleanupTimer 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#e... | private startCleanupTimer(): void {
if (this.cleanupTimerId >= 0) {
return;
}
// 每小时清理一次过期缓存
this.cleanupTimerId = setInterval(() => {
this.cleanupExpiredCache();
}, 60 * 60 * 1000) as number;
} | https://github.com/DaLongZhuaZi/manxia | 17992b612f97af1dafa7841bec892ed9759615ea | github |
Joker-x-dev/CoolMallArkTS | core/datastore/src/main/ets/datasource/account/AccountStoreDataSourceImpl.ets | arkts | constructor | 构造函数
@param {common.Context} context UIAbility 上下文 | constructor(context: common.Context) {
this.prefs = new PreferencesUtil(context, AccountStoreDataSourceImpl.PREFS_NAME);
} | 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 context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Left... | constructor(context: common.Context) {
this.prefs = new PreferencesUtil(context, AccountStoreDataSourceImpl.PREFS_NAME);
} | https://github.com/Joker-x-dev/CoolMallArkTS | 2c8ce21b99f0630e7c3273d88c8270bf847c5735 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/export/services/ExportService.ets | arkts | collectUserData | 收集用户数据
@param userId 用户ID
@returns 导出数据内容 | private static async collectUserData(userId: number): Promise<ExportDataContent> {
try {
ExportService.logInfo(`开始收集用户数据: userId=${userId}`);
// 并行查询所有数据
const results = await Promise.all([
UserDAO.getById(userId),
AccountDAO.getByUserId(userId),
CategoryDAO.getAll(userI... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left collectUserData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left... | private static async collectUserData(userId: number): Promise<ExportDataContent> {
try {
ExportService.logInfo(`开始收集用户数据: userId=${userId}`);
// 并行查询所有数据
const results = await Promise.all([
UserDAO.getById(userId),
AccountDAO.getByUserId(userId),
CategoryDAO.getAll(userI... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | a37a4b448e36c1685cb9f29eee32258a72154be7 | github |
Countly/countly-sdk-hos | library/src/ohosTest/ets/test/Consent.test.ets | arkts | <arrow> | ViewsApi | async (): Promise<void> => { await h.instance.views.startAutoStoppedView('post_halt_view_auto', null); }, | AST#program#Left AST#ERROR#Left AST#arrow_function#Left AST#async#Left async AST#async#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_type#Left AST#type_identifier#Left Promise AST#type_identifi... | async (): Promise<void> => { await h.instance.views.startAutoStoppedView('post_halt_view_auto', null); }, | https://github.com/Countly/countly-sdk-hos | d38eaf2e565d5f78f5717f9541dc020cb3fbe97d | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/DynamicUrlResolver.ets | arkts | addQueryParams | 添加查询参数到URL | addQueryParams(url: string, params: Record<string, string>): string {
if (!params || Object.keys(params).length === 0) {
return url;
}
const separator = url.includes('?') ? '&' : '?';
const queryString = Object.keys(params)
.map(key => `${encodeURIComponent(key)}=${encodeURIComponent(para... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left addQueryParams AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , A... | addQueryParams(url: string, params: Record<string, string>): string {
if (!params || Object.keys(params).length === 0) {
return url;
}
const separator = url.includes('?') ? '&' : '?';
const queryString = Object.keys(params)
.map(key => `${encodeURIComponent(key)}=${encodeURIComponent(para... | https://github.com/DaLongZhuaZi/manxia | 4c81abdf0ce4703b6e817e0a97e311292d93ac7c | github |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/components/parts/Downloads/Panel.ets | arkts | estTime | Estimate time remaining.
@param remaining The remaining part.
@param speed The speed.
@returns A string. | estTime(remaining: number, speed: number) {
if (remaining == 0) return ' ヽ(°◇° )ノ';
if (speed == 0) return ' ∞';
return ' ' + addUnitsToSeconds(Math.ceil(remaining / speed));
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left estTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left remaining AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Le... | estTime(remaining: number, speed: number) {
if (remaining == 0) return ' ヽ(°◇° )ノ';
if (speed == 0) return ' ∞';
return ' ' + addUnitsToSeconds(Math.ceil(remaining / speed));
} | https://github.com/awaLiny2333/LinysBrowser_NEXT | 480dbaa352864504e540d4adc7639f4a74c52d81 | github |
AGenUI/AGenUI | platforms/harmony/agenui/src/main/ets/agenui/function/FunctionManager.ets | arkts | registerFunction | Registers a function.
@param func IFunctionCall implementation | public registerFunction(func: IFunctionCall): void {
const config = func.getConfig();
const name = config.name;
if (name.length === 0) {
hilog.error(0x0000, 'FunctionManager', 'registerFunction failed: name is empty');
return;
}
// Convert FunctionResult into the format expected by th... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left registerFunction AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left func AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | public registerFunction(func: IFunctionCall): void {
const config = func.getConfig();
const name = config.name;
if (name.length === 0) {
hilog.error(0x0000, 'FunctionManager', 'registerFunction failed: name is empty');
return;
}
// Convert FunctionResult into the format expected by th... | https://github.com/AGenUI/AGenUI | 30df2a4ab08167889ec3f9dc483a26d67e7a53d2 | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/CrashLogService.ets | arkts | hasCrashLog | 检查是否存在崩溃日志 | public async hasCrashLog(): Promise<boolean> {
try {
if (!this.logDirPath) {
return false;
}
const files = await this.getCrashLogFiles();
return files.length > 0;
} catch (error) {
const err = error as BusinessError;
hilog.error(DOMAIN, TAG, 'Failed to check crash l... | 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 hasCrashLog AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Le... | public async hasCrashLog(): Promise<boolean> {
try {
if (!this.logDirPath) {
return false;
}
const files = await this.getCrashLogFiles();
return files.length > 0;
} catch (error) {
const err = error as BusinessError;
hilog.error(DOMAIN, TAG, 'Failed to check crash l... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/CrashLogService.ets#L405-L417 | 3db72a2fc61a68c357fd6077f973690e9d7c23d3 | github |
fuhhhhhhhh/openharmony | entry/src/main/ets/data/database/DBManager.ets | arkts | initDB | 初始化数据库
创建表结构并设置数据库版本 | public async initDB(): Promise<void> {
if (!this.context) {
throw new Error('需要先设置context');
}
try {
const config: relationalStore.StoreConfig = {
name: this.DB_NAME,
securityLevel: relationalStore.SecurityLevel.S1,
};
this.rdbStore = await relationalStore.getRdbS... | 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 initDB AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : ... | public async initDB(): Promise<void> {
if (!this.context) {
throw new Error('需要先设置context');
}
try {
const config: relationalStore.StoreConfig = {
name: this.DB_NAME,
securityLevel: relationalStore.SecurityLevel.S1,
};
this.rdbStore = await relationalStore.getRdbS... | https://github.com/fuhhhhhhhh/openharmony | 8449ff913018d170c3026b95e8666843de850355 | github |
CsCesium/KantaiHomo | entry/src/main/ets/infra/fairy/service/FairyService.ets | arkts | requestOpenDashboard | Signal the main window to open the Dashboard.
Observers watch 'fairy.openDashboard' in AppStorage. | requestOpenDashboard(): void {
AppStorage.set<number>('fairy.openDashboard', Date.now());
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left requestOpenDashboard 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#stateme... | requestOpenDashboard(): void {
AppStorage.set<number>('fairy.openDashboard', Date.now());
} | https://github.com/CsCesium/KantaiHomo | bf77e12b39ea2756cd310809a46fe5d76971f526 | github |
tdcare/tdwebrtc | example/SignalingClientExample.ets | arkts | sendSessionDescription | ============================================================
SDP/ICE 交换
============================================================
发送 SDP 描述 | public sendSessionDescription(sdp: string, type: 'offer' | 'answer', toMac: string): void {
if (!this.signaling) {
return;
}
this.signaling.sendSessionDescription(sdp, type, toMac, this.currentRoomId);
console.log(`[SignalingExample] 发送 ${type} to ${toMac}`);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left sendSessionDescription AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left sdp AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier... | public sendSessionDescription(sdp: string, type: 'offer' | 'answer', toMac: string): void {
if (!this.signaling) {
return;
}
this.signaling.sendSessionDescription(sdp, type, toMac, this.currentRoomId);
console.log(`[SignalingExample] 发送 ${type} to ${toMac}`);
} | https://github.com/tdcare/tdwebrtc | a64d83d7ab3c1d8fe078c2bf2d106f79958bfcf6 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Console.ets | arkts | debug | Prints debug-level messages
If first argument is a string it is treated as a format string
@param {...Any[]} vals - Variable number of values to be logged
@returns {void}
@public | public debug(...vals: Any[]): void {
this.printRest(LogLevel.DEBUG, ...vals)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left debug AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#ERROR#Left AST#identifier#Left val... | public debug(...vals: Any[]): void {
this.printRest(LogLevel.DEBUG, ...vals)
} | https://gitcode.com/iop123123/arkts-static-skills | 38879a6dcec405f5f2c2b9d43ac7905247dbe97a | gitcode |
Cool_foolisher1/ArkTSRepository | GraphicalCode/features/algorithm/src/main/ets/service/AlgorithmService.ets | arkts | getComponentData | 获取组件数据
@param currentPage 当前页
@param pageSize 每页上的资源数据数量
@returns | public getComponentData(currentPage?: number, pageSize?: number): Promise<ResponseModel<ComponentModel>> {
Logger.info(TAG, `getComponentData, 当前页: ${currentPage}, 每页上的资源数据数量: ${pageSize}`)
return this.getComponentDataByLocal()
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getComponentData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left currentPage AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST... | public getComponentData(currentPage?: number, pageSize?: number): Promise<ResponseModel<ComponentModel>> {
Logger.info(TAG, `getComponentData, 当前页: ${currentPage}, 每页上的资源数据数量: ${pageSize}`)
return this.getComponentDataByLocal()
} | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 8c0b3a2659c76c7ebb626358cb59672149a1a070 | gitcode |
Tencent-RTC/TUIKit_Harmony | call/src/main/ets/common/widgets/Toast.ets | arkts | unbindHost | Drop the cached UIContext on `TUICallKit.detach()`. | static unbindHost(): void {
Toast._hostUIContext = null;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left unbindHost AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_... | static unbindHost(): void {
Toast._hostUIContext = null;
} | https://github.com/Tencent-RTC/TUIKit_Harmony | 3124f9f4d6290285b2ef14acb42a191421123f2f | github |
751496032/ZRouter | RouterApi/src/main/ets/api/RouterMgr.ets | arkts | getParamByName | 获取跳转携带的参数
@param name
@returns | public getParamByName(name: string): Record<string, ObjectOrNull>[] {
return this.getNavStack().getParamByName(name) as Record<string, ObjectOrNull>[]
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getParamByName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left s... | public getParamByName(name: string): Record<string, ObjectOrNull>[] {
return this.getNavStack().getParamByName(name) as Record<string, ObjectOrNull>[]
} | https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/api/RouterMgr.ets#L689-L691 | 8b9b98f7c65c8f67ffdc5256905770f2647da664 | github |
arkui-x/samples | CodeLab/Cases/feature/cuberotateanimation/src/main/ets/components/CubeRotateAnimationSwiper.ets | arkts | resetAnimationAttr | 重置动画属性。 | resetAnimationAttr() {
this.angleList = new Array(this.items.length).fill(0);
this.centerXList = new Array(this.items.length).fill('100%');
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left resetAnimationAttr 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... | resetAnimationAttr() {
this.angleList = new Array(this.items.length).fill(0);
this.centerXList = new Array(this.items.length).fill('100%');
} | https://gitcode.com/arkui-x/samples | e25be2325dbcce96593463315cae58a1d472a3a7 | gitcode |
smarthane/DrawerLayout | DrawerLayout/src/main/ets/components/DrawerLayout.ets | arkts | watchDrawerTypeChange | 观察左右侧边栏是否有变化 | watchDrawerTypeChange() {
switch (this.currentDrawerType) {
case DrawerLayout.Type.LEFT:
this.model.drawerPositionX = this.model.drawerWidth * -1;
break;
case DrawerLayout.Type.RIGHT:
this.model.drawerPositionX = this.model.displayWidth;
break;
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left watchDrawerTypeChange 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_bl... | watchDrawerTypeChange() {
switch (this.currentDrawerType) {
case DrawerLayout.Type.LEFT:
this.model.drawerPositionX = this.model.drawerWidth * -1;
break;
case DrawerLayout.Type.RIGHT:
this.model.drawerPositionX = this.model.displayWidth;
break;
}
} | https://github.com/smarthane/DrawerLayout | 7752b0e70a0aef7a03f9a6a58c2564faec632ecd | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/ThemeManager.ets | arkts | getThemeConfig | 获取主题配置(异步) | public async getThemeConfig(theme?: ThemeType): Promise<ThemeConfig> {
const targetTheme = theme || await this.getActualTheme();
return THEME_CONFIGS[targetTheme];
} | 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 getThemeConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left theme AST#identifier#Right AST#?#Left ? A... | public async getThemeConfig(theme?: ThemeType): Promise<ThemeConfig> {
const targetTheme = theme || await this.getActualTheme();
return THEME_CONFIGS[targetTheme];
} | https://github.com/DaLongZhuaZi/manxia | a438a274ff759f939e2913bd19d4cf16c62558b9 | github |
CsCesium/KantaiHomo | entry/src/main/ets/features/alerts/executor.ets | arkts | handleSortieAdvance | 进击选择出现提醒
- 始终振动提醒玩家注意
- 无击沉风险时显示 Toast
- 有击沉风险时由 WebHostController 的回调负责弹窗,此处仅振动(避免重复覆盖对话框) | async function handleSortieAdvance(alert: SortieAdvanceAlert): Promise<void> {
const config = getAlertBus().getConfig();
if (!config.enableAdvanceAlert) return;
if (config.enableVibrate) {
await executeVibrate(config.vibrateDurationMs);
// 双击振动增强感知
setTimeout(() => {
void executeVibrate(config.... | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left handleSortieAdvance AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left alert AST#identifier#Right AS... | async function handleSortieAdvance(alert: SortieAdvanceAlert): Promise<void> {
const config = getAlertBus().getConfig();
if (!config.enableAdvanceAlert) return;
if (config.enableVibrate) {
await executeVibrate(config.vibrateDurationMs);
// 双击振动增强感知
setTimeout(() => {
void executeVibrate(config.... | https://github.com/CsCesium/KantaiHomo | d5bf662451c6cfa23119d2472d2c8826c32f0afc | github |
YANGZX22/Voot | entry/src/main/ets/services/ContinuityService.ets | arkts | requestDistributedPermission | 请求分布式数据同步权限 | async requestDistributedPermission(context: common.UIAbilityContext): Promise<boolean> {
const atManager = abilityAccessCtrl.createAtManager();
const permissions: Array<Permissions> = ['ohos.permission.DISTRIBUTED_DATASYNC'];
try {
const result: PermissionRequestResult = await atManager.request... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left requestDistributedPermission AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left context AST#identifier#Right AST#type_annotation#L... | async requestDistributedPermission(context: common.UIAbilityContext): Promise<boolean> {
const atManager = abilityAccessCtrl.createAtManager();
const permissions: Array<Permissions> = ['ohos.permission.DISTRIBUTED_DATASYNC'];
try {
const result: PermissionRequestResult = await atManager.request... | https://github.com/YANGZX22/Voot | 6dda7e8ef8d550f77e5cae07f32c142be5684a05 | github |
HarmonyOS_Samples/hmosworld | HMOSWorld/Application/commons/aspect/src/main/ets/utils/AspectUtil.ets | arkts | addBefore | Insert some logic before the method.
@param methodClassName - The name of the operated class.
@param targetClass - The operated class
@param methodName- The name of the operated method.
@param isStatic - The flag whether the method is static.
@param beforeFun - The logic inserted before the method.
@param insteadFun - ... | public static addBefore(methodClassName: string, targetClass: Object, methodName: string, isStatic: boolean) {
util.Aspect.addBefore(targetClass, methodName, isStatic, (instance: Object, ...args: Object[]) => {
const currentTime: number = (new Date()).getTime();
const params: string = JSON.stringify([... | 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 addBefore AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left methodClassName AST#identifier#Right AST#ERROR#Left AST#:#Le... | public static addBefore(methodClassName: string, targetClass: Object, methodName: string, isStatic: boolean) {
util.Aspect.addBefore(targetClass, methodName, isStatic, (instance: Object, ...args: Object[]) => {
const currentTime: number = (new Date()).getTime();
const params: string = JSON.stringify([... | https://gitcode.com/HarmonyOS_Samples/hmosworld | b03564b350c7a90b3237f1dfbeeca94ac6b9595f | gitcode |
offlinecat-dev/OCNetORM | example/database/DatabaseInit.ets | arkts | registerEntities | 注册所有实体 | private registerEntities(): void {
// 注册用户实体
registerUserEntity()
// 如果有更多实体,在此处继续注册
// registerProductEntity()
// registerOrderEntity()
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left registerEntities 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#ex... | private registerEntities(): void {
// 注册用户实体
registerUserEntity()
// 如果有更多实体,在此处继续注册
// registerProductEntity()
// registerOrderEntity()
} | https://github.com/offlinecat-dev/OCNetORM | 80551b0df00fc87f14760b16b8d611d6f66e0c99 | github |
openharmony-sig/applications_clock | common/src/main/ets/manager/SnoozeManager.ets | arkts | getSnoozedTimes | Obtains the number of naps.
@param alarmId alarm id
@return number of naps | async getSnoozedTimes(alarmId: string): Promise<number> {
const preferences = await this.getPreferences();
const snoozedTimes = await preferences.get(alarmId, 0);
return Number(snoozedTimes);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getSnoozedTimes AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left alarmId AST#identifier#Right AST#type_annotation#Left AST#:#Lef... | async getSnoozedTimes(alarmId: string): Promise<number> {
const preferences = await this.getPreferences();
const snoozedTimes = await preferences.get(alarmId, 0);
return Number(snoozedTimes);
} | https://gitee.com/openharmony-sig/applications_clock.git | f1df72aacdfa8cb8e33aa2cca55a14ee418f9820 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Database/MigrationScripts.ets | arkts | cleanDuplicatePages | 清理page表的重复数据 | async cleanDuplicatePages(store: any): Promise<void> {
logger.info(TAG, '开始清理page表的重复数据');
const findDuplicatesSql = `
SELECT chapterId, pageNumber, COUNT(*) as count
FROM page
GROUP BY chapterId, pageNumber
HAVING COUNT(*) > 1
`;
const duplicates = await store.queryS... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left cleanDuplicatePages AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left store AST#identifier#Right AST#type_annotation#Lef... | async cleanDuplicatePages(store: any): Promise<void> {
logger.info(TAG, '开始清理page表的重复数据');
const findDuplicatesSql = `
SELECT chapterId, pageNumber, COUNT(*) as count
FROM page
GROUP BY chapterId, pageNumber
HAVING COUNT(*) > 1
`;
const duplicates = await store.queryS... | https://github.com/DaLongZhuaZi/manxia | a77451b85d31e14f6345e55063210cd5fb16165e | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/ImageCacheManager.ets | arkts | generateCacheKey | 生成缓存键 | private generateCacheKey(url: string, options?: LoadOptions): string {
let base: string = url;
if (options && options.width && options.height) {
base = base + `_${options.width}x${options.height}`;
}
if (options && options.quality) {
base = base + `_q${options.quality}`;
}
if (opti... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left generateCacheKey AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | private generateCacheKey(url: string, options?: LoadOptions): string {
let base: string = url;
if (options && options.width && options.height) {
base = base + `_${options.width}x${options.height}`;
}
if (options && options.quality) {
base = base + `_q${options.quality}`;
}
if (opti... | https://github.com/DaLongZhuaZi/manxia | cf01adc698b604a7b63a4cd4b54665fb10dd27eb | github |
openharmony-tpc/XmlGraphicsBatik | library/src/main/ets/batik/svggen/SVGSpecifiedFormat.ets | arkts | setElementName | 设置节点名称
@param elementName 节点名称 | public setElementName(elementName: string): void {
if (!elementName) {
return;
}
this._formatResultObj[SVGAttrConstants.ATTR_KEY_NAME] = elementName;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setElementName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left elementName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#str... | public setElementName(elementName: string): void {
if (!elementName) {
return;
}
this._formatResultObj[SVGAttrConstants.ATTR_KEY_NAME] = elementName;
} | https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git | 3611407ade141b4360c3d1bb697477386e2539bf | gitee |
AlkaidLab/moonlight-harmony | entry/src/main/ets/utils/PreferencesUtil.ets | arkts | get | 通用获取方法
注意:对于数字类型,如果存储的是字符串会自动转换 | static async get<T>(key: string, defaultValue: T): Promise<T> {
const prefs = await PreferencesUtil.getPreferences();
const value = await prefs.get(key, defaultValue as preferences.ValueType);
// 如果期望返回数字但得到字符串,尝试转换
if (typeof defaultValue === 'number' && typeof value === 'string') {
const ... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#binary_expression#Left AST#identifier#Left get AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#form... | static async get<T>(key: string, defaultValue: T): Promise<T> {
const prefs = await PreferencesUtil.getPreferences();
const value = await prefs.get(key, defaultValue as preferences.ValueType);
// 如果期望返回数字但得到字符串,尝试转换
if (typeof defaultValue === 'number' && typeof value === 'string') {
const ... | https://github.com/AlkaidLab/moonlight-harmony | 5e40eb2b75e9621333af8c3c4791dbfd73aa81ec | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/Rect.ets | arkts | centerX | @return the horizontal center of the rectangle. If the computed value
is fractional, this method returns the largest integer that is
less than the computed value. | public centerX(): number {
return (this.left + this.right) >> 1;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left centerX AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#... | public centerX(): number {
return (this.left + this.right) >> 1;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | e931d8a161b5d0839ec1fea2f537328dfe3f57cf | gitee |
Countly/countly-sdk-hos | library/src/main/ets/internal/modules/ModuleRemoteConfig.ets | arkts | downloadInternal | -- Internal download -- | private async downloadInternal(
keysToInclude: string[] | null,
keysToOmit: string[] | null,
callback: RCDownloadCallback | null
): Promise<void> {
if (!this.core.consentModule.hasConsent(CountlyFeature.REMOTE_CONFIG)) {
this.config.logger.v('[ModuleRemoteConfig] download, no remote-config con... | 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 downloadInternal AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#identifier#Left keysToInclude AST#identi... | private async downloadInternal(
keysToInclude: string[] | null,
keysToOmit: string[] | null,
callback: RCDownloadCallback | null
): Promise<void> {
if (!this.core.consentModule.hasConsent(CountlyFeature.REMOTE_CONFIG)) {
this.config.logger.v('[ModuleRemoteConfig] download, no remote-config con... | https://github.com/Countly/countly-sdk-hos | cb80050f73849bb2fad17c3bbba471da7e80027a | github |
the-wwyang/kids-learning-app | src/main/ets/services/AnswerValidator.ets | arkts | shouldEncourage | 检查是否应该给予鼓励
@param consecutiveCorrect 连续答对次数
@returns 是否应该鼓励 | static shouldEncourage(consecutiveCorrect: number): boolean {
// 每连续答对3题给予鼓励
return consecutiveCorrect > 0 && consecutiveCorrect % 3 === 0;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left shouldEncourage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left consecutiveCorrect AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number... | static shouldEncourage(consecutiveCorrect: number): boolean {
// 每连续答对3题给予鼓励
return consecutiveCorrect > 0 && consecutiveCorrect % 3 === 0;
} | https://github.com/the-wwyang/kids-learning-app | 1840c9cad2021ed8b16112b7fba4ef523ea65e54 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/GamepadVibrationService.ets | arkts | findControllerBySlot | ==================== 内部实现 ====================
根据槽位号查找控制器(带多级后备) | private findControllerBySlot(controllers: AbstractController[], slotNumber: number): AbstractController | null {
if (controllers.length === 0) return null;
// 优先:槽位精确匹配
for (const controller of controllers) {
if (this.deviceKeyToSlotLookup.get(controller.getDeviceKey()) === slotNumber) {
re... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left findControllerBySlot AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left controllers AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#s... | private findControllerBySlot(controllers: AbstractController[], slotNumber: number): AbstractController | null {
if (controllers.length === 0) return null;
// 优先:槽位精确匹配
for (const controller of controllers) {
if (this.deviceKeyToSlotLookup.get(controller.getDeviceKey()) === slotNumber) {
re... | https://github.com/AlkaidLab/moonlight-harmony | 080bdc46c5c4af7fef7d9cd168db47208a5b8360 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/highlight/Highlight.ets | arkts | getYPx | returns the y-position of the highlight in pixels | public getYPx(): number {
return this.mYPx;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getYPx AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#R... | public getYPx(): number {
return this.mYPx;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 76f09e8384fa77f81ce67a29a39908ada289969e | gitee |
arkui-x/samples | CodeLab/Cases/feature/h5cache/src/main/ets/diskLruCache/DiskLruCache.ets | arkts | initStatus | 初始化状态,
如果不存在缓存路径,则创建
如果已经存在缓存路径,则需要重新设置状态 | initStatus() {
// 如果不存在缓存文件夹,创建
if (!FileUtils.existFolder(this.path)) {
FileUtils.createFolder(this.path);
return;
}
// 缓存文件路径内的缓存文件目录数组
let fileNameArr: Array<string> = FileUtils.getFilesInDir(this.path);
// 缓存文件路径内的文件Stat数组
let fileStatArr: Array<fs.Stat> = [];
// 文件ino... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left initStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AS... | initStatus() {
// 如果不存在缓存文件夹,创建
if (!FileUtils.existFolder(this.path)) {
FileUtils.createFolder(this.path);
return;
}
// 缓存文件路径内的缓存文件目录数组
let fileNameArr: Array<string> = FileUtils.getFilesInDir(this.path);
// 缓存文件路径内的文件Stat数组
let fileStatArr: Array<fs.Stat> = [];
// 文件ino... | https://gitcode.com/arkui-x/samples | e156ad9c4eb6c5eb41644ba8bca4cab1785ca402 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets | arkts | getStringSingle | 获取单个规则的字符串结果
支持组合规则:如 $.name@js:java.put("name",result);result | private getStringSingle(ruleStr: string): string {
const chainedParts = this.splitJsonFirstRuleChain(ruleStr);
if (chainedParts.length > 1) {
return this.getStringFromJsonFirstRuleChain(chainedParts);
}
// 检查是否是组合规则:主规则@js:JS代码
// 例如:$.name@js:java.put("name",result);result
const jsPost... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getStringSingle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left ruleStr AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#str... | private getStringSingle(ruleStr: string): string {
const chainedParts = this.splitJsonFirstRuleChain(ruleStr);
if (chainedParts.length > 1) {
return this.getStringFromJsonFirstRuleChain(chainedParts);
}
// 检查是否是组合规则:主规则@js:JS代码
// 例如:$.name@js:java.put("name",result);result
const jsPost... | https://github.com/DaLongZhuaZi/manxia | 803032274e7aef1311d6c01334c707c675ec9685 | github |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/LessonImagePicker.ets | arkts | readFd | ArkTS strict mode rejects re-exporting ReadOptions through the
`fileIo` namespace alias, so we hand the option object straight to
`read()` and let the SDK structurally typecheck it. | private static async readFd(fd: number, buf: ArrayBuffer, offset: number): Promise<number> {
try {
return await fs.read(fd, buf, { offset });
} catch (e) {
const be: BusinessError = e as BusinessError;
throw new Error(`fs.read(${fd}) failed: ${JSON.stringify(be)}`);
}
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left readFd AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left fd AST#i... | private static async readFd(fd: number, buf: ArrayBuffer, offset: number): Promise<number> {
try {
return await fs.read(fd, buf, { offset });
} catch (e) {
const be: BusinessError = e as BusinessError;
throw new Error(`fs.read(${fd}) failed: ${JSON.stringify(be)}`);
}
} | https://github.com/terryma2024/happyword | 26c912838707b668f6affcbbc26dbe748e33e2d2 | github |
Octo-o-o-o/harmonyos-ai-workspace | tools/hooks/test-fixtures/BadRuntimePitfalls.ets | arkts | pickPhoto | ARKTS-DEPRECATED-PICKER: HarmonyOS 6 弃用 | async function pickPhoto(): Promise<void> {
const p = new picker.PhotoViewPicker(); // ← 应改 photoAccessHelper.PhotoViewPicker
} | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left pickPhoto AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Lef... | async function pickPhoto(): Promise<void> {
const p = new picker.PhotoViewPicker(); // ← 应改 photoAccessHelper.PhotoViewPicker
} | https://github.com/Octo-o-o-o/harmonyos-ai-workspace | 10dc555c8b20d2dbb1561e876cd0cdd9ed17d235 | github |
arkui-x/samples | CodeLab/Cases/feature/customscan/src/main/ets/model/PermissionModel.ets | arkts | reqCurGrantStatus | 检测权限状态
@param {Permissions} permission 检测授权的权限名
@returns {Promise<abilityAccessCtrl.GrantStatus>} 权限状态 | async reqCurGrantStatus(permission: Permissions): Promise<abilityAccessCtrl.GrantStatus> {
const atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
let grantStatus: abilityAccessCtrl.GrantStatus = abilityAccessCtrl.GrantStatus.PERMISSION_DENIED;
// 获取应用程序的accessTokenID
let ... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left reqCurGrantStatus AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left permission AST#identifier#Right AST#type_annotation#Left AST#... | async reqCurGrantStatus(permission: Permissions): Promise<abilityAccessCtrl.GrantStatus> {
const atManager: abilityAccessCtrl.AtManager = abilityAccessCtrl.createAtManager();
let grantStatus: abilityAccessCtrl.GrantStatus = abilityAccessCtrl.GrantStatus.PERMISSION_DENIED;
// 获取应用程序的accessTokenID
let ... | https://gitcode.com/arkui-x/samples | 7551050b3bbe864230b3fb36ea6d07a1ba80b54a | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | findLastIndex | Finds an index of the last element in the Uint16Array that satisfies the condition
@param fn condition
@returns the index of the last element that satisfies fn, -1 otherwise | public findLastIndex(fn: (val: number, index: int, array: Uint16Array) => boolean): int {
for (let i = this.length - 1; i >= 0; --i) {
let val = this.at(i)
if (fn(val, i, this)) {
return i
}
}
return -1
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left findLastIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : ... | public findLastIndex(fn: (val: number, index: int, array: Uint16Array) => boolean): int {
for (let i = this.length - 1; i >= 0; --i) {
let val = this.at(i)
if (fn(val, i, this)) {
return i
}
}
return -1
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | fb51e73a8d9a854b67a89a09e302316ded1ca469 | gitee |
aimilin6688/KeePassHO | entry/src/main/ets/common/utils/KdbxUtils.ets | arkts | sortBy | 对组和条目进行排序
@param items 条目和分组的合并数组
@param sortMode 0: 默认排序 1: 按名称排序 2: 按修改时间排序 3: 按创建时间排序 | public static sortBy(items: Array<KdbxGroup | KdbxEntry>, sortMode: SortMode) {
// 根据排序方式进行排序
switch (sortMode) {
case SortMode.NAME:
// 按名称排序(置顶优先,同是置顶的按修改时间排序)
items.sort((a, b) => {
const pinnedResult = KdbxUtils.comparePinnedAndTime(a, b);
if (pinnedResult !== 0) ... | 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 sortBy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left items AST#identifier#Right AST#:#Left : AST#:#Ri... | public static sortBy(items: Array<KdbxGroup | KdbxEntry>, sortMode: SortMode) {
// 根据排序方式进行排序
switch (sortMode) {
case SortMode.NAME:
// 按名称排序(置顶优先,同是置顶的按修改时间排序)
items.sort((a, b) => {
const pinnedResult = KdbxUtils.comparePinnedAndTime(a, b);
if (pinnedResult !== 0) ... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/KdbxUtils.ets#L350-L392 | 347034b3223311d7d348d85ec9fabc59816036e3 | github |
zcg741/chengyu-game | entry/src/main/ets/pages/GameOverPage.ets | arkts | goToReview | 跳转到回顾页面 | goToReview() {
try {
const paramsMap: Record<string, Object> = {};
paramsMap['records'] = this.recordsJson;
paramsMap['from'] = 'gameover';
navigateToWithParams('pages/ReviewPage', paramsMap);
} catch (error) {
console.error('Failed to navigate to review:', error);
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left goToReview AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AS... | goToReview() {
try {
const paramsMap: Record<string, Object> = {};
paramsMap['records'] = this.recordsJson;
paramsMap['from'] = 'gameover';
navigateToWithParams('pages/ReviewPage', paramsMap);
} catch (error) {
console.error('Failed to navigate to review:', error);
}
} | https://github.com/zcg741/chengyu-game | 15ad2e6f00cfba0994833b09b8bb6863420990e2 | github |
CLMC2025/Vignette | entry/src/main/ets/vocabulary/SnowballSystem.ets | arkts | getLearningRecommendations | 获取学习建议 | getLearningRecommendations(): string[] {
const networkStats = this.analyzeLearningNetwork();
const recommendations: string[] = [];
if (networkStats.weakConnections > networkStats.strongConnections) {
recommendations.push('建议:加强已学词汇的复习,建立更强的关联');
}
if (networkStats.isolatedWords.length > ne... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getLearningRecommendations AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AS... | getLearningRecommendations(): string[] {
const networkStats = this.analyzeLearningNetwork();
const recommendations: string[] = [];
if (networkStats.weakConnections > networkStats.strongConnections) {
recommendations.push('建议:加强已学词汇的复习,建立更强的关联');
}
if (networkStats.isolatedWords.length > ne... | https://github.com/CLMC2025/Vignette | 8fe743ed9c54d179f1e360a422657d0413583dc4 | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test15_original_index.ets | arkts | testNumberChecks | --- Number.isFinite / Number.isInteger --- | function testNumberChecks(): string {
let a: boolean = Number.isFinite(42);
let b: boolean = Number.isFinite(1 / 0);
let c: boolean = Number.isInteger(7);
let d: boolean = Number.isInteger(3.14);
return String(a) + ',' + String(b) + ',' + String(c) + ',' + String(d);
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testNumberChecks AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined... | function testNumberChecks(): string {
let a: boolean = Number.isFinite(42);
let b: boolean = Number.isFinite(1 / 0);
let c: boolean = Number.isInteger(7);
let d: boolean = Number.isInteger(3.14);
return String(a) + ',' + String(b) + ',' + String(c) + ',' + String(d);
} | https://github.com/miaochiahao/ark-ghidra | c843ebbbbfbb5ca6722ace5645ba1504322e37d0 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/RegExp.ets | arkts | toString | Returns a string representing the given object
@returns a string representing the given object | public override toString(): String {
return "/" + this.source + "/" + this.flags;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left toString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Le... | public override toString(): String {
return "/" + this.source + "/" + this.flags;
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 8d354b3b665af5caca6248e52dc5b685198d5f6b | gitee |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/ChartModel.ets | arkts | setupDefaultFormatter | Calculates the required number of digits for the values that might be
drawn in the chart (if enabled), and creates the default-value-formatter | protected setupDefaultFormatter(min: number, max: number) {
let reference: number = 0;
if (this.mData == null || this.mData.getEntryCount() < 2) {
reference = Math.max(Math.abs(min), Math.abs(max));
} else {
reference = Math.abs(max - min);
}
let digits: number = Utils.getDecimals(... | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left setupDefaultFormatter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left min AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#id... | protected setupDefaultFormatter(min: number, max: number) {
let reference: number = 0;
if (this.mData == null || this.mData.getEntryCount() < 2) {
reference = Math.max(Math.abs(min), Math.abs(max));
} else {
reference = Math.abs(max - min);
}
let digits: number = Utils.getDecimals(... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 69843c0e41ad8824d5376b60c8c22548efd49cd8 | gitee |
CPF-ApplicationTPC/openharmony_tpc_samples | SwipeMenuListView/library/src/main/ets/components/SwipeMenuList.ets | arkts | setOpenInterpolator | 设置菜单打开时的插值器
@param interpolator 插值器类型 | setOpenInterpolator(interpolator: InterpolatorType): void {
this.openAnimationConfig.setInterpolator(interpolator);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setOpenInterpolator AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left interpolator AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left InterpolatorType AST#identif... | setOpenInterpolator(interpolator: InterpolatorType): void {
this.openAnimationConfig.setInterpolator(interpolator);
} | https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples | 43826ab4d171695e071366713719007a311772ce | gitcode |
openharmony/codelabs | ETSUI/PassNote/entry/src/main/ets/pages/FingerprintPage.ets | arkts | getFingerprintColor | 获取指纹图标颜色 | getFingerprintColor(): string {
switch (this.currentStatus) {
case FingerprintStatus.SUCCESS:
return '#4CD964'; // 绿色
case FingerprintStatus.FAILED:
return '#FF3B30'; // 红色
case FingerprintStatus.SCANNING:
return '#007AFF'; // 蓝色
case FingerprintStatus.LOCKED:
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getFingerprintColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#st... | getFingerprintColor(): string {
switch (this.currentStatus) {
case FingerprintStatus.SUCCESS:
return '#4CD964'; // 绿色
case FingerprintStatus.FAILED:
return '#FF3B30'; // 红色
case FingerprintStatus.SCANNING:
return '#007AFF'; // 蓝色
case FingerprintStatus.LOCKED:
... | https://gitcode.com/openharmony/codelabs | 428c167537886c92abdc595164ba4064680a7fb1 | gitcode |
DaLongZhuaZi/NGF | ngf_framework/src/main/ets/contentWorkflow/facades/WorkflowDefinitionFacade.ets | arkts | executeParallelGroup | 并行组执行:组内所有步骤并发执行,投入 Promise.all | private async executeParallelGroup(
group: NGFWorkflowParallelGroup,
contextJson: string
): Promise<Array<NGFWorkflowStepResult>> {
logger.debug(TAG, '并行组开始: group=' + group.groupName + ', steps=' + group.steps.length);
const promises: Array<Promise<NGFWorkflowStepResult>> = [];
for (let i = 0; ... | 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 executeParallelGroup AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left group AST#identifier#Right AST#:... | private async executeParallelGroup(
group: NGFWorkflowParallelGroup,
contextJson: string
): Promise<Array<NGFWorkflowStepResult>> {
logger.debug(TAG, '并行组开始: group=' + group.groupName + ', steps=' + group.steps.length);
const promises: Array<Promise<NGFWorkflowStepResult>> = [];
for (let i = 0; ... | https://github.com/DaLongZhuaZi/NGF | b7cfe0823c936ea878b46a5d8ae96d31668f8c77 | github |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/services/auth/AuthService.ets | arkts | setCurrentUser | 设置当前用户 | setCurrentUser(user: User, notify: boolean = false): void {
this.currentUser = user;
if (user.username.trim().length > 0) {
this.currentUsername = user.username;
}
this.persistCurrentUser();
if (notify) {
this.notifyListeners();
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setCurrentUser AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left user AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left User AST#identifier#Right AST#,#Left , AS... | setCurrentUser(user: User, notify: boolean = false): void {
this.currentUser = user;
if (user.username.trim().length > 0) {
this.currentUsername = user.username;
}
this.persistCurrentUser();
if (notify) {
this.notifyListeners();
}
} | https://github.com/Amaz1ny/HarmonyDO-public | 83321b506ae86c8b89d666497026f686b5a406d0 | github |
the-wwyang/kids-learning-app | src/main/ets/utils/AnimationUtils.ets | arkts | randomDelay | 生成随机延迟(用于粒子效果等)
@param minDelay 最小延迟(毫秒)
@param maxDelay 最大延迟(毫秒)
@returns 随机延迟时间 | static randomDelay(minDelay: number = 0, maxDelay: number = 300): number {
return Math.floor(Math.random() * (maxDelay - minDelay + 1)) + minDelay;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left randomDelay AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left minDelay AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expre... | static randomDelay(minDelay: number = 0, maxDelay: number = 300): number {
return Math.floor(Math.random() * (maxDelay - minDelay + 1)) + minDelay;
} | https://github.com/the-wwyang/kids-learning-app | ddd4a2059058cd619cf9a10cc939bb90e143696d | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelSourceExecutor.ets | arkts | analyzeRequestUrl | 智能解析URL:包含JS规则时使用异步解析,其他情况优先同步并兜底异步 | private async analyzeRequestUrl(
urlTemplate: string,
key?: string,
page?: number,
runtimeBaseUrl?: string
): Promise<ParsedUrlRequest> {
const runtimeBaseUrlValue = runtimeBaseUrl !== undefined ? runtimeBaseUrl.trim() : '';
const hasRuntimeBaseUrl = runtimeBaseUrlValue.length > 0;
const... | 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 analyzeRequestUrl AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left urlTemplate AST#identifier#Right AST#ERROR#Left AS... | private async analyzeRequestUrl(
urlTemplate: string,
key?: string,
page?: number,
runtimeBaseUrl?: string
): Promise<ParsedUrlRequest> {
const runtimeBaseUrlValue = runtimeBaseUrl !== undefined ? runtimeBaseUrl.trim() : '';
const hasRuntimeBaseUrl = runtimeBaseUrlValue.length > 0;
const... | https://github.com/DaLongZhuaZi/manxia | 55d7d08c22ef3044803b00c480e470d5fbf6ca6d | github |
OHPG/FinSdk | emby/src/main/ets/api/SystemApi.ets | arkts | getSystemInfo | getSystemInfo
@summary Gets information about the server.
@throws {RequiredError}
@memberof SystemApi | public async getSystemInfo(): Promise<SystemInfo> {
return this.apiClient.get({ path: "/System/Info" })
} | 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 getSystemInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#... | public async getSystemInfo(): Promise<SystemInfo> {
return this.apiClient.get({ path: "/System/Info" })
} | https://github.com/OHPG/FinSdk | 69877471e6a91aa80a68ab6a3c2a3f8e1f1cc6e2 | github |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/services/ExtensionLoader.ets | arkts | testSshKeyAuth | 测试 SSH 密钥认证是否可用 (同步阻塞) | testSshKeyAuth(host: string, port: number, username: string,
privateKeyPem: string, passphrase: string): SshAuthTestResult {
try {
return rdpnapi.testSshKeyAuth(host, port, username, privateKeyPem, passphrase) as SshAuthTestResult;
} catch (err) {
hilog.error(DOMAIN, TAG, '[Extens... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left testSshKeyAuth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left host AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , ... | testSshKeyAuth(host: string, port: number, username: string,
privateKeyPem: string, passphrase: string): SshAuthTestResult {
try {
return rdpnapi.testSshKeyAuth(host, port, username, privateKeyPem, passphrase) as SshAuthTestResult;
} catch (err) {
hilog.error(DOMAIN, TAG, '[Extens... | https://github.com/Mydstiny/RemoteDeskHarmonyOS | 5479e5e2e80ee15a199cf9f599102251ea49fbcc | github |
openharmony/codelabs | ETSUI/PositioningDemo/entry/src/main/ets/pages/PlanDetailPage.ets | arkts | hasAnyTarget | 是否有任意一个目标被设置 | hasAnyTarget(task: DailyTask): boolean {
return task.distanceTarget > 0 ||
task.durationTarget > 0 ||
task.caloriesTarget > 0 ||
task.recordsTarget > 0;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasAnyTarget AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left task AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left DailyTask AST#identifier#Right AST#)#Left )... | hasAnyTarget(task: DailyTask): boolean {
return task.distanceTarget > 0 ||
task.durationTarget > 0 ||
task.caloriesTarget > 0 ||
task.recordsTarget > 0;
} | https://gitcode.com/openharmony/codelabs | 751d60eea4d688ab555606fb4eb83e4a6d610343 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | toLocaleString | Converts Int16Array to a string with respect to locale
@param locales
@param options
@returns string representation | public toLocaleString(locales: Object, options: Object): string {
throw new Error("Int16Array.toLocaleString: not implemented")
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toLocaleString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left locales AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Object AST#ide... | public toLocaleString(locales: Object, options: Object): string {
throw new Error("Int16Array.toLocaleString: not implemented")
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 490e670017b3c417600c792888a7c8967949f236 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/TimeUtils.ets | arkts | toDate | 将时间戳转换为Date对象
@param timestamp - 时间戳(毫秒)
@returns Date对象 | static toDate(timestamp: number): Date {
return new Date(timestamp);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left toDate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left timestamp AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right ... | static toDate(timestamp: number): Date {
return new Date(timestamp);
} | https://github.com/DaLongZhuaZi/manxia | 59dd27aa9d5a70b61a95f7ba896f4007fa8aa827 | github |
openharmony-sig/flutter_packages | packages/webview_flutter/webview_flutter_ohos/ohos/src/main/ets/io.flutter.plugins/webview_flutter/CustomViewCallbackHostApiImpl.ets | arkts | constructor | Constructs a {@link CustomViewCallbackHostApiImpl}.
@param binaryMessenger used to communicate with Dart over asynchronous messages
@param instanceManager maintains instances stored to communicate with attached Dart objects | constructor(binaryMessenger: BinaryMessenger, instanceManager: InstanceManager) {
super()
this.binaryMessenger = binaryMessenger;
this.instanceManager = instanceManager;
} | 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 binaryMessenger AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left BinaryMessenger AS... | constructor(binaryMessenger: BinaryMessenger, instanceManager: InstanceManager) {
super()
this.binaryMessenger = binaryMessenger;
this.instanceManager = instanceManager;
} | https://gitee.com/openharmony-sig/flutter_packages.git | 00cb8ace7978cf4d780f57d2242889d406556557 | gitee |
YANGZX22/Voot | entry/src/main/ets/pages/PolishPage.ets | arkts | tokenize | 将文本分割成token(单词、标点、空格等) | tokenize(text: string): string[] {
// 匹配中文、英文单词、数字,或者其他字符(标点、空格等)
return text.match(/[\u4e00-\u9fa5]+|[a-zA-Z0-9]+|[^a-zA-Z0-9\u4e00-\u9fa5]+/g) || [];
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left tokenize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : A... | tokenize(text: string): string[] {
// 匹配中文、英文单词、数字,或者其他字符(标点、空格等)
return text.match(/[\u4e00-\u9fa5]+|[a-zA-Z0-9]+|[^a-zA-Z0-9\u4e00-\u9fa5]+/g) || [];
} | https://github.com/YANGZX22/Voot | fceb87c52398a6af132a023d483c069c6c00d672 | github |
ibestservices/ibest-ui | library/src/main/ets/components/cascader/index.ets | arkts | tabChange | 顶部tab切换 | tabChange(index: number){
this.swiperController.changeIndex(index, true)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left tabChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AS... | tabChange(index: number){
this.swiperController.changeIndex(index, true)
} | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/cascader/index.ets#L152-L154 | 7236b5525f064b5be1f25e1cbb24f33ede7337cf | github |
iHongRen/harmony-study-demo | entry/src/main/ets/pages/oss/OssUploader.ets | arkts | initClient | 初始化 OSS 客户端
@param token OSS 临时凭证
@param endpoint OSS 端点(如 oss-cn-hangzhou.aliyuncs.com) | private initClient(token: OSSToken, endpoint: string): Client {
// 解析 region
const region = endpoint.split('.')[0];
const client = new Client({
accessKeyId: token.AccessKeyId,
accessKeySecret: token.AccessKeySecret,
securityToken: token.SecurityToken,
region,
timeout: this.d... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left initClient AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left token AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left O... | private initClient(token: OSSToken, endpoint: string): Client {
// 解析 region
const region = endpoint.split('.')[0];
const client = new Client({
accessKeyId: token.AccessKeyId,
accessKeySecret: token.AccessKeySecret,
securityToken: token.SecurityToken,
region,
timeout: this.d... | https://github.com/iHongRen/harmony-study-demo | 5b3dc69102a031b259c792194b2c2ec5d5835d72 | github |
Joker-x-dev/CoolMallArkTS | feature/order/src/main/ets/viewmodel/OrderDetailViewModel.ets | arkts | convertOrderGoodsToCart | 将订单商品转换为购物车列表
@param {Order} order - 订单信息
@returns {Cart[]} 购物车列表 | private convertOrderGoodsToCart(order: Order): Cart[] {
const goodsList: OrderGoods[] = order.goodsList ?? [];
if (goodsList.length === 0) {
return [];
}
const groupedMap = new Map<number, OrderGoods[]>();
for (const goods of goodsList) {
const exists = groupedMap.get(goods.goodsId);
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left convertOrderGoodsToCart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left order AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#iden... | private convertOrderGoodsToCart(order: Order): Cart[] {
const goodsList: OrderGoods[] = order.goodsList ?? [];
if (goodsList.length === 0) {
return [];
}
const groupedMap = new Map<number, OrderGoods[]>();
for (const goods of goodsList) {
const exists = groupedMap.get(goods.goodsId);
... | https://github.com/Joker-x-dev/CoolMallArkTS | 48dba946892a0831b1412806756e4863b4682bda | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/usbdriver/UsbDriverService.ets | arkts | getControllers | 获取所有控制器 | getControllers(): AbstractController[] {
return [...this.controllers];
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getControllers 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 AbstractController AST#identifier#Right AST#[#L... | getControllers(): AbstractController[] {
return [...this.controllers];
} | https://github.com/AlkaidLab/moonlight-harmony | a57073790655df49de41022fff601307b4750365 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/InteractionManager.ets | arkts | getVibrationDuration | 根据场景和强度获取震动时长 | private getVibrationDuration(scene: VibrationScene): number {
// 基础震动时长(毫秒)- 大幅提高基础值
const baseDurations: Record<VibrationScene, number> = {
[VibrationScene.BUTTON_CLICK]: 50,
[VibrationScene.TOGGLE_SWITCH]: 60,
[VibrationScene.LIST_ITEM_SELECT]: 50,
[VibrationScene.LONG_PRESS]: 100,
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getVibrationDuration AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left scene AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif... | private getVibrationDuration(scene: VibrationScene): number {
// 基础震动时长(毫秒)- 大幅提高基础值
const baseDurations: Record<VibrationScene, number> = {
[VibrationScene.BUTTON_CLICK]: 50,
[VibrationScene.TOGGLE_SWITCH]: 60,
[VibrationScene.LIST_ITEM_SELECT]: 50,
[VibrationScene.LONG_PRESS]: 100,
... | https://github.com/DaLongZhuaZi/manxia | 1212ce4dce8d1ac7c640c6c1e87ce7300868e01f | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/String.ets | arkts | concat | Concatenation of this and array of strings.
@param { String } s strings to concat with
@returns { String } new String which is a concatenation of this + strings[0] + ... + strings[string.length - 1]
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public concat(s: String): String {
return String.concat2(this, s);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left concat AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left s AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left String AST#i... | public concat(s: String): String {
return String.concat2(this, s);
} | https://gitcode.com/iop123123/arkts-static-skills | 5224f1ae5ba580b4a1336d32f25452780b857940 | gitcode |
openharmony/codelabs | Card/MovieCard/entry/src/main/ets/common/utils/CommonUtils.ets | arkts | updateMovieCardData | Update movie data show in to the card.
@param {relationalStore.RdbStore} rdbStore RDB database | updateMovieCardData(rdbStore: relationalStore.RdbStore) {
if (this.isEmpty(rdbStore)) {
Logger.error(CommonConstants.TAG_COMMON_UTILS, 'rdbStore is null');
return;
}
let predicates: relationalStore.RdbPredicates = new relationalStore.RdbPredicates(CommonConstants.TABLE_NAME);
rdbStore.quer... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left updateMovieCardData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left rdbStore AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identi... | updateMovieCardData(rdbStore: relationalStore.RdbStore) {
if (this.isEmpty(rdbStore)) {
Logger.error(CommonConstants.TAG_COMMON_UTILS, 'rdbStore is null');
return;
}
let predicates: relationalStore.RdbPredicates = new relationalStore.RdbPredicates(CommonConstants.TABLE_NAME);
rdbStore.quer... | https://gitee.com/openharmony/codelabs.git | 65c26881b4070a9cb705a0cff7b41a845942cc0c | gitee |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/BinaryEncodingVisitor.ets | arkts | visitMapStringBool | 访问 map<string, bool> 字段 | visitMapStringBool(value: Map<string, boolean>, fieldNumber: number): void {
value.forEach((v, k) => {
const entryWriter = this.writer.fork()
entryWriter.tag(1, 2).string(k)
entryWriter.tag(2, 0).bool(v)
this.writer.tag(fieldNumber, 2).ldelim(entryWriter)
})
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left visitMapStringBool AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Map AST#identifier... | visitMapStringBool(value: Map<string, boolean>, fieldNumber: number): void {
value.forEach((v, k) => {
const entryWriter = this.writer.fork()
entryWriter.tag(1, 2).string(k)
entryWriter.tag(2, 0).bool(v)
this.writer.tag(fieldNumber, 2).ldelim(entryWriter)
})
} | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | 71ced732574bc81e476c471a46ffe31d41519258 | gitcode |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.buffer.ets | arkts | slice | Creates and returns a new Blob containing a subset of this Blob objects data. The original Blob is not altered.
@param {int} [start=0] - The starting index.
@param {int} [end=buffer.length] - The ending index.
@param {string} [type] - The content-type for the new Blob
@returns {Blob} | slice(start?: int, end?: int, type?: string): Blob {
if (start == undefined) {
start = 0;
}
const slicedArrayBuffer = this.arrBuffer.slice(start, end) as ArrayBuffer;
return new Blob([slicedArrayBuffer], "ArrayBuffer", type)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left slice AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left start AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#Right AST#ERROR#Right... | slice(start?: int, end?: int, type?: string): Blob {
if (start == undefined) {
start = 0;
}
const slicedArrayBuffer = this.arrBuffer.slice(start, end) as ArrayBuffer;
return new Blob([slicedArrayBuffer], "ArrayBuffer", type)
} | https://gitcode.com/iop123123/arkts-static-skills | b0304989525ac71349cdd01bfd20a18d7c8359a3 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets | arkts | evaluateJsonPath | 执行JSONPath查询
增强实现,支持更多JSONPath语法 | private evaluateJsonPath(data: ESObject, path: string): ESObject {
if (!path || path === '$') {
return data;
}
// 移除开头的$
let normalizedPath = path;
if (normalizedPath.startsWith('$.')) {
normalizedPath = normalizedPath.substring(2);
} else if (normalizedPath.startsWith('$')) {
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left evaluateJsonPath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | private evaluateJsonPath(data: ESObject, path: string): ESObject {
if (!path || path === '$') {
return data;
}
// 移除开头的$
let normalizedPath = path;
if (normalizedPath.startsWith('$.')) {
normalizedPath = normalizedPath.substring(2);
} else if (normalizedPath.startsWith('$')) {
... | https://github.com/DaLongZhuaZi/manxia | 799b45547e2b25f2b63e9068d5eaf76a911ebfe8 | github |
openharmony-sig/applications_calculator | feature/calculation/src/main/ets/calculator/Evaluator.ets | arkts | operatorForChar | operatorForChar
@param keyCode number
@param callBack Function | private operatorForChar(keyCode: number, callBack: Function): void {
let res: string = this.getOperatorForKeyCode(keyCode);
this.expression = this.handleExpressionWithOperator(res, this.expression);
this.setState(CalculatorState.INPUT);
this.setGlobalExpression(this.expression);
if (DisplayUtil.is... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left operatorForChar AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left keyCode AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#num... | private operatorForChar(keyCode: number, callBack: Function): void {
let res: string = this.getOperatorForKeyCode(keyCode);
this.expression = this.handleExpressionWithOperator(res, this.expression);
this.setState(CalculatorState.INPUT);
this.setGlobalExpression(this.expression);
if (DisplayUtil.is... | https://gitee.com/openharmony-sig/applications_calculator.git | e1212eaa35a502e72974cb320ed99ffc7e39d966 | gitee |
openharmony/applications_app_samples | code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/videotrimmer/VideoTrimmerView.ets | arkts | getFormatString | 获取选择时间范围后的提示信息 | getFormatString(res: Resource, instead: string): string {
let resId = res.id;
let ctx = this.videoTrimmerOption.context;
if (ctx != undefined) {
} else {
ctx = getContext(this) as common.UIAbilityContext;
}
let ret: string = '';
let resMgr = ctx.resourceManager;
try {
let ... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getFormatString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left res AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Resource AST#identifier#Right AST#,#Left ... | getFormatString(res: Resource, instead: string): string {
let resId = res.id;
let ctx = this.videoTrimmerOption.context;
if (ctx != undefined) {
} else {
ctx = getContext(this) as common.UIAbilityContext;
}
let ret: string = '';
let resMgr = ctx.resourceManager;
try {
let ... | https://github.com/openharmony/applications_app_samples | 2ccc69f84309f5fa90d8eb09c9c898318040d77c | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/SupportService.ets | arkts | isShowSupport | 是否需要显示支持弹框 | private static isShowSupport():
boolean {
// 不需要显示支持弹框
if (!SettingsService.getSync(SettingsService.KEY_SHOW_SUPPORT_DIALOG, SettingsService.KEY_SHOW_SUPPORT_DIALOG_DEFAULT)) {
return false;
}
// 今天支持弹款已经显示过了
const lastShowTime = SettingsService.getSync(SettingsService.KEY_SHOW_SUPPORT_T... | 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 isShowSupport AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS... | private static isShowSupport():
boolean {
// 不需要显示支持弹框
if (!SettingsService.getSync(SettingsService.KEY_SHOW_SUPPORT_DIALOG, SettingsService.KEY_SHOW_SUPPORT_DIALOG_DEFAULT)) {
return false;
}
// 今天支持弹款已经显示过了
const lastShowTime = SettingsService.getSync(SettingsService.KEY_SHOW_SUPPORT_T... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/SupportService.ets#L160-L170 | dc9924c536ecbc930c26bf80349bf0680936e6a7 | github |
XHXYT/Pixark | entry/src/main/ets/common/utils/JumpUtils.ets | arkts | goToWeb | 隐式 Want 跳转网站
@param url 要跳转的网址 | static async goToWeb(url: string): Promise<void> {
try {
let want: Want = {
// 如果希望仅在特定包中隐式查询,请取消下面的注释行
// bundleName: "com.example.myapplication",
action: "ohos.want.action.viewData",
entities: ["entity.system.browsable"],
uri: url,
}
await JumpUtil.getCo... | 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 goToWeb AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Righ... | static async goToWeb(url: string): Promise<void> {
try {
let want: Want = {
// 如果希望仅在特定包中隐式查询,请取消下面的注释行
// bundleName: "com.example.myapplication",
action: "ohos.want.action.viewData",
entities: ["entity.system.browsable"],
uri: url,
}
await JumpUtil.getCo... | https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/common/utils/JumpUtils.ets#L34-L48 | b43b2295d04d651f692651d3320c31eac31a2aa3 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/String.ets | arkts | $_invoke | Creates a new instance of a String from float
@param { float } value The value to be converted to a string.
@returns { string } A new String instance
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | static $_invoke(value: float): string {
return new String(value);
} | 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#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left float ... | static $_invoke(value: float): string {
return new String(value);
} | https://gitcode.com/iop123123/arkts-static-skills | 30d47157993ec4e06025904c2337a1cc9d46b33c | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoJsExtensions.ets | arkts | hexEncodeToString | 字符串编码为Hex | hexEncodeToString(str: string): string {
return this.hexEncode(str);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hexEncodeToString 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 ... | hexEncodeToString(str: string): string {
return this.hexEncode(str);
} | https://github.com/DaLongZhuaZi/manxia | d984d5b3012e5c04f6a0c73c34acf8eaa341a32f | github |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/CocosEngineHost.ets | arkts | notifyForeground | Relay from EntryAbility.onForeground; no-op until booted. The render
loop only resumes when the battle page is also the active route. | notifyForeground(): void {
if (!this.booted) {
return;
}
this.appForeground = true;
this.updateVisibility();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left notifyForeground 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... | notifyForeground(): void {
if (!this.booted) {
return;
}
this.appForeground = true;
this.updateVisibility();
} | https://github.com/terryma2024/happyword | 18301f02ce4a934bf98a375f1c6ec05106b43b25 | github |
David8Idira/AI-OA | packages/harmonyos/commons/src/main/ets/services/KnowledgeService.ets | arkts | getDocuments | ============ 文档管理 ============
获取文档列表
@param params.parentId 父文件夹ID,undefined 表示根目录 | async getDocuments(params?: { parentId?: string; page?: number; pageSize?: number; sortBy?: 'name' | 'updatedAt' | 'createdAt' }): Promise<ApiResponse<{ documents: KnowledgeDocument[]; total: number }>> {
return this.client.get<{ documents: KnowledgeDocument[]; total: number }>('/api/v1/knowledge/documents', para... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getDocuments AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#optional_parameter#Left AST#identifier#Left params AST#identifier#Right AST#?#Left ? AST#?#Right AST#type_anno... | async getDocuments(params?: { parentId?: string; page?: number; pageSize?: number; sortBy?: 'name' | 'updatedAt' | 'createdAt' }): Promise<ApiResponse<{ documents: KnowledgeDocument[]; total: number }>> {
return this.client.get<{ documents: KnowledgeDocument[]; total: number }>('/api/v1/knowledge/documents', para... | https://github.com/David8Idira/AI-OA | 4506ce8c9391bd95df129bc8cc2bfb0d3be986d5 | github |
openharmony/applications_app_samples | code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/uploadanddownload/RequestUpload.ets | arkts | getFilesAndData | 获取上传文件数据 | private async getFilesAndData(cacheDir: string, fileUris: Array<string>): Promise<Array<request.agent.FormItem>> {
logger.info(TAG, `getFilesAndData begin`);
let files: request.agent.FormItem[] = [];
for (let i = 0; i < fileUris.length; i++) {
logger.info(TAG, `getFilesAndData fileUri = ${fileUris[i... | 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 getFilesAndData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left cacheDir AST#identifier#Right AST#ERROR#Left AST#:#L... | private async getFilesAndData(cacheDir: string, fileUris: Array<string>): Promise<Array<request.agent.FormItem>> {
logger.info(TAG, `getFilesAndData begin`);
let files: request.agent.FormItem[] = [];
for (let i = 0; i < fileUris.length; i++) {
logger.info(TAG, `getFilesAndData fileUri = ${fileUris[i... | https://github.com/openharmony/applications_app_samples | dbf9f6c2081d09f29b466a3e68ccac1b255beb64 | github |
LongLiveY96/chatcube | entry/src/main/ets/services/DatabaseService.ets | arkts | getAllSessions | 获取所有会话 | async getAllSessions(repairLegacySummary: boolean = true): Promise<ChatSession[]> {
try {
await this.waitForInitialization()
} catch (error) {
console.error('DatabaseService', `Failed to wait for database initialization: ${JSON.stringify(error)}`)
return []
}
if (this.rdbStore === nu... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getAllSessions AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left repairLegacySummary AST#identifier#Right AST#type_annotation#Lef... | async getAllSessions(repairLegacySummary: boolean = true): Promise<ChatSession[]> {
try {
await this.waitForInitialization()
} catch (error) {
console.error('DatabaseService', `Failed to wait for database initialization: ${JSON.stringify(error)}`)
return []
}
if (this.rdbStore === nu... | https://github.com/LongLiveY96/chatcube | b6b0fb23add0524f1976ab5e57a972ef72ecdd84 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Array.ets | arkts | from | Creates a new `Array` instance from a `FixedArray` and applies a mapping function to each element.
@param { FixedArray<T> } values The source primitive array.
@param { function } mapfn A mapping function to call on every element of the array.
@returns { Array<U> } A new Array instance with the mapped values.
@static
@s... | public static from<T, U>(values: FixedArray<T>, mapfn: (v: T, k: int) => U): Array<U> {
const length: int = values.length
const ret: Array<U> = new Array<U>(length)
for (let i: int = 0; i < length; ++i) {
ret[i] = mapfn(values[i], i)
}
return ret
} | AST#program#Left AST#expression_statement#Left AST#sequence_expression#Left AST#binary_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#from#Left from AST#from#Right AST#ERROR#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#ident... | public static from<T, U>(values: FixedArray<T>, mapfn: (v: T, k: int) => U): Array<U> {
const length: int = values.length
const ret: Array<U> = new Array<U>(length)
for (let i: int = 0; i < length; ++i) {
ret[i] = mapfn(values[i], i)
}
return ret
} | https://gitcode.com/iop123123/arkts-static-skills | e15e172d17e30a06f9b171632d9b9bf2c7570e05 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/MangaSourceConfigParser.ets | arkts | buildSearchBySeriesActions | 构建系列搜索操作序列
@param config 图源配置
@param seriesId 系列ID
@returns 操作序列,如果工作流不存在则返回空数组 | buildSearchBySeriesActions(config: MangaSourceConfig, seriesId: string): Action[] {
const workflow = this.getWorkflow(config, 'searchBySeries');
if (!workflow) {
logger.info(TAG, 'searchBySeries工作流不存在,返回空数组');
return [];
}
return this.processActions(workflow, { seriesId } as Partial<Workfl... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left buildSearchBySeriesActions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left MangaSourceC... | buildSearchBySeriesActions(config: MangaSourceConfig, seriesId: string): Action[] {
const workflow = this.getWorkflow(config, 'searchBySeries');
if (!workflow) {
logger.info(TAG, 'searchBySeries工作流不存在,返回空数组');
return [];
}
return this.processActions(workflow, { seriesId } as Partial<Workfl... | https://github.com/DaLongZhuaZi/manxia | 43ea5ca59ec5ef248ad08b7f30b4aa78a71b904d | github |
arkui-x/samples | CodeLab/Cases/feature/imagetheft/src/main/ets/view/ImageTheft.ets | arkts | build | 组件焦点控制器 | build() {
Column() {
// 场景描述组件
FunctionDescription({
content: $r("app.string.image_theft_content")
})
// 输入框和按钮
Column({ space: IMAGE_THEFT_COLUMN_SPACE }) {
Row() {
Text($r("app.string.image_theft_image_url"))
.width($r("app.integer.image_theft_... | 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() {
// 场景描述组件
FunctionDescription({
content: $r("app.string.image_theft_content")
})
// 输入框和按钮
Column({ space: IMAGE_THEFT_COLUMN_SPACE }) {
Row() {
Text($r("app.string.image_theft_image_url"))
.width($r("app.integer.image_theft_... | https://gitcode.com/arkui-x/samples | ecc948913323b98b6b66e23d879cc38af630547d | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Core/ErrorHandler.ets | arkts | setupGlobalErrorHandling | 设置全局错误处理 | private setupGlobalErrorHandling(): void {
// 这里可以设置全局的未捕获异常处理
// 注意:HarmonyOS可能有特定的全局错误处理机制
logger.info(ERROR_HANDLER_TAG, '🛡️ 全局错误处理已设置');
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left setupGlobalErrorHandling 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#Righ... | private setupGlobalErrorHandling(): void {
// 这里可以设置全局的未捕获异常处理
// 注意:HarmonyOS可能有特定的全局错误处理机制
logger.info(ERROR_HANDLER_TAG, '🛡️ 全局错误处理已设置');
} | https://github.com/DaLongZhuaZi/manxia | 9add454b2f7a0e043281f453f45651d579bc3a76 | github |
openharmony/developtools_profiler | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/components/LegendEntry.ets | arkts | constructor | @param label The legend entry text. A `null` label will start a group.
@param form The form to draw for this entry.
@param formSize Set to NaN to use the legend's default.
@param formLineWidth Set to NaN to use the legend's default.
@param formLineDashEffect Set to nil to use the legend's default.
@param formColor The ... | constructor(
label?: string,
form?: LegendForm,
formSize?: number,
formLineWidth?: number,
formLineDashEffect?: Object /*DashPathEffect*/,
formColor?: number | Color
) {
this.label = label;
this.form = form;
this.formSize = formSize;
this.formLineWidth = formLineWidth;
th... | 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 label AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left str... | constructor(
label?: string,
form?: LegendForm,
formSize?: number,
formLineWidth?: number,
formLineDashEffect?: Object /*DashPathEffect*/,
formColor?: number | Color
) {
this.label = label;
this.form = form;
this.formSize = formSize;
this.formLineWidth = formLineWidth;
th... | https://gitee.com/openharmony/developtools_profiler.git | 1970ae4553939ba0a7baad05cd2eb6144fe65ef1 | gitee |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/GamepadManager.ets | arkts | setShowGameMenuCallback | 设置长按 Start 键显示返回菜单的回调 | setShowGameMenuCallback(callback: (() => void) | null): void {
this.showGameMenuCallback = callback;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setShowGameMenuCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#(#Left ( AST#(#Right AST#formal_p... | setShowGameMenuCallback(callback: (() => void) | null): void {
this.showGameMenuCallback = callback;
} | https://github.com/AlkaidLab/moonlight-harmony | 5d579b074d7d491ebf946c0f9a7d25024ab369f1 | github |
richshaw2015/nds | ohos/entry/src/main/ets/utils/RomParser.ets | arkts | decodeAscii | 解码 ASCII 字符串 | function decodeAscii(data: Uint8Array, start: number, length: number): string {
const chars: string[] = [];
for (let i = 0; i < length; i++) {
const code = data[start + i];
if (code === 0) break;
chars.push(String.fromCharCode(code));
}
return chars.join('').trim();
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left decodeAscii AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left data AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Righ... | function decodeAscii(data: Uint8Array, start: number, length: number): string {
const chars: string[] = [];
for (let i = 0; i < length; i++) {
const code = data[start + i];
if (code === 0) break;
chars.push(String.fromCharCode(code));
}
return chars.join('').trim();
} | https://github.com/richshaw2015/nds | 6aff6a3a10ba2849be68df3a4c769cef68655ca5 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/BigInt.ets | arkts | $_invoke | Creates a new instance of BigInt from existing Long number
@param { Long } value BigInt value
@returns { BigInt } A new BigInt instance from existing Long number
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | static $_invoke(value: long): BigInt {
return new BigInt(value)
} | 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#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left long AST#identifier#Ri... | static $_invoke(value: long): BigInt {
return new BigInt(value)
} | https://gitcode.com/iop123123/arkts-static-skills | b4987169d2470f7a64aca722f6271c0fc3c65175 | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/listener/ChartTouchListener.ets | arkts | distance | returns the distance between two points
@param eventX
@param startX
@param eventY
@param startY
@return | protected static distance(eventX: number, startX: number, eventY: number, startY: number): number {
let dx: number = eventX - startX;
let dy: number = eventY - startY;
return Math.sqrt(dx * dx + dy * dy);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left protected AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left distance AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left even... | protected static distance(eventX: number, startX: number, eventY: number, startY: number): number {
let dx: number = eventX - startX;
let dy: number = eventY - startY;
return Math.sqrt(dx * dx + dy * dy);
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | ae69a7aea562db9f8a65e655fb7b2b65530d1efd | gitee |
zcg741/chengyu-game | entry/src/main/ets/viewmodel/GameViewModel.ets | arkts | getTotalQuestions | 获取总答题数 | getTotalQuestions(): number {
return this.session.records.length;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getTotalQuestions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#stat... | getTotalQuestions(): number {
return this.session.records.length;
} | https://github.com/zcg741/chengyu-game | d805ddbb9107e083fd868a0fabe74f74c7b199a9 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/rag/Reranker.ets | arkts | score | 计算重排序得分
@param query 查询文本
@param document 文档内容
@returns 重排序得分 | private async score(query: string, document: string): Promise<number> {
// 实际项目中使用Cross-Encoder模型
// 这里使用简化的相似度计算
// 1. 关键词匹配度
const keywordScore = this.calculateKeywordMatch(query, document);
// 2. 语义相似度(简化版)
const semanticScore = this.calculateSemanticSimilarity(query, document);
... | 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 score AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left query AST#identifier#Right AST#:#Left : AST#:#R... | private async score(query: string, document: string): Promise<number> {
// 实际项目中使用Cross-Encoder模型
// 这里使用简化的相似度计算
// 1. 关键词匹配度
const keywordScore = this.calculateKeywordMatch(query, document);
// 2. 语义相似度(简化版)
const semanticScore = this.calculateSemanticSimilarity(query, document);
... | https://github.com/LJ666-ui/harmony-health-care | 989b3ed81d5b7f60bed1b86257f5db6a1baab6c4 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | constructor | Creates a copy of Float32Array.
@param { Float32Array } other - data initializer
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public constructor(other: Float32Array) {
this.buffer = other.buffer.slice(other.byteOffset, other.byteOffset + other.byteLength) as ArrayBuffer
this.byteLength = other.byteLength
this.lengthInt = other.length
this.byteOffset = 0
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Flo... | public constructor(other: Float32Array) {
this.buffer = other.buffer.slice(other.byteOffset, other.byteOffset + other.byteLength) as ArrayBuffer
this.byteLength = other.byteLength
this.lengthInt = other.length
this.byteOffset = 0
} | https://gitcode.com/iop123123/arkts-static-skills | 9c0aaea0d796b8bec122ffe5d71fe1562911eada | gitcode |
nyzhhd/HMMusic | entry/src/main/ets/Utils/AVPlayerManager.ets | arkts | singPlay | 播放歌曲
singPlay(song: SongItemType) {
this.player!.url = song.url
this.currentSong.img = song.img
} | singPlay(song: SongItemType) {
// 需要申请长时任务
sessionManager.startBackgroundTask()
sessionManager.setAVPlayBackState()
// 判断是否在列表里面 -> some用法 检查数组里面的数据是否满足条件 -> 只要有一个满足some就返回true
const inList = this.currentSong.playList.some((item: SongItemType) => item.id == song.id)
if (inList) { //在播放列表里面
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left singPlay AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left song AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left SongItemType AST#identifier#Righ... | singPlay(song: SongItemType) {
// 需要申请长时任务
sessionManager.startBackgroundTask()
sessionManager.setAVPlayBackState()
// 判断是否在列表里面 -> some用法 检查数组里面的数据是否满足条件 -> 只要有一个满足some就返回true
const inList = this.currentSong.playList.some((item: SongItemType) => item.id == song.id)
if (inList) { //在播放列表里面
... | https://github.com/nyzhhd/HMMusic | 316f827aa3defe590fd436acc1babf8258a327a1 | github |
wuba/omni-ui | omni_component/src/main/ets/components/guide/model/HighLightOptionsBuilder.ets | arkts | isFetchLocationEveryTime | 是否每次显示引导页都重新获取组件坐标
@param isFetchLocation 是否每次显示引导页都重新获取组件坐标
@returns 额外配置构建类 | public isFetchLocationEveryTime(isFetchLocation: boolean): HighLightOptionsBuilder {
this.options.fetchLocationEveryTime = isFetchLocation;
return this;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isFetchLocationEveryTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isFetchLocation AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left... | public isFetchLocationEveryTime(isFetchLocation: boolean): HighLightOptionsBuilder {
this.options.fetchLocationEveryTime = isFetchLocation;
return this;
} | https://github.com/wuba/omni-ui | 194fae4aa8e9ff00ec0890b2ae80028724223f8c | github |
wuba/omni-ui | omni_component/src/main/ets/components/popup/Config.ets | arkts | getPopupOptions | 获取弹窗内默认设置
@returns | static getPopupOptions(): PopupInfo {
return JSON.parse(JSON.stringify(Config.popupOptions))
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getPopupOptions 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 PopupI... | static getPopupOptions(): PopupInfo {
return JSON.parse(JSON.stringify(Config.popupOptions))
} | https://github.com/wuba/omni-ui | 211299cdaeb935b480d64bf2cc1368f493693e98 | github |
2763981847/Clock-Alarm | entry/src/main/ets/model/database/PreferencesHandler.ets | arkts | configure | 配置偏好设置处理器,用于初始化用户首选项存储。
@param context 上下文对象,提供对应用程序的访问权限 | public async configure(context: Context) {
this.preferences = await data_preferences.getPreferences(context, CommonConstants.PREFERENCE_ID);
this.preferences.on('change', (data: Record<string, Object>) => {
// 当首选项数据发生变化时,通知所有已注册的监听器
for (let preferencesListener of this.listeners) {
prefer... | 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 configure AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#... | public async configure(context: Context) {
this.preferences = await data_preferences.getPreferences(context, CommonConstants.PREFERENCE_ID);
this.preferences.on('change', (data: Record<string, Object>) => {
// 当首选项数据发生变化时,通知所有已注册的监听器
for (let preferencesListener of this.listeners) {
prefer... | https://github.com/2763981847/Clock-Alarm | 2e5bd3d8b2195f44d0108d0450fa42ec4518581d | github |
HarmonyOS_Samples/MultiPictureBeautification | multipicturecommon/src/main/ets/utils/WindowUtil.ets | arkts | setWindowDecorImmersive | Set immersive window decorations for PC: hide default decorations and use custom ones | setWindowDecorImmersive(): void {
if (!this.mainWindow) {
return;
}
try {
this.mainWindow.setWindowDecorVisible(false);
this.mainWindow.setWindowDecorHeight(CommonConstants.WINDOW_DECOR_HEIGHT);
this.mainWindow.setDecorButtonStyle({ buttonIconSize: CommonConstants.DECOR_BUTTON_ICON... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setWindowDecorImmersive 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#stat... | setWindowDecorImmersive(): void {
if (!this.mainWindow) {
return;
}
try {
this.mainWindow.setWindowDecorVisible(false);
this.mainWindow.setWindowDecorHeight(CommonConstants.WINDOW_DECOR_HEIGHT);
this.mainWindow.setDecorButtonStyle({ buttonIconSize: CommonConstants.DECOR_BUTTON_ICON... | https://gitcode.com/HarmonyOS_Samples/MultiPictureBeautification | b78228e4c5252098529b7a076650af6dd4ffccfa | gitcode |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.