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 |
|---|---|---|---|---|---|---|---|---|---|---|
HarmonyOS_Samples/BestPracticeSnippets | SegmentedPhotograph/entry/src/main/ets/mode/CameraService.ets | arkts | initCamera | [Start init_camera]
Initialize Camera Functions
@param surfaceId - Surface ID
@param cameraDeviceIndex - Camera Device Index
@returns No return value | async initCamera(surfaceId: string, cameraDeviceIndex: number): Promise<void> {
Logger.debug(TAG, `initCamera cameraDeviceIndex: ${cameraDeviceIndex}`);
this.photoMode = AppStorage.get('photoMode');
if (!this.photoMode) {
return;
}
try {
await this.releaseCamera();
// Get Camera ... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left initCamera AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left surfaceId AST#identifier#Right AST#type_annotation#Left AST... | async initCamera(surfaceId: string, cameraDeviceIndex: number): Promise<void> {
Logger.debug(TAG, `initCamera cameraDeviceIndex: ${cameraDeviceIndex}`);
this.photoMode = AppStorage.get('photoMode');
if (!this.photoMode) {
return;
}
try {
await this.releaseCamera();
// Get Camera ... | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | f35042db9ad89917a7f975684dca33ccc31b516b | gitcode |
OpenHarmonyPCDeveloper/GitNext | entry/src/main/ets/utils/DebounceSingletonUtil.ets | arkts | endOperation | 标记某操作结束(释放状态) | public endOperation(operationName: string): void{
DebounceSingletonUtil.operationsLock.set(operationName, false);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left endOperation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left operationName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#str... | public endOperation(operationName: string): void{
DebounceSingletonUtil.operationsLock.set(operationName, false);
} | https://gitcode.com/OpenHarmonyPCDeveloper/GitNext | cb3114c3d086b415d9c7f90b77cbafec704d1d35 | gitcode |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/services/ExtensionLoader.ets | arkts | validatePublicKeyForAuthorizedKeys | 校验 authorized_keys 公钥行安全性 | validatePublicKeyForAuthorizedKeys(publicKeyOpenSsh: string): boolean {
try {
return rdpnapi.validatePublicKeyForAuthorizedKeys(publicKeyOpenSsh) as boolean;
} catch (err) {
hilog.error(DOMAIN, TAG, '[ExtensionLoader] validatePublicKeyForAuthorizedKeys: ' + JSON.stringify(err));
return false... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left validatePublicKeyForAuthorizedKeys AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left publicKeyOpenSsh AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#E... | validatePublicKeyForAuthorizedKeys(publicKeyOpenSsh: string): boolean {
try {
return rdpnapi.validatePublicKeyForAuthorizedKeys(publicKeyOpenSsh) as boolean;
} catch (err) {
hilog.error(DOMAIN, TAG, '[ExtensionLoader] validatePublicKeyForAuthorizedKeys: ' + JSON.stringify(err));
return false... | https://github.com/Mydstiny/RemoteDeskHarmonyOS | cb2bb80918232eb66048f29b1ae1f4bcb569e7fb | github |
richshaw2015/nds | ohos/entry/src/main/ets/utils/PersistedUriManager.ets | arkts | getDisplayName | 获取显示名称 | private getDisplayName(uri: string, path: string): string {
const parts = path.split('/').filter(p => p.length > 0);
if (parts.length > 0) {
return parts[parts.length - 1];
}
return uri;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getDisplayName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left uri AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | private getDisplayName(uri: string, path: string): string {
const parts = path.split('/').filter(p => p.length > 0);
if (parts.length > 0) {
return parts[parts.length - 1];
}
return uri;
} | https://github.com/richshaw2015/nds | 7fbacea44e1c0024e134017dcc236cef5b437bc4 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/NovelSourceManagementPage.ets | arkts | showImportOptions | 显示导入选项弹窗 | showImportOptions(): void {
this.showImportEntryDialog = true;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left showImportOptions 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_... | showImportOptions(): void {
this.showImportEntryDialog = true;
} | https://github.com/DaLongZhuaZi/manxia | 2f0ed3312c74a3800610c517f61537eb5722129e | github |
TDCQCX/ShiHuaMusic-Harmony | entry/src/main/ets/utils/StyleUtil.ets | arkts | getButtonStyle | 获取按钮样式 | static getButtonStyle(variant: 'primary' | 'secondary' | 'outlined' | 'text' = 'primary') {
const theme = ThemeUtil.getCurrentThemeConfig();
const spacing = theme.spacing;
const borderRadius = theme.borderRadius;
const fontSize = theme.fontSize;
let backgroundColor: string;
let color: str... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getButtonStyle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left variant AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_exp... | static getButtonStyle(variant: 'primary' | 'secondary' | 'outlined' | 'text' = 'primary') {
const theme = ThemeUtil.getCurrentThemeConfig();
const spacing = theme.spacing;
const borderRadius = theme.borderRadius;
const fontSize = theme.fontSize;
let backgroundColor: string;
let color: str... | https://github.com/TDCQCX/ShiHuaMusic-Harmony | 06caf9fc8f2545af2a2e73283ff2fbb89a0168ed | github |
ASweetBite/HarmonyPulse | entry/src/main/ets/utils/managers/LyricManager.ets | arkts | getOrCreateLyricPath | 创建并获取歌词路径 (改为实例方法) | getOrCreateLyricPath(songId: string): string {
const lyricPath = `${this.getBaseDir()}/${songId}.lrc`;
if (!fs.accessSync(lyricPath)) {
const file = fs.openSync(lyricPath, fs.OpenMode.CREATE | fs.OpenMode.READ_WRITE);
const initContent = `暂无歌词`;
fs.writeSync(file.fd, initContent);
fs.c... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getOrCreateLyricPath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left songId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)... | getOrCreateLyricPath(songId: string): string {
const lyricPath = `${this.getBaseDir()}/${songId}.lrc`;
if (!fs.accessSync(lyricPath)) {
const file = fs.openSync(lyricPath, fs.OpenMode.CREATE | fs.OpenMode.READ_WRITE);
const initContent = `暂无歌词`;
fs.writeSync(file.fd, initContent);
fs.c... | https://github.com/ASweetBite/HarmonyPulse/blob/a7fcf153a20bafa29ac1fb8c25743dd5350dc54c/entry/src/main/ets/utils/managers/LyricManager.ets#L71-L80 | c4370d50210c21afa3656ddd8b00842f7a1c097d | github |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/common/constants/ApiConstants.ets | arkts | postAction | 单个帖子动作(用于取消点赞等) | static postAction(postId: number, postActionTypeId: number): string {
return `/post_actions/${postId}.json?post_action_type_id=${postActionTypeId}`;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left postAction AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left postId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left num... | static postAction(postId: number, postActionTypeId: number): string {
return `/post_actions/${postId}.json?post_action_type_id=${postActionTypeId}`;
} | https://github.com/Amaz1ny/HarmonyDO-public | ce0d2b7348b2985386a24f3371bb7858010826f2 | github |
encorexin/WordPressCMS | harmonyos/entry/src/main/ets/services/http/WordPressApi.ets | arkts | extractErrorMessage | 从响应体提取错误信息 | private static extractErrorMessage(responseData: string, code: number): string {
try {
const parsed = JSON.parse(responseData) as WPErrorPayload
if (typeof parsed.message === 'string' && parsed.message.length > 0) {
return parsed.message
}
} catch (parseErr) {
Logger.debug('Wor... | 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 extractErrorMessage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left responseData AST#identifier#Right AST#ERROR#Lef... | private static extractErrorMessage(responseData: string, code: number): string {
try {
const parsed = JSON.parse(responseData) as WPErrorPayload
if (typeof parsed.message === 'string' && parsed.message.length > 0) {
return parsed.message
}
} catch (parseErr) {
Logger.debug('Wor... | https://github.com/encorexin/WordPressCMS | 668ba897343d129f12684c27c3cbd2e86e16fa34 | github |
AGenUI/AGenUI | playground/harmony/entry/src/main/ets/components/CustomChartComponent.ets | arkts | buildBarChart | ─────────────────────────────────────────────
Bar chart
───────────────────────────────────────────── | private buildBarChart(data: NewBarData): void {
const model: BarChartModel = new BarChartModel();
const description: Description = new Description();
description.setEnabled(false);
model.setDescription(description);
const seriesCount: number = data.series.length;
const groupCount: number = d... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildBarChart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | private buildBarChart(data: NewBarData): void {
const model: BarChartModel = new BarChartModel();
const description: Description = new Description();
description.setEnabled(false);
model.setDescription(description);
const seriesCount: number = data.series.length;
const groupCount: number = d... | https://github.com/AGenUI/AGenUI | 4c45e0e9adf5782ba9d5a6537c7455869e3a9de1 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/EnhancedBackupManager.ets | arkts | exportFavorites | 导出收藏信息 | private async exportFavorites(): Promise<FavoriteBackup[]> {
try {
const sql = `
SELECT
id, comicId, userId, folderName, addTime,
lastReadChapterId, lastReadPageNumber, lastReadTime, readProgress
FROM favorite
`;
const results = await this.dbManager.querySql(s... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left exportFavorites AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A... | private async exportFavorites(): Promise<FavoriteBackup[]> {
try {
const sql = `
SELECT
id, comicId, userId, folderName, addTime,
lastReadChapterId, lastReadPageNumber, lastReadTime, readProgress
FROM favorite
`;
const results = await this.dbManager.querySql(s... | https://github.com/DaLongZhuaZi/manxia | 477358cd9d447c74859dc5415f359a0c927f54bb | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Math.ets | arkts | max | Largest value of `u` and `v`
@param u arbitrary number (of type `Int`)
@param v arbitrary number (of type `Int`)
@returns Largest value of `u` and `v` | public static max(): double {
return -Infinity;
} | 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 max AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AS... | public static max(): double {
return -Infinity;
} | https://gitcode.com/iop123123/arkts-static-skills | 40d6f87f66f9258fe735113863afe02f1cd35c12 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/MetadataXmlGenerator.ets | arkts | generateEBookMetadataXml | 生成电子书元数据XML | static generateEBookMetadataXml(metadata: EBookMetadata): string {
const lines: string[] = [];
lines.push('<?xml version="1.0" encoding="UTF-8"?>');
lines.push('<EBookInfo>');
lines.push(` <Id>${MetadataXmlGenerator.escapeXml(metadata.id)}</Id>`);
lines.push(` <Title>${MetadataXmlGenerator.... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left generateEBookMetadataXml AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left metadata AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ide... | static generateEBookMetadataXml(metadata: EBookMetadata): string {
const lines: string[] = [];
lines.push('<?xml version="1.0" encoding="UTF-8"?>');
lines.push('<EBookInfo>');
lines.push(` <Id>${MetadataXmlGenerator.escapeXml(metadata.id)}</Id>`);
lines.push(` <Title>${MetadataXmlGenerator.... | https://github.com/DaLongZhuaZi/manxia | e1e78d6a6139547379121dc5156c97530c639d9e | github |
Countly/countly-sdk-hos | library/src/ohosTest/ets/test/Consent.test.ets | arkts | <arrow> | RemoteConfigApi | async (): Promise<void> => { await h.instance.remoteConfig.downloadAllKeys(null); }, | AST#program#Left AST#ERROR#Left AST#arrow_function#Left AST#async#Left async AST#async#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_type#Left AST#type_identifier#Left Promise AST#type_identifi... | async (): Promise<void> => { await h.instance.remoteConfig.downloadAllKeys(null); }, | https://github.com/Countly/countly-sdk-hos | 92a8f2ade37173a2117de7cea059e3004748f916 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Scraper/GoogleBooksScraper.ets | arkts | search | 通用搜索方法
自动检测ISBN格式,否则进行全文搜索 | public async search(keyword: string, limit: number = 20): Promise<ScraperSearchResult> {
// 检查是否是ISBN格式
const isbnPattern = /^[\d\-X]{10,17}$/i;
const cleanKeyword = keyword.replace(/[\s\-]/g, '');
if (isbnPattern.test(cleanKeyword) && (cleanKeyword.length === 10 || cleanKeyword.length === 13)) {... | 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 search AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left keyword AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#R... | public async search(keyword: string, limit: number = 20): Promise<ScraperSearchResult> {
// 检查是否是ISBN格式
const isbnPattern = /^[\d\-X]{10,17}$/i;
const cleanKeyword = keyword.replace(/[\s\-]/g, '');
if (isbnPattern.test(cleanKeyword) && (cleanKeyword.length === 10 || cleanKeyword.length === 13)) {... | https://github.com/DaLongZhuaZi/manxia | 526d2c9fd3f58ac2bc873654f9e6aed46af6cd97 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/PaginationHandler.ets | arkts | getStatistics | 获取分页统计信息 | getStatistics(sourceId: string): string {
const state = this.paginationStates.get(sourceId);
if (!state) {
return '无分页状态';
}
return `Page: ${state.currentPage}, Offset: ${state.currentOffset}, Cursor: ${state.currentCursor || 'null'}, HasMore: ${state.hasMore}`;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getStatistics AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST#)... | getStatistics(sourceId: string): string {
const state = this.paginationStates.get(sourceId);
if (!state) {
return '无分页状态';
}
return `Page: ${state.currentPage}, Offset: ${state.currentOffset}, Cursor: ${state.currentCursor || 'null'}, HasMore: ${state.hasMore}`;
} | https://github.com/DaLongZhuaZi/manxia | 1af0f5d4157eb0d8a823c0bd38d92284657573a8 | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/FirmwareManager.ets | arkts | ensureUefiVars | 确保 UEFI VARS 固件存在(aarch64 推荐)
仅用于补齐变量盘,不改变 ensureUefi() 的返回值语义 | private static async ensureUefiVars(ctx: common.UIAbilityContext, varsTargetPath: string): Promise<void> {
try {
// 已存在则跳过
try {
await fs.access(varsTargetPath)
const st = await fs.stat(varsTargetPath)
if (st.size > 1024) {
hilog.info(0x0000, 'FIRMWARE', 'VARS 已存在且有效,... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left ensureUefiVars AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ... | private static async ensureUefiVars(ctx: common.UIAbilityContext, varsTargetPath: string): Promise<void> {
try {
// 已存在则跳过
try {
await fs.access(varsTargetPath)
const st = await fs.stat(varsTargetPath)
if (st.size > 1024) {
hilog.info(0x0000, 'FIRMWARE', 'VARS 已存在且有效,... | https://github.com/AetheriumSimulator/qemu-hmos | 7c35e42a282cbb1846f7bb165c974d9215e300cd | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Short.ets | arkts | toInt | Returns value of this instance
@returns { int } value as int
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public override toInt(): int {
return Short.toInt(this.value);
} | 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#identifier#Left toInt AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Righ... | public override toInt(): int {
return Short.toInt(this.value);
} | https://gitcode.com/iop123123/arkts-static-skills | b37b5c1fd25b9e6858ec2bab1979fe8767f6ddab | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/ArrayBuffer.ets | arkts | sliceInternal | TODO(egor-porsev): should be slice(int, int) without an extra 'sliceInternal' method. This is a workaround for #13402
abstract | /* abstract */ sliceInternal(begin: int, end: int): Buffer { throw new Error("abstract"); } | AST#program#Left AST#comment#Left /* abstract */ AST#comment#Right AST#ERROR#Left AST#call_expression#Left AST#identifier#Left sliceInternal AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left begin AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST... | /* abstract */ sliceInternal(begin: int, end: int): Buffer { throw new Error("abstract"); } | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | c93241cf3ec8188cd671d9fbe4b31e53fcbc6f7b | gitee |
HarmonyOS_Samples/BestPracticeSnippets | AppAspectProgrammingDesign/entry/src/main/ets/pages/Index1.ets | arkts | bar | [LOG]: "countFoo = ", 2 | function bar(a: Test) {
a.foo();
console.log('countFoo = ', countFoo);
new Test().foo();
console.log('countFoo = ', countFoo);
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left bar AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left a AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#type_... | function bar(a: Test) {
a.foo();
console.log('countFoo = ', countFoo);
new Test().foo();
console.log('countFoo = ', countFoo);
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 3b80bd0b64c65b2e26bc86d3cb8688216dc80d0d | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | constructor | Creates a copy of Float64Array.
@param other data initializer | public constructor(other: Float64Array) {
this.buffer = other.buffer.sliceInternal(0, other.byteLength)
this.byteLength = other.byteLength
this.length = other.length
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left other AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Flo... | public constructor(other: Float64Array) {
this.buffer = other.buffer.sliceInternal(0, other.byteLength)
this.byteLength = other.byteLength
this.length = other.length
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | fec0c8110ea3bbdef5a046ebd6b2407ec89d4d51 | gitee |
openharmony-tpc/openharmony_tpc_samples | SmartRefreshLayout/library/src/main/ets/components/topRefresh/SmartRefresh.ets | arkts | touchEventFunction | touch事件 | touchEventFunction(event: TouchEvent) {
switch (event.type) {
case TouchType.Down: // 手指按下
this.headerHeight = 0
this.model.headerHeight = 0
this.model.initScrollerYOffset = this.model.scroller.currentOffset().yOffset
// 记录按下的y坐标
this.model.downY = event.touches[0].y
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left touchEventFunction AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left TouchEvent AST#identi... | touchEventFunction(event: TouchEvent) {
switch (event.type) {
case TouchType.Down: // 手指按下
this.headerHeight = 0
this.model.headerHeight = 0
this.model.initScrollerYOffset = this.model.scroller.currentOffset().yOffset
// 记录按下的y坐标
this.model.downY = event.touches[0].y
... | https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git | 40b364d442c0b49cb1db3b6a2798b708c0042bcf | gitee |
CLMC2025/Vignette | entry/src/main/ets/utils/SecureStorage.ets | arkts | getApiKey | Get API key from secure storage | async getApiKey(): Promise<string> {
console.log('[SecureStorage] getApiKey: Attempting to get API key');
if (!await this.ensureInitialized()) {
console.error('[SecureStorage] getApiKey: Failed to initialize storage');
return '';
}
try {
if (!this.preferences) {
console... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getApiKey AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#g... | async getApiKey(): Promise<string> {
console.log('[SecureStorage] getApiKey: Attempting to get API key');
if (!await this.ensureInitialized()) {
console.error('[SecureStorage] getApiKey: Failed to initialize storage');
return '';
}
try {
if (!this.preferences) {
console... | https://github.com/CLMC2025/Vignette | eb7c7ee2d3d12ed45388ec173756ae9cdaa822ef | github |
youlookwhat/HarmoryOS-learning | HarmonyOSLearning/entry/src/main/ets/login/LoginPage.ets | arkts | getSpAccount | 获取账号名,密码 | getSpAccount(context: Context) {
PreferencesUtil.instance().get(context, "account", (value: string) => {
this.account = value
})
PreferencesUtil.instance().get(context, "password", (value: string) => {
this.password = value
})
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getSpAccount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Context AST#identifier#Ri... | getSpAccount(context: Context) {
PreferencesUtil.instance().get(context, "account", (value: string) => {
this.account = value
})
PreferencesUtil.instance().get(context, "password", (value: string) => {
this.password = value
})
} | https://github.com/youlookwhat/HarmoryOS-learning | 8a1644d85612bf32c6e8582a746dc30d5f89d29a | github |
itrainhub/wu-ui | WuUI/wu_ui/src/main/ets/components/swipecell/index.ets | arkts | handleActionUpdate | 处理拖动过程 | handleActionUpdate() {
if (this.offsetX < -1 * (this.leftWidth + this.rightWidth)) {
this.offsetX = -1 * (this.leftWidth + this.rightWidth)
} else if (this.offsetX > 0) {
this.offsetX = 0
}
this.matrix = matrix4.identity().translate({
x: this.offsetX,
y: 0,
}).copy()
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left handleActionUpdate 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... | handleActionUpdate() {
if (this.offsetX < -1 * (this.leftWidth + this.rightWidth)) {
this.offsetX = -1 * (this.leftWidth + this.rightWidth)
} else if (this.offsetX > 0) {
this.offsetX = 0
}
this.matrix = matrix4.identity().translate({
x: this.offsetX,
y: 0,
}).copy()
} | https://github.com/itrainhub/wu-ui | 0d080398c9af33b21768ee5074484b0198061625 | github |
openharmony/codelabs | ETSUI/LifeTrack/entry/src/main/ets/pages/ContactPage.ets | arkts | editContact | 编辑联系人 | editContact() {
if (!this.selectedContact) {
this.prompt.showToast({ message: '请先选择一个联系人' });
return;
}
console.log('编辑联系人:', this.selectedContact.name)
this.pathStack.replacePathByName("ContactEdit", this.selectedContact, false)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left editContact 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 A... | editContact() {
if (!this.selectedContact) {
this.prompt.showToast({ message: '请先选择一个联系人' });
return;
}
console.log('编辑联系人:', this.selectedContact.name)
this.pathStack.replacePathByName("ContactEdit", this.selectedContact, false)
} | https://gitcode.com/openharmony/codelabs | 107ea31646856c27eab573824c9376b8c82ba933 | gitcode |
who7708/harmonyos-codelabs | HmosWorld/commons/common/src/main/ets/service/repository/UserAccountRepository.ets | arkts | saveUserData | Save data to Preference
@param userAccount | saveUserData(userAccount: UserAccount): void {
this.userStore.addUserAccount(userAccount);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left saveUserData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userAccount AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left UserAccount AST#identifier#Right AST... | saveUserData(userAccount: UserAccount): void {
this.userStore.addUserAccount(userAccount);
} | https://github.com/who7708/harmonyos-codelabs | c307d2681ac964adaa9eb4e751397ad11bbe9523 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/components/MangaViewer.ets | arkts | onCurrentPageIndexChange | 当前页面索引变化时的回调(@Watch监听) | onCurrentPageIndexChange(): void {
if (this.suppressExternalIndex) {
logger.debug(TAG, `忽略外部索引更新: 外部=${this.currentPageIndex + 1}, 本地=${this.viewCurrentPageIndex + 1}`);
return;
}
// [修复] 在初始化期间忽略 @Watch 回调,防止错误的页面索引覆盖正确的初始值
// 问题:ArkUI 的 @Prop @Watch 机制在组件初始化后会触发 @Watch 回调,
// 但此... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onCurrentPageIndexChange 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#{#Left { AST#{#Righ... | onCurrentPageIndexChange(): void {
if (this.suppressExternalIndex) {
logger.debug(TAG, `忽略外部索引更新: 外部=${this.currentPageIndex + 1}, 本地=${this.viewCurrentPageIndex + 1}`);
return;
}
// [修复] 在初始化期间忽略 @Watch 回调,防止错误的页面索引覆盖正确的初始值
// 问题:ArkUI 的 @Prop @Watch 机制在组件初始化后会触发 @Watch 回调,
// 但此... | https://github.com/DaLongZhuaZi/manxia | b2af5015316b65e928bce42aa0625b45ae99f3ad | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Download/UnifiedDownloadManager.ets | arkts | downloadNovelChapters | ==================== 小说下载 ====================
下载小说章节(批量) | public async downloadNovelChapters(params: NovelChapterDownloadParams): Promise<string> {
const startedAt: number = Date.now();
const flowId: string = this.ensureDownloadCacheFlow(
params.downloadCacheFlowId || '',
DownloadCacheEntrySource.UNIFIED_DOWNLOAD_MANAGER,
DownloadCacheContentType.N... | 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 downloadNovelChapters AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left params AST#identifier#Right AST#:#... | public async downloadNovelChapters(params: NovelChapterDownloadParams): Promise<string> {
const startedAt: number = Date.now();
const flowId: string = this.ensureDownloadCacheFlow(
params.downloadCacheFlowId || '',
DownloadCacheEntrySource.UNIFIED_DOWNLOAD_MANAGER,
DownloadCacheContentType.N... | https://github.com/DaLongZhuaZi/manxia | 877a01d4fc72a14cdcc4bff9104047f519848de1 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Source/SuwayomiSourceExecutor.ets | arkts | searchLibrary | 在库中搜索漫画 | public async searchLibrary(query: string): Promise<ComicInfo[]> {
try {
return await this.suwayomiSource.searchLibrary(query);
} catch (error) {
logger.error(TAG, `库搜索失败: ${error}`);
return [];
}
} | 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 searchLibrary AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left query AST#identifier#Right AST#:#Left : AS... | public async searchLibrary(query: string): Promise<ComicInfo[]> {
try {
return await this.suwayomiSource.searchLibrary(query);
} catch (error) {
logger.error(TAG, `库搜索失败: ${error}`);
return [];
}
} | https://github.com/DaLongZhuaZi/manxia | 8210c2ddcdd5e539b36ec081da6044568e292d7f | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/components/DownloadManager.ets | arkts | processQueue | 处理下载队列 | private async processQueue() {
if (this.isRunning) return;
this.isRunning = true;
while (this.downloadQueue.length > 0 && this.activeDownloads.size < this.maxConcurrentDownloads) {
const taskId = this.downloadQueue.shift();
if (taskId) {
const task = this.tasks.get(taskId);
if... | 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 processQueue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#... | private async processQueue() {
if (this.isRunning) return;
this.isRunning = true;
while (this.downloadQueue.length > 0 && this.activeDownloads.size < this.maxConcurrentDownloads) {
const taskId = this.downloadQueue.shift();
if (taskId) {
const task = this.tasks.get(taskId);
if... | https://github.com/AetheriumSimulator/qemu-hmos | 903b0c36d12214f084694328450caa5cfdff5895 | github |
erosTeam/NextE | shared/src/main/ets/constants/EhConstants.ets | arkts | iso936 | Language tag name (e.g. 'chinese') → 2-letter display code ('ZH'). eros_fe EHConst.iso936. | static iso936(): Map<string, string> {
if (EhConstants.iso936Map === null) {
const m: Map<string, string> = new Map<string, string>()
m.set('japanese', 'JP')
m.set('english', 'EN')
m.set('chinese', 'ZH')
m.set('dutch', 'NL')
m.set('french', 'FR')
m.set('german', 'DE')
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left iso936 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_stat... | static iso936(): Map<string, string> {
if (EhConstants.iso936Map === null) {
const m: Map<string, string> = new Map<string, string>()
m.set('japanese', 'JP')
m.set('english', 'EN')
m.set('chinese', 'ZH')
m.set('dutch', 'NL')
m.set('french', 'FR')
m.set('german', 'DE')
... | https://github.com/erosTeam/NextE | dd617d41e3e94b6392f884eaba73d6fd9bda70af | github |
apap6628114/nga_oh | entry/src/main/ets/common/utils/Utils.ets | arkts | doStripSuffix | NGA CDN 图片 URL 后缀处理
NGA 对同一张图片提供多种分辨率,通过文件名后缀区分:
xxx.jpg → 原始全尺寸
xxx.thumb_s.jpg → 小缩略图 (≤56px)
xxx.thumb_m.jpg → 中缩略图 (≤120px)
xxx.medium.jpg → 中等尺寸 (>120px)
xxx.thumb.jpg → 旧式缩略图
stripImageSuffix(url) → 去掉所有后缀,返回原始尺寸 URL
applyImageSuffix(url, suffix) → 在原始尺寸 URL 上添加指定后缀 | function doStripSuffix(url: string): string {
let r: string = url
.replace(/\.thumb_s(\.\w+)$/i, '$1')
.replace(/\.thumb_m(\.\w+)$/i, '$1')
.replace(/\.medium(\.\w+)$/i, '$1')
.replace(/\.thumb(\.\w+)$/i, '$1')
const knownExts: string[] = ['webp', 'png', 'gif', 'bmp', 'jpg', 'jpeg']
const lastDot:... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left doStripSuffix AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left url AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Rig... | function doStripSuffix(url: string): string {
let r: string = url
.replace(/\.thumb_s(\.\w+)$/i, '$1')
.replace(/\.thumb_m(\.\w+)$/i, '$1')
.replace(/\.medium(\.\w+)$/i, '$1')
.replace(/\.thumb(\.\w+)$/i, '$1')
const knownExts: string[] = ['webp', 'png', 'gif', 'bmp', 'jpg', 'jpeg']
const lastDot:... | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/common/utils/Utils.ets#L86-L105 | 042e10c277483f39243b7a9bc8e4b105b6921297 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.LightWeightSet.ets | arkts | increaseCapacityTo | Increases the capacity of the LightWeightSet to the specified minimum capacity
@param minimumCapacity the minimum capacity to increase to
throws BusinessError if the minimumCapacity out of range. | increaseCapacityTo(minimumCapacity: int): void {
if (minimumCapacity > Int.MAX_VALUE) {
return;
}
if (minimumCapacity <= 0 || this.capacity >= minimumCapacity) {
throw new BusinessError(outOfBoundsErrorCodeId,
new Error('BusinessError',`The value of "m... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left increaseCapacityTo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left minimumCapacity AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#Right AST#ERROR#Right A... | increaseCapacityTo(minimumCapacity: int): void {
if (minimumCapacity > Int.MAX_VALUE) {
return;
}
if (minimumCapacity <= 0 || this.capacity >= minimumCapacity) {
throw new BusinessError(outOfBoundsErrorCodeId,
new Error('BusinessError',`The value of "m... | https://gitcode.com/iop123123/arkts-static-skills | 1e54df9b0b0dd7a77bacc64bbfecc1653742e33c | gitcode |
codelably/tuniao-ui | packages/main/src/main/ets/viewmodel/TnCountDownViewModel.ets | arkts | startControl | 开始手动控制的倒计时 | startControl(): void {
this.controlController.start();
this.controlStatusText = "倒计时中";
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left startControl 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... | startControl(): void {
this.controlController.start();
this.controlStatusText = "倒计时中";
} | https://github.com/codelably/tuniao-ui | 89b6fde9511e35ba017dcedaa1ab4a7d32adac80 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Task/BackgroundTaskManager.ets | arkts | startBackgroundRunningIfNeeded | 如有需要,为任务申请后台长时运行 | private async startBackgroundRunningIfNeeded(task: InternalTask): Promise<void> {
if (!task.options?.enableBackgroundRunning || !task.options.context) {
return;
}
const backgroundOwner = this.buildBackgroundOwner(task.id);
logger.info(TAG, `准备为后台任务申请长时运行:id=${task.id},持有者=${backgroundOwner}`);
... | 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 startBackgroundRunningIfNeeded AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left task AST#identifier#Ri... | private async startBackgroundRunningIfNeeded(task: InternalTask): Promise<void> {
if (!task.options?.enableBackgroundRunning || !task.options.context) {
return;
}
const backgroundOwner = this.buildBackgroundOwner(task.id);
logger.info(TAG, `准备为后台任务申请长时运行:id=${task.id},持有者=${backgroundOwner}`);
... | https://github.com/DaLongZhuaZi/manxia | f3acf194d6a1d073f3fc41dc47b1cf4cc89ed58a | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Parsers/TxtMetadataExtractor.ets | arkts | extractChapters | 提取章节信息(增强版,支持多种格式) | private static extractChapters(content: string): TxtChapterInfo[] {
const chapters: TxtChapterInfo[] = [];
const chapterMatches: ChapterMatchInfo[] = [];
let match: RegExpExecArray | null;
// 1. 尝试标准中文章节格式:第X章/回/卷/节/集/部/篇
const mainPattern = /^[ \s]*第\s*([0-9零一二三四五六七八九十百千万亿]+)\s*[章回卷节集部篇]\s*(.*)$... | 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 extractChapters AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left content AST#identifier#Right AST#ERROR#Left AST#:#L... | private static extractChapters(content: string): TxtChapterInfo[] {
const chapters: TxtChapterInfo[] = [];
const chapterMatches: ChapterMatchInfo[] = [];
let match: RegExpExecArray | null;
// 1. 尝试标准中文章节格式:第X章/回/卷/节/集/部/篇
const mainPattern = /^[ \s]*第\s*([0-9零一二三四五六七八九十百千万亿]+)\s*[章回卷节集部篇]\s*(.*)$... | https://github.com/DaLongZhuaZi/manxia | 5011f8a4d93dd469ed68f7c0bdc4c208c21d2745 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/Int.ets | arkts | compareTo | Compares this instance to other Int object
The result is less than 0 if this instance lesser than provided object
0 if they are equal
and greater than 0 otherwise.
@param other Int object to compare with
@returns result of the comparison | public override compareTo(other: Int): int {
return this.value - other.unboxed();
} | 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 compareTo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left other AST#identifier#Right AST#ERROR#Left AST#:#Left : AST... | public override compareTo(other: Int): int {
return this.value - other.unboxed();
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | e1eb47b391a68ea34c27224731e2853b616c3dd5 | gitee |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/app/tabs/classes/meowTabsBunch.ets | arkts | sendFinish | Called when the tab is dropped to elsewhere.
In the .onDropEnd() events from Tabs panels from where tabs are dragged away. | sendFinish() {
// Clear tunnel.
getCreateMyApp().dataTunnelForTabs = undefined;
meow(`getCreateMyApp().dataTunnelForTabs = undefined`, 'meowTabInfo][didDrop', meowLevel.WARN);
// Clear hover state of all app windows.
for (const wId of getAllWindowIds()) {
const thatUi = AppStorageV2.connect(... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left sendFinish AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AS... | sendFinish() {
// Clear tunnel.
getCreateMyApp().dataTunnelForTabs = undefined;
meow(`getCreateMyApp().dataTunnelForTabs = undefined`, 'meowTabInfo][didDrop', meowLevel.WARN);
// Clear hover state of all app windows.
for (const wId of getAllWindowIds()) {
const thatUi = AppStorageV2.connect(... | https://github.com/awaLiny2333/LinysBrowser_NEXT | 2814fc4df0551eae9cf6969646cab414a4002fcc | github |
openharmony-tpc/ImageKnife | library/src/main/ets/ImageKnife.ets | arkts | isFileCacheInit | 判断文件缓存是否已完成初始化
@returns 是否初始化 | public isFileCacheInit(): boolean {
return this.fileCache === undefined ? false : this.fileCache.isFileCacheInit()
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isFileCacheInit AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean A... | public isFileCacheInit(): boolean {
return this.fileCache === undefined ? false : this.fileCache.isFileCacheInit()
} | https://gitee.com/openharmony-tpc/ImageKnife.git | 2262d8e82f4975271f463b7e269b5fd25f0e9c46 | gitee |
openharmony/codelabs | ETSUI/LifeTrack/entry/src/main/ets/pages/DataManager.ets | arkts | getAllEvents | 获取全部日程 | async getAllEvents(): Promise<CalendarEvent[]> {
try {
const allEvents = await this.eventDao.getAllEvents();
return allEvents
} catch (error) {
console.error('Get all events failed:', error);
return [];
}
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getAllEvents AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic... | async getAllEvents(): Promise<CalendarEvent[]> {
try {
const allEvents = await this.eventDao.getAllEvents();
return allEvents
} catch (error) {
console.error('Get all events failed:', error);
return [];
}
} | https://gitcode.com/openharmony/codelabs | d5239394161bf7eecddb5fd55d09af977abae4b2 | gitcode |
luojiang001/Pulse | Pulse/entry/src/main/ets/pages/component/Medicine/MedicineList.ets | arkts | getFilteredMedicineList | 代理 searchKeyword 的变化 (通过 build 中的逻辑或 @Watch)
更好的方式是在 medicineList 变化或筛选条件变化时更新 DataSource
--------------------------------------------------------- | getFilteredMedicineList(): IMedicine[] {
let list = this.medicineList;
// Only filter by category locally
if (this.curCategoryIndex !== 0) {
const selectedId = this.categories[this.curCategoryIndex]?.id;
if (selectedId !== undefined) {
list = list.filter(med => med.category === selecte... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getFilteredMedicineList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left IMedicin... | getFilteredMedicineList(): IMedicine[] {
let list = this.medicineList;
// Only filter by category locally
if (this.curCategoryIndex !== 0) {
const selectedId = this.categories[this.curCategoryIndex]?.id;
if (selectedId !== undefined) {
list = list.filter(med => med.category === selecte... | https://github.com/luojiang001/Pulse | 4c0657520045e51e3b0ffe4e5e0eec68bd0901d8 | github |
openharmony/codelabs | ETSUI/LifeTrack/entry/src/main/ets/services/StepCounterService.ets | arkts | getCurrentSteps | 获取当前步数 | public getCurrentSteps(): number {
return this.currentStepCount;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCurrentSteps AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST... | public getCurrentSteps(): number {
return this.currentStepCount;
} | https://gitcode.com/openharmony/codelabs | 4f0c27112ea805d520c4a2882654adb92a76519d | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | findSourceIdByPkgOrName | [修复] 尝试通过 sourcePkg 或 sourceName 查找图源ID
用于在 sourceId 失效时的降级查找
@param sourcePkg 图源唯一包名(优先)
@param sourceName 图源名称(备选)
@returns 图源ID,如果未找到返回 null | public async findSourceIdByPkgOrName(sourcePkg?: string, sourceName?: string): Promise<number | null> {
try {
// 1. 优先通过 pkg 查找
if (sourcePkg) {
const sourceByPkg = await this.getComicSourceByPkg(sourcePkg);
if (sourceByPkg) {
logger.info(TAG, `[修复] 通过 pkg="${sourcePkg}" 找到图源... | 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 findSourceIdByPkgOrName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourcePkg AST#identifier#Right AST#ERROR#Left A... | public async findSourceIdByPkgOrName(sourcePkg?: string, sourceName?: string): Promise<number | null> {
try {
// 1. 优先通过 pkg 查找
if (sourcePkg) {
const sourceByPkg = await this.getComicSourceByPkg(sourcePkg);
if (sourceByPkg) {
logger.info(TAG, `[修复] 通过 pkg="${sourcePkg}" 找到图源... | https://github.com/DaLongZhuaZi/manxia | 14eee6ed0d7128e87cba9562aa826f8d7f150b3c | github |
CLMC2025/Vignette | entry/src/main/ets/utils/SecureStorage.ets | arkts | clearAll | Clear all secure storage data | async clearAll(): Promise<boolean> {
if (!await this.ensureInitialized()) {
return false;
}
if (!this.abilityContext) {
console.error('[SecureStorage] clearAll: abilityContext is not available');
return false;
}
try {
await preferences.deletePreferences(this.abilityContex... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left clearAll AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#... | async clearAll(): Promise<boolean> {
if (!await this.ensureInitialized()) {
return false;
}
if (!this.abilityContext) {
console.error('[SecureStorage] clearAll: abilityContext is not available');
return false;
}
try {
await preferences.deletePreferences(this.abilityContex... | https://github.com/CLMC2025/Vignette | 2a0d3d93cf97bf8abcbb4e20c0c22ef427c2af11 | github |
offlinecat-dev/OCNetORM | src/main/ets/query/QueryExecutor.ets | arkts | loadRelations | 加载关联数据
支持嵌套关联路径(如 posts.comments.author)
并按路径顺序递归加载关联数据
@param entities 主实体数据数组
@returns 带有关联数据的实体数组 | private async loadRelations(entities: Array<EntityData>): Promise<Array<EntityData>> {
return await this.relationSupport.loadRelations(entities)
} | 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 loadRelations AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left entities AST#identif... | private async loadRelations(entities: Array<EntityData>): Promise<Array<EntityData>> {
return await this.relationSupport.loadRelations(entities)
} | https://github.com/offlinecat-dev/OCNetORM | 4af6ec6aa2af10e3294e396509a0f2ecffdc8275 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Box.ets | arkts | box | Creates a new LongBox instance with the specified initial value.
@param { long } value - The initial long value to be wrapped
@returns { LongBox } A new LongBox instance containing the specified long value
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static box(value: long): LongBox {
return new LongBox(value);
} | 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 box AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right ... | public static box(value: long): LongBox {
return new LongBox(value);
} | https://gitcode.com/iop123123/arkts-static-skills | 898f4e4d290aea741e97a2ea8d6a30797a81c4c6 | gitcode |
killetom/ktretrofit | ktretrofit/src/main/ets/retrofit/interceptor/InterceptorHttpClient.ets | arkts | cancelAll | Cancel all ongoing requests by delegating to the underlying HttpClient. | cancelAll(): void {
this.delegate.cancelAll();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left cancelAll 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#Le... | cancelAll(): void {
this.delegate.cancelAll();
} | https://github.com/killetom/ktretrofit | 402b46c85198e7d54b1484301fd765dcf1955a96 | github |
xiebyapps/ClipLink | entry/src/main/ets/services/SyncClipboardService.ets | arkts | downloadTextContent | Download text clipboard content | async downloadTextContent(): Promise<string> {
const profile = await this.getProfile();
if (profile.type === 'Text') {
if (profile.hasData && profile.hash) {
return await this.downloadHistoryText(`Text-${profile.hash}`);
}
return profile.text;
}
return '';
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left downloadTextContent AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#... | async downloadTextContent(): Promise<string> {
const profile = await this.getProfile();
if (profile.type === 'Text') {
if (profile.hasData && profile.hash) {
return await this.downloadHistoryText(`Text-${profile.hash}`);
}
return profile.text;
}
return '';
} | https://github.com/xiebyapps/ClipLink | 79eeb4fe286895eff3e68f1428a849ee9c63e972 | github |
richshaw2015/nds | ohos/entry/src/main/ets/utils/NdsRomCache.ets | arkts | getMaxCacheSizeSync | 同步获取最大缓存大小 | getMaxCacheSizeSync(): SizeUnit {
const sizeIndex = this.settingsManager.getSync<number>('rom_cache_max_size', 3);
const bytes = romCacheSizeToBytes(sizeIndex);
return SizeUnit.bytes(bytes);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getMaxCacheSizeSync 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 SizeUnit AST#identifier#Right AST#ERROR#Ri... | getMaxCacheSizeSync(): SizeUnit {
const sizeIndex = this.settingsManager.getSync<number>('rom_cache_max_size', 3);
const bytes = romCacheSizeToBytes(sizeIndex);
return SizeUnit.bytes(bytes);
} | https://github.com/richshaw2015/nds | 78ffef986f70a890d778a3ff0b7628539731c87a | github |
Joker-x-dev/CoolMallArkTS | core/util/src/main/ets/toast/ToastUtils.ets | arkts | showSuccess | 显示成功提示
@param {string | ResourceStr} message - 提示内容
@returns {void} 无返回值 | static showSuccess(message: string | ResourceStr): void {
IBestToast.show({
type: "success",
message: message
});
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left showSuccess AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left message AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression... | static showSuccess(message: string | ResourceStr): void {
IBestToast.show({
type: "success",
message: message
});
} | https://github.com/Joker-x-dev/CoolMallArkTS | a04f2e06455ea54210baecdc388b3a742f0ffeb6 | github |
NissonCX/CQU-HarmonyOS-APP-Dev-Final | entry/src/main/ets/utils/ReminderManager.ets | arkts | clearReminderConfig | 清除提醒配置 | private async clearReminderConfig(id: string): Promise<void> {
try {
const key = `reminder_config_${id}`;
AppStorage.delete(key);
} catch (error) {
console.error('清除提醒配置失败:', JSON.stringify(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 clearReminderConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Lef... | private async clearReminderConfig(id: string): Promise<void> {
try {
const key = `reminder_config_${id}`;
AppStorage.delete(key);
} catch (error) {
console.error('清除提醒配置失败:', JSON.stringify(error));
}
} | https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final | a71c7d834ca0cf1d592c8edd5a5499a2ed5139c8 | github |
openharmony/applications_app_samples | code/ArkTS1.2/ComponentSample/entry/src/main/ets/pages/Example1/DataType.ets | arkts | notifyDataAdd | 通知LazyForEach组件需要在index对应索引处添加子组件。
@param {number} index - 索引值。 | notifyDataAdd(index: double): void {
this.listeners.forEach(listener => {
listener.onDataAdd(index);
})
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left notifyDataAdd AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left double AST#identifier#Right AST#)#Left ) ... | notifyDataAdd(index: double): void {
this.listeners.forEach(listener => {
listener.onDataAdd(index);
})
} | https://github.com/openharmony/applications_app_samples | 89af1dee85f7b0a3ea915ab4339773e7c0a2e729 | github |
openharmony-sig/applications_calculator | feature/calculation/src/main/ets/calculator/Evaluator.ets | arkts | getMemory | get memory | private async getMemory(): Promise<string> {
await this.getPreference();
if (this.sharePreference === null) {
LogUtil.error(TAG, 'sharePreference is null');
return '';
}
let mem: dataPreferences.ValueType = '';
try {
mem = await this.sharePreference.get(SHARE_MEMORY, '');
} c... | 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 getMemory AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L... | private async getMemory(): Promise<string> {
await this.getPreference();
if (this.sharePreference === null) {
LogUtil.error(TAG, 'sharePreference is null');
return '';
}
let mem: dataPreferences.ValueType = '';
try {
mem = await this.sharePreference.get(SHARE_MEMORY, '');
} c... | https://gitee.com/openharmony-sig/applications_calculator.git | a21c70010bd73d9b104d0712f591a04e6bb7bb6f | gitee |
erosTeam/NextE | shared/src/main/ets/utils/ShareUtil.ets | arkts | shareGallery | Open the system share sheet for a gallery's public URL. No-op when gid/token are missing. | static shareGallery(
context: common.UIAbilityContext,
gid: string,
token: string,
isEx: boolean,
title: string,
): void {
if (gid.length === 0 || token.length === 0) {
return
}
const url: string = `${EhConstants.baseUrl(isEx)}/g/${gid}/${token}/`
ShareUtil.shareUrl(context... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left shareGallery AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expressio... | static shareGallery(
context: common.UIAbilityContext,
gid: string,
token: string,
isEx: boolean,
title: string,
): void {
if (gid.length === 0 || token.length === 0) {
return
}
const url: string = `${EhConstants.baseUrl(isEx)}/g/${gid}/${token}/`
ShareUtil.shareUrl(context... | https://github.com/erosTeam/NextE | fb38ca00dddbc473a14246977b6281f9dd7711db | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/NotificationManager.ets | arkts | sendDetailedDownloadCompleteNotification | 发送详细的下载完成通知
显示缓存内容的详细信息,包括书名、章节范围、成功/失败数量 | public async sendDetailedDownloadCompleteNotification(
taskId: string,
contentTitle: string,
contentType: 'novel' | 'manga',
successCount: number,
failCount: number,
startChapter?: number,
endChapter?: number
): Promise<boolean> {
const totalCount = successCount + failCount;
cons... | 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 sendDetailedDownloadCompleteNotification AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left taskId AST#iden... | public async sendDetailedDownloadCompleteNotification(
taskId: string,
contentTitle: string,
contentType: 'novel' | 'manga',
successCount: number,
failCount: number,
startChapter?: number,
endChapter?: number
): Promise<boolean> {
const totalCount = successCount + failCount;
cons... | https://github.com/DaLongZhuaZi/manxia | bac885152b78341211ae7acdd621b165f47431c0 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/SmartCategoryService.ets | arkts | generateReason | 生成推荐理由 | private static generateReason(matchedRules: string[], matchedKeywords: string[]): string {
if (matchedKeywords.length > 0) {
return `匹配关键词: ${matchedKeywords.slice(0, 3).join('、')}`;
} else if (matchedRules.length > 0) {
return `匹配规则: ${matchedRules[0]}`;
}
return '基于历史习惯推荐';
} | 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 generateReason AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left matchedRules AST#identifier#Right AST#ERROR#Left AST... | private static generateReason(matchedRules: string[], matchedKeywords: string[]): string {
if (matchedKeywords.length > 0) {
return `匹配关键词: ${matchedKeywords.slice(0, 3).join('、')}`;
} else if (matchedRules.length > 0) {
return `匹配规则: ${matchedRules[0]}`;
}
return '基于历史习惯推荐';
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | f56bd22c48277628ded0827e7e0b3a265908d310 | github |
Joker-x-dev/HarmonyKit | feature/demo/src/main/ets/viewmodel/StateManagementViewModel.ets | arkts | increment | 计数加一
@returns {void} 无返回值 | increment(): void {
this.counterState.increment();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left increment 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#Le... | increment(): void {
this.counterState.increment();
} | https://github.com/Joker-x-dev/HarmonyKit | 25934fa52d8f6d2d2f626536acb5119dabb2b140 | github |
openharmony-sig/ohos_danmaku_flame_master | library/src/main/ets/components/common/master/flame/danmaku/danmaku/model/ohos/DanmakuContext.ets | arkts | setFTDanmakuVisibility | �����Ƿ���ʾ������Ļ
@param visible | public setFTDanmakuVisibility(visible: boolean): DanmakuContext {
this.setDanmakuVisible(visible, BaseDanmaku.TYPE_FIX_TOP);
this.setFilterData(DanmakuFilters.TAG_TYPE_DANMAKU_FILTER, this.mFilterTypes);
this.mGlobalFlagValues.updateFilterFlag();
if (this.FTDanmakuVisibility != visible) {
this.F... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setFTDanmakuVisibility AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left visible AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi... | public setFTDanmakuVisibility(visible: boolean): DanmakuContext {
this.setDanmakuVisible(visible, BaseDanmaku.TYPE_FIX_TOP);
this.setFilterData(DanmakuFilters.TAG_TYPE_DANMAKU_FILTER, this.mFilterTypes);
this.mGlobalFlagValues.updateFilterFlag();
if (this.FTDanmakuVisibility != visible) {
this.F... | https://gitee.com/openharmony-sig/ohos_danmaku_flame_master.git | 3b99d6bea27277e3d23b086a6bedbb5837667e99 | gitee |
David8Idira/AI-OA | packages/harmonyos/commons/src/main/ets/services/KnowledgeService.ets | arkts | renameDocument | 重命名文档
@param documentId 文档ID
@param newName 新名称 | async renameDocument(documentId: string, newName: string): Promise<ApiResponse<any>> {
return this.client.put<any>(`/api/v1/knowledge/documents/${documentId}/rename`, { title: newName })
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left renameDocument AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left documentId AST#identifier#Right AST#type_annotation#Left AST#:#L... | async renameDocument(documentId: string, newName: string): Promise<ApiResponse<any>> {
return this.client.put<any>(`/api/v1/knowledge/documents/${documentId}/rename`, { title: newName })
} | https://github.com/David8Idira/AI-OA | 2189e54831ab62a81928cfff584c8ab405db0eeb | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets | arkts | equals | Checks for equality this instance with provided object, treated as a LongType
@param {Type} other type to be checked against
@returns {boolean} true if object also has LongType and
this type and other type both are reference or value
@throws {Error} - Input parameter error.
@syscap SystemCapability.Utils.Lang
@FaAndSta... | public override equals(other: Type): boolean {
return other instanceof LongType
} | 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 equals AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left other AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#... | public override equals(other: Type): boolean {
return other instanceof LongType
} | https://gitcode.com/iop123123/arkts-static-skills | 6e58d0d73332e3a7dc4c5377d5e98b30a60af446 | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/utils/CryptoUtil.ets | arkts | skipAsn1Length | 解析 ASN.1 长度字段并返回长度值后的位置 | private static skipAsn1Length(data: Uint8Array, pos: number): number {
if (pos >= data.length) return -1;
if ((data[pos] & 0x80) === 0) {
return pos + 1;
}
const lenBytes = data[pos] & 0x7F;
return pos + 1 + lenBytes;
} | 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 skipAsn1Length AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left ... | private static skipAsn1Length(data: Uint8Array, pos: number): number {
if (pos >= data.length) return -1;
if ((data[pos] & 0x80) === 0) {
return pos + 1;
}
const lenBytes = data[pos] & 0x7F;
return pos + 1 + lenBytes;
} | https://github.com/AlkaidLab/moonlight-harmony | c3990f686a3521f98686972b196a08ede9354527 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/components/PreloadManager.ets | arkts | trimQueue | 修剪队列,保持在最大长度内 | private trimQueue(): void {
if (this.queue.size <= this.MAX_QUEUE_SIZE) {
return;
}
// 移除优先级最低且距离当前页最远的项
const entries: Array<[number, PreloadItem]> = [];
this.queue.forEach((item, index) => {
entries.push([index, item]);
});
entries.sort((a, b) => {
const indexA = ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left trimQueue 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#R... | private trimQueue(): void {
if (this.queue.size <= this.MAX_QUEUE_SIZE) {
return;
}
// 移除优先级最低且距离当前页最远的项
const entries: Array<[number, PreloadItem]> = [];
this.queue.forEach((item, index) => {
entries.push([index, item]);
});
entries.sort((a, b) => {
const indexA = ... | https://github.com/DaLongZhuaZi/manxia | b0799ef92e8c5396102c370c6b6a83ea42554801 | github |
cheinlu/HarmonyOS-groundhog-charging-system | TbsChargeHarmonyOs/common/src/main/ets/utils/WindowModel.ets | arkts | getKeyBoardVisible | 软键盘是否显示/隐藏
@param callback | getKeyBoardVisible(callback: (visible: boolean) => void) {
window.getLastWindow(getContext(this)).then(currentWindow => {
// 监听软键盘的隐藏和显示
currentWindow.on('avoidAreaChange', data => {
if (data.type == window.AvoidAreaType.TYPE_KEYBOARD) {
const keyBoardHeight = px2vp(data.area.bottomR... | AST#program#Left AST#ERROR#Left AST#identifier#Left getKeyBoardVisible AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Lef... | getKeyBoardVisible(callback: (visible: boolean) => void) {
window.getLastWindow(getContext(this)).then(currentWindow => {
// 监听软键盘的隐藏和显示
currentWindow.on('avoidAreaChange', data => {
if (data.type == window.AvoidAreaType.TYPE_KEYBOARD) {
const keyBoardHeight = px2vp(data.area.bottomR... | https://github.com/cheinlu/HarmonyOS-groundhog-charging-system | 49b12325c9d36e8c523118730e39e31179afaf5f | github |
codelably/tuniao-ui | core/tuniaoui/src/main/ets/components/image-preview/TnImagePreview.ets | arkts | tnImagePreviewBuilder | 预览组件 Builder 函数
@param params 预览参数 | @Builder
function tnImagePreviewBuilder(params: TnImagePreviewParams): void {
TnPreviewContent({ params: params });
} | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Builder AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left tnImagePreviewBuilder AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right... | @Builder
function tnImagePreviewBuilder(params: TnImagePreviewParams): void {
TnPreviewContent({ params: params });
} | https://github.com/codelably/tuniao-ui | 7240d22c09e31fdd16ed2fbf2e6b7f670c2a8b8c | github |
AGenUI/AGenUI | playground/harmony/entry/src/main/ets/pages/AGenUIDemoPage.ets | arkts | aboutToAppear | Lifecycle: initializes the SurfaceManager, registers SDK functions/components, and loads the story menu. | aboutToAppear() {
// Copy rawfile assets into the sandbox and initialize the SDK.
const context = getContext(this) as common.UIAbilityContext;
// Initialize custom RuntimeLogger and inject to engine
this.runtimeLogger = new PlaygroundRuntimeLogger(context,
(level: number, tag: string, func:... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left... | aboutToAppear() {
// Copy rawfile assets into the sandbox and initialize the SDK.
const context = getContext(this) as common.UIAbilityContext;
// Initialize custom RuntimeLogger and inject to engine
this.runtimeLogger = new PlaygroundRuntimeLogger(context,
(level: number, tag: string, func:... | https://github.com/AGenUI/AGenUI | d0c07b6e502aca1cebc1252f01cf514f816cb882 | github |
CLMC2025/Vignette | entry/src/main/ets/algorithm/Algorithm.ets | arkts | resetToDefault | Reset to default parameters | resetToDefault(): void {
this.w = [...FSRSParams.DEFAULT_W];
this.usingOptimizedParams = false;
this.decay = -this.w[20];
this.factor = Math.pow(0.9, 1 / this.decay) - 1;
FSRSParameterStore.getInstance().clearParameters();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left resetToDefault AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_blo... | resetToDefault(): void {
this.w = [...FSRSParams.DEFAULT_W];
this.usingOptimizedParams = false;
this.decay = -this.w[20];
this.factor = Math.pow(0.9, 1 / this.decay) - 1;
FSRSParameterStore.getInstance().clearParameters();
} | https://github.com/CLMC2025/Vignette | 1cf2a0387e1f747f7cc72945f1a2babff5a19609 | github |
erosTeam/NextE | shared/src/main/ets/constants/EhConstants.ets | arkts | cdnThumb | Normalize a thumbnail URL to the public ehgt.org CDN. On ExHentai the parsed thumb host is
`s.exhentai.org` (auth-gated, and DNS-blackholed on some networks); ehgt.org mirrors the
identical `/w/...` path publicly, so covers load reliably without the EX cookie. Full reader
images (hath hosts) are untouched. | static cdnThumb(url: string): string {
return url.indexOf('s.exhentai.org') >= 0 ? url.replace('s.exhentai.org', 'ehgt.org') : url
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left cdnThumb AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string A... | static cdnThumb(url: string): string {
return url.indexOf('s.exhentai.org') >= 0 ? url.replace('s.exhentai.org', 'ehgt.org') : url
} | https://github.com/erosTeam/NextE | fa76eb998193e542940b6e3d718492e7e3445166 | github |
openharmony/arkui_advanced_ui_component | atomicservicenavigation/source/atomicservicenavigation.ets | arkts | updateLayout | 更新侧边栏布局
@param breakPoint 当前断点
@param layout 布局参数 | public updateLayout(breakPoint: string, layout: sideBarAttributeSet): void {
if (breakPoint === BREAK_POINT_LG) {
this.updateLGLayout(layout);
} else {
this.updateCommonLayout(layout);
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left updateLayout AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left breakPoint AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string... | public updateLayout(breakPoint: string, layout: sideBarAttributeSet): void {
if (breakPoint === BREAK_POINT_LG) {
this.updateLGLayout(layout);
} else {
this.updateCommonLayout(layout);
}
} | https://gitee.com/openharmony/arkui_advanced_ui_component.git | 1f784091086d72cdc9df161963f889f86e2a0c2e | gitee |
openharmony/applications_contacts | entry/src/main/ets/feature/sim/SimCardState.ets | arkts | init | Initialization is required only when callback is required. Callback is required to ensure data accuracy and timeliness. | public init() {
try {
HiLog.i(TAG, 'SimCardState, init.')
this.addSimChangeListener();
this.getSimCardState();
} catch (error) {
HiLog.w(TAG, 'SimCardState, get sim state error.')
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Le... | public init() {
try {
HiLog.i(TAG, 'SimCardState, init.')
this.addSimChangeListener();
this.getSimCardState();
} catch (error) {
HiLog.w(TAG, 'SimCardState, get sim state error.')
}
} | https://gitee.com/openharmony/applications_contacts.git | 0e1b9f65c387ce3edf14f13ab7c65471cef486d8 | gitee |
Coke0807/NewsAPP-HarmonyOS | NewsApp/entry/src/main/ets/utils/SettingsUtil.ets | arkts | saveFontSize | 保存字体大小 | static async saveFontSize(size: number): Promise<void> {
if (!SettingsUtil.prefs) {
promptAction.showToast({ message: '设置未初始化,请重启应用' });
return;
}
try {
await SettingsUtil.prefs.put(STORAGE_KEYS.FONT_SIZE, size);
await SettingsUtil.prefs.flush();
AppStorage.setOrCreate(STORA... | 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 saveFontSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left size AST#identifier#Right AST#:#Left : AST#... | static async saveFontSize(size: number): Promise<void> {
if (!SettingsUtil.prefs) {
promptAction.showToast({ message: '设置未初始化,请重启应用' });
return;
}
try {
await SettingsUtil.prefs.put(STORAGE_KEYS.FONT_SIZE, size);
await SettingsUtil.prefs.flush();
AppStorage.setOrCreate(STORA... | https://github.com/Coke0807/NewsAPP-HarmonyOS | 691d7fb4b59666d4cb209080627ff64a2681bfbf | github |
HarmonyOS_Samples/accountkit-samplecode-clientdemo-arkts | entry/src/main/ets/common/CommonEventUtil.ets | arkts | subscriberCommonEvent | Common event method, which is used to subscribe to common events related to the youth mode. | subscriberCommonEvent() {
hilog.info(domainId, logTag, 'into subscriberCommonEvent');
// Create a subscriber.
if (canIUse("SystemCapability.Notification.CommonEvent")) {
// Subscriber information.
const subscribeInfo: commonEventManager.CommonEventSubscribeInfo = {
events: [
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left subscriberCommonEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_bl... | subscriberCommonEvent() {
hilog.info(domainId, logTag, 'into subscriberCommonEvent');
// Create a subscriber.
if (canIUse("SystemCapability.Notification.CommonEvent")) {
// Subscriber information.
const subscribeInfo: commonEventManager.CommonEventSubscribeInfo = {
events: [
... | https://gitcode.com/HarmonyOS_Samples/accountkit-samplecode-clientdemo-arkts | 007dc04ca395eeccda6ede6eb9a06a92fc8b4014 | gitcode |
OMGCA/sakipay | sakipay_hmos/main/src/main/ets/models/EarningsCalculator.ets | arkts | elapsedSinceStart | Converts a clock-minute value to minutes elapsed since work start,
handling the cross-midnight wrap. Clamped to 0 for minutes before work start. | public elapsedSinceStart(clockMinute: number): number {
if (!this.isCrossMidnight) {
return Math.max(0, clockMinute - this.workStartMinutes)
}
if (clockMinute >= this.workStartMinutes) {
return clockMinute - this.workStartMinutes
}
return (1440 - this.workStartMinutes) + clockMinute
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left elapsedSinceStart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left clockMinute AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#... | public elapsedSinceStart(clockMinute: number): number {
if (!this.isCrossMidnight) {
return Math.max(0, clockMinute - this.workStartMinutes)
}
if (clockMinute >= this.workStartMinutes) {
return clockMinute - this.workStartMinutes
}
return (1440 - this.workStartMinutes) + clockMinute
... | https://github.com/OMGCA/sakipay | 4db24870e040a486b8bf34f1e1334eaec06ec8f8 | github |
SMAT-Lab/PhantomRendering | example/entry/src/main/ets/common/DeviceUtils.ets | arkts | sp2px | sp转px (用于字体大小) | static sp2px(sp: number): number {
return Math.round(sp * (deviceInfo.scaledDensity || DeviceUtils.getDensity()))
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left sp2px AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left sp AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR... | static sp2px(sp: number): number {
return Math.round(sp * (deviceInfo.scaledDensity || DeviceUtils.getDensity()))
} | https://github.com/SMAT-Lab/PhantomRendering | 7adc111e571dbbe679cfe6239141898f01096ec0 | github |
openharmony/applications_app_samples | code/BasicFeature/Media/Image/photomodify/src/main/ets/components/pages/MaterialEdit.ets | arkts | getMarkAnchorPosition | 相对于中心点的偏移量,-1/2素材宽,-1/2素材高 | getMarkAnchorPosition(): Position {
const dx: number = this.materialWidth / 2;
const dy: number = this.materialHeight / 2;
return {
x: dx,
y: dy
};
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getMarkAnchorPosition 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 Position AST#identifier#Right AST#ERROR#... | getMarkAnchorPosition(): Position {
const dx: number = this.materialWidth / 2;
const dy: number = this.materialHeight / 2;
return {
x: dx,
y: dy
};
} | https://github.com/openharmony/applications_app_samples | f0021dddbfcc95594c849cf89087a6c3f71ff68b | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | copyWithin | Makes a copy of internal elements to insertPos from startPos to end of Int8Array.
@param insertPos insert index to place copied elements
@param startPos start index to begin copy from
See rules of parameters normalization {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/copy... | public copyWithin(insertPos: number, startPos: number): void {
this.copyWithin(insertPos as int, startPos as int)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left copyWithin AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left insertPos AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Ri... | public copyWithin(insertPos: number, startPos: number): void {
this.copyWithin(insertPos as int, startPos as int)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | d3fe5aee6713b729402743e807679505d740cf00 | gitee |
yanglfree/CopoHub-Multi | flutter/ohos/entry/src/main/ets/entryability/EntryAbility.ets | arkts | applyWindowStatus | Called before super.onWindowStageCreate so we know the initial window
mode before skipCheck is set to true by setUseFullScreen(). | applyWindowStatus(status: window.WindowStatusType): void {
this.windowStatus = status;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left applyWindowStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left status AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Left window AS... | applyWindowStatus(status: window.WindowStatusType): void {
this.windowStatus = status;
} | https://github.com/yanglfree/CopoHub-Multi | f7e9ff625872349f94c1b733ba845236a1c05058 | github |
Joker-x-dev/HarmonyKit | feature/demo/src/main/ets/viewmodel/LocalStorageViewModel.ets | arkts | loadAccount | 读取账号
@returns {Promise<void>} Promise<void> | async loadAccount(): Promise<void> {
this.storedAccount = await this.repository.loadAccount();
} | AST#program#Left AST#expression_statement#Left AST#assignment_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left loadAccount AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#R... | async loadAccount(): Promise<void> {
this.storedAccount = await this.repository.loadAccount();
} | https://github.com/Joker-x-dev/HarmonyKit | 0467285276cd8ac59b660c2c0da35f9ae0d534d0 | github |
openharmony-sig/flutter_engine | shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/platform/PlatformView.ets | arkts | onFlutterViewAttached | Called by the {@link io.flutter.embedding.engine.FlutterEngine} that owns this {@code
PlatformView} when the DynamicView responsible for rendering a Flutter UI is
associated with the {@link io.flutter.embedding.engine.FlutterEngine}.
<p>This means that our associated {@link io.flutter.embedding.engine.FlutterEngine} ca... | onFlutterViewAttached(dvModel: DVModel): void {} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onFlutterViewAttached AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left dvModel AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left DVModel AST#identifier#Right AS... | onFlutterViewAttached(dvModel: DVModel): void {} | https://gitee.com/openharmony-sig/flutter_engine.git | 67693d85b20922fc7a754063803b59ec826cdd9c | gitee |
LongLiveY96/chatcube | entry/src/main/ets/viewmodels/ProviderViewModel.ets | arkts | syncProviderProperties | 把 source 的所有字段浅拷贝到 target。保留为 stateless helper:
UI 层(ModelManagePage)通过它把 Store 新返的 provider 字段刷到
已绑定到子组件 @Param 的旧实例上,保证子组件引用稳定、不触发重建 | syncProviderProperties(target: ModelProvider, source: ModelProvider): void {
target.name = source.name
target.isConnected = source.isConnected
target.apiKey = source.apiKey
target.requiresApiKey = source.requiresApiKey
target.baseUrl = source.baseUrl
target.apiPath = source.apiPath
target.... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left syncProviderProperties AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left target AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ModelProvider AST#identifier#Ri... | syncProviderProperties(target: ModelProvider, source: ModelProvider): void {
target.name = source.name
target.isConnected = source.isConnected
target.apiKey = source.apiKey
target.requiresApiKey = source.requiresApiKey
target.baseUrl = source.baseUrl
target.apiPath = source.apiPath
target.... | https://github.com/LongLiveY96/chatcube | 7f72393646316aa43aeb2b6b72f7c6eab3fcb8eb | github |
wuba/omni-ui | omni_component/src/main/ets/components/popup/Builder.ets | arkts | asCustomPopup | 自定义视图
@param popup
@returns | asCustomPopup<P extends BasePopup<ESObject>>(popup: P): P {
popup.setAttachViewId(this.attachViewId)
popup.setDialogOptions(this.dialogOptions)
popup.setPopupConfig(this.popupConfig)
popup.setPopupCallback(this.popupCallback)
return popup
} | AST#program#Left AST#ERROR#Left AST#identifier#Left asCustomPopup AST#identifier#Right AST#<#Left < AST#<#Right AST#type_identifier#Left P AST#type_identifier#Right AST#extends#Left extends AST#extends#Right AST#ERROR#Left AST#generic_type#Left AST#type_identifier#Left BasePopup AST#type_identifier#Right AST#type_argum... | asCustomPopup<P extends BasePopup<ESObject>>(popup: P): P {
popup.setAttachViewId(this.attachViewId)
popup.setDialogOptions(this.dialogOptions)
popup.setPopupConfig(this.popupConfig)
popup.setPopupCallback(this.popupCallback)
return popup
} | https://github.com/wuba/omni-ui | a28b13f8608b1b1d4ab45b7bacb55731d145facc | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/NvHttp.ets | arkts | fromAddress | 从指定地址 + 电脑信息创建 NvHttp(用于轮询/测试指定地址)
对齐 Android `tryPollIp` 的 `portMatchesActiveAddress` 逻辑:
仅当指定 address 的端口与 computer.address 缓存端口一致时,才复用缓存的 httpsPort;
否则置 0,让 NvHttp 在 HTTPS 请求时通过 HTTP serverinfo 重新探测。
这避免了切换网络(如 LAN→公网/frp)时使用 stale 的 httpsPort 导致 getAppList 超时。 | static fromAddress(address: string, computer: NvHttpHost, context?: common.UIAbilityContext): NvHttp {
const httpFallback = computer.httpPort || NvHttp.DEFAULT_HTTP_PORT;
const targetPort = NvHttp.resolveHttpPort(address, httpFallback);
const activePort = computer.address ? NvHttp.resolveHttpPort(computer... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left fromAddress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left address AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Rig... | static fromAddress(address: string, computer: NvHttpHost, context?: common.UIAbilityContext): NvHttp {
const httpFallback = computer.httpPort || NvHttp.DEFAULT_HTTP_PORT;
const targetPort = NvHttp.resolveHttpPort(address, httpFallback);
const activePort = computer.address ? NvHttp.resolveHttpPort(computer... | https://github.com/AlkaidLab/moonlight-harmony | 1f877dd08a054e8e44b90aff658804768df06d90 | github |
kumaleap/ArkLuban | library/src/main/ets/luban/LubanUtils.ets | arkts | getFileExtension | 获取文件扩展名
@param filePath 文件路径
@returns 文件扩展名(小写) | static getFileExtension(filePath: string): string {
const normalizedPath = LubanUtils.stripQueryAndFragment(filePath);
const fileName = normalizedPath.split('/').pop() || '';
const dotIndex = fileName.lastIndexOf('.');
if (dotIndex === -1 || dotIndex === fileName.length - 1) {
return '';
}
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getFileExtension AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#stri... | static getFileExtension(filePath: string): string {
const normalizedPath = LubanUtils.stripQueryAndFragment(filePath);
const fileName = normalizedPath.split('/').pop() || '';
const dotIndex = fileName.lastIndexOf('.');
if (dotIndex === -1 || dotIndex === fileName.length - 1) {
return '';
}
... | https://github.com/kumaleap/ArkLuban | 86930ef3832ccc3219c5ea91a926a324ec2794d4 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/deepseek/SiliconFlowClient.ets | arkts | doStreamRequest | 执行流式HTTP请求 | private async doStreamRequest(
request: ChatCompletionRequest,
callback: StreamCallback
): Promise<void> {
return new Promise((resolve, reject) => {
const httpRequest = http.createHttp();
httpRequest.request(
`${this.config.baseUrl}/chat/completions`,
{
method: htt... | 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 doStreamRequest AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left request AST#identifier#Right AST#:#Le... | private async doStreamRequest(
request: ChatCompletionRequest,
callback: StreamCallback
): Promise<void> {
return new Promise((resolve, reject) => {
const httpRequest = http.createHttp();
httpRequest.request(
`${this.config.baseUrl}/chat/completions`,
{
method: htt... | https://github.com/LJ666-ui/harmony-health-care | 7a0d50383f5abfdbceb6d5e0e6a11ca19f18acf5 | github |
openharmony/codelabs | ETSUI/RoundThreadScheduler/entry/src/main/ets/scheduler/RoundThreadScheduler.ets | arkts | start | 启动调度流程 | async start(): Promise<number> {
if (this.running) {
// 防止重复启动
return this.finalResult;
}
this.running = true;
this.executor = new RoundExecutor(
this.workerCount,
this.roundCount
);
this.finalResult = await this.executor.start();
this.running = false;
retur... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left start AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Lef... | async start(): Promise<number> {
if (this.running) {
// 防止重复启动
return this.finalResult;
}
this.running = true;
this.executor = new RoundExecutor(
this.workerCount,
this.roundCount
);
this.finalResult = await this.executor.start();
this.running = false;
retur... | https://gitcode.com/openharmony/codelabs | 60a1879ad79f1aa40037d01724d3ad65b39a01bb | gitcode |
the-wwyang/kids-learning-app | src/main/ets/services/LearningRecordService.ets | arkts | getPeakLearningHour | 获取学习高峰时段
@param records 答题记录列表
@returns 高峰时段 (小时) | static getPeakLearningHour(records: AnswerRecord[]): number {
if (records.length === 0) return 0;
const hourCounts = new Map<number, number>();
for (const record of records) {
const hour = new Date(record.timestamp).getHours();
hourCounts.set(hour, (hourCounts.get(hour) || 0) + 1);
}
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getPeakLearningHour AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left records AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript... | static getPeakLearningHour(records: AnswerRecord[]): number {
if (records.length === 0) return 0;
const hourCounts = new Map<number, number>();
for (const record of records) {
const hour = new Date(record.timestamp).getHours();
hourCounts.set(hour, (hourCounts.get(hour) || 0) + 1);
}
... | https://github.com/the-wwyang/kids-learning-app | cc1807e0071920d69de8e966d740dd00254b5684 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/services/SyncService.ets | arkts | init | 初始化同步服务 | async init(): Promise<void> {
await this.loadLastSyncTime();
this.startAutoSync();
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left init AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_type#Le... | async init(): Promise<void> {
await this.loadLastSyncTime();
this.startAutoSync();
} | https://github.com/LJ666-ui/harmony-health-care | 97a8dd6d21eaea3d7a523b1c9ca5e4db024ab9f3 | github |
openharmony/codelabs | Security/StringCipherArkTS/entry/src/main/ets/pages/Login.ets | arkts | checkUserData | Verify the user name and password.
@returns | checkUserData() {
// Check whether the account or password is empty.
if (this.username === '' || this.password === '') {
PromptUtil.promptMessage($r('app.string.message_input_empty'), CommonConstants.PROMPT_TIME);
return false;
}
// RegExp for matching username.
let namePattern: RegExp... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left checkUserData 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... | checkUserData() {
// Check whether the account or password is empty.
if (this.username === '' || this.password === '') {
PromptUtil.promptMessage($r('app.string.message_input_empty'), CommonConstants.PROMPT_TIME);
return false;
}
// RegExp for matching username.
let namePattern: RegExp... | https://gitee.com/openharmony/codelabs.git | e7b604e4533b36f0334b4ca426da1926987e9b4a | gitee |
harmonyos/codelabs | HarmonyOS_NEXT/MusicHome/common/mediaCommon/src/main/ets/utils/MediaService.ets | arkts | playPrevious | Play previous music. | public playPrevious() {
switch (this.playMode) {
case MusicPlayMode.RANDOM:
this.playRandom();
break;
case MusicPlayMode.ORDER:
case MusicPlayMode.SINGLE_CYCLE:
if (this.musicIndex === 0) {
this.updateMusicIndex(this.songList.length - 1);
} else {
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left playPrevious 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 { ... | public playPrevious() {
switch (this.playMode) {
case MusicPlayMode.RANDOM:
this.playRandom();
break;
case MusicPlayMode.ORDER:
case MusicPlayMode.SINGLE_CYCLE:
if (this.musicIndex === 0) {
this.updateMusicIndex(this.songList.length - 1);
} else {
... | https://gitee.com/harmonyos/codelabs.git | 84e9b4779141574ab8a5a9a13e2212589c865a4b | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Animation/AnimatedGridState.ets | arkts | getPreviousPositions | 获取之前的位置列表 | public getPreviousPositions(): ItemPosition[] {
return Array.from(this.previousPositions.values());
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getPreviousPositions 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 I... | public getPreviousPositions(): ItemPosition[] {
return Array.from(this.previousPositions.values());
} | https://github.com/DaLongZhuaZi/manxia | 1b6aa1cfb29116c7462a6f419e5fd667de3a2cd1 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/TypeGuards.ets | arkts | isStringArray | 检查值是否为字符串数组
@param value - 要检查的值
@returns 是否为字符串数组 | static isStringArray(value: Object): boolean {
if (!TypeGuards.isArray(value)) {
return false;
}
const arrayValue = value as Array<Object>;
for (let i = 0; i < arrayValue.length; i++) {
if (!TypeGuards.isString(arrayValue[i])) {
return false;
}
}
return true;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isStringArray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left O... | static isStringArray(value: Object): boolean {
if (!TypeGuards.isArray(value)) {
return false;
}
const arrayValue = value as Array<Object>;
for (let i = 0; i < arrayValue.length; i++) {
if (!TypeGuards.isString(arrayValue[i])) {
return false;
}
}
return true;
} | https://github.com/DaLongZhuaZi/manxia | e0b247823c9a7f1df89b3d1afe18a59ab1ced753 | github |
the-wwyang/kids-learning-app | src/main/ets/utils/AudioManager.ets | arkts | playStarEarn | 播放星星获得音效 | static playStarEarn(): void {
AudioManager.getInstance().playSound(SoundType.STAR_EARN);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left playStarEarn 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#expressio... | static playStarEarn(): void {
AudioManager.getInstance().playSound(SoundType.STAR_EARN);
} | https://github.com/the-wwyang/kids-learning-app | 5dddb904f1843c2dfff48e1ddff7671bfe6a37b1 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/utils/CryptoUtil.ets | arkts | concatBytes | 合并两个字节数组 | static concatBytes(a: Uint8Array, b: Uint8Array): Uint8Array {
const result = new Uint8Array(a.length + b.length);
result.set(a, 0);
result.set(b, a.length);
return result;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left concatBytes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left a AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Uint8Ar... | static concatBytes(a: Uint8Array, b: Uint8Array): Uint8Array {
const result = new Uint8Array(a.length + b.length);
result.set(a, 0);
result.set(b, a.length);
return result;
} | https://github.com/AlkaidLab/moonlight-harmony | 4d6a7988affa296abde2da76fdf0a620d8875405 | github |
LongLiveY96/chatcube | entry/src/main/ets/services/DefaultModelService.ets | arkts | loadConfig | 加载所有配置(model + prompt 都走 Store) | async loadConfig(): Promise<void> {
await this.store.ensureDefaultModelsInitialized()
await this.store.ensurePromptsInitialized()
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left loadConfig AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_t... | async loadConfig(): Promise<void> {
await this.store.ensureDefaultModelsInitialized()
await this.store.ensurePromptsInitialized()
} | https://github.com/LongLiveY96/chatcube | 94fdad9b909f49e94c60c5413042e28b84f05324 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/SeasonalityDetectionService.ets | arkts | convertToSeasonalFactors | 转换为SeasonalFactor格式(兼容现有代码) | static convertToSeasonalFactors(results: SeasonalityAnalysisResult[]): SeasonalFactor[] {
const factors: SeasonalFactor[] = [];
for (const result of results) {
if (result.hasSeasonality) {
const factor: SeasonalFactor = {
period: result.categoryName,
factor: result.seasonali... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left convertToSeasonalFactors AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left results AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subs... | static convertToSeasonalFactors(results: SeasonalityAnalysisResult[]): SeasonalFactor[] {
const factors: SeasonalFactor[] = [];
for (const result of results) {
if (result.hasSeasonality) {
const factor: SeasonalFactor = {
period: result.categoryName,
factor: result.seasonali... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 15ca31145c39b0be874651a37377c61e731c45ca | github |
Joker-x-dev/CoolMallArkTS | feature/goods/src/main/ets/viewmodel/GoodsCategoryViewModel.ets | arkts | getOptionalString | 获取非空字符串
@param {string} value - 原始值
@returns {string | undefined} 非空字符串 | private getOptionalString(value: string): string | undefined {
const normalized: string = value.trim();
if (normalized.length === 0) {
return undefined;
}
return normalized;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getOptionalString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier... | private getOptionalString(value: string): string | undefined {
const normalized: string = value.trim();
if (normalized.length === 0) {
return undefined;
}
return normalized;
} | https://github.com/Joker-x-dev/CoolMallArkTS | ab10d7139943edbf22f26430be420df95d4d4cfa | github |
CLMC2025/Vignette | entry/src/main/ets/database/repositories/WordRepository.ets | arkts | getWordByWord | Get word by word string | async getWordByWord(wordStr: string): Promise<WordItem | null> {
this.ensureInitialized();
const predicates = new relationalStore.RdbPredicates(TABLE_WORDS);
predicates.equalTo(WordColumns.WORD, wordStr);
const resultSet = await this.store!.query(predicates);
try {
if (resultSet.goToFirst... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getWordByWord AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left word... | async getWordByWord(wordStr: string): Promise<WordItem | null> {
this.ensureInitialized();
const predicates = new relationalStore.RdbPredicates(TABLE_WORDS);
predicates.equalTo(WordColumns.WORD, wordStr);
const resultSet = await this.store!.query(predicates);
try {
if (resultSet.goToFirst... | https://github.com/CLMC2025/Vignette | f5070855da97df21d1ae372738f97e9750d03ecd | github |
arkui-x/samples | CodeLab/Cases/feature/customscan/src/main/ets/viewmodel/CustomScanViewModel.ets | arkts | constructor | 单例模型私有化构造函数,使用getInstance静态方法获得单例 | private constructor() {
// 初始化窗口管理model
const windowStage: window.WindowStage | undefined = AppStorage.get('windowStage');
if (windowStage) {
this.windowModel.setWindowStage(windowStage);
}
// 初始化相机流尺寸
this.updateCameraCompSize();
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left ... | private constructor() {
// 初始化窗口管理model
const windowStage: window.WindowStage | undefined = AppStorage.get('windowStage');
if (windowStage) {
this.windowModel.setWindowStage(windowStage);
}
// 初始化相机流尺寸
this.updateCameraCompSize();
} | https://gitcode.com/arkui-x/samples | 3a0786d8256794c29ccb8b3b17548f45750d450a | gitcode |
tdcare/tdwebrtc | src/main/ets/MediaStream.ets | arkts | startVideoEncoder | 启动视频编码器(Rust 层内部编码器) | public async startVideoEncoder(): Promise<boolean> {
if (this.videoEncoderCreated) {
const ok: boolean = WebRTC.startVideoEncoder();
LogUtil.info(`[MediaStream] Rust 视频编码器启动: ${ok}`);
return ok;
}
return false;
} | 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 startVideoEncoder AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS... | public async startVideoEncoder(): Promise<boolean> {
if (this.videoEncoderCreated) {
const ok: boolean = WebRTC.startVideoEncoder();
LogUtil.info(`[MediaStream] Rust 视频编码器启动: ${ok}`);
return ok;
}
return false;
} | https://github.com/tdcare/tdwebrtc | 738485a1258e4633968f99c258858fee06b46356 | github |
JackJiang2011/harmonychat | entry/src/main/ets/pages/model/Message.ets | arkts | createChatMsgEntity_OUTGO_TEXT | 构建一条发出的消息对象。
@param message 消息内容
@param fingerPrint 消息ID
@returns 新的消息对象 | static createChatMsgEntity_OUTGO_TEXT(message: string, fingerPrint: string): Message {
let localUid = ToolKits.getLocalUserUid();
if(!localUid) {
ClientCoreSDK.Log.error('无法读取本地用户uid,还没有登录?');
}
let cm: Message = new Message(localUid ? localUid : '', "我", Utils.getCurrentUTCTimestamp(), messag... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createChatMsgEntity_OUTGO_TEXT AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left message AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left st... | static createChatMsgEntity_OUTGO_TEXT(message: string, fingerPrint: string): Message {
let localUid = ToolKits.getLocalUserUid();
if(!localUid) {
ClientCoreSDK.Log.error('无法读取本地用户uid,还没有登录?');
}
let cm: Message = new Message(localUid ? localUid : '', "我", Utils.getCurrentUTCTimestamp(), messag... | https://github.com/JackJiang2011/harmonychat | 37b02c643e6a84769d7d4431870c9fd1589f8926 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.