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 |
|---|---|---|---|---|---|---|---|---|---|---|
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | internal | Creates a copy with replaced value on index
@param index
@param value
@returns an BigUint64Array with replaced value on index
public | /* public */ internal with(index: int, value: BigInt): BigUint64Array {
let res = new BigUint64Array(this)
res.set(index, value)
return res
} | AST#program#Left AST#comment#Left /* public */ AST#comment#Right AST#ERROR#Left AST#identifier#Left internal AST#identifier#Right AST#ERROR#Right AST#with_statement#Left AST#with#Left with AST#with#Right AST#parenthesized_expression#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#R... | /* public */ internal with(index: int, value: BigInt): BigUint64Array {
let res = new BigUint64Array(this)
res.set(index, value)
return res
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 73507eb703c84637cb96a6ab87c4b77d5227561b | gitee |
Countly/countly-sdk-hos | library/src/main/ets/internal/modules/ModuleCrashes.ets | arkts | errorFromMessage | Parse the platform-supplied `errMsg` (a pre-formatted
"Name: message\nstack..." string) back into an `Error`. Sets `.stack` to
the full original payload so `recordInternal`'s "head already in stack"
fast path keeps the trace intact. | private static errorFromMessage(errMsg: string): Error {
const safe: string = errMsg ? errMsg : 'UnhandledException';
const newlineIdx: number = safe.indexOf('\n');
const head: string = newlineIdx === -1 ? safe : safe.substring(0, newlineIdx);
const colonIdx: number = head.indexOf(': ');
let name:... | 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 errorFromMessage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left errMsg AST#identifier#Right AST#:#L... | private static errorFromMessage(errMsg: string): Error {
const safe: string = errMsg ? errMsg : 'UnhandledException';
const newlineIdx: number = safe.indexOf('\n');
const head: string = newlineIdx === -1 ? safe : safe.substring(0, newlineIdx);
const colonIdx: number = head.indexOf(': ');
let name:... | https://github.com/Countly/countly-sdk-hos | d6cbb5a6235da70adad5e9a0a80ac62c5854aef6 | github |
CarGuo/GSYGithubAppOH | entry/src/main/ets/entryability/EntryAbility.ets | arkts | handleBootPhotoInjection | 测试通道:want.parameters.bootPhoto=<image url>,
HomePage 启动后会读取该值并 push 到 PhotoPage,方便对大图预览页做真机回归。 | private handleBootPhotoInjection(want: Want): void {
const params: Record<string, Object> | undefined = want.parameters as Record<string, Object> | undefined;
if (!params) {
return;
}
const raw: Object | undefined = params[PARAM_BOOT_PHOTO];
if (typeof raw !== 'string') {
return;
}... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleBootPhotoInjection AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#iden... | private handleBootPhotoInjection(want: Want): void {
const params: Record<string, Object> | undefined = want.parameters as Record<string, Object> | undefined;
if (!params) {
return;
}
const raw: Object | undefined = params[PARAM_BOOT_PHOTO];
if (typeof raw !== 'string') {
return;
}... | https://github.com/CarGuo/GSYGithubAppOH | 597c3bb4ac2e98a3075f5d28454a1000e10f6f17 | github |
Joker-x-dev/CoolMallArkTS | feature/common/src/main/ets/navigation/CommonGraph.ets | arkts | register | 注册公共模块导航路由 | register(): void {
RouteBuild.register(CommonRoutes.About, wrapBuilder(AboutNav));
RouteBuild.register(CommonRoutes.Web, wrapBuilder(WebNav));
RouteBuild.register(CommonRoutes.Settings, wrapBuilder(SettingsNav));
RouteBuild.register(CommonRoutes.UserAgreement, wrapBuilder(UserAgreementNav));
Route... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left register AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Lef... | register(): void {
RouteBuild.register(CommonRoutes.About, wrapBuilder(AboutNav));
RouteBuild.register(CommonRoutes.Web, wrapBuilder(WebNav));
RouteBuild.register(CommonRoutes.Settings, wrapBuilder(SettingsNav));
RouteBuild.register(CommonRoutes.UserAgreement, wrapBuilder(UserAgreementNav));
Route... | https://github.com/Joker-x-dev/CoolMallArkTS | d89fac0784a7dfa77840ad3535dd0d5920043474 | github |
Joker-x-dev/CoolMallArkTS | core/navigation/src/main/ets/order/OrderNavigator.ets | arkts | toPay | 跳转到订单支付
@param {number} orderId - 订单 ID
@param {number} price - 支付价格
@param {string} [from] - 来源
@returns {void} 无返回值 | static toPay(orderId: number, price: number, from?: string): void {
if (from) {
const params: OrderPayParam = { orderId, price, from };
navigateTo(OrderRoutes.Pay, params);
return;
}
const params: OrderPayParam = { orderId, price };
navigateTo(OrderRoutes.Pay, params);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left toPay AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left orderId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#... | static toPay(orderId: number, price: number, from?: string): void {
if (from) {
const params: OrderPayParam = { orderId, price, from };
navigateTo(OrderRoutes.Pay, params);
return;
}
const params: OrderPayParam = { orderId, price };
navigateTo(OrderRoutes.Pay, params);
} | https://github.com/Joker-x-dev/CoolMallArkTS | e16815ed566b651cbb386b89dea72abfa9c68067 | github |
HarmonyOS_Samples/MusicHome | products/pc/src/main/ets/pcability/PcAbility.ets | arkts | onWindowStageDestroy | Tears down immersive title settings and releases WindowUtil. | onWindowStageDestroy(): void {
Logger.info('PcAbility: Ability onWindowStageDestroy');
try {
WindowUtil.getInstance().applyPcFreeWindowTitleImmersive(false);
WindowUtil.getInstance().release();
} catch (error) {
Logger.error(`WindowUtil release ${JSON.stringify(error)}`);
}
try ... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onWindowStageDestroy 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... | onWindowStageDestroy(): void {
Logger.info('PcAbility: Ability onWindowStageDestroy');
try {
WindowUtil.getInstance().applyPcFreeWindowTitleImmersive(false);
WindowUtil.getInstance().release();
} catch (error) {
Logger.error(`WindowUtil release ${JSON.stringify(error)}`);
}
try ... | https://gitcode.com/HarmonyOS_Samples/MusicHome | ff50e9fb567d63faef17224f2236508fb58b8c51 | gitcode |
Countly/countly-sdk-hos | library/src/main/ets/internal/modules/ModuleConsent.ets | arkts | flushInitialConsentIfPending | Ship the init-time consent snapshot if the constructor flagged one as
pending. Called by `CountlyInstance.init()` AFTER
`deviceIdModule.resolveInitial()` so `device_id` is populated when
`sendSnapshot()` reads it. Also clears any in-flight runtime coalesce
timer (the snapshot we're about to send supersedes it).
This us... | public async flushInitialConsentIfPending(): Promise<void> {
// Clear any runtime coalesce timer scheduled by setConsentInternal —
// its pending snapshot is the same one we're about to send anyway.
if (this.pendingCoalesceTimer !== null) {
clearTimeout(this.pendingCoalesceTimer);
this.pending... | 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 flushInitialConsentIfPending AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expressi... | public async flushInitialConsentIfPending(): Promise<void> {
// Clear any runtime coalesce timer scheduled by setConsentInternal —
// its pending snapshot is the same one we're about to send anyway.
if (this.pendingCoalesceTimer !== null) {
clearTimeout(this.pendingCoalesceTimer);
this.pending... | https://github.com/Countly/countly-sdk-hos | 1e561eb974dbcde9f202c2a6b9308df144cbb088 | github |
offlinecat-dev/OCNetORM | src/main/ets/query/QueryBuilder.ets | arkts | forPage | 设置分页参数(paginate 的别名)
@param page 页码(从 1 开始)
@param size 每页数量
@returns 当前实例(支持链式调用) | forPage(page: number, size: number): QueryBuilder {
return this.paginate(page, size)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left forPage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left page AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left , AST#,#R... | forPage(page: number, size: number): QueryBuilder {
return this.paginate(page, size)
} | https://github.com/offlinecat-dev/OCNetORM | 22c2d777c52f45ef83ffd67dd994f51e3cadc545 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/BackgroundStreamService.ets | arkts | createAVSession | 创建并激活 AVSession
设置封面图片、元数据、播控命令以满足播控中心规范 | private async createAVSession(gameName: string): Promise<void> {
try {
// 创建 audio 类型的 AVSession
this.session = await AVSessionManager.createAVSession(
this.context!,
'MoonlightStreaming',
'audio'
);
console.info(`${TAG} AVSession 已创建, sessionId=${this.session.sessi... | 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 createAVSession AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left gameName AST#identifier#Right AST#ERROR#Left AST#:#L... | private async createAVSession(gameName: string): Promise<void> {
try {
// 创建 audio 类型的 AVSession
this.session = await AVSessionManager.createAVSession(
this.context!,
'MoonlightStreaming',
'audio'
);
console.info(`${TAG} AVSession 已创建, sessionId=${this.session.sessi... | https://github.com/AlkaidLab/moonlight-harmony | cfcab1011a0afdc00788f62a2b0423e9435ac46f | github |
the-wwyang/kids-learning-app | src/main/ets/storage/DataStorageManager.ets | arkts | getBoolean | 读取布尔数据
@param storeName 存储文件名
@param key 键名
@param defaultValue 默认值
@returns 读取的值或默认值 | async getBoolean(storeName: string, key: string, defaultValue: boolean = false): Promise<boolean> {
try {
const prefs = await this.getPreferences(storeName);
const value = await prefs.get(key, defaultValue);
return value as boolean;
} catch (error) {
console.error(`[DataStorageManager]... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getBoolean AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left storeName AST#identifier#Right AST#type_annotation#Left AST#:#Left :... | async getBoolean(storeName: string, key: string, defaultValue: boolean = false): Promise<boolean> {
try {
const prefs = await this.getPreferences(storeName);
const value = await prefs.get(key, defaultValue);
return value as boolean;
} catch (error) {
console.error(`[DataStorageManager]... | https://github.com/the-wwyang/kids-learning-app | 7eaf5ae2e223818e18e57a43b276a6ae02e00836 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | forEach | Applies a function over all elements of Uint8Array
@param fn function to apply
@returns undefined | public forEach(fn: (val: number, index: int, array: Uint8Array) => number): void {
for (let i = 0; i < this.length; ++i) {
this.set(i, fn(this.at(i), i, this))
}
throw new Error("Uint8Array.forEach: has to return undefined, but returns void for now")
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left forEach AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#... | public forEach(fn: (val: number, index: int, array: Uint8Array) => number): void {
for (let i = 0; i < this.length; ++i) {
this.set(i, fn(this.at(i), i, this))
}
throw new Error("Uint8Array.forEach: has to return undefined, but returns void for now")
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | f1cde4918daa5d65b690ddf7c6d7bb27d45c229d | gitee |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/ScatterDataSet.ets | arkts | setShapeRenderer | Sets a new IShapeRenderer responsible for drawing this DataSet.
This can also be used to set a custom IShapeRenderer aside from the default ones.
@param shapeRenderer | public setShapeRenderer(shapeRenderer: IShapeRenderer): void {
this.mShapeRenderer = shapeRenderer;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setShapeRenderer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left shapeRenderer AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi... | public setShapeRenderer(shapeRenderer: IShapeRenderer): void {
this.mShapeRenderer = shapeRenderer;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 69c1d0be5349a1b063ac8702c9e30083209709f9 | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | with | Creates a copy with replaced value on index
@param index
@param value
@returns an Uint8Array with replaced value on index | public with(index: number, value: number): Uint8Array {
return this.with(index as int, value as number)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#ERROR#Right AST#with_statement#Left AST#with#Left with AST#with#Right AST#parenthesized_expression#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST... | public with(index: number, value: number): Uint8Array {
return this.with(index as int, value as number)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 3e0484caca8625b8f04b98262e39ab3df52e88f8 | gitee |
openharmony/applications_settings | product/phone/src/main/ets/pages/passwordSetting.ets | arkts | aboutToAppear | prevent continuous and multiple clicks | aboutToAppear(): void {
if (deviceTypeInfo === 'phone' || deviceTypeInfo === 'default') {
this.isPhoneOrRK = true;
} else {
this.isPhoneOrRK = false;
}
// bind component and initialize
this.mController.bindComponent(this)
.bindProperties(["passwordList", "pinChallenge"])
.... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#L... | aboutToAppear(): void {
if (deviceTypeInfo === 'phone' || deviceTypeInfo === 'default') {
this.isPhoneOrRK = true;
} else {
this.isPhoneOrRK = false;
}
// bind component and initialize
this.mController.bindComponent(this)
.bindProperties(["passwordList", "pinChallenge"])
.... | https://gitee.com/openharmony/applications_settings.git | 62ef91e3606cb42cf1d075d90ba1bba10903477f | gitee |
HarmonyOS_Samples/MusicHome | common/musicbasic/src/main/ets/util/Logger.ets | arkts | error | Writes an error line to hilog; joins all parts with " | ".
@param args Text segments to log. | public static error(...args: Object[]): void {
hilog.error(Logger.domain, Logger.prefix, Logger.formatSingle, Logger.prefix, args.join(' | '));
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left error AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#... | public static error(...args: Object[]): void {
hilog.error(Logger.domain, Logger.prefix, Logger.formatSingle, Logger.prefix, args.join(' | '));
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | aba39a63bf882fde5293fe380d41075e4b698d92 | gitcode |
the-wwyang/kids-learning-app | src/main/ets/services/ParentalControlService.ets | arkts | getTodayString | 获取今天的日期字符串 | private getTodayString(): string {
const date = new Date();
const year = date.getFullYear();
const month = (date.getMonth() + 1).toString().padStart(2, '0');
const day = date.getDate().toString().padStart(2, '0');
return `${year}-${month}-${day}`;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getTodayString 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 A... | private getTodayString(): string {
const date = new Date();
const year = date.getFullYear();
const month = (date.getMonth() + 1).toString().padStart(2, '0');
const day = date.getDate().toString().padStart(2, '0');
return `${year}-${month}-${day}`;
} | https://github.com/the-wwyang/kids-learning-app | 821ad694098b4c07c66752579f64cb8b7686b9e4 | github |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/components/TouchPointerView.ets | arkts | rightClick | Send right click at current position | rightClick(): void {
if (this.instance === 0) return;
LibFreeRDP.sendCursorEvent(this.instance, this.pointerX, this.pointerY,
PTR_FLAGS_DOWN | PTR_FLAGS_BUTTON2);
LibFreeRDP.sendCursorEvent(this.instance, this.pointerX, this.pointerY,
PT... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left rightClick AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#L... | rightClick(): void {
if (this.instance === 0) return;
LibFreeRDP.sendCursorEvent(this.instance, this.pointerX, this.pointerY,
PTR_FLAGS_DOWN | PTR_FLAGS_BUTTON2);
LibFreeRDP.sendCursorEvent(this.instance, this.pointerX, this.pointerY,
PT... | https://github.com/tangwengang-del/freerdp-harmonyos | bcd79b662adc38ac11a6c69777b07e1d02e794fc | github |
Tencent-RTC/TUIKit_Harmony | atomic_x/src/main/ets/basecomponent/language/LanguageState.ets | arkts | initLanguage | Initialize language state from system configuration | private initLanguage(): void {
this.currentLanguage = this.getSystemLanguage();
this.currentLayoutDirection = this.calculateLayoutDirection(this.currentLanguage);
this.syncToAppStorage();
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left initLanguage 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#expres... | private initLanguage(): void {
this.currentLanguage = this.getSystemLanguage();
this.currentLayoutDirection = this.calculateLayoutDirection(this.currentLanguage);
this.syncToAppStorage();
} | https://github.com/Tencent-RTC/TUIKit_Harmony | ffafd8a4ef7022a1d185525d52ba5d207abe0f8a | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/template/strategies/UserTemplateStrategy.ets | arkts | findTemplatesGroup | 查找模板分组 | private findTemplatesGroup(kdbx: Kdbx): KdbxGroup | null {
// 首先检查数据库元数据中的模板分组
if (kdbx.meta && kdbx.meta.entryTemplatesGroup) {
const templateUuid = kdbx.meta.entryTemplatesGroup;
const group = this.findGroupByUuid(kdbx.getDefaultGroup(), templateUuid);
if (group) {
return group;
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left findTemplatesGroup AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left kdbx AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier... | private findTemplatesGroup(kdbx: Kdbx): KdbxGroup | null {
// 首先检查数据库元数据中的模板分组
if (kdbx.meta && kdbx.meta.entryTemplatesGroup) {
const templateUuid = kdbx.meta.entryTemplatesGroup;
const group = this.findGroupByUuid(kdbx.getDefaultGroup(), templateUuid);
if (group) {
return group;
... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/template/strategies/UserTemplateStrategy.ets#L64-L76 | b5643dd10095add66b797eaf75fb8616141ab3db | github |
David8Idira/AI-OA | packages/harmonyos/commons/src/main/ets/data/api/ApiClient.ets | arkts | getAttendanceStatistics | 获取考勤统计数据 | async getAttendanceStatistics(): Promise<ApiResponse<any>> {
return this.get<any>('/api/attendance/statistics')
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getAttendanceStatistics AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) ... | async getAttendanceStatistics(): Promise<ApiResponse<any>> {
return this.get<any>('/api/attendance/statistics')
} | https://github.com/David8Idira/AI-OA | 52faa7a6a01276bff1a1eaf7259294c564dbdc49 | github |
pangpang20/antennaPodHM | entry/src/main/ets/service/PlayerService.ets | arkts | getDuration | 获取总时长 | getDuration(): number {
// 优先使用 AVPlayer 的时长,如果没有则使用 Episode 的
if (this.avPlayer && this.avPlayer.duration > 0) {
return Math.floor(this.avPlayer.duration / 1000); // 毫秒转秒
}
return this.currentEpisode?.duration || 0;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getDuration AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statement_... | getDuration(): number {
// 优先使用 AVPlayer 的时长,如果没有则使用 Episode 的
if (this.avPlayer && this.avPlayer.duration > 0) {
return Math.floor(this.avPlayer.duration / 1000); // 毫秒转秒
}
return this.currentEpisode?.duration || 0;
} | https://github.com/pangpang20/antennaPodHM | 573c6aaad04c674ddd80f1e59164dd05f1ad02bb | github |
751496032/ZRouter | RouterApi/src/main/ets/api/Router.ets | arkts | getAnnotationParam | @deprecated
@see {ZRouter.getInstance().getAnnotationParam}
@returns | public static getAnnotationParam() {
return ZRouter.getRouterMgr().getAnnotationParam()
} | 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 getAnnotationParam AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right ... | public static getAnnotationParam() {
return ZRouter.getRouterMgr().getAnnotationParam()
} | https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/api/Router.ets#L542-L544 | 5ed91e7972522928f7674d347ecbcb3aefeb1b57 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelSettingsManager.ets | arkts | getSearchSettings | ==================== 搜索设置 ====================
获取搜索设置 | getSearchSettings(): NovelSearchSettings {
return this.cloneSearchSettings(this.searchSettings);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getSearchSettings 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 NovelSearchSettings AST#identifier#Right AST... | getSearchSettings(): NovelSearchSettings {
return this.cloneSearchSettings(this.searchSettings);
} | https://github.com/DaLongZhuaZi/manxia | 3f8561d72d220b21d20d526ab6954b10d92d7945 | github |
OHPG/FinVideo | entry/src/main/ets/player/VersionSelectStrategy.ets | arkts | getScreenLongEdge | 返回屏幕长边像素,用于分辨率档位判断(横竖屏均取最大边,反映实际播放上限) | private static getScreenLongEdge(): number {
try {
const d = display.getDefaultDisplaySync()
return Math.max(d.width, d.height)
} catch (_e) {
return 1920
}
} | 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 getScreenLongEdge AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ... | private static getScreenLongEdge(): number {
try {
const d = display.getDefaultDisplaySync()
return Math.max(d.width, d.height)
} catch (_e) {
return 1920
}
} | https://github.com/OHPG/FinVideo | 86ec32531e50291dc1b63c7f22bb5c6fc8de0f56 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/libs/htmlparser/HtmlEntities.ets | arkts | getEntityName | 获取字符对应的命名实体 | static getEntityName(char: string): string | undefined {
return HtmlEntities.getReverseEntities().get(char);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getEntityName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left char AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left st... | static getEntityName(char: string): string | undefined {
return HtmlEntities.getReverseEntities().get(char);
} | https://github.com/DaLongZhuaZi/manxia | 3f730d1c3b9c9f030453f0cd0888cf74089cddb5 | github |
richshaw2015/nds | ohos/entry/src/main/ets/utils/InputProcessor.ets | arkts | updateGamepadMappings | 更新手柄按键映射配置
@param mappings 新的手柄映射配置 | updateGamepadMappings(mappings: GamepadMappingEntry[]): void {
this.gamepadMappings = mappings
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateGamepadMappings AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left mappings AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left ... | updateGamepadMappings(mappings: GamepadMappingEntry[]): void {
this.gamepadMappings = mappings
} | https://github.com/richshaw2015/nds | f802daf2c205e3f0b635c9bea8df5532007576e5 | github |
Kira-Yagami-Light/Kira-Projects | TodoTask/entry/src/main/ets/data/repository/TaskRepository.ets | arkts | searchTasksByName | 根据任务名搜索任务
@param taskName 任务名(支持模糊匹配)
@returns Promise<Array<TaskListData>> 任务模型数组 | async searchTasksByName(taskName: string): Promise<Array<TaskListData>> {
try {
const records = await this.dao.queryByName(taskName);
return records.map(r => TaskListData.fromRecord(r));
} catch (err) {
Logger.error(this.LOG_TAG, `Failed to search tasks: ${JSON.stringify(err)}`);
retur... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left searchTasksByName AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left taskName AST#identifier#Right AST#type_annotation#Left AST#:#... | async searchTasksByName(taskName: string): Promise<Array<TaskListData>> {
try {
const records = await this.dao.queryByName(taskName);
return records.map(r => TaskListData.fromRecord(r));
} catch (err) {
Logger.error(this.LOG_TAG, `Failed to search tasks: ${JSON.stringify(err)}`);
retur... | https://github.com/Kira-Yagami-Light/Kira-Projects | 2b77f5cd41da5d9bdbca8d0e0e9dc4422aa71583 | github |
LZZLHY/hlib | entry/src/main/ets/api/ZLibraryClient.ets | arkts | getBookInfo | 书籍详情(包含 description / readOnlineUrl 等首屏列表里没有的字段)。 | async getBookInfo(bookId: number | string, hashId: string): Promise<Book> {
const json = await this.http.get<BookEnvelope>(`/eapi/book/${bookId}/${hashId}`);
ZLibraryClient.assertOk(json);
return Book.fromJson(json.book as object);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getBookInfo AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left bookId AST#identifier#Right AST#type_annotation#Left AST#:#Left : A... | async getBookInfo(bookId: number | string, hashId: string): Promise<Book> {
const json = await this.http.get<BookEnvelope>(`/eapi/book/${bookId}/${hashId}`);
ZLibraryClient.assertOk(json);
return Book.fromJson(json.book as object);
} | https://github.com/LZZLHY/hlib | 6061ccec17c6468067fbb265a8888bdc73a281c8 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Array.ets | arkts | mapArray | Creates a new `Object[]` primitive array and populates
it with the results of calling a provided function on every element in the calling array.
@param fn mapping function, applied to each element of an array.
@returns Primitive array of `Object`s, constructed from `this` and given function. | private mapArray<U>(fn: (v: T, k: number) => U): U[] {
let res = new U[this.data.length];
for (let i = 0; i < this.data.length; i++) {
res[i] = fn(this.data[i], i);
}
return res;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#binary_expression#Left AST#identifier#Left mapArray AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left U AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#ERROR#Left AST#formal_parameters#Left AST#(... | private mapArray<U>(fn: (v: T, k: number) => U): U[] {
let res = new U[this.data.length];
for (let i = 0; i < this.data.length; i++) {
res[i] = fn(this.data[i], i);
}
return res;
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 958f7280d8ad1d49250dd5f8304c77dc6fa14fc8 | gitee |
Nekofox-POT/LinMusic | entry/src/main/ets/package/files_manager/download_manager.ets | arkts | scan_data | 完整扫描数据库 // | async scan_data() {
// 扫描歌曲(格式化完整路径) //
let tmp_audio: string[] = []
for (const i of await fs.listFile(song_path, { recursion: true, filter: { suffix: support_audio_format } })) {
tmp_audio.push(song_path + '/' + i)
}
if (this.global_config!.dsd_support) {
for (const i of await fs.lis... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left scan_data AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#{#Left { AST#{#Right AST#ERROR#Right AST#comment#Le... | async scan_data() {
// 扫描歌曲(格式化完整路径) //
let tmp_audio: string[] = []
for (const i of await fs.listFile(song_path, { recursion: true, filter: { suffix: support_audio_format } })) {
tmp_audio.push(song_path + '/' + i)
}
if (this.global_config!.dsd_support) {
for (const i of await fs.lis... | https://github.com/Nekofox-POT/LinMusic | a610643ef5a2aecd77e34ebbc032c836d26a7a80 | github |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/Message.ets | arkts | toString | 转换为可读字符串(用于调试)
@returns JSON 格式的字符串 | toString(): string {
try {
return JSON.stringify(this.toJson(), null, 2)
} catch (e) {
return `[${this.$typeName}]`
}
} | AST#program#Left AST#ERROR#Left 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#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement_blo... | toString(): string {
try {
return JSON.stringify(this.toJson(), null, 2)
} catch (e) {
return `[${this.$typeName}]`
}
} | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | 7f1f817abf5e49ef5160cc65bebc03404dddb192 | gitcode |
Delsin-Yu/JustPDF | entry/src/main/ets/pages/pdfview/PDFViewerViewModel.ets | arkts | isAtHorizontalScrollLeftEnd | 横向可滚动且已贴左端(可向右拖出上一页预览) | isAtHorizontalScrollLeftEnd(uiContext: UIContext, epsilonVp: number = 2): boolean {
const b = this.getPanClampBounds(uiContext);
if (b.scaledViewSizeVp.x <= b.viewportSizeVp.x) {
return false;
}
return this.viewPan.x >= b.maxX - b.relaxX * 0.35 - epsilonVp;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isAtHorizontalScrollLeftEnd AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uiContext AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left UIContext AST#identifie... | isAtHorizontalScrollLeftEnd(uiContext: UIContext, epsilonVp: number = 2): boolean {
const b = this.getPanClampBounds(uiContext);
if (b.scaledViewSizeVp.x <= b.viewportSizeVp.x) {
return false;
}
return this.viewPan.x >= b.maxX - b.relaxX * 0.35 - epsilonVp;
} | https://github.com/Delsin-Yu/JustPDF/blob/07d9dd917e7592f584d67821fb06a7369bd3f15b/entry/src/main/ets/pages/pdfview/PDFViewerViewModel.ets#L426-L432 | f07717dfd0cdaafc0153807a861c2619c2ecf014 | github |
zcg741/chengyu-game | entry/src/main/ets/viewmodel/GameViewModel.ets | arkts | nextQuestion | 进入下一题 | nextQuestion(): void {
if (this.session.isGameOver) {
return;
}
this.loadNextQuestion();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left nextQuestion AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Le... | nextQuestion(): void {
if (this.session.isGameOver) {
return;
}
this.loadNextQuestion();
} | https://github.com/zcg741/chengyu-game | 41792711041d020a4b3c574d3dd3b9f343421a0f | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets | arkts | getLiteral | Returns literal representation of this lambda type
@returns {string} Literal representation
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public override getLiteral(): string {
let sb = new StringBuilder("(")
const paramsNum = this.getParametersNum()
for (let i = 0; i < paramsNum; ++i) {
sb.append(this.getParameter(i).toString())
if (i != paramsNum - 1) {
sb.append(", ")
}
... | 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 getLiteral AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#... | public override getLiteral(): string {
let sb = new StringBuilder("(")
const paramsNum = this.getParametersNum()
for (let i = 0; i < paramsNum; ++i) {
sb.append(this.getParameter(i).toString())
if (i != paramsNum - 1) {
sb.append(", ")
}
... | https://gitcode.com/iop123123/arkts-static-skills | 98da778a6af1f68f0269c53d44e6d8d94fb78f45 | gitcode |
xiaofenger_705/protobuf-arkts-generator | test/performance_test.ets | arkts | createTestMessage | Create test data | function createTestMessage(id: number): PerformanceTest {
return PerformanceTest.create({
id: `test-${id}`,
value1: id * 1,
value2: id * 2,
value3: id * 3,
value4: id * 4,
score1: id * 1.5,
score2: id * 2.5,
score3: id * 3.5,
flag1: id % 2 === 0,
flag2: id % 3 === 0,
tags: ... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left createTestMessage AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#... | function createTestMessage(id: number): PerformanceTest {
return PerformanceTest.create({
id: `test-${id}`,
value1: id * 1,
value2: id * 2,
value3: id * 3,
value4: id * 4,
score1: id * 1.5,
score2: id * 2.5,
score3: id * 3.5,
flag1: id % 2 === 0,
flag2: id % 3 === 0,
tags: ... | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | 18055051c4229fc379bcf103a895fdbea6d6058f | gitcode |
Kira-Yagami-Light/Kira-Projects | TodoTask/entry/src/main/ets/data/database/CategoryDao.ets | arkts | queryById | 根据 ID 查询分类
@param id 分类 ID
@returns Promise<Record<string, any> | null> 分类记录或 null | async queryById(id: number): Promise<Record<string, number | string> | null> {
const store = this.dbHelper.getRdbStore();
if (!store) {
Logger.error(this.LOG_TAG, 'RdbStore is null');
return null;
}
try {
const predicates = new relationalStore.RdbPredicates(this.tableName);
pr... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left queryById AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#R... | async queryById(id: number): Promise<Record<string, number | string> | null> {
const store = this.dbHelper.getRdbStore();
if (!store) {
Logger.error(this.LOG_TAG, 'RdbStore is null');
return null;
}
try {
const predicates = new relationalStore.RdbPredicates(this.tableName);
pr... | https://github.com/Kira-Yagami-Light/Kira-Projects | 2bd2bd8ea1314ddd33dd63f0f0fd5e2936f8bd9b | github |
arkui-x/samples | CodeLab/Cases/feature/bluetooth/src/main/ets/uicomponents/HeartRateGraph.ets | arkts | draw | 画心率变动图 | draw() {
this.context.clearRect(0, 0, this.viewWidth, this.viewHeight);
this.drawCoordinate();
this.drawHeartRateLine();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left draw AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#ca... | draw() {
this.context.clearRect(0, 0, this.viewWidth, this.viewHeight);
this.drawCoordinate();
this.drawHeartRateLine();
} | https://gitcode.com/arkui-x/samples | c6d39e1a5b796a29746246c95738c0b434946b7d | gitcode |
CLMC2025/Vignette | entry/src/main/ets/sync/VersionControl.ets | arkts | getEntityHistory | 获取特定实体的变更历史 | getEntityHistory(entityType: string, entityId: number): ChangeLogEntry[] {
return this.changeLog.filter(
(entry: ChangeLogEntry): boolean => entry.entityType === entityType && entry.entityId === entityId
);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getEntityHistory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left entityType AST#identifier#Right AST#ERROR#Left ... | getEntityHistory(entityType: string, entityId: number): ChangeLogEntry[] {
return this.changeLog.filter(
(entry: ChangeLogEntry): boolean => entry.entityType === entityType && entry.entityId === entityId
);
} | https://github.com/CLMC2025/Vignette | 7b693418aa3e659ebb11144ef0794ec791177a1e | github |
openharmony-sig/flutter_sqflite | sqflite/ohos/src/main/ets/io/flutter/plugins/sqflite/SqflitePlugin.ets | arkts | handleQueryCall | /查询数据 | async handleQueryCall(call: MethodCall, result: MethodResult): Promise<void> {
let rdbStore = DatabaseHelper.getDatabaseOrError(call, result);
if (rdbStore == null) {
return;
}
let operation: MethodCallOperation = new MethodCallOperation(call, result);
Database.query(operation, rdbStore);
... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left handleQueryCall AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left call AST#identifier#Right AST#type_annotation#Left AST... | async handleQueryCall(call: MethodCall, result: MethodResult): Promise<void> {
let rdbStore = DatabaseHelper.getDatabaseOrError(call, result);
if (rdbStore == null) {
return;
}
let operation: MethodCallOperation = new MethodCallOperation(call, result);
Database.query(operation, rdbStore);
... | https://gitee.com/openharmony-sig/flutter_sqflite.git | d1eb752a103a054cfdde267d2d9ddf3cc5f22ce7 | gitee |
CLMC2025/Vignette | entry/src/main/ets/manager/SessionPlanner.ets | arkts | estimateSessionTime | 计算会话总预估时间(分钟) | estimateSessionTime(tasks: TaskItem[]): number {
const totalSeconds = tasks.reduce((sum: number, task: TaskItem): number => {
return sum + task.estimatedTime;
}, 0);
return Math.round(totalSeconds / 60);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left estimateSessionTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tasks AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left TaskI... | estimateSessionTime(tasks: TaskItem[]): number {
const totalSeconds = tasks.reduce((sum: number, task: TaskItem): number => {
return sum + task.estimatedTime;
}, 0);
return Math.round(totalSeconds / 60);
} | https://github.com/CLMC2025/Vignette | f44b3e5fd94f4a2d3f83e9b9295f4e7cd638d78a | github |
openharmony-tpc/VCard | library/src/main/ets/components/VCardProperty.ets | arkts | setValues | TODO: would be much better to have translateRawValue() functionality instead of forcing
VCardParserImpl does this job.
public setValues(propertyValueList: Array<string>): void | public setValues(...propertyValues: string[]): void{
this.mValueList = propertyValues
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setValues AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#identifier#Left propertyValues AST#identifier#Right AST#spread_elemen... | public setValues(...propertyValues: string[]): void{
this.mValueList = propertyValues
} | https://gitee.com/openharmony-tpc/VCard.git | 0d31873b5cf3b9b0059c2f237a4b866dceee7d8d | gitee |
Vincent-Leon/zotero-harmony | entry/src/main/ets/api/ZoteroClient.ets | arkts | getCollectionItems | GET /users/{uid}/collections/{collectionKey}/items/top. Top-level items
belonging to the given collection. Server-side filtering (vs reading the
`collections` field on each item from getItems()) — collection membership
is hierarchical at the API layer. | async getCollectionItems(collectionKey: string, options?: ListOptions): Promise<PagedResult<ZoteroItem>> {
if (collectionKey.length === 0) {
throw new ZoteroApiError(0, 'getCollectionItems: collectionKey must not be empty');
}
const uid = this.requireUserId();
const path = `/users/${uid}/collect... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getCollectionItems AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left collectionKey AST#identifi... | async getCollectionItems(collectionKey: string, options?: ListOptions): Promise<PagedResult<ZoteroItem>> {
if (collectionKey.length === 0) {
throw new ZoteroApiError(0, 'getCollectionItems: collectionKey must not be empty');
}
const uid = this.requireUserId();
const path = `/users/${uid}/collect... | https://github.com/Vincent-Leon/zotero-harmony | fc7afb3bded5f6dd67195367b2db0a9c92442235 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/SharedLedgerDAO.ets | arkts | getById | 根据ID获取账本 | static async getById(ledgerId: number): Promise<SharedLedger | null> {
let resultSet: relationalStore.ResultSet | null = null;
try {
const store = DatabaseManager.getDatabase();
const predicates = new relationalStore.RdbPredicates(SharedLedger.tableName);
predicates.equalTo('ledger_id', ledg... | 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 getById AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left ledgerId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:... | static async getById(ledgerId: number): Promise<SharedLedger | null> {
let resultSet: relationalStore.ResultSet | null = null;
try {
const store = DatabaseManager.getDatabase();
const predicates = new relationalStore.RdbPredicates(SharedLedger.tableName);
predicates.equalTo('ledger_id', ledg... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 66487655a2502f3927c5d44abd135d71d8670981 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/BigInt.ets | arkts | valueOf | Returns the primitive value of the specified BigInt object.
@returns { BigInt } The primitive value.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public valueOf(): BigInt {
return this
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left valueOf AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left BigInt AST#ide... | public valueOf(): BigInt {
return this
} | https://gitcode.com/iop123123/arkts-static-skills | de2279e4778cd4a1524159506f86e9395baf27fa | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | constructor | Creates an Float32Array from FixedArray<int>
@param { FixedArray<int> } numbers - data initializer
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public constructor(numbers: FixedArray<int>) {
this(numbers.length)
for (let i: int = 0; i < this.lengthInt; ++i) {
this.setUnsafe(i, numbers[i].toFloat())
}
} | 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 numbers AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_exp... | public constructor(numbers: FixedArray<int>) {
this(numbers.length)
for (let i: int = 0; i < this.lengthInt; ++i) {
this.setUnsafe(i, numbers[i].toFloat())
}
} | https://gitcode.com/iop123123/arkts-static-skills | a0773668e201590a73ffbb72c09a58d406849577 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Error.ets | arkts | constructor | Constructs a new error instance with provided code, message and cause
@param { int } code - Error code
@param { String } [message] - Error text
@param { ErrorOptions } [options] - Error options
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | constructor(code: int, message?: String, options?: ErrorOptions) {
this("Error", code, message, options)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left code AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#Right AST#ERROR#Right AST#... | constructor(code: int, message?: String, options?: ErrorOptions) {
this("Error", code, message, options)
} | https://gitcode.com/iop123123/arkts-static-skills | de0ffc7bd6f915ee73780e3f72260cbd6f669769 | gitcode |
openharmony/applications_mms | entry/src/main/ets/pages/infomsg/InfoMsgController.ets | arkts | deleteDialogCancel | Cancel Ejection | deleteDialogCancel() {
if (this.isSelectLockMsg) {
this.isSelectLockMsg = false;
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left deleteDialogCancel 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... | deleteDialogCancel() {
if (this.isSelectLockMsg) {
this.isSelectLockMsg = false;
}
} | https://gitee.com/openharmony/applications_mms.git | f733a83d839b54c6f05f648f0bd4219d6cea5a94 | gitee |
openharmony/applications_print_spooler | entry/src/main/ets/pages/component/PreviewComponent.ets | arkts | fdToPixelMap | fd生成pixelMap
@param fd | fdToPixelMap(fd:number){
Log.info(TAG, 'fd is: ' + fd);
Log.debug(TAG, 'this.currentImage: ' + JSON.stringify(this.currentImage));
if (this.currentImage === undefined) {
Log.error(TAG, 'currentImage is undefined');
return;
}
if (CheckEmptyUtils.isEmpty(this.currentImage!.imageSource)) ... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left fdToPixelMap AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left fd AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AS... | fdToPixelMap(fd:number){
Log.info(TAG, 'fd is: ' + fd);
Log.debug(TAG, 'this.currentImage: ' + JSON.stringify(this.currentImage));
if (this.currentImage === undefined) {
Log.error(TAG, 'currentImage is undefined');
return;
}
if (CheckEmptyUtils.isEmpty(this.currentImage!.imageSource)) ... | https://gitee.com/openharmony/applications_print_spooler.git | dbd62e3c6e54197aab5d1e9ce7054f2428110654 | gitee |
openharmony-sig/applications_clock | common/src/main/ets/manager/PageStateManager.ets | arkts | getPreferences | Get PageStateManager Preferences instance.
@return Preferences instance | private async getPreferences(): Promise<Preferences> {
if (this.preferences) {
return this.preferences;
}
this.preferences = await preferencesUtil.getPreferences((GlobalContext.getContext()
.getObject('clockContext') as Context), PAGE_STATE_STORE);
return this.preferences as Preferences;
... | 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 getPreferences AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS... | private async getPreferences(): Promise<Preferences> {
if (this.preferences) {
return this.preferences;
}
this.preferences = await preferencesUtil.getPreferences((GlobalContext.getContext()
.getObject('clockContext') as Context), PAGE_STATE_STORE);
return this.preferences as Preferences;
... | https://gitee.com/openharmony-sig/applications_clock.git | 5f8417d3113b33ff911e84ff59156e4a0db0537e | gitee |
openharmony-tpc/XmlGraphicsBatik | library/src/main/ets/batik/svggen/SVGLine.ets | arkts | setY2 | 设置结束点Y坐标
@param newY2 结束点Y坐标 | public setY2(newY2: number): void{
this._y1 = newY2;
this._lineResultObj['y2'] = newY2;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left setY2 AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left newY2 AST#identifier#Right AST#:#Left : AST#:#Right AST#ER... | public setY2(newY2: number): void{
this._y1 = newY2;
this._lineResultObj['y2'] = newY2;
} | https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git | d1ab54a3525e419fa64ab90c376eb66a5c5f2842 | gitee |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/components/DownloadManager.ets | arkts | deleteLocalFile | 删除本地文件 | private async deleteLocalFile(filePath: string) {
try {
await fileIo.unlink(filePath);
} catch (error) {
console.error(`Failed to delete file ${filePath}:`, error);
}
} | 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 deleteLocalFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath AST#identifier#Right AST#ERROR#Left AST#:#L... | private async deleteLocalFile(filePath: string) {
try {
await fileIo.unlink(filePath);
} catch (error) {
console.error(`Failed to delete file ${filePath}:`, error);
}
} | https://github.com/AetheriumSimulator/qemu-hmos | 102eb67a2631c289cd43185fb00cf51d2f8236b8 | github |
openharmony/xts_acts | ability/ability_runtime/actsabilityamstest/actsdeeplinktest/entry/src/main/ets/specifedprocessability/SpecifedProcessAbility.ets | arkts | onWindowStageCreate | 创建舞台(页面)时 | onWindowStageCreate(windowStage: window.WindowStage): void {
// Main window is created, set main page for this ability
hilog.info(0x0000, tag, '%{public}s', 'SpecifedProcessAbility onWindowStageCreate');
windowStage.loadContent('pages/Index', (err) => {
if (err.code) {
hilog.error(0x0000, t... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onWindowStageCreate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left windowStage AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left window AST#identif... | onWindowStageCreate(windowStage: window.WindowStage): void {
// Main window is created, set main page for this ability
hilog.info(0x0000, tag, '%{public}s', 'SpecifedProcessAbility onWindowStageCreate');
windowStage.loadContent('pages/Index', (err) => {
if (err.code) {
hilog.error(0x0000, t... | https://gitee.com/openharmony/xts_acts.git | 1750b0a1d041a2cc56b0494279b36d641c4afe17 | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/pages/ExportImportPage.ets | arkts | copyToClipboard | 功能 1.1: 复制到剪贴板 (最稳妥方案) | copyToClipboard() {
if (!this.csvContent) {
promptAction.showToast({ message: '请先生成数据' });
return;
}
const data = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, this.csvContent);
const systemPasteboard = pasteboard.getSystemPasteboard();
systemPasteboard.setData(data).then(() =>... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left copyToClipboard 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#Le... | copyToClipboard() {
if (!this.csvContent) {
promptAction.showToast({ message: '请先生成数据' });
return;
}
const data = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, this.csvContent);
const systemPasteboard = pasteboard.getSystemPasteboard();
systemPasteboard.setData(data).then(() =>... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | d8ad7ef12f835e5bd6ef11b083b90a407f4dffee | github |
openharmony/codelabs | ETSUI/LifeTrack/entry/src/main/ets/dao/EventDao.ets | arkts | getEventInstancesByDateRange | 获取某个时间范围内的实例 | async getEventInstancesByDateRange(startDate: number, endDate: number): Promise<EventInstance[]> {
const rdbStore = await this.initDatabase();
const instances: EventInstance[] = [];
try {
const predicates = new relationalStore.RdbPredicates('event_instances');
predicates.greaterThanOrEqualTo(... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getEventInstancesByDateRange AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left startDate AST#identifier#Right AST#type_annotation... | async getEventInstancesByDateRange(startDate: number, endDate: number): Promise<EventInstance[]> {
const rdbStore = await this.initDatabase();
const instances: EventInstance[] = [];
try {
const predicates = new relationalStore.RdbPredicates('event_instances');
predicates.greaterThanOrEqualTo(... | https://gitcode.com/openharmony/codelabs | a3cc25f507eef90d12536b4651b0dccf1df8254e | gitcode |
ibestservices/ibest-ui | library/src/main/ets/apis/IBestActionSheet.ets | arkts | show | 展示actionSheet | public async show(option: IBestActionSheetOption): Promise<string> {
let key = this.getUniKey()
let windowClass = GlobalStore.getMainWindow()
let uiContext = windowClass.getUIContext()
let params = new IBestActionSheetParams(option)
params.id = key
params.close = (id: string): Promise<void> => this.close(i... | 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 show AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left option AST#identifier#Right AST#:#Left : AST#:#Righ... | public async show(option: IBestActionSheetOption): Promise<string> {
let key = this.getUniKey()
let windowClass = GlobalStore.getMainWindow()
let uiContext = windowClass.getUIContext()
let params = new IBestActionSheetParams(option)
params.id = key
params.close = (id: string): Promise<void> => this.close(i... | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/apis/IBestActionSheet.ets#L423-L471 | 07ecbc6c6e75ea4796c4ed6c27eb8fe918f63881 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Scraper/AniListScraper.ets | arkts | getDetail | 获取媒体详情
@param mediaId 媒体ID | public async getDetail(mediaId: number | string): Promise<ScraperDetailResult> {
try {
logger.info(TAG, `获取AniList媒体详情: ${mediaId}`);
const query = `
query ($id: Int) {
Media(id: $id) {
id
idMal
title {
romaji
english
... | 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 getDetail AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left mediaId AST#identifier#Right AST#:#Left : AST#... | public async getDetail(mediaId: number | string): Promise<ScraperDetailResult> {
try {
logger.info(TAG, `获取AniList媒体详情: ${mediaId}`);
const query = `
query ($id: Int) {
Media(id: $id) {
id
idMal
title {
romaji
english
... | https://github.com/DaLongZhuaZi/manxia | c74f22d785bebb012bf1c5ceba7cf5c4ce86b1ca | github |
751496032/ZRouter | RouterApi/src/main/ets/lifecycle/LifecycleRegistry.ets | arkts | addListener | 添加生命周期监听
@param callback
@param inRootView 当前页面是否是Navigation根视图中 可选参数 | public addListener(callback: LifecycleCallback, inRootView: boolean = false) {
RouterMgr.getInstance().lifecycleMgr.addListener(callback, this.targetClassName, inRootView);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left callback AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | public addListener(callback: LifecycleCallback, inRootView: boolean = false) {
RouterMgr.getInstance().lifecycleMgr.addListener(callback, this.targetClassName, inRootView);
} | https://github.com/751496032/ZRouter/blob/bacb12ccf3187546fe287cff3c63f2925ce941d6/RouterApi/src/main/ets/lifecycle/LifecycleRegistry.ets#L47-L49 | bfb97ffff9d8c6a2ee6f4fa39f4785bf87a35fe3 | github |
HarmonyOS_Samples/MusicHome | features/recommendation/src/main/ets/view/PanelPrivateStrip.ets | arkts | build | Column with header and three-lane lazy list of private songs. | build() {
Column({ space: 24 }) {
this.SectionHeader()
List({ space: 16 }) {
LazyForEach(this.recommendViewModel.privateSongDataSource,
(item: RecommendPrivateSongUi, index?: number) => {
ListItem() {
this.PrivateSongListItem(item);
}
}... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AST#c... | build() {
Column({ space: 24 }) {
this.SectionHeader()
List({ space: 16 }) {
LazyForEach(this.recommendViewModel.privateSongDataSource,
(item: RecommendPrivateSongUi, index?: number) => {
ListItem() {
this.PrivateSongListItem(item);
}
}... | https://gitcode.com/HarmonyOS_Samples/MusicHome | 33b45c11f47a84920424f4214cd8eff798a4448e | gitcode |
openharmony/applications_permission_manager | permissionmanager/src/main/ets/GlobalExtAbility/GlobalExtAbility.ets | arkts | onRequest | Lifecycle function, called back when a service extension is started or recall. | onRequest(want: Want, startId: number): void {
Log.info('ServiceExtensionAbility onRequest. start id is ' + startId);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onRequest AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Want AST#identifier#Right AST#,#Left , AST#,#R... | onRequest(want: Want, startId: number): void {
Log.info('ServiceExtensionAbility onRequest. start id is ' + startId);
} | https://gitee.com/openharmony/applications_permission_manager.git | c0e839414bdb4ef424366a88e62e65e080fbe182 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelSettingsManager.ets | arkts | isGroupEnabled | ==================== 书源分组管理 ====================
检查分组是否启用 | isGroupEnabled(groupName: string): boolean {
// 如果没有设置启用分组,则默认全部启用
if (this.searchSettings.enabledGroups.length === 0) {
return true;
}
return this.searchSettings.enabledGroups.includes(groupName);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isGroupEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left groupName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST... | isGroupEnabled(groupName: string): boolean {
// 如果没有设置启用分组,则默认全部启用
if (this.searchSettings.enabledGroups.length === 0) {
return true;
}
return this.searchSettings.enabledGroups.includes(groupName);
} | https://github.com/DaLongZhuaZi/manxia | 96279b78defdd4d7dd4e2a37a802a9ca748206e0 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | entries | Returns an array of key, value pairs for every entry in the BigUint64Array
@returns { IterableIterator<[int, BigInt]> } - key, value pairs for every entry in the array
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public entries(): IterableIterator<[int, BigInt]> {
return new BigUint64ArrayIteratorEntries(this)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left entries 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_sta... | public entries(): IterableIterator<[int, BigInt]> {
return new BigUint64ArrayIteratorEntries(this)
} | https://gitcode.com/iop123123/arkts-static-skills | 43922011f98cf04ffbf3545e3b01ba71fd484bc1 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Scraper/BangumiScraper.ets | arkts | searchAnime | 按类型搜索动画 | public async searchAnime(keyword: string, limit: number = 25): Promise<ScraperSearchResult> {
return this.search(keyword, BangumiSubjectType.ANIME, limit);
} | 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 searchAnime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left keyword AST#identifier#Right AST#ERROR#Left AST#:#Left : AS... | public async searchAnime(keyword: string, limit: number = 25): Promise<ScraperSearchResult> {
return this.search(keyword, BangumiSubjectType.ANIME, limit);
} | https://github.com/DaLongZhuaZi/manxia | 18681da90d75bb292025d641f57020efeb90d9a1 | github |
openharmony-sig/commons-cli | library/src/main/ets/components/cli/HelpFormatter.ets | arkts | setLongOptSeparator | Set the separator displayed between a long option and its value. Ensure that the separator specified is supported by
the parser used, typically ' ' or '='.
@param longOptSeparator the separator, typically ' ' or '='.
@since 1.3 | public setLongOptSeparator(longOptSeparator:string):void {
this.longOptSeparator = longOptSeparator;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setLongOptSeparator AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left longOptSeparator AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left stri... | public setLongOptSeparator(longOptSeparator:string):void {
this.longOptSeparator = longOptSeparator;
} | https://gitee.com/openharmony-sig/commons-cli.git | cab13cd4a2078f45e966a0ba34c85200f7989b87 | gitee |
HarmonyOS_Samples/speech-kit-sample-TextReader_-arkts | entry/src/main/ets/pages/Index.ets | arkts | setActionListener | Setting the Operation Listener | setActionListener() {
TextReader.on('setArticle', (id: string) => {});
TextReader.on('clickArticle', (id: string) => {});
TextReader.on('clickAuthor', (id: string) => {});
TextReader.on('clickNotification', (id: string) => { hilog.info(0x0001, TAG, `onClickNotification ${id}`) });
TextReader.o... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setActionListener 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#... | setActionListener() {
TextReader.on('setArticle', (id: string) => {});
TextReader.on('clickArticle', (id: string) => {});
TextReader.on('clickAuthor', (id: string) => {});
TextReader.on('clickNotification', (id: string) => { hilog.info(0x0001, TAG, `onClickNotification ${id}`) });
TextReader.o... | https://gitcode.com/HarmonyOS_Samples/speech-kit-sample-TextReader_-arkts | 13e12a4e77d02c3b2e7ec2c9393655c6d2b0cfb3 | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/components/StreamMenuManager.ets | arkts | handleMainMenuSelect | 处理主菜单选择 | private handleMainMenuSelect(option: OptionItem): void {
const session = this.getSession();
switch (option.value) {
case 'resume':
this.callbacks.onResume();
break;
case 'send_esc':
session?.sendKeys([VirtualKey.VK_ESCAPE]);
this.showToast('已发送 ESC');
break... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleMainMenuSelect AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left option AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi... | private handleMainMenuSelect(option: OptionItem): void {
const session = this.getSession();
switch (option.value) {
case 'resume':
this.callbacks.onResume();
break;
case 'send_esc':
session?.sendKeys([VirtualKey.VK_ESCAPE]);
this.showToast('已发送 ESC');
break... | https://github.com/AlkaidLab/moonlight-harmony | f7f2812d380042e1ef8333c0ab4694781691ced5 | github |
openeuler-mirror/arkui-linux | samples/arkui-test/Component/09_Animation/entry/src/main/ets/pages/PageTransitionTest.ets | arkts | build | 控制组件的添加和删除 | build() {
Column() {
Row() {
Button('返回', { type: ButtonType.Normal })
.height(30)
.width(50)
.fontColor('#696969')
.backgroundColor('#DCDCDC')
.onClick(() => {
router.replaceUrl({ url: 'pages/MainPage' });
})
.margin(... | 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() {
Row() {
Button('返回', { type: ButtonType.Normal })
.height(30)
.width(50)
.fontColor('#696969')
.backgroundColor('#DCDCDC')
.onClick(() => {
router.replaceUrl({ url: 'pages/MainPage' });
})
.margin(... | https://github.com/openeuler-mirror/arkui-linux | 8ec4e1afcadec5c58bcaae4f8b545fca330924cf | github |
harmonyos/codelabs | HarmonyOS_NEXT/DistributedMail/entry/src/main/ets/pages/MailHomePage.ets | arkts | createPicture | Rendering pictures.
@param buffer Returned image stream of cross-end photographing. | createPicture(buffer: ArrayBuffer): void {
let imageSource = image.createImageSource(buffer);
imageSource.createPixelMap().then((pixelMap) => {
this.crossEndPicture = pixelMap;
})
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left createPicture AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left buffer AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ArrayBuffer AST#identifier#Right AST#)#L... | createPicture(buffer: ArrayBuffer): void {
let imageSource = image.createImageSource(buffer);
imageSource.createPixelMap().then((pixelMap) => {
this.crossEndPicture = pixelMap;
})
} | https://gitee.com/harmonyos/codelabs.git | 952cbc1f946aa20d316ed4e0233cd3683e478732 | gitee |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/RDPInputHandler.ets | arkts | getState | 获取当前键盘状态 | getState() {
return {
isVisible: this.isVisible,
currentLayout: this.currentLayout
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#return_statement#Left AST#re... | getState() {
return {
isVisible: this.isVisible,
currentLayout: this.currentLayout
}
} | https://github.com/AetheriumSimulator/qemu-hmos | 282c277c8d4609f873e195e2be1faf4ccdab9943 | github |
HarmonyOS_Samples/MusicHome | common/musicbasic/src/main/ets/util/WindowUtil.ets | arkts | setFullScreen | Toggles layout full-screen and updates {@link WindowInfo.isFullScreen} on success.
@param isFullScreen Whether the window should use layout full-screen. | setFullScreen(isFullScreen: boolean): void {
try {
this.mainWindow!.setWindowLayoutFullScreen(isFullScreen)
.then(() => {
Logger.info(`Succeeded in setting full-screen mode.`);
this.mainWindowInfo.isFullScreen = isFullScreen;
})
.catch((err: BusinessError) => {
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setFullScreen AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left isFullScreen AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#)#Left ... | setFullScreen(isFullScreen: boolean): void {
try {
this.mainWindow!.setWindowLayoutFullScreen(isFullScreen)
.then(() => {
Logger.info(`Succeeded in setting full-screen mode.`);
this.mainWindowInfo.isFullScreen = isFullScreen;
})
.catch((err: BusinessError) => {
... | https://gitcode.com/HarmonyOS_Samples/MusicHome | ae3bb61aa3e12c610bf5c1be572736a1d674f97c | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/DataView.ets | arkts | getInt16 | Read bytes as they represent given type
@param { int } byteOffset zero index to read
@param { boolean } [ littleEndian ] read as little or big endian
@returns { int }
@throws { RangeError } - Input parameter error.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public getInt16(byteOffset: int, littleEndian?: boolean): int {
if (littleEndian !== undefined && littleEndian.valueOf() == true) {
return this.getInt16Little(byteOffset)
} else {
return this.getInt16Big(byteOffset)
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getInt16 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left byteOffset AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifie... | public getInt16(byteOffset: int, littleEndian?: boolean): int {
if (littleEndian !== undefined && littleEndian.valueOf() == true) {
return this.getInt16Little(byteOffset)
} else {
return this.getInt16Big(byteOffset)
}
} | https://gitcode.com/iop123123/arkts-static-skills | 2998cb1e09ee1c1c34987d84c80a75141a8d1da2 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/ArrayAsListInt.ets | arkts | set | Sets an element at the specified index
@param index element position
@param e new value | public override set(index: int, e: Int): void {
this.data[index] = e;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left override AST#identifier#Right AST#set#Left set AST#set#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left index AST#identifier#Right AST#ERROR#Le... | public override set(index: int, e: Int): void {
this.data[index] = e;
} | https://gitcode.com/iop123123/arkts-static-skills | a7fb15819e8e621ed901a146e4e4d413ba3d0d48 | gitcode |
openharmony-sig/ohos_banner | library/src/main/ets/indicator/CircleIndicator.ets | arkts | calculateCompWH | 计算组件宽高 | calculateCompWH() {
let mNormalRadius = this.indicatorConfig.getNormalWidth();
let mSelectedRadius = this.indicatorConfig.getSelectedWidth();
//考虑当 选中和默认 的大小不一样的情况
let calculateHeight = Math.max(mSelectedRadius, mNormalRadius);
//间距*(总数-1)+选中宽度+默认宽度*(总数-1)
let width = this.indicatorConfig.getI... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left calculateCompWH 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#Le... | calculateCompWH() {
let mNormalRadius = this.indicatorConfig.getNormalWidth();
let mSelectedRadius = this.indicatorConfig.getSelectedWidth();
//考虑当 选中和默认 的大小不一样的情况
let calculateHeight = Math.max(mSelectedRadius, mNormalRadius);
//间距*(总数-1)+选中宽度+默认宽度*(总数-1)
let width = this.indicatorConfig.getI... | https://gitee.com/openharmony-sig/ohos_banner.git | 21d0f57ffd6642fcafb98d5bc1e5787feb266701 | gitee |
ibestservices/ibest-ui | library/src/main/ets/components/slider/index.ets | arkts | getScopeValue | 获取活动最大值 | getScopeValue(){
return this.max - this.min
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getScopeValue 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... | getScopeValue(){
return this.max - this.min
} | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/components/slider/index.ets#L203-L205 | c50b135ccf9a731575e1f3636f15e8ee447c7a32 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.stream.ets | arkts | setDefaultEncoding | Set the default encoding mode.
@param { string } [encoding] - Encoding type. Default: utf-8.
@returns { boolean } Setting successful returns true, setting failed returns false. | setDefaultEncoding(encoding?: string): boolean {
if (!encoding) {
return false;
}
const ret = this.setEncoding(encoding);
if (ret) {
this.defaultEncoding = encoding;
}
return ret;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setDefaultEncoding AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left encoding AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#... | setDefaultEncoding(encoding?: string): boolean {
if (!encoding) {
return false;
}
const ret = this.setEncoding(encoding);
if (ret) {
this.defaultEncoding = encoding;
}
return ret;
} | https://gitcode.com/iop123123/arkts-static-skills | c5e4d0fd8ec4ab47adeafa1e5ac6d98322863293 | gitcode |
openharmony/codelabs | Data/PersonalAssistantPro/entry/src/main/ets/debug/DebugRunner.ets | arkts | createCase | 你想测别的就改成 DebugTarget.CONTACT_DATABASE 等 | function createCase(target: DebugTarget): DebugCase | null {
switch (target) {
case DebugTarget.EXAMPLE:
return new ExampleDebugCase();
case DebugTarget.CONTACT_DATABASE:
return new ContactDatabaseCase();
case DebugTarget.ENCRYPTION_PRIVACY:
return new EncryptionPrivacyCase();
case D... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left createCase AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left target AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Rig... | function createCase(target: DebugTarget): DebugCase | null {
switch (target) {
case DebugTarget.EXAMPLE:
return new ExampleDebugCase();
case DebugTarget.CONTACT_DATABASE:
return new ContactDatabaseCase();
case DebugTarget.ENCRYPTION_PRIVACY:
return new EncryptionPrivacyCase();
case D... | https://gitcode.com/openharmony/codelabs | 9029825bc9b66bd0d09c97b1ce8f64d081b3a392 | gitcode |
Nekofox-POT/LinMusic | entry/src/main/ets/package/files_manager/class_files_manager.ets | arkts | get_dir | 文件夹查询访问 // | get_dir(path: string = ''): string[][] {return this.download_manager!.get_dir(path)} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#non_null_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left get_dir AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#ide... | get_dir(path: string = ''): string[][] {return this.download_manager!.get_dir(path)} | https://github.com/Nekofox-POT/LinMusic | ad6567af24f6467648bb19a4f54f6ae0ff992262 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets | arkts | setUTCMinutes | Sets the minutes for a specified date according to universal time.
@param { int } value new minutes
@param { int } sec
@returns { long } get new date value
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public setUTCMinutes(value: int, sec: int): long {
this.setUTCMinutes(value);
this.setUTCSeconds(sec);
return this.ms;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setUTCMinutes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifie... | public setUTCMinutes(value: int, sec: int): long {
this.setUTCMinutes(value);
this.setUTCSeconds(sec);
return this.ms;
} | https://gitcode.com/iop123123/arkts-static-skills | a1fc75d1636059da19dc33bc127137d56e5b623c | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Source/AuthenticationHandler.ets | arkts | extractByPath | 通过路径提取值 | private extractByPath(obj: ESObject, path: string): string | null {
try {
const parts = path.split('.');
let current: ESObject = obj;
for (const part of parts) {
if (current && typeof current === 'object' && part in current) {
current = current[part] as ESObject;
} els... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left extractByPath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | private extractByPath(obj: ESObject, path: string): string | null {
try {
const parts = path.split('.');
let current: ESObject = obj;
for (const part of parts) {
if (current && typeof current === 'object' && part in current) {
current = current[part] as ESObject;
} els... | https://github.com/DaLongZhuaZi/manxia | f5288577ed42dec13fd44bea44d24f66547ba907 | github |
openharmony-sig/applications_clock | feature/alarmclock/src/main/ets/manager/AlarmServiceManager.ets | arkts | cancelSnoozeInput | Cancel the snooze input listening. | cancelSnoozeInput(): void {
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left cancelSnoozeInput AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expressi... | cancelSnoozeInput(): void {
} | https://gitee.com/openharmony-sig/applications_clock.git | 08bebd18d440d6bf692bc169ffcbb3312ce72cce | gitee |
RedRackham-R/WanAndroidHarmoney | entry/src/main/ets/global/viewmodel/GlobalUserViewModel.ets | arkts | updateUserInfo | 更新用户信息,并保存到数据库
@param userinfo | private async updateUserInfo(userinfo?: IUserInfo) {
await lock.acquire();
try {
this.userInfo = userinfo;
if (userinfo != null) {
globalVM_WanDB.updateUserInfo(userinfo.userInfo.id, JSON.stringify(userinfo));
}
} finally {
lock.release();
}
} | 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 updateUserInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userinfo AST#identifier#Right AST#?#Le... | private async updateUserInfo(userinfo?: IUserInfo) {
await lock.acquire();
try {
this.userInfo = userinfo;
if (userinfo != null) {
globalVM_WanDB.updateUserInfo(userinfo.userInfo.id, JSON.stringify(userinfo));
}
} finally {
lock.release();
}
} | https://github.com/RedRackham-R/WanAndroidHarmoney | f88e67d821970c2b362242d5955785da24540dc8 | github |
Tencent-RTC/TUIKit_Harmony | call/src/main/ets/TUICallKit.ets | arkts | formatError | Render an exception thrown by the atomicxcore engine into a single readable
line. `Logger.error('...', e)` on a JSON-serialised `ErrorInfo` only shows
`{"code":...,"name":"ErrorInfo"}` because Error.message is non-enumerable
(skipped by JSON.stringify). | function formatError(e: object | Error | ErrorInfo | null | undefined): string {
if (!e) {
return 'unknown error';
}
if (e instanceof Error) {
const code = (e as ErrorInfo).code;
const codeStr = (code !== undefined && code !== null) ? `code=${code}, ` : '';
return `${codeStr}message=${e.message}`;... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left formatError AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left e AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right A... | function formatError(e: object | Error | ErrorInfo | null | undefined): string {
if (!e) {
return 'unknown error';
}
if (e instanceof Error) {
const code = (e as ErrorInfo).code;
const codeStr = (code !== undefined && code !== null) ? `code=${code}, ` : '';
return `${codeStr}message=${e.message}`;... | https://github.com/Tencent-RTC/TUIKit_Harmony | d21f2dca69c833d6843a59918138b2141776dbf2 | github |
openharmony-sig/knowledge_demo_entainment | FA/BombGame/entry/src/main/ets/MainAbility/pages/RemoteDeviceManager.ets | arkts | constructor | 构造函数,传入@State 或者 @Provide 装饰的设备列表数据
不能对deviceList进行重新赋值,否则将不能动态更新视图 | constructor(deviceList: RemoteDevice[]) {
this.deviceList = deviceList
// 使用相同的Id,若之前没有正常停止会导致第二次不能正常发现设备
this.subscribeId = Math.floor(65536 * Math.random());
} | 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 deviceList AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifie... | constructor(deviceList: RemoteDevice[]) {
this.deviceList = deviceList
// 使用相同的Id,若之前没有正常停止会导致第二次不能正常发现设备
this.subscribeId = Math.floor(65536 * Math.random());
} | https://gitee.com/openharmony-sig/knowledge_demo_entainment.git | 25d90d5e7c17d014c55e2aa9f33c312ebf032d29 | gitee |
openharmony-tpc/XmlGraphicsBatik | library/src/main/ets/batik/SVGManager.ets | arkts | _isFolderExisted | 判断文件夹是否存在
@param 文件夹绝对路径 | public _isFolderExisted(path: string): boolean{
try {
let stat = fileio.statSync(path)
return stat.isDirectory()
} catch (e) {
consoleInfo('SVGManager existFolder', e.message);
return false
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left _isFolderExisted AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | public _isFolderExisted(path: string): boolean{
try {
let stat = fileio.statSync(path)
return stat.isDirectory()
} catch (e) {
consoleInfo('SVGManager existFolder', e.message);
return false
}
} | https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git | 7f01df74026582f1fb3ee1d49a504c1606f7f827 | gitee |
AlkaidLab/moonlight-harmony | entry/src/main/ets/utils/CryptoUtil.ets | arkts | generateSelfSignedCert | 生成自签名 X.509 证书
由于 HarmonyOS 没有直接的 X.509 API,我们手动构造 DER 格式
证书结构参考 RFC 5280 | static async generateSelfSignedCert(keyPair: cryptoFramework.KeyPair): Promise<Uint8Array> {
const pubKeyDer = await CryptoUtil.exportPublicKeyDer(keyPair.pubKey);
// 构造简化的 X.509 v3 证书
// 这是一个最小化的证书结构,包含:版本、序列号、签名算法、颁发者、有效期、主题、公钥、签名
// 序列号(随机 8 字节)
const serialNumber = CryptoUtil.generateRandomB... | 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 generateSelfSignedCert AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left keyPair AST#identifier#Right AST#... | static async generateSelfSignedCert(keyPair: cryptoFramework.KeyPair): Promise<Uint8Array> {
const pubKeyDer = await CryptoUtil.exportPublicKeyDer(keyPair.pubKey);
// 构造简化的 X.509 v3 证书
// 这是一个最小化的证书结构,包含:版本、序列号、签名算法、颁发者、有效期、主题、公钥、签名
// 序列号(随机 8 字节)
const serialNumber = CryptoUtil.generateRandomB... | https://github.com/AlkaidLab/moonlight-harmony | a95375a1412ef40ac5f5c1e40769b12ec8e2e5b0 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/TagDAO.ets | arkts | bulkInsert | 批量插入标签 - 使用 DAOHelper 统一事务处理
@param tags 标签数组 | static async bulkInsert(tags: Tag[]): Promise<void> {
if (tags.length === 0) {
return;
}
await DAOHelper.transaction(async () => {
const now = new Date().toISOString();
const store = DatabaseManager.getDatabase();
const sql = `
INSERT INTO tags
(user_id, name... | 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 bulkInsert AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left tags AST#identifier#Right AST#:#Left : AST#:#... | static async bulkInsert(tags: Tag[]): Promise<void> {
if (tags.length === 0) {
return;
}
await DAOHelper.transaction(async () => {
const now = new Date().toISOString();
const store = DatabaseManager.getDatabase();
const sql = `
INSERT INTO tags
(user_id, name... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 93af697f32f1ea991cade16840689a4f610e687b | github |
SMAT-Lab/Homecheck-Sec2026 | test/unittest/sample/ExplicitMemberAccessibility/ets/default.ets | arkts | name | No accessibility modifier | get name(): string {
// No accessibility modifier
return this.animalNames;
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left name 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#ER... | get name(): string {
// No accessibility modifier
return this.animalNames;
} | https://github.com/SMAT-Lab/Homecheck-Sec2026 | 77f39af4f2cfc5b09afae758d11917422bc41252 | github |
arkui-x/samples | CodeLab/Cases/common/routermodule/src/main/ets/router/DynamicsRouter.ets | arkts | pushRouterStack | 存储引用信息 | private static pushRouterStack(routerInfo: AppRouterInfo) {
DynamicsRouter.appRouterStack.push(routerInfo);
const referrerModel: AppRouterInfo = DynamicsRouter.appRouterStack[DynamicsRouter.appRouterStack.length-2];
DynamicsRouter.referrer[0] = referrerModel.pageModule;
DynamicsRouter.referrer[1] = re... | 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 pushRouterStack AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left routerInfo AST#identifier#Right AST#... | private static pushRouterStack(routerInfo: AppRouterInfo) {
DynamicsRouter.appRouterStack.push(routerInfo);
const referrerModel: AppRouterInfo = DynamicsRouter.appRouterStack[DynamicsRouter.appRouterStack.length-2];
DynamicsRouter.referrer[0] = referrerModel.pageModule;
DynamicsRouter.referrer[1] = re... | https://gitcode.com/arkui-x/samples | c58af6bced66212f5fa295d43d79bcd4f9732a05 | gitcode |
RedRackham-R/WanAndroidHarmoney | entry/src/main/ets/global/viewmodel/GlobalSettingViewModel.ets | arkts | subscribeAvatarChangeEvent | 注册头像更换通知事件
@param key
@param callback | subscribeAvatarChangeEvent(key: string, callback: (eventData: emitter.EventData) => void) {
EventBus.getInstance().regist(WanEventId.EVENT_AVATAR_CHANGE, key, callback)
} | AST#program#Left AST#ERROR#Left AST#identifier#Left subscribeAvatarChangeEvent AST#identifier#Right AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Right AST#call_expression#L... | subscribeAvatarChangeEvent(key: string, callback: (eventData: emitter.EventData) => void) {
EventBus.getInstance().regist(WanEventId.EVENT_AVATAR_CHANGE, key, callback)
} | https://github.com/RedRackham-R/WanAndroidHarmoney | eb1160c585687ce6d19ef6f01b2942e1503db942 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/MangaSourceEngine.ets | arkts | parseStructuredScriptResult | 解析脚本返回的数据,兼容普通 JSON 与双重字符串化 JSON | private parseStructuredScriptResult(scriptData: string): string | Object | undefined {
const trimmedData = scriptData.trim();
if (!trimmedData) {
logger.debug(TAG, 'script返回空字符串,跳过JSON解析');
return undefined;
}
const looksLikeJsonObject = trimmedData.startsWith('{') && trimmedData.endsWith... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseStructuredScriptResult AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left scriptData AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left... | private parseStructuredScriptResult(scriptData: string): string | Object | undefined {
const trimmedData = scriptData.trim();
if (!trimmedData) {
logger.debug(TAG, 'script返回空字符串,跳过JSON解析');
return undefined;
}
const looksLikeJsonObject = trimmedData.startsWith('{') && trimmedData.endsWith... | https://github.com/DaLongZhuaZi/manxia | 7115451fbe352fb425fed0131010e3abef22163f | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Either.ets | arkts | isRight | Checks if Either is Right
@returns { boolean } If Either is Right
@syscap SystemCapability.Utils.Lang
@final
@FaAndStageModel | public final isRight(): boolean {
return !this.isLeft()
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left final AST#identifier#Right AST#call_expression#Left AST#identifier#Left isRight AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left :... | public final isRight(): boolean {
return !this.isLeft()
} | https://gitcode.com/iop123123/arkts-static-skills | 6a13dc85a12f78363de059bc0c81dd7b03bbb067 | gitcode |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.List.ets | arkts | getLast | Gets the last element of the list.
@returns The last element of the list.
@throws Error if the list is empty. | public getLast(): T {
return this.buffer.getLast();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getLast AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifi... | public getLast(): T {
return this.buffer.getLast();
} | https://gitcode.com/iop123123/arkts-static-skills | afef3c2f8910ee6d49bb8234a214bff9d731d036 | gitcode |
FinalScave/SweetEditor | platform/OHOS/sweeteditor/src/main/ets/SweetEditor.ets | arkts | applyTextEdits | Applies multiple text edits as one undoable operation.
Edits use the original document coordinates. The first edit is the primary edit. | applyTextEdits(edits: TextEdit[]): void {
if (!this.editorCore) {
return;
}
const result = this.editorCore.applyTextEdits(edits);
this.resetCursorBlink();
this.dispatchEditorActionResult(result);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left applyTextEdits AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left edits AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left TextEdit A... | applyTextEdits(edits: TextEdit[]): void {
if (!this.editorCore) {
return;
}
const result = this.editorCore.applyTextEdits(edits);
this.resetCursorBlink();
this.dispatchEditorActionResult(result);
} | https://github.com/FinalScave/SweetEditor | 22d9ba17444ec30c212309f3d768c464ce3536b1 | github |
openharmony/applications_app_samples | code/BasicFeature/Connectivity/StageSocket/entry/src/main/ets/controller/LoginController.ets | arkts | closeSocket | 关闭Socket | public closeSocket(): void {
this.mSocket?.closeSocket();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left closeSocket 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... | public closeSocket(): void {
this.mSocket?.closeSocket();
} | https://github.com/openharmony/applications_app_samples | beffaf7f0572b99463d18fbec8a647d61009d73f | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/Atomics.ets | arkts | fetchAdd | Atomically adds the given value to the current value and returns the previous value.
This operation is performed as a single atomic action that cannot be interrupted by other threads.
@param { float } val - The value to add to the current atomic float value
@returns { float } The previous value before the addition was ... | public fetchAdd(val: float): float {
let current: float = this.load();
let expected: float = 0;
do {
expected = current;
current = this.compareAndSwap(expected, expected + val);
} while(current != expected)
return expected;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left fetchAdd AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left val AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left float AS... | public fetchAdd(val: float): float {
let current: float = this.load();
let expected: float = 0;
do {
expected = current;
current = this.compareAndSwap(expected, expected + val);
} while(current != expected)
return expected;
} | https://gitcode.com/iop123123/arkts-static-skills | 9ca426d0e67b4e98c3bc0011cd6d9c2dec3cd1b4 | gitcode |
HarmonyOS_Samples/BestPracticeSnippets | ScreenFlickerSolution/entry/src/main/ets/pages/TabsRight.ets | arkts | build | [Start tabs_right_build] | build() {
Stack({ alignContent: Alignment.TopStart }) {
Tabs({ barPosition: BarPosition.Start }) {
TabContent() {
Column()
.width('100%')
.height('100%')
.backgroundColor(Color.Green)
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, ... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Stack({ alignContent: Alignment.TopStart }) {
Tabs({ barPosition: BarPosition.Start }) {
TabContent() {
Column()
.width('100%')
.height('100%')
.backgroundColor(Color.Green)
.expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, ... | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 74716ddaaf93f0a1ae44a0237894fd8a0a0c8d75 | gitcode |
Kira-Yagami-Light/Kira-Projects | TodoTask/entry/src/main/ets/data/database/TaskDao.ets | arkts | update | 更新任务
@param id 任务 ID
@param valueBucket 要更新的数据
@returns Promise<number> 更新的行数 | async update(id: number, valueBucket: relationalStore.ValuesBucket): Promise<number> {
const store = this.dbHelper.getRdbStore();
if (!store) {
Logger.error(this.LOG_TAG, 'RdbStore is null');
throw new Error('Database not initialized');
}
try {
const predicates = new relationalStore... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left update AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left id AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Righ... | async update(id: number, valueBucket: relationalStore.ValuesBucket): Promise<number> {
const store = this.dbHelper.getRdbStore();
if (!store) {
Logger.error(this.LOG_TAG, 'RdbStore is null');
throw new Error('Database not initialized');
}
try {
const predicates = new relationalStore... | https://github.com/Kira-Yagami-Light/Kira-Projects | c0566646365716e91e079325050f6c47e8824683 | github |
HarmonyOS_Samples/BestPracticeSnippets | SegmentedPhotograph/entry/src/main/ets/views/ModeComponent.ets | arkts | onJumpClick | [End handle_save_picture] | onJumpClick(): void {
this.getUIContext().getRouter().pushUrl({ url: 'pages/EditPage' }, router.RouterMode.Single, (err) => {
if (err) {
Logger.error(TAG, `Invoke pushUrl failed, code is ${err.code}, message is ${err.message}`);
return;
}
this.isClick = false
Logger.info(TA... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onJumpClick AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#... | onJumpClick(): void {
this.getUIContext().getRouter().pushUrl({ url: 'pages/EditPage' }, router.RouterMode.Single, (err) => {
if (err) {
Logger.error(TAG, `Invoke pushUrl failed, code is ${err.code}, message is ${err.message}`);
return;
}
this.isClick = false
Logger.info(TA... | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 585f20ffa38d88057c2139f6913807bf227dc77c | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/ThemeManager.ets | arkts | toggleTheme | 切换主题(强制切换当前实际显示的主题)
如果当前实际显示浅色 -> 切换到深色
如果当前实际显示深色 -> 切换到浅色
注意:这会覆盖AUTO模式,强制使用固定主题 | public async toggleTheme(): Promise<void> {
// 获取当前实际显示的主题(考虑AUTO模式)
const actualTheme = this.getActualThemeSync();
let newTheme: ThemeType;
// 基于实际显示的主题进行切换
if (actualTheme === ThemeType.LIGHT) {
newTheme = ThemeType.DARK;
} else {
newTheme = ThemeType.LIGHT;
}
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 toggleTheme 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 toggleTheme(): Promise<void> {
// 获取当前实际显示的主题(考虑AUTO模式)
const actualTheme = this.getActualThemeSync();
let newTheme: ThemeType;
// 基于实际显示的主题进行切换
if (actualTheme === ThemeType.LIGHT) {
newTheme = ThemeType.DARK;
} else {
newTheme = ThemeType.LIGHT;
}
l... | https://github.com/DaLongZhuaZi/manxia | 15a28d5efaf315b96cf882953ad5746691660845 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Set.ets | arkts | has | Checks if a value is in the Set
@param v the value to find in the Set
@returns true if the value is in the Set | has(v: K): boolean {
return this.map.has(v);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left has AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left v AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left K AST#identifier#Right AST#)#Left ) AST#)#Right AST#arg... | has(v: K): boolean {
return this.map.has(v);
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 2d247e503ad314555c3b673f6fe88b1a63d3a418 | gitee |
NissonCX/CQU-HarmonyOS-APP-Dev-Final | entry/src/main/ets/utils/DataManager.ets | arkts | getInstance | 获取DataManager单例 | static getInstance(): DataManager {
if (!DataManager.instance) {
DataManager.instance = new DataManager();
}
return DataManager.instance;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left DataManage... | static getInstance(): DataManager {
if (!DataManager.instance) {
DataManager.instance = new DataManager();
}
return DataManager.instance;
} | https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final | 41cbefcc36813ab07d56b4475ffa44b036b31663 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.