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 |
|---|---|---|---|---|---|---|---|---|---|---|
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/database/DatabaseConfigOptimizer.ets | arkts | optimizeCacheSize | 优化缓存大小
配置:
- cache_size = 10000 页(约 40MB,假设每页 4KB)
优势:
- 减少磁盘 I/O:更多数据缓存在内存中
- 提升查询性能:缓存命中率提升 20-30%
- 加速索引查找:索引数据常驻内存
原理:
- SQLite 使用页缓存机制
- 默认缓存大小较小(约 2000 页)
- 增大缓存可以显著提升性能
权衡:
- 优点:性能提升明显
- 缺点:占用更多内存(约 40MB) | private static async optimizeCacheSize(store: relationalStore.RdbStore): Promise<void> {
try {
await store.executeSql('PRAGMA cache_size=10000;');
console.log('[DatabaseConfigOptimizer] ✓ 缓存大小已优化');
console.log(' - 缓存大小: 10000 页(约 40MB)');
console.log(' - 查询性能提升 20-30%');
console.l... | 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 optimizeCacheSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Le... | private static async optimizeCacheSize(store: relationalStore.RdbStore): Promise<void> {
try {
await store.executeSql('PRAGMA cache_size=10000;');
console.log('[DatabaseConfigOptimizer] ✓ 缓存大小已优化');
console.log(' - 缓存大小: 10000 页(约 40MB)');
console.log(' - 查询性能提升 20-30%');
console.l... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | fdd658dce2d18cd7119b8fa3a0d5cc67009cb4d1 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/utils/CryptoUtil.ets | arkts | readAsn1Element | 读取一个 ASN.1 元素的信息 | private static readAsn1Element(data: Uint8Array, pos: number): Asn1ElementInfo | null {
if (pos >= data.length) return null;
let offset = pos + 1; // 跳过 tag
if (offset >= data.length) return null;
let contentLength: number;
if ((data[offset] & 0x80) === 0) {
contentLength = data[offset];
... | 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 readAsn1Element AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left... | private static readAsn1Element(data: Uint8Array, pos: number): Asn1ElementInfo | null {
if (pos >= data.length) return null;
let offset = pos + 1; // 跳过 tag
if (offset >= data.length) return null;
let contentLength: number;
if ((data[offset] & 0x80) === 0) {
contentLength = data[offset];
... | https://github.com/AlkaidLab/moonlight-harmony | 5fbc4a0f03e57daf0718c7113f23e41679e7b638 | github |
openharmony/codelabs | Data/PersonalAssistantPro/entry/src/main/ets/common/utils/ResourceUtils.ets | arkts | init | 初始化工具类 | public static init(context: common.UIAbilityContext) {
// Fix: this.context -> ResourceUtils.context
ResourceUtils.context = context;
ResourceUtils.logger.info('ResourceUtils initialized');
} | AST#program#Left AST#expression_statement#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 init AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#L... | public static init(context: common.UIAbilityContext) {
// Fix: this.context -> ResourceUtils.context
ResourceUtils.context = context;
ResourceUtils.logger.info('ResourceUtils initialized');
} | https://gitcode.com/openharmony/codelabs | 5410fc0ad100912459d9f99a7d6bb9e30a41634e | gitcode |
openharmony-tpc/VCard | library/src/main/ets/components/VCardBuilder.ets | arkts | appendPhotoLine | @param encodedValue Must be encoded by BASE64
@param photoType | public appendPhotoLine(encodedValue: string, photoType: string): void {
let tmpBuilder: StringBuilder = new StringBuilder();
tmpBuilder.append(VCardConstants.PROPERTY_PHOTO);
tmpBuilder.append(VCardBuilder.VCARD_PARAM_SEPARATOR);
if (this.mIsV30OrV40) {
tmpBuilder.append(... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left appendPhotoLine AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left encodedValue AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#s... | public appendPhotoLine(encodedValue: string, photoType: string): void {
let tmpBuilder: StringBuilder = new StringBuilder();
tmpBuilder.append(VCardConstants.PROPERTY_PHOTO);
tmpBuilder.append(VCardBuilder.VCARD_PARAM_SEPARATOR);
if (this.mIsV30OrV40) {
tmpBuilder.append(... | https://gitee.com/openharmony-tpc/VCard.git | 21ec978456c975dd94f833c3af3d12ca42fe7c46 | gitee |
Joker-x-dev/CoolMallArkTS | core/ui/src/main/ets/component/title/TitleWithLine.ets | arkts | build | 构建标题组件
@returns {void} 无返回值 | build(): void {
Row() {
Column()
.width($r("app.float.space_padding_small_x"))
.height(20)
.backgroundColor(this.lineColor)
.borderRadius($r("app.float.radius_small_x"));
SpaceHorizontalSmall();
Text(this.text)
.fontSize($r("app.float.headline_large"))
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left AST#... | build(): void {
Row() {
Column()
.width($r("app.float.space_padding_small_x"))
.height(20)
.backgroundColor(this.lineColor)
.borderRadius($r("app.float.radius_small_x"));
SpaceHorizontalSmall();
Text(this.text)
.fontSize($r("app.float.headline_large"))
... | https://github.com/Joker-x-dev/CoolMallArkTS | f4b47410dfb7aed4b0b5fae31a16059c4d35d01b | github |
wuba/omni-ui | omni_component/src/main/ets/components/calendar/OmniCalendar.ets | arkts | _setListOfMonthDate | 设置月日期列表的方法 | _setListOfMonthDate(monthDate: Date) {
this.dateList = [];
let tmpDateList: Date[] = [];
let newDate = new Date(monthDate.getFullYear(), monthDate.getMonth(), 0);
let previousMonthDay = (newDate.getDay() + 1) % 7;
for (let i = 1; i <= previousMonthDay; i++) {
tmpDateList.push(new Date(newDat... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left _setListOfMonthDate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left monthDate AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Date AST#identifier#Right AST#ER... | _setListOfMonthDate(monthDate: Date) {
this.dateList = [];
let tmpDateList: Date[] = [];
let newDate = new Date(monthDate.getFullYear(), monthDate.getMonth(), 0);
let previousMonthDay = (newDate.getDay() + 1) % 7;
for (let i = 1; i <= previousMonthDay; i++) {
tmpDateList.push(new Date(newDat... | https://github.com/wuba/omni-ui | 0bc53cc943fb18c8095186be2e56477199966ece | github |
apap6628114/nga_oh | entry/src/main/ets/common/datasource/LazyDataSource.ets | arkts | updateSection | 覆写指定下标的分区并触发该位置的数据变更通知。
@param index - 目标下标
@param section - 新分区 | updateSection(index: number, section: SidebarSection): void {
this.dataList[index] = section
this.notifyDataChange(index)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateSection AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left , ... | updateSection(index: number, section: SidebarSection): void {
this.dataList[index] = section
this.notifyDataChange(index)
} | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/common/datasource/LazyDataSource.ets#L60-L63 | 5a9a8c50de0e471a5e4e0534ef4600fd771c4fa8 | github |
wuba/omni-ui | omni_component/src/main/ets/components/guide/util/ComponentRectFUtil.ets | arkts | getComponentRectF | 获取组件的矩形区域
@param parentId 父组件Id
@param componentId 组件Id
@returns 组件的矩形区域 | public static getComponentRectF(parentId: string, componentId: string): RectF | null {
if (!parentId || !componentId) {
return null;
}
let highLightContainerRect = ComponentRectFUtil.componentGlobalRect(parentId);
if (!highLightContainerRect) {
return null;
}
let componentRect = Co... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getComponentRectF AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left parentId AST#identifier#Right AST#ERROR#Left AST#:#L... | public static getComponentRectF(parentId: string, componentId: string): RectF | null {
if (!parentId || !componentId) {
return null;
}
let highLightContainerRect = ComponentRectFUtil.componentGlobalRect(parentId);
if (!highLightContainerRect) {
return null;
}
let componentRect = Co... | https://github.com/wuba/omni-ui | efb0b98007a3712743e0b6b96b2ab9c1715a98b5 | github |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/DeviceBindingService.ets | arkts | startFromGalleryImage | V0.6.x — gallery-QR path. Decode the QR from a saved image,
extract the pair token, and feed it into the existing redeem
state machine. Decoder failure / parser failure / token-length
failure all surface as TOKEN_INVALID so the UI shares the same
red-text hint as the manual short-code error path.
Server-side errors (TO... | async startFromGalleryImage(uri: string): Promise<void> {
this.transition('scanning');
let payload: string = '';
try {
payload = await this.decoder.decodeFromUri(uri);
} catch (err) {
if (err instanceof NoBarcodeFoundError) {
this.fail('TOKEN_INVALID');
return;
}
... | 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 startFromGalleryImage AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#L... | async startFromGalleryImage(uri: string): Promise<void> {
this.transition('scanning');
let payload: string = '';
try {
payload = await this.decoder.decodeFromUri(uri);
} catch (err) {
if (err instanceof NoBarcodeFoundError) {
this.fail('TOKEN_INVALID');
return;
}
... | https://github.com/terryma2024/happyword | 32d2847699b04f2b6596c94ba84996a51b9d0b0c | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/renderer/LegendRenderer.ets | arkts | drawForm | private mLineFormPath:Path2D = new Path2D();
Draws the Legend-form at the given position with the color at the given
index.
@param c canvas to draw with
@param x position
@param y position
@param entry the entry to render
@param legend the legend context | protected drawForm(
c: CanvasRenderingContext2D,
x: number, y: number,
entry: LegendEntry,
legend: Legend): void {
if (entry.formColor == ColorTemplate.COLOR_SKIP ||
entry.formColor == ColorTemplate.COLOR_NONE ||
entry.formColor == 0)
return;
let form: LegendForm = entry.form;
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left protected AST#identifier#Right AST#ERROR#Left AST#identifier#Left drawForm AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left c AST#identifier#Right AST#:#Left : AST#:#Right AST#... | protected drawForm(
c: CanvasRenderingContext2D,
x: number, y: number,
entry: LegendEntry,
legend: Legend): void {
if (entry.formColor == ColorTemplate.COLOR_SKIP ||
entry.formColor == ColorTemplate.COLOR_NONE ||
entry.formColor == 0)
return;
let form: LegendForm = entry.form;
... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 03d745ca81f2438b009a89bdd2491acddd52ff8a | gitee |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/AudioVibrationService.ets | arkts | isMusicScene | ==================== 场景判断 ==================== | private isMusicScene(): boolean {
return this.sceneMode === '音乐/节奏' || this.sceneMode === '自动';
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left isMusicScene 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... | private isMusicScene(): boolean {
return this.sceneMode === '音乐/节奏' || this.sceneMode === '自动';
} | https://github.com/AlkaidLab/moonlight-harmony | 775ef860453af500ff4bd950c893ed2c3bbcd6af | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/greater_than/greater_than_char.ets | arkts | main | ---
desc: check greater operation for two chars
--- | function main(): void {
const a: char = {{v.left}}
const b: char = {{v.right}}
assert (a > b) == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
const a: char = {{v.left}}
const b: char = {{v.right}}
assert (a > b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | b89e5b34401caad8e4a1c8dffb8715eb95928f4c | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/CoverCacheManager.ets | arkts | ensurePathInitialized | 确保路径已初始化 | private async ensurePathInitialized(): Promise<boolean> {
if (this.isPathInitialized) {
return true;
}
// 如果正在初始化,等待完成
if (this.initializationPromise) {
await this.initializationPromise;
return this.isPathInitialized;
}
// 开始初始化
this.initializationPromise = this... | 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 ensurePathInitialized AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#R... | private async ensurePathInitialized(): Promise<boolean> {
if (this.isPathInitialized) {
return true;
}
// 如果正在初始化,等待完成
if (this.initializationPromise) {
await this.initializationPromise;
return this.isPathInitialized;
}
// 开始初始化
this.initializationPromise = this... | https://github.com/DaLongZhuaZi/manxia | 9b17084fe10c42e0a963cacd85f34f291641012f | github |
richshaw2015/nds | ohos/entry/src/main/ets/pages/settings/GameConfigSettings.ets | arkts | getGbaSlotOptions | 对齐 Android string-array: gba_slot_options
Rumble Pak 在 commit 73d5ce0 加入,nightly-release 已包含 | function getGbaSlotOptions(): SelectOption[] {
return [
{ value: GbaSlotType.NONE, label: I18n.t('opt_none') },
{ value: GbaSlotType.GBA_ROM, label: 'GBA ROM' },
{ value: GbaSlotType.RUMBLE_PAK, label: 'Rumble Pak' },
{ value: GbaSlotType.MEMORY_EXPANSION, label: I18n.t('opt_memory_expansion') }
];
... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getGbaSlotOptions 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#array_typ... | function getGbaSlotOptions(): SelectOption[] {
return [
{ value: GbaSlotType.NONE, label: I18n.t('opt_none') },
{ value: GbaSlotType.GBA_ROM, label: 'GBA ROM' },
{ value: GbaSlotType.RUMBLE_PAK, label: 'Rumble Pak' },
{ value: GbaSlotType.MEMORY_EXPANSION, label: I18n.t('opt_memory_expansion') }
];
... | https://github.com/richshaw2015/nds | 16dfd71f202ad71de2099ec7eefecb182f334e7f | github |
admundhou/mshijie | product/default/src/main/ets/controller/VideoController.ets | arkts | initPlayPageThis | Obtains the this object of the PlayPage.
@param playPageThis This object of PlayPage. | initPlayPageThis(playPageThis) {
this.playPageThis = playPageThis;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left initPlayPageThis AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left playPageThis AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Righ... | initPlayPageThis(playPageThis) {
this.playPageThis = playPageThis;
} | https://github.com/admundhou/mshijie | ec11aff73418dbcd0688d6400e7412362cc58e4b | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/ComicInfoParser.ets | arkts | handleTagValue | 处理XML标签和标签值(备用方法)
@param name 标签名
@param value 标签值
@returns 是否继续解析 | private handleTagValue(name: string, value: string): boolean {
try {
// 主要的XML解析逻辑已移至handleTokenValue方法
// 这里保留作为备用,记录调试信息
logger.debug(TAG, `tagValueCallback: name="${name}", value="${value}"`);
return true;
} catch (error) {
logger.error(TAG, '处理XML标签值时出错' + error);
retur... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left handleTagValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | private handleTagValue(name: string, value: string): boolean {
try {
// 主要的XML解析逻辑已移至handleTokenValue方法
// 这里保留作为备用,记录调试信息
logger.debug(TAG, `tagValueCallback: name="${name}", value="${value}"`);
return true;
} catch (error) {
logger.error(TAG, '处理XML标签值时出错' + error);
retur... | https://github.com/DaLongZhuaZi/manxia | 3b6b1b2904f74f46c02adf0bc77254999e9e5098 | github |
LongLiveY96/chatcube | entry/src/main/ets/state/AppSettingsStore.ets | arkts | setCurrentAssistantIdPersisted | 更新 currentAssistantId:写 Preferences + 同步到 state。
空串会被规整为 DEFAULT_ASSISTANT_ID,语义与 PreferencesService 保持一致 | async setCurrentAssistantIdPersisted(assistantId: string): Promise<void> {
const normalized = assistantId.trim() !== '' ? assistantId.trim() : DEFAULT_ASSISTANT_ID
await this.preferences.setCurrentAssistantId(normalized)
this.setCurrentAssistantIdInMemory(normalized)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left setCurrentAssistantIdPersisted AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left assistantId AST#identifier#Right AST#type_annota... | async setCurrentAssistantIdPersisted(assistantId: string): Promise<void> {
const normalized = assistantId.trim() !== '' ? assistantId.trim() : DEFAULT_ASSISTANT_ID
await this.preferences.setCurrentAssistantId(normalized)
this.setCurrentAssistantIdInMemory(normalized)
} | https://github.com/LongLiveY96/chatcube | 4d59aecd111b1bc617fd992a0f87c7c9d2f2735a | github |
Joker-x-dev/CoolMallArkTS | feature/goods/src/main/ets/viewmodel/GoodsCategoryViewModel.ets | arkts | parseCategoryIds | 解析分类 ID 列表
@param {string} typeIdParam - 分类参数
@returns {number[]} 分类 ID 列表 | private parseCategoryIds(typeIdParam: string): number[] {
if (typeIdParam.trim().length === 0) {
return [];
}
return typeIdParam
.split(",")
.map((id: string): number => Number(id.trim()))
.filter((id: number): boolean => !Number.isNaN(id) && id > 0);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left parseCategoryIds AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left typeIdParam AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AS... | private parseCategoryIds(typeIdParam: string): number[] {
if (typeIdParam.trim().length === 0) {
return [];
}
return typeIdParam
.split(",")
.map((id: string): number => Number(id.trim()))
.filter((id: number): boolean => !Number.isNaN(id) && id > 0);
} | https://github.com/Joker-x-dev/CoolMallArkTS | 7962d45bbf3455d27435f26bc323cbed57ef481b | github |
arkui-x/samples | CodeLab/Cases/feature/danmakuplayer/src/main/ets/model/DanmakuVideoPlayer.ets | arkts | onDanmakuLongClick | 弹幕长按逻辑 | onDanmakuLongClick(danmakus: IDanmakus): boolean {
return false;
}; | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onDanmakuLongClick AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left danmakus AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left IDanmakus AST#identifier#Right AS... | onDanmakuLongClick(danmakus: IDanmakus): boolean {
return false;
}; | https://gitcode.com/arkui-x/samples | b5b9ef75a501a5721291bf1ca3f77e213052be47 | gitcode |
silence17/harmonydemo | common_lib/src/main/ets/utils/axios/HttpClient.ets | arkts | batch | 批量请求, 一般用于页面内多个平行请求
仅支持 promise方式调用 , 即各子请求内 不能带有success fail 等回调函数
showLoading 支持 Boolean 和 对象(loading参数) | batch(requests = [], showLoading = true) {
if (showLoading) {
Utils.showLoading()
}
let ps = new Promise((res, rej) => {
Promise.all(requests).then((rss) => res(rss)).catch(rej).finally(() => {
if (showLoading) {
Utils.hideLoading()
}
});
});
return ps;
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left batch AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#assignment_expression#Left AST#identifier#Left requests AST#identifier#Right AST#=#Left = AST#=#Right AST#array#Left AST#[#Left [ AST#[#Right AST#]#Left ... | batch(requests = [], showLoading = true) {
if (showLoading) {
Utils.showLoading()
}
let ps = new Promise((res, rej) => {
Promise.all(requests).then((rss) => res(rss)).catch(rej).finally(() => {
if (showLoading) {
Utils.hideLoading()
}
});
});
return ps;
... | https://github.com/silence17/harmonydemo | 83557fd56ef2fdb94f4ff7ddb8b450ad45623028 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/common/utils/DAOHelper.ets | arkts | toError | 统一错误处理
将各种类型的错误转换为标准Error对象
@param message 错误消息前缀
@param err 原始错误对象
@returns 标准Error对象 | static toError(message: string, err: Error | string | object): Error {
let details = '';
try {
if (typeof err === 'string') {
details = err;
} else if (err instanceof Error) {
details = err.message;
} else {
details = JSON.stringify(err);
}
} catch (_) {
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left toError 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 string AST#string#Right A... | static toError(message: string, err: Error | string | object): Error {
let details = '';
try {
if (typeof err === 'string') {
details = err;
} else if (err instanceof Error) {
details = err.message;
} else {
details = JSON.stringify(err);
}
} catch (_) {
... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 67b5115b5f122df67820fbacce85b5a22d535530 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Services/GlobalSearchService.ets | arkts | classifyTasksByGroup | 根据分组类型对任务进行分类 | private classifyTasksByGroup(
groups: SearchSourceGroup[],
tasks: Array<() => Promise<void>>
): ClassifiedTasks {
const result: ClassifiedTasks = {
local: [],
mangaHttp: [],
mangaWebView: [],
novel: [],
suwayomi: []
};
// tasks 和 groups 是一一对应的(同一顺序添加)
for ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left classifyTasksByGroup AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left groups AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscr... | private classifyTasksByGroup(
groups: SearchSourceGroup[],
tasks: Array<() => Promise<void>>
): ClassifiedTasks {
const result: ClassifiedTasks = {
local: [],
mangaHttp: [],
mangaWebView: [],
novel: [],
suwayomi: []
};
// tasks 和 groups 是一一对应的(同一顺序添加)
for ... | https://github.com/DaLongZhuaZi/manxia | b07c5d042c3bd81acc6d85f8d643e190b7ed9936 | github |
offlinecat-dev/OCNetORM | src/main/ets/query/PaginatedResult.ets | arkts | create | 创建成功的分页结果
@param data 当前页数据
@param total 总记录数
@param page 当前页码
@param pageSize 每页数量
@returns PaginatedResult 实例 | static create(data: Array<EntityData>, total: number, page: number, pageSize: number): PaginatedResult {
return new PaginatedResult(data, total, page, pageSize)
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left create 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#instantiation_expression#... | static create(data: Array<EntityData>, total: number, page: number, pageSize: number): PaginatedResult {
return new PaginatedResult(data, total, page, pageSize)
} | https://github.com/offlinecat-dev/OCNetORM | fa44fdbf98af1a474aacfc7a763006f1d919c322 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/Description.ets | arkts | setText | Sets the text to be shown as the description.
@param text | public setText(text: string): void {
this.text = text;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string A... | public setText(text: string): void {
this.text = text;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 1bb8592ec18ceda474424c792f2ec9651d3eac5d | gitee |
dingzhilin1990/zhilinclaw | src/adapters/AIModelAdapter.ets | arkts | loadModel | 加载本地模型 | public async loadModel(modelPath: string): Promise<boolean> {
try {
console.log('[LocalAIModelAdapter] 加载本地模型:', modelPath);
// 实际项目中应加载模型文件
this.modelLoaded = true;
return true;
} catch (error) {
console.error('[LocalAIModelAdapter] 加载模型失败:', error);
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 loadModel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left modelPath AST#identifier#Right AST#ERROR#Left AST#:#Left : AS... | public async loadModel(modelPath: string): Promise<boolean> {
try {
console.log('[LocalAIModelAdapter] 加载本地模型:', modelPath);
// 实际项目中应加载模型文件
this.modelLoaded = true;
return true;
} catch (error) {
console.error('[LocalAIModelAdapter] 加载模型失败:', error);
return false;
}
... | https://github.com/dingzhilin1990/zhilinclaw | 0c6e40a75450a2de523148d62d240a0bcc1a5253 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | internal | Fills the Uint8Array with specified value
@param value new valuy
@returns modified Uint8Array
public | /* public */ internal fill(value: number, start: int, end: int): Uint8Array {
throw new Error("not implemented")
} | AST#program#Left AST#comment#Left /* public */ AST#comment#Right AST#ERROR#Left AST#call_expression#Left AST#identifier#Left internal AST#identifier#Right AST#ERROR#Left AST#identifier#Left fill AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST... | /* public */ internal fill(value: number, start: int, end: int): Uint8Array {
throw new Error("not implemented")
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 2b63d8253997487eb970192aaaf5948b72dfd327 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/ReflectStaticMethod.ets | arkts | equals | Compare whether the current Static Method object is equal to another object.
@param { StaticMethod } other - Another Static Method object used for comparison.
@returns { boolean } If two objects point to the same method, return true; otherwise, return false.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public equals(other: StaticMethod): boolean {
return this.methodPtr == other.methodPtr
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left equals 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 StaticMe... | public equals(other: StaticMethod): boolean {
return this.methodPtr == other.methodPtr
} | https://gitcode.com/iop123123/arkts-static-skills | 1e3fb01ef0710ad88006b978f2eff8b5eb15eef7 | gitcode |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/services/CloudStore.ets | arkts | pullNowAsync | 手动触发拉取同步 (返回 Promise, 等待所有表完成) | pullNowAsync(): Promise<void> {
return new Promise<void>((resolve) => {
if (!this.store) { resolve(); return; }
let completedCount: number = 0;
const totalTables: number = TABLES.length;
for (let i = 0; i < totalTables; i++) {
const tbl: string = TABLES[i];
this.store.cloud... | AST#program#Left AST#expression_statement#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left pullNowAsync 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#i... | pullNowAsync(): Promise<void> {
return new Promise<void>((resolve) => {
if (!this.store) { resolve(); return; }
let completedCount: number = 0;
const totalTables: number = TABLES.length;
for (let i = 0; i < totalTables; i++) {
const tbl: string = TABLES[i];
this.store.cloud... | https://github.com/Mydstiny/RemoteDeskHarmonyOS | 0120d4df1ee02d51cf09d3165f31da19fe8c2cfe | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/left_shift/left_shift_int.ets | arkts | main | ---
desc: check left shift operation for integer
--- | function main(): void {
const a: int = {{v.left}}
const b: int = {{v.right}}
assert (a << b) == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
const a: int = {{v.left}}
const b: int = {{v.right}}
assert (a << b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | e453c8cf22501a59650b011ff777ec2551b3407b | gitee |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/services/DataCrypto.ets | arkts | isSetupComplete | 是否已完成初始设置 (检查盐值是否存在) | isSetupComplete(): boolean {
try {
const salt = this.getCloudPref('crypto_salt');
return salt.length > 0;
} catch (_e) {
return false;
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isSetupComplete AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#sta... | isSetupComplete(): boolean {
try {
const salt = this.getCloudPref('crypto_salt');
return salt.length > 0;
} catch (_e) {
return false;
}
} | https://github.com/Mydstiny/RemoteDeskHarmonyOS | 340b64fcf69f2fdd40d1904da56e84d7d057b431 | github |
Joker-x-dev/HarmonyKit | feature/demo/src/main/ets/viewmodel/StateManagementViewModel.ets | arkts | reset | 重置计数
@returns {void} 无返回值 | reset(): void {
this.counterState.reset();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left reset 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#Left A... | reset(): void {
this.counterState.reset();
} | https://github.com/Joker-x-dev/HarmonyKit | 95f90ab40a931605c3a3723ac64adf90203fa807 | github |
pangpang20/antennaPodHM | entry/src/main/ets/service/PlayerService.ets | arkts | waitForState | 等待播放器到达指定状态(带超时) | private waitForState(targetState: string, timeoutMs: number = 5000): Promise<void> {
return new Promise<void>((resolve: () => void, reject: (reason: Error) => void) => {
const startTime = Date.now();
const checkState = (): void => {
if (this.avPlayer?.state === targetState) {
resolve... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left waitForState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left targetState AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#st... | private waitForState(targetState: string, timeoutMs: number = 5000): Promise<void> {
return new Promise<void>((resolve: () => void, reject: (reason: Error) => void) => {
const startTime = Date.now();
const checkState = (): void => {
if (this.avPlayer?.state === targetState) {
resolve... | https://github.com/pangpang20/antennaPodHM | b26b275198aa6892ce307751ed0cae3352a9e5e0 | github |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/model/SessionState.ets | arkts | cleanup | Clean up session resources | cleanup(): void {
console.info('SessionState: Cleaning up session resources');
if (this.pixelMap) {
this.pixelMap.release();
this.pixelMap = null;
}
this.uiEventListener = null;
this.connectionState = ConnectionState.DISCONNECTED;
this.instance = 0;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left cleanup 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#Left... | cleanup(): void {
console.info('SessionState: Cleaning up session resources');
if (this.pixelMap) {
this.pixelMap.release();
this.pixelMap = null;
}
this.uiEventListener = null;
this.connectionState = ConnectionState.DISCONNECTED;
this.instance = 0;
} | https://github.com/tangwengang-del/freerdp-harmonyos | 2edc5c9b0f5ab4c76386e85298c01fb856979a4b | github |
CLMC2025/Vignette | entry/src/main/ets/manager/UserStateManager.ets | arkts | isSimilarToKnownWord | 判断是否与用户已复习词汇相似 | private isSimilarToKnownWord(word: string): boolean {
// 检查词根相似性
const entries: Array<[string, string[]]> = Array.from(this.wordRootMap.entries());
for (let i: number = 0; i < entries.length; i++) {
const root: string = entries[i][0];
const words: string[] = entries[i][1];
if (words.incl... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left isSimilarToKnownWord AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left word AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi... | private isSimilarToKnownWord(word: string): boolean {
// 检查词根相似性
const entries: Array<[string, string[]]> = Array.from(this.wordRootMap.entries());
for (let i: number = 0; i < entries.length; i++) {
const root: string = entries[i][0];
const words: string[] = entries[i][1];
if (words.incl... | https://github.com/CLMC2025/Vignette | 855ac3046c45a0842e28391523ed5d8bc5575d19 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/utils/ViewPortHandler.ets | arkts | getMatrixTouch | Returns the charts-touch matrix used for translation and scale on touch.
@return | public getMatrixTouch(): Matrix {
return this.mMatrixTouch;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getMatrixTouch 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 Matrix ... | public getMatrixTouch(): Matrix {
return this.mMatrixTouch;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | d4b9437a65e9d72a5126c14ab993f39a10fb4c08 | gitee |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/PieChartModel.ets | arkts | setCenterText | Sets the text String that is displayed in the center of the PieChart.
@param text | public setCenterText(text: string /*CharSequence*/
): void {
if (text == null)
this.mCenterText = "";
else {
this.mCenterText = text;
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setCenterText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left st... | public setCenterText(text: string /*CharSequence*/
): void {
if (text == null)
this.mCenterText = "";
else {
this.mCenterText = text;
}
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | f4550ee246fa3264f968107bd32daee47c9c02a2 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/ThemeManager.ets | arkts | getThemeConfigSync | 获取主题配置(同步) | public getThemeConfigSync(theme?: ThemeType): ThemeConfig {
const targetTheme = theme || this.getActualThemeSync();
return THEME_CONFIGS[targetTheme];
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getThemeConfigSync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left theme AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#ERR... | public getThemeConfigSync(theme?: ThemeType): ThemeConfig {
const targetTheme = theme || this.getActualThemeSync();
return THEME_CONFIGS[targetTheme];
} | https://github.com/DaLongZhuaZi/manxia | 2dd25e39b49faafbce8603c1a7c7a72536afe295 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/SmartCategoryDAO.ets | arkts | getCorrectPredictions | 查询正确的预测记录(用于模型评估) | static async getCorrectPredictions(
userId: number,
limit: number = 100
): Promise<SmartCategoryTraining[]> {
try {
const store = DatabaseManager.getDatabase();
const sql = `
SELECT *
FROM ${SmartCategoryTraining.tableName}
WHERE user_id = ? AND is_correct = 1 AND is_... | 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 getCorrectPredictions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#... | static async getCorrectPredictions(
userId: number,
limit: number = 100
): Promise<SmartCategoryTraining[]> {
try {
const store = DatabaseManager.getDatabase();
const sql = `
SELECT *
FROM ${SmartCategoryTraining.tableName}
WHERE user_id = ? AND is_correct = 1 AND is_... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | b29d04b6bbcaff90ae1d1dfa060d7c8db4846e89 | github |
openharmony-tpc/ImageKnife | library/src/main/ets/ImageKnife.ets | arkts | getCurrentCacheSize | gets the current cache size
@param cacheType
@returns | getCurrentCacheSize(cacheType: CacheStrategy): number | undefined {
if (cacheType == undefined || cacheType == CacheStrategy.Default) {
cacheType = CacheStrategy.Memory;
}
if (cacheType == CacheStrategy.Memory) {
return (this.memoryCache as MemoryLruCache).currentMemory;
} else {
if ... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getCurrentCacheSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left cacheType AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ident... | getCurrentCacheSize(cacheType: CacheStrategy): number | undefined {
if (cacheType == undefined || cacheType == CacheStrategy.Default) {
cacheType = CacheStrategy.Memory;
}
if (cacheType == CacheStrategy.Memory) {
return (this.memoryCache as MemoryLruCache).currentMemory;
} else {
if ... | https://gitee.com/openharmony-tpc/ImageKnife.git | dde2f0dbd59328572875bc97d89beee255f65a08 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets | arkts | applyAndPredicate | 处理 and 逻辑运算 | private applyAndPredicate(elements: string[], predicateStr: string): string[] {
const parts = predicateStr.split(/\s+and\s+/);
let result = elements;
for (const part of parts) {
const pred = this.parseXPathPredicate(part.trim());
result = this.applyXPathPredicate(result, pred);
}
retur... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left applyAndPredicate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left elements AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#... | private applyAndPredicate(elements: string[], predicateStr: string): string[] {
const parts = predicateStr.split(/\s+and\s+/);
let result = elements;
for (const part of parts) {
const pred = this.parseXPathPredicate(part.trim());
result = this.applyXPathPredicate(result, pred);
}
retur... | https://github.com/DaLongZhuaZi/manxia | 7743d75b3c39406c95c81684ae5d235b34f0592b | github |
HarmonyOS_Samples/MusicHome | products/default/src/main/ets/entryability/EntryAbility.ets | arkts | onDestroy | Ability lifecycle teardown hook. | onDestroy() {
Logger.info('EntryAbility: Ability onDestroy');
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onDestroy 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 AST... | onDestroy() {
Logger.info('EntryAbility: Ability onDestroy');
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | 0d82d00a96a17db3bb20fea9e649026cee7a826a | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/BackgroundStreamService.ets | arkts | start | 启动后台保活
在串流连接建立后调用,防止进入后台时被系统冻结
@param context UIAbilityContext
@param gameName 当前串流的游戏名称(用于播控中心展示)
@param callbacks 播控中心操作回调(stop → 断开串流) | async start(context: common.UIAbilityContext, gameName?: string, callbacks?: BroadcastControlCallbacks): Promise<void> {
if (this.isRunning) {
console.info(`${TAG} 已在运行,跳过重复启动`);
return;
}
this.context = context;
this.gameName = gameName || 'Moonlight 串流';
this.controlCallbacks = call... | 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#required_parameter#Left AST#identifier#Left context AST#identifier#Right AST#type_a... | async start(context: common.UIAbilityContext, gameName?: string, callbacks?: BroadcastControlCallbacks): Promise<void> {
if (this.isRunning) {
console.info(`${TAG} 已在运行,跳过重复启动`);
return;
}
this.context = context;
this.gameName = gameName || 'Moonlight 串流';
this.controlCallbacks = call... | https://github.com/AlkaidLab/moonlight-harmony | 1bf7e944dfac8874e5c4d2bce1426f3ef914edd8 | github |
openharmony-sig/applications_calculator | feature/calculation/src/main/ets/calculator/Evaluator.ets | arkts | handleMemoryChange | handleMemoryChange
@param operator string | private async handleMemoryChange(operator: string): Promise<void> {
let memory: string = await this.getMemory();
if (memory !== NAN) {
let tmp: string = this.result || this.expression;
if (tmp === ERROR_CODE || (tmp === '' && this.expression === '')) {
return;
}
if (this.calcul... | 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 handleMemoryChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left operator AST#identifier#Right AST#ERROR#Left AST#... | private async handleMemoryChange(operator: string): Promise<void> {
let memory: string = await this.getMemory();
if (memory !== NAN) {
let tmp: string = this.result || this.expression;
if (tmp === ERROR_CODE || (tmp === '' && this.expression === '')) {
return;
}
if (this.calcul... | https://gitee.com/openharmony-sig/applications_calculator.git | 9c0cf7dcb7f11f5a9639c95a0a3ce2a919d80566 | gitee |
Joker-x-dev/CoolMallArkTS | feature/order/src/main/ets/viewmodel/OrderListViewModel.ets | arkts | handleRebuy | 处理再次购买逻辑
@param {Order} order - 订单信息
@returns {void} 无返回值 | handleRebuy(order: Order): void {
this.rebuyCurrentOrder = null;
this.rebuyCartList = [];
const cartList: Cart[] = this.convertOrderGoodsToCart(order);
if (cartList.length > 1) {
this.rebuyCurrentOrder = order;
this.rebuyCartList = cartList;
this.showRebuyModal();
return;
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left handleRebuy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left order AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Order AST#identifier#Right AST#)#Left ) AST... | handleRebuy(order: Order): void {
this.rebuyCurrentOrder = null;
this.rebuyCartList = [];
const cartList: Cart[] = this.convertOrderGoodsToCart(order);
if (cartList.length > 1) {
this.rebuyCurrentOrder = order;
this.rebuyCartList = cartList;
this.showRebuyModal();
return;
... | https://github.com/Joker-x-dev/CoolMallArkTS | a84f562154211445c3198a29a3af2a9ed006947a | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/PieChartModel.ets | arkts | setCenterTextColor | Sets the color of the center text of the PieChart.
@param color | public setCenterTextColor(color: number): void {
( /*(PieChartRenderer)*/
this.mRenderer as PieChartRenderer).getPaintCenterText().setColor(color);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setCenterTextColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left color AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | public setCenterTextColor(color: number): void {
( /*(PieChartRenderer)*/
this.mRenderer as PieChartRenderer).getPaintCenterText().setColor(color);
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 70575c109e7bf721065928a58d78bba1c54544e1 | gitee |
openharmony/codelabs | Distributed/DistributeDraw/entry/src/main/ets/pages/Index.ets | arkts | onTouchEvent | Draw events.
@param event Touch event. | onTouchEvent(event: TouchEvent): void {
let positionX: number = event.touches[0].x;
let positionY: number = event.touches[0].y;
switch (event.type) {
case TouchType.Down: {
this.canvasContext.beginPath();
this.canvasContext.lineWidth = CommonConstants.CANVAS_LINE_WIDTH;
this.... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onTouchEvent 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#identifier#Right AST#)#Left... | onTouchEvent(event: TouchEvent): void {
let positionX: number = event.touches[0].x;
let positionY: number = event.touches[0].y;
switch (event.type) {
case TouchType.Down: {
this.canvasContext.beginPath();
this.canvasContext.lineWidth = CommonConstants.CANVAS_LINE_WIDTH;
this.... | https://gitee.com/openharmony/codelabs.git | 9e150f5036f173c09dce89ef3a5c7a818969a455 | gitee |
HarmonyOS_Samples/sample_in_harmonyos | features/devpractices/src/main/ets/model/ImageModel.ets | arkts | pinchGestureStart | Pinch gesture recognition successful callback. | pinchGestureStart(event: GestureEvent): void {
this.center = this.evaluateCenter(event.pinchCenterX, event.pinchCenterY);
this.centerX = 1 - this.center[0];
this.centerY = 1 - this.center[1];
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left pinchGestureStart 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 GestureEvent AST#identifier#Right AST... | pinchGestureStart(event: GestureEvent): void {
this.center = this.evaluateCenter(event.pinchCenterX, event.pinchCenterY);
this.centerX = 1 - this.center[0];
this.centerY = 1 - this.center[1];
} | https://gitcode.com/HarmonyOS_Samples/sample_in_harmonyos | 6405f5140d072ae789b3efcd87fea324b39faa69 | gitcode |
HarmonyOS_Samples/guide-snippets | ArkGraphics3D/entry/src/main/ets/arkgraphic/resource.ets | arkts | createMaterialPromise | [Start create_material_promise] | function createMaterialPromise(): Promise<Material> {
return new Promise((resolve, reject) => {
// Ensure the scene is loaded before accessing sceneFactory
if (globalScene) {
let sceneFactory: SceneResourceFactory = globalScene.getResourceFactory();
let sceneMaterialParameter: SceneResourceParamet... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left createMaterialPromise 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#gener... | function createMaterialPromise(): Promise<Material> {
return new Promise((resolve, reject) => {
// Ensure the scene is loaded before accessing sceneFactory
if (globalScene) {
let sceneFactory: SceneResourceFactory = globalScene.getResourceFactory();
let sceneMaterialParameter: SceneResourceParamet... | https://gitcode.com/HarmonyOS_Samples/guide-snippets | 543308a14020ab6f211dfdcd54299abe178befde | gitcode |
the-wwyang/kids-learning-app | src/main/ets/services/LearningRecordService.ets | arkts | generateRecordId | 生成记录ID
@returns 唯一ID | static generateRecordId(): string {
return `record_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left generateRecordId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AS... | static generateRecordId(): string {
return `record_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
} | https://github.com/the-wwyang/kids-learning-app | 26269818fab1326334a02196015e25aa3d19507b | github |
Joker-x-dev/CoolMallArkTS | feature/main/src/main/ets/viewmodel/MeViewModel.ets | arkts | loadRecentFootprints | 加载最近足迹
@returns {void} 无返回值 | private loadRecentFootprints(): void {
this.footprintRepository.getRecentFootprints(8)
.then((data: Footprint[]): void => {
this.recentFootprints = data;
})
.catch((): void => {
this.recentFootprints = [];
});
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left loadRecentFootprints 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 AS... | private loadRecentFootprints(): void {
this.footprintRepository.getRecentFootprints(8)
.then((data: Footprint[]): void => {
this.recentFootprints = data;
})
.catch((): void => {
this.recentFootprints = [];
});
} | https://github.com/Joker-x-dev/CoolMallArkTS | 55e74aaabcda01616f536692706f67bd2eb4bec7 | github |
openharmony/developtools_profiler | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/animation/ChartAnimator.ets | arkts | animateX | Animates values along the X axis, in a linear fashion.
@param durationMillis animation duration | public animateX(durationMillis: number) {
animateX(durationMillis, Easing.Linear);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left animateX AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left durationMillis AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number... | public animateX(durationMillis: number) {
animateX(durationMillis, Easing.Linear);
} | https://gitee.com/openharmony/developtools_profiler.git | 7fad5fed607d89ae47a1ea65d5d9f4a25f6cc9f7 | gitee |
jjjjjjava/ffmpeg_tools | src/main/ets/ffmpeg/FFmpegCommandBuilder.ets | arkts | audioBitrate | 设置音频码率 | public audioBitrate(bitrate: string): FFmpegCommandBuilder {
this.aBitrate = bitrate;
return this;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left audioBitrate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left bitrate AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Ri... | public audioBitrate(bitrate: string): FFmpegCommandBuilder {
this.aBitrate = bitrate;
return this;
} | https://github.com/jjjjjjava/ffmpeg_tools | f253f3ff6f8e18768b7d40c236cc24eb2282f80f | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test20_original_index.ets | arkts | testDeepEquality | --- Deep equality === chains --- | function testDeepEquality(): string {
let a: number = 42;
let b: number = 42;
let c: number = 43;
let eq1: boolean = a === b;
let eq2: boolean = a === c;
let neq: boolean = a !== c;
return String(eq1) + ',' + String(eq2) + ',' + String(neq);
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testDeepEquality AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined... | function testDeepEquality(): string {
let a: number = 42;
let b: number = 42;
let c: number = 43;
let eq1: boolean = a === b;
let eq2: boolean = a === c;
let neq: boolean = a !== c;
return String(eq1) + ',' + String(eq2) + ',' + String(neq);
} | https://github.com/miaochiahao/ark-ghidra | 91de4c950297cae89916173fbd69ecaaa52a18fb | github |
HarmonyOS_Samples/MusicHome | features/player/src/main/ets/viewmodel/PlayerViewModel.ets | arkts | songTitle | Title string for the current track, or empty when none. | public songTitle(): string | Resource {
const track = this.currentTrack();
return track !== undefined ? track.title : '';
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left songTitle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left AST#i... | public songTitle(): string | Resource {
const track = this.currentTrack();
return track !== undefined ? track.title : '';
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | e14f7ab0c2b27e4cbe9199565b96ab15a42e513f | gitcode |
harmonyos/codelabs | HarmonyOS_NEXT/DistributedContacts/entry/src/main/ets/viewmodel/PageViewModel.ets | arkts | getSelectAll | Select all data. | getSelectAll(checkList: Array<ListItemData>): Array<ListItemData> {
checkList.forEach((item: ListItemData) => {
item.checked = true;
});
return checkList;
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getSelectAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left checkList AST#identifier#Right AST#ERROR#L... | getSelectAll(checkList: Array<ListItemData>): Array<ListItemData> {
checkList.forEach((item: ListItemData) => {
item.checked = true;
});
return checkList;
} | https://gitee.com/harmonyos/codelabs.git | 37525cbb500266648d3babe3d77885f690c4e3b1 | gitee |
revalue-o/HarmonyOS-Next-Hook-demo | source_codes/ArkTS-inject/entry/src/main/ets/utils/SecurityCheckUtil.ets | arkts | getSysIntegrityDescription | 获取系统完整性检测的说明 | static getSysIntegrityDescription(): string {
return '系统完整性检测用于检测设备环境的安全状态,包括:\n' +
'- 越狱检测 (jailbreak)\n' +
'- 模拟器检测 (emulator)\n' +
'- 攻击检测 (attack)\n' +
'- 风险等级评估 (basicIntegrity)';
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getSysIntegrityDescription AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left... | static getSysIntegrityDescription(): string {
return '系统完整性检测用于检测设备环境的安全状态,包括:\n' +
'- 越狱检测 (jailbreak)\n' +
'- 模拟器检测 (emulator)\n' +
'- 攻击检测 (attack)\n' +
'- 风险等级评估 (basicIntegrity)';
} | https://github.com/revalue-o/HarmonyOS-Next-Hook-demo | 7b515bc7b255ecb34d53c7aeed5d76b2a4cf43be | github |
openharmony/codelabs | ETSUI/MemoTime/entry/src/main/ets/pages/Index.ets | arkts | updateSelectedDateSchedules | 更新选中日期的日程列表 | updateSelectedDateSchedules(): void {
this.selectedDateSchedules = this.schedules.filter((s: Schedule) => s.isOnDate(this.selectedDate))
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateSelectedDateSchedules 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#... | updateSelectedDateSchedules(): void {
this.selectedDateSchedules = this.schedules.filter((s: Schedule) => s.isOnDate(this.selectedDate))
} | https://gitcode.com/openharmony/codelabs | 2f81ec602b1db0bbfdf207d1fb9614a513873550 | gitcode |
openharmony/arkcompiler_taihe_ffi_gen | test/ani_tuple/user/main.ets | arkts | testMakeMixedRef | ====== Test 6: MixedRefTuple - mixed ref and primitive types ====== | function testMakeMixedRef() {
let metadata = new Record<string, string>();
metadata["key1"] = "value1";
metadata["key2"] = "value2";
let t = TupleTest.makeMixedRef("Alice", 30, 95.5, true, metadata);
console.log(
"makeMixedRef: [" + t[0] + ", " + t[1] + ", " + t[2] + ", " + t[3] +
"]... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testMakeMixedRef AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#lexical_de... | function testMakeMixedRef() {
let metadata = new Record<string, string>();
metadata["key1"] = "value1";
metadata["key2"] = "value2";
let t = TupleTest.makeMixedRef("Alice", 30, 95.5, true, metadata);
console.log(
"makeMixedRef: [" + t[0] + ", " + t[1] + ", " + t[2] + ", " + t[3] +
"]... | https://gitcode.com/openharmony/arkcompiler_taihe_ffi_gen | a0c4f57ee6496094ec8169a36897a7f964e1bb82 | gitcode |
jjjjjjava/ffmpeg_tools | src/main/ets/ffmpeg/FFmpegManager.ets | arkts | startWorkerLoop | 工作线程主循环 | private async startWorkerLoop(): Promise<void> {
FLog.info(FFmpegManager.TAG, 'Worker loop started');
while (this.isRunning) {
// 1. 等待任务(阻塞)
const task = await this.waitForTask();
if (!task || !this.isRunning) {
continue;
}
// 2. 检查任务是否已取消
if (ta... | 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 startWorkerLoop AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right A... | private async startWorkerLoop(): Promise<void> {
FLog.info(FFmpegManager.TAG, 'Worker loop started');
while (this.isRunning) {
// 1. 等待任务(阻塞)
const task = await this.waitForTask();
if (!task || !this.isRunning) {
continue;
}
// 2. 检查任务是否已取消
if (ta... | https://github.com/jjjjjjava/ffmpeg_tools | d85d0c304bbdf51550cae737c2cebfbb919b75c9 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Animation/AnimatedGridState.ets | arkts | getPreviousItems | 获取之前的条目列表 | public getPreviousItems(): T[] {
return this.previousItems.slice();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getPreviousItems 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#expre... | public getPreviousItems(): T[] {
return this.previousItems.slice();
} | https://github.com/DaLongZhuaZi/manxia | d81abbc0dcad1b9da208c9adf42dc4f6f97f306f | github |
openharmony-sig/ohos_highlightguide | library/src/main/ets/highlightguide/core/HighLightGuideBuilder.ets | arkts | setOnGuideChangedListener | 添加引导页组件的可见状态监听
@param listener 状态监听器
@returns 引导页组件的配置项 | public setOnGuideChangedListener(listener: OnGuideChangedListener | null): HighLightGuideBuilder {
this.visibleStateChangeListener = listener;
return this;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setOnGuideChangedListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left listener AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#bi... | public setOnGuideChangedListener(listener: OnGuideChangedListener | null): HighLightGuideBuilder {
this.visibleStateChangeListener = listener;
return this;
} | https://gitee.com/openharmony-sig/ohos_highlightguide.git | c276c2394a112ab06f6e4d49c67a5ca4286dbe31 | gitee |
HarmonyCandies/image_cropper | image_cropper/src/main/ets/model/Geometry.ets | arkts | fromDirection | Private properties for x and y components
Factory method to create an Offset from direction and distance | static fromDirection(direction: number, distance: number = 1.0): Offset {
return new Offset(distance * Math.cos(direction), distance * Math.sin(direction));
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left fromDirection AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left direction AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number... | static fromDirection(direction: number, distance: number = 1.0): Offset {
return new Offset(distance * Math.cos(direction), distance * Math.sin(direction));
} | https://github.com/HarmonyCandies/image_cropper/blob/dd3664946b413166307b736a5763f998084364e1/image_cropper/src/main/ets/model/Geometry.ets#L68-L70 | 135c1e37f23ab4ba5f18835419b2da118fb0c1c2 | github |
Joker-x-dev/CoolMallArkTS | core/data/src/main/ets/repository/AuthRepository.ets | arkts | loginByPhone | 手机号验证码登录
@param {Record<string, string>} params - 登录参数
@returns {Promise<NetworkResponse<Auth>>} 登录结果 | async loginByPhone(params: Record<string, string>): Promise<NetworkResponse<Auth>> {
return this.networkDataSource.loginByPhone(params);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left loginByPhone AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left params AST#identifier#Right AST#type_annotation#Left AST#:#Left : ... | async loginByPhone(params: Record<string, string>): Promise<NetworkResponse<Auth>> {
return this.networkDataSource.loginByPhone(params);
} | https://github.com/Joker-x-dev/CoolMallArkTS | 356469672aef0856f3789d26c306a8e639034d87 | github |
terryma2024/happyword | harmonyos/entry/src/ohosTest/ets/test/PackManagerFlow.ui.test.ets | arkts | wipeBoundDeviceState | Wipe the `wordmagic_cloud` (binding) keys so the device is left in
an unbound state for the next suite. Mirrors
`CloudCredentials.clearBinding` semantics: every key the snapshot
reads is overwritten with the empty string, then flushed. This is
preferred over `preferences.deletePreferences` because the test
process and ... | async function wipeBoundDeviceState(): Promise<void> {
try {
const ctx: common.Context = DELEGATOR.getAppContext();
const handle: preferences.Preferences =
await preferences.getPreferences(ctx, PREFS_CLOUD);
await handle.put('device_token', '');
await handle.put('binding_id', '');
await hand... | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left wipeBoundDeviceState AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Lef... | async function wipeBoundDeviceState(): Promise<void> {
try {
const ctx: common.Context = DELEGATOR.getAppContext();
const handle: preferences.Preferences =
await preferences.getPreferences(ctx, PREFS_CLOUD);
await handle.put('device_token', '');
await handle.put('binding_id', '');
await hand... | https://github.com/terryma2024/happyword | ebdb1e0543b5b604634cf48f74fa1574b91f334d | github |
qiuhaotc/HarmonyOSPlayground | entry/src/main/ets/utils/PreferencesUtil.ets | arkts | getLastCategory | 获取上次选择的分类 | async getLastCategory(type: BillType): Promise<string> {
if (!this.preferences) {
console.error('PreferencesUtil: 未初始化');
return '';
}
try {
const key = type === BillType.EXPENSE ? this.KEY_LAST_EXPENSE_CATEGORY : this.KEY_LAST_INCOME_CATEGORY;
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getLastCategory AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left type AST#identifier#Right AST... | async getLastCategory(type: BillType): Promise<string> {
if (!this.preferences) {
console.error('PreferencesUtil: 未初始化');
return '';
}
try {
const key = type === BillType.EXPENSE ? this.KEY_LAST_EXPENSE_CATEGORY : this.KEY_LAST_INCOME_CATEGORY;
... | https://github.com/qiuhaotc/HarmonyOSPlayground | c3178889459dd5fef5f6d295c6e2a2e319ffa450 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/07.expressions/24.equality_expressions/05.value_equality_operators_for_character/char_eq.ets | arkts | main | ---
desc: >-
The operation is a character equality if: both operands of a value equality operator are of type char;
or one operand is of type char and the other is of type Char.
The character equality operators are associative.
--- | function main(): void {
let c1 = {{c.c1}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
let c1 = {{c.c1}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 65e01a850bf40d4c4a04be86539a6476a56352b7 | gitee |
HarmonyOS_Samples/MusicHome | features/recommendation/src/main/ets/model/RecommendSongUiDataSource.ets | arkts | constructor | Copies the given songs into an internal array for lazy list rendering.
@param element - Initial private song rows. | public constructor(element: RecommendPrivateSongUi[]) {
for (let index = 0; index < element.length; index++) {
this.dataArray.push(element[index]);
}
} | 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 element AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_express... | public constructor(element: RecommendPrivateSongUi[]) {
for (let index = 0; index < element.length; index++) {
this.dataArray.push(element[index]);
}
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | 4db1c4b20cd1dbf3beeee62843f4f8fdd08402dc | gitcode |
GrassyUnknown/Health-Life-HarmonyOS-Next | entry/src/main/ets/pages/MonthCalendar.ets | arkts | onParamsChanged | 每次改变任务参数时触发 | onParamsChanged() {
this.isChanged = true;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onParamsChanged AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Le... | onParamsChanged() {
this.isChanged = true;
} | https://github.com/GrassyUnknown/Health-Life-HarmonyOS-Next | fac1e3278955e5e7255d6721c250605aeaf2ae64 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.stream.ets | arkts | constructor | The Transform constructor. | constructor() {
super();
this._writable.doWriteFunc = this.doWrite;
this._writable.doWritevFunc = this.doWritev;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A... | constructor() {
super();
this._writable.doWriteFunc = this.doWrite;
this._writable.doWritevFunc = this.doWritev;
} | https://gitcode.com/iop123123/arkts-static-skills | cb63b90bbe9a8eeed89eff0a104ae99724b5ffa1 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/String.ets | arkts | substr | The substr() method returns a portion of the string, starting at the specified
index and extending for a given number of characters afterwards. | public substr(begin: number): String {
return this.substr(begin as int);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left substr AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left begin AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number A... | public substr(begin: number): String {
return this.substr(begin as int);
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 04c4f4cb89bbfb9ad36e4889d51507c5578e9820 | gitee |
openharmony-sig/commons-cli | library/src/main/ets/components/cli/JMap.ets | arkts | size | 获取MAP元素个数 | size():number {
return this.elements.length;
}; | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left size AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statement_block#L... | size():number {
return this.elements.length;
}; | https://gitee.com/openharmony-sig/commons-cli.git | f842571ac5616a7daffb176190ab1636e9028ebc | gitee |
huangyuanlove/HelloArkUI | entry/src/main/ets/pages/playground/lynx/LynxPage.ets | arkts | build | 上面放在 rawFile 文件夹下的文件名字 | build() {
Column() {
LynxView({
templateResourceFetcher: this.templateResourceFetcher,
mediaResourceFetcher: this.mediaResourceFetcher,
genericResourceFetcher: this.genericResourceFetcher,
url: this.url,
}).width('100%').height('100%');
}
.size({ width: '100%', ... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Column() {
LynxView({
templateResourceFetcher: this.templateResourceFetcher,
mediaResourceFetcher: this.mediaResourceFetcher,
genericResourceFetcher: this.genericResourceFetcher,
url: this.url,
}).width('100%').height('100%');
}
.size({ width: '100%', ... | https://github.com/huangyuanlove/HelloArkUI | c6dba098d1d54eab2d0422f5addd9e41fac8a784 | github |
Tlntin/home-cloud-shield | entry/src/main/ets/data/DnsLogDb.ets | arkts | page | One page of matching rows, newest first. | async page(action: string, search: string, limit: number, offset: number): Promise<DnsLogRow[]> {
return this.queryRows(action, search, limit, offset);
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left page AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left action AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Ri... | async page(action: string, search: string, limit: number, offset: number): Promise<DnsLogRow[]> {
return this.queryRows(action, search, limit, offset);
} | https://github.com/Tlntin/home-cloud-shield/blob/bfd8d549ccb3e55bdfc30fa7687b31d52e4c1cc0/entry/src/main/ets/data/DnsLogDb.ets#L252-L254 | fc03c39faab74a3d3d5e43da9750efcba09425cf | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/CrashLogService.ets | arkts | cleanupOldLogs | 清理旧日志文件,保留最新的MAX_LOG_FILES个 | private async cleanupOldLogs(): Promise<void> {
try {
if (!this.logDirPath) {
return;
}
const files: string[] = [];
const dir = fileIo.listFileSync(this.logDirPath);
for (const fileName of dir) {
if (fileName.startsWith(LOG_PREFIX) && fileName.endsWith(LOG_EXT)) {
... | 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 cleanupOldLogs AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS... | private async cleanupOldLogs(): Promise<void> {
try {
if (!this.logDirPath) {
return;
}
const files: string[] = [];
const dir = fileIo.listFileSync(this.logDirPath);
for (const fileName of dir) {
if (fileName.startsWith(LOG_PREFIX) && fileName.endsWith(LOG_EXT)) {
... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/CrashLogService.ets#L370-L400 | 398f9065525e1326ee0c6c97dc089ab1724d7fcd | github |
YANGZX22/Voot | entry/src/main/ets/storage/OnboardingStorage.ets | arkts | acceptPrivacyPolicy | 标记用户已接受最新的隐私政策
@param ctx UI Ability Context | static async acceptPrivacyPolicy(ctx: common.UIAbilityContext): Promise<void> {
const prefs = await OnboardingStorage.getPrefs(ctx);
await prefs.put(OnboardingStorage.KEY_ACCEPTED_PRIVACY_VERSION, POLICY_VERSIONS.PRIVACY);
await prefs.flush();
} | 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 acceptPrivacyPolicy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ctx AST#identifier#Right AST#:#Left ... | static async acceptPrivacyPolicy(ctx: common.UIAbilityContext): Promise<void> {
const prefs = await OnboardingStorage.getPrefs(ctx);
await prefs.put(OnboardingStorage.KEY_ACCEPTED_PRIVACY_VERSION, POLICY_VERSIONS.PRIVACY);
await prefs.flush();
} | https://github.com/YANGZX22/Voot | 746a7b4c57845a8c19c8704974d102ce4ff1f73e | github |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/JsonEncodingVisitor.ets | arkts | finish | ========== 完成编码 ==========
完成编码,获取最终的 JSON 对象
@returns Protobuf JSON 格式对象 | finish(): Record<string, Object> {
return this.json
} | AST#program#Left AST#expression_statement#Left AST#sequence_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left finish 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 : A... | finish(): Record<string, Object> {
return this.json
} | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | fcea048325cbaffa8b182c02580c3e04a63529a3 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/TaskExecutor.ets | arkts | getValueByPath | 根据路径获取值 | private getValueByPath(obj: Object | undefined, path: string): Object | undefined {
if (!obj) return undefined;
const parts = path.split('.');
let current: Object | undefined = obj;
for (const part of parts) {
if (current === null || current === undefined) {
return undefined;
}
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getValueByPath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expressi... | private getValueByPath(obj: Object | undefined, path: string): Object | undefined {
if (!obj) return undefined;
const parts = path.split('.');
let current: Object | undefined = obj;
for (const part of parts) {
if (current === null || current === undefined) {
return undefined;
}
... | https://github.com/DaLongZhuaZi/manxia | ba52aecbeb079a82a7bb066d74d04a9b7c15d10b | github |
offlinecat-dev/OCNetORM | src/main/ets/logging/Logger.ets | arkts | shouldLog | 检查指定级别的日志是否应该被记录
@param requiredLevel 需要的最低日志级别
@returns 是否应该记录 | private shouldLog(requiredLevel: LogLevel): boolean {
return this.enabled && this.level >= requiredLevel
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left shouldLog AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left requiredLevel AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left LogLevel A... | private shouldLog(requiredLevel: LogLevel): boolean {
return this.enabled && this.level >= requiredLevel
} | https://github.com/offlinecat-dev/OCNetORM | 6a406aef89d402fcbf6eeee81de1918227445caa | github |
CLMC2025/Vignette | .qwen/skills/arkts-helper/arkts-snippets.ets | arkts | navigateTo | 跳转到新页面 | function navigateTo(url: string, params?: Object) {
router.pushUrl({
url: url,
params: params
})
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left navigateTo AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left url AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right ... | function navigateTo(url: string, params?: Object) {
router.pushUrl({
url: url,
params: params
})
} | https://github.com/CLMC2025/Vignette | e33484ef42ebc5ba8cc3901dab63a3eb6fd77a65 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/viewmodel/StreamViewModel.ets | arkts | quitGame | 退出远程游戏
调用服务器 API 退出当前运行的游戏并停止串流 | async quitGame(): Promise<void> {
// 调用 StreamingSession 的 quitApp 方法退出远程游戏
try {
if (this.streamingSession) {
const success = await this.streamingSession.quitApp();
if (success) {
console.info('远程游戏已退出');
} else {
console.warn('退出远程游戏失败,但已断开连接');
}
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left quitGame AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_typ... | async quitGame(): Promise<void> {
// 调用 StreamingSession 的 quitApp 方法退出远程游戏
try {
if (this.streamingSession) {
const success = await this.streamingSession.quitApp();
if (success) {
console.info('远程游戏已退出');
} else {
console.warn('退出远程游戏失败,但已断开连接');
}
... | https://github.com/AlkaidLab/moonlight-harmony | c36ebb961e83e34b1a9f45dcf589d70750ea0093 | github |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/CocosEngineHost.ets | arkts | sendToScene | Task 0.3 bridge, ArkTS -> scene direction. Serialised bridge envelopes
are delivered to the scene by evaluating a JS snippet inside the engine
VM via libcocos.so's evalString. Called from the UI thread: the engine
recognises the UI main thread (where the XComponent loaded the module)
and re-schedules the eval onto the ... | sendToScene(json: string): void {
if (!this.booted) {
hilog.warn(0x0000, 'WMBridge', 'sendToScene before boot; dropped');
return;
}
const literal: string = JSON.stringify(json);
evalString(
`if (globalThis.${SCENE_INBOUND_GLOBAL}) { globalThis.${SCENE_INBOUND_GLOBAL}(${literal}); }`
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left sendToScene AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left json AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST... | sendToScene(json: string): void {
if (!this.booted) {
hilog.warn(0x0000, 'WMBridge', 'sendToScene before boot; dropped');
return;
}
const literal: string = JSON.stringify(json);
evalString(
`if (globalThis.${SCENE_INBOUND_GLOBAL}) { globalThis.${SCENE_INBOUND_GLOBAL}(${literal}); }`
... | https://github.com/terryma2024/happyword | d4272ff724cf6324e748d87f1dea6543b1771b2f | github |
richshaw2015/nds | ohos/entry/src/main/ets/utils/WebUploadServer.ets | arkts | getUploadProgress | 获取上传进度列表 | public getUploadProgress(): UploadProgress[] {
return Array.from(this.uploadProgress.values());
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getUploadProgress 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 Uplo... | public getUploadProgress(): UploadProgress[] {
return Array.from(this.uploadProgress.values());
} | https://github.com/richshaw2015/nds | 49b2e270e61442c8d8e3d6b3471df15b95872a4b | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/store/DistributedKVService.ets | arkts | onSyncComplete | 同步完成回调 | private static onSyncComplete(data: Array<[string, number]>): void {
try {
hilog.info(DOMAIN, TAG, `Sync complete: ${JSON.stringify(data)}`);
EventBus.emit(EventBus.KV_SYNC_COMPLETE, data);
} catch (err) {
hilog.error(DOMAIN, TAG, `onSyncComplete error: ${err?.code}, ${err?.message}`);
}... | 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 onSyncComplete AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left ... | private static onSyncComplete(data: Array<[string, number]>): void {
try {
hilog.info(DOMAIN, TAG, `Sync complete: ${JSON.stringify(data)}`);
EventBus.emit(EventBus.KV_SYNC_COMPLETE, data);
} catch (err) {
hilog.error(DOMAIN, TAG, `onSyncComplete error: ${err?.code}, ${err?.message}`);
}... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/store/DistributedKVService.ets#L210-L217 | 5fe57ea5f9ed3213c921afa8df959c532767c9c9 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | of | Creates a new Int16Array using initializer
@param { FixedArray<Object> } data - initializer
@returns { Int16Array } - a new Int16Array
@throws { Error } - function not implemented
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public of(data: FixedArray<Object>): Int16Array {
throw new Error("Int16Array.of: not implemented")
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left of AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#... | public of(data: FixedArray<Object>): Int16Array {
throw new Error("Int16Array.of: not implemented")
} | https://gitcode.com/iop123123/arkts-static-skills | f310326a46d1a7e582a39e5ad40a65f17763d6dc | gitcode |
luojiang001/Pulse | Pulse/entry/src/main/ets/pages/component/Medicine/MedicineOrderDetail.ets | arkts | aboutToAppear | 获取页面路由参数 | aboutToAppear() {
const params = router.getParams() as Record<string, Object>
// 检查参数是否存在
if (params && params['order']) {
this.order = params['order'] as IOrder
}
} | 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() {
const params = router.getParams() as Record<string, Object>
// 检查参数是否存在
if (params && params['order']) {
this.order = params['order'] as IOrder
}
} | https://github.com/luojiang001/Pulse | d9149f6573a5fcfe9bc705a59089d427a986cbf5 | github |
azhu0001/localsend-harmony | serve/src/main/ets/http/impl/HttpExchangeImpl.ets | arkts | getRequestHeaders | ================== 对外接口 ================== | getRequestHeaders(): Headers {
return this.reqHeaders
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getRequestHeaders 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 Headers AST#identifier#Right AST#ERROR#Right... | getRequestHeaders(): Headers {
return this.reqHeaders
} | https://gitcode.com/azhu0001/localsend-harmony | 2bd7d4966207e81383c43e329470fd6c2ecc8dc3 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/MangaSourceEngine.ets | arkts | populateSourceSettings | 填充源级设置与登录变量到上下文 | private async populateSourceSettings(context: ActionContext): Promise<void> {
const sidStr = this.engineConfig.sourceId !== undefined ? String(this.engineConfig.sourceId as number) : '';
if (!sidStr) {
return;
}
const sid: number = Number(sidStr);
// [优化] 检查缓存
const cached = this.source... | 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 populateSourceSettings AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right A... | private async populateSourceSettings(context: ActionContext): Promise<void> {
const sidStr = this.engineConfig.sourceId !== undefined ? String(this.engineConfig.sourceId as number) : '';
if (!sidStr) {
return;
}
const sid: number = Number(sidStr);
// [优化] 检查缓存
const cached = this.source... | https://github.com/DaLongZhuaZi/manxia | fa751b61be38d131e337b24e8f11481b1fb89246 | github |
codelably/tuniao-ui | packages/main/src/main/ets/viewmodel/TnCountScrollViewModel.ets | arkts | randomUpdateValue | 随机更新动态值 | randomUpdateValue(): void {
const newVal: number = Math.floor(Math.random() * 99999);
this.dynamicValue = newVal.toString();
this.dynamicStatusText = `当前值:${this.dynamicValue}`;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left randomUpdateValue 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_... | randomUpdateValue(): void {
const newVal: number = Math.floor(Math.random() * 99999);
this.dynamicValue = newVal.toString();
this.dynamicStatusText = `当前值:${this.dynamicValue}`;
} | https://github.com/codelably/tuniao-ui | 8dfff3321486fd3f9bfee59aec6e5479984d964e | github |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/services/network/HttpClient.ets | arkts | delete | DELETE 请求 | async delete(path: string): Promise<string> {
await this.cookieStore.init();
await this.ensureCsrfToken();
const url: string = `${this.baseUrl}${path}`;
hilog.info(0x0000, TAG, 'DELETE %{public}s', url);
const headers: Record<string, string> = this.buildHeaders('application/json', 'application/jso... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left delete AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left path AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Ri... | async delete(path: string): Promise<string> {
await this.cookieStore.init();
await this.ensureCsrfToken();
const url: string = `${this.baseUrl}${path}`;
hilog.info(0x0000, TAG, 'DELETE %{public}s', url);
const headers: Record<string, string> = this.buildHeaders('application/json', 'application/jso... | https://github.com/Amaz1ny/HarmonyDO-public | 82d9ea98cfcfc38da264bf88f520120ca6a8fea6 | github |
Tianpei-Shi/MusicDash | src/model/UserModel.ets | arkts | fromCloudObject | 从CloudDB对象创建PlayHistory | static fromCloudObject(obj: CloudDBZoneObject): PlayHistory {
const history = new PlayHistory(
obj.userId as number,
obj.songId as number,
obj.songTitle as string,
obj.songArtist as string
);
history.id = obj.id as string;
history.playedTime = obj.playedTime as number;
r... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left fromCloudObject AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left obj AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left C... | static fromCloudObject(obj: CloudDBZoneObject): PlayHistory {
const history = new PlayHistory(
obj.userId as number,
obj.songId as number,
obj.songTitle as string,
obj.songArtist as string
);
history.id = obj.id as string;
history.playedTime = obj.playedTime as number;
r... | https://github.com/Tianpei-Shi/MusicDash | a33236408994c173d92e0e0aeff8263e539e19bd | github |
openharmony/codelabs | ETSUI/LifeHub/entry/src/main/ets/model/LifeHubData.ets | arkts | addReminder | ==================== 提醒模块方法 ==================== | async addReminder(reminder: Reminder): Promise<number> {
await this.ensureDatabaseReady();
if (!this.rdbStore) {
throw new Error('数据库未初始化');
}
const valuesBucket: relationalStore.ValuesBucket = {
title: reminder.title,
description: reminder.description || '',
type: reminder.ty... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left addReminder AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left reminder AST#identifier#Right AST#type_annotation#Left AST#:#Left :... | async addReminder(reminder: Reminder): Promise<number> {
await this.ensureDatabaseReady();
if (!this.rdbStore) {
throw new Error('数据库未初始化');
}
const valuesBucket: relationalStore.ValuesBucket = {
title: reminder.title,
description: reminder.description || '',
type: reminder.ty... | https://gitcode.com/openharmony/codelabs | ee5a4ae72f41053d79dfd0fbe495745b83339d4b | gitcode |
CPF-ApplicationTPC/openharmony_tpc_samples | SwipeMenuListView/library/src/main/ets/model/SwipeMenuItem.ets | arkts | getIcon | 获取菜单项图标
@returns 图标资源 | public getIcon(): ImageResourceType | undefined {
return this.icon;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getIcon AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left AST#ide... | public getIcon(): ImageResourceType | undefined {
return this.icon;
} | https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples | 9cddd9201a14f22765a2d95f5fb4881e4e6ee927 | gitcode |
arkui-x/samples | CodeLab/Cases/feature/customstepper/src/main/ets/view/CategoryView.ets | arkts | build | Radio每个选项的间隔 | build() {
Column() {
Scroll() {
Column({ space: this.ITEM_SPACE }) {
ForEach(this.categoryArray, (item: string, index: number) => {
Row() {
Radio({ value: index.toString(), group: this.group })
.checked(this.checkedIndex === index)
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Column() {
Scroll() {
Column({ space: this.ITEM_SPACE }) {
ForEach(this.categoryArray, (item: string, index: number) => {
Row() {
Radio({ value: index.toString(), group: this.group })
.checked(this.checkedIndex === index)
... | https://gitcode.com/arkui-x/samples | 043feded1296c0b09749f1f81858e4f7e1dd0b27 | gitcode |
2763981847/Clock-Alarm | entry/src/main/ets/pages/AddCityPage.ets | arkts | build | 构建页面内容。 | build() {
Column() {
BackContainer({ header: "添加城市" });
List({ scroller: new Scroller(), space: DimensionUtil.getVp($r('app.float.city_list_space')) }) {
ForEach(WorldClockViewModel.mainCities, (city: CityItem) => {
ListItem() {
Column() {
Text(`${city.city... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Column() {
BackContainer({ header: "添加城市" });
List({ scroller: new Scroller(), space: DimensionUtil.getVp($r('app.float.city_list_space')) }) {
ForEach(WorldClockViewModel.mainCities, (city: CityItem) => {
ListItem() {
Column() {
Text(`${city.city... | https://github.com/2763981847/Clock-Alarm | 7f01ffc99fe1749ac2370994944b637db175cca2 | github |
openharmony-sig/node_pool | nodepool/src/main/ets/lib/NodePool.ets | arkts | preCreateNode | 预创建节点到节点池
@param type 节点类型
@param data 数据
@param builder 封装builder对象
@returns 预创建节点是否成功 | public preCreateNode(type: string, data: ESObject, builder: WrappedBuilder<ESObject>, uiContext: UIContext): boolean {
let offlineNodes: Array<NodeItem> | undefined = this.getOfflineNodes(type);
if (!offlineNodes) {
return false;
}
let node: NodeItem = new NodeItem(builder, data, type, this);
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left preCreateNode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left st... | public preCreateNode(type: string, data: ESObject, builder: WrappedBuilder<ESObject>, uiContext: UIContext): boolean {
let offlineNodes: Array<NodeItem> | undefined = this.getOfflineNodes(type);
if (!offlineNodes) {
return false;
}
let node: NodeItem = new NodeItem(builder, data, type, this);
... | https://gitee.com/openharmony-sig/node_pool.git | da5db557d9ac146b950381af030a526816ea4458 | gitee |
openharmony/codelabs | ETSUI/HarmonyPhotoAlbum/entry/src/main/ets/service/FileService.ets | arkts | saveFileToSandbox | 将选中的图片 URI 复制到应用的沙箱目录
@param context UIAbilityContext (用于获取沙箱路径)
@param sourceUri 选择器返回的原始 URI
@returns Promise<string> 返回保存后的沙箱文件路径 | public static async saveFileToSandbox(context: common.UIAbilityContext, sourceUri: string): Promise<string> {
let fileFd = -1;
try {
// 1. 使用 fs.openSync 打开源文件 (以只读模式)
const srcFile = fs.openSync(sourceUri, fs.OpenMode.READ_ONLY);
fileFd = srcFile.fd;
// 2. 生成一个新的唯一文件名
const new... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left saveFileToSandbox AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ... | public static async saveFileToSandbox(context: common.UIAbilityContext, sourceUri: string): Promise<string> {
let fileFd = -1;
try {
// 1. 使用 fs.openSync 打开源文件 (以只读模式)
const srcFile = fs.openSync(sourceUri, fs.OpenMode.READ_ONLY);
fileFd = srcFile.fd;
// 2. 生成一个新的唯一文件名
const new... | https://gitcode.com/openharmony/codelabs | 3a7bef41162658d8dd0a17512f6e805784662a97 | gitcode |
JackJiang2011/harmonychat | entry/src/main/ets/pages/utils/ToolKits.ets | arkts | showAlertDialog | 显示对话框.
@param message 文本显示内容
@param primaryButtonText 主按钮文本
@param primaryButtonTextColor 主按钮文本颜色
@param primaryAction 主按钮Action
@param secondaryButtonText 次按钮文本
@param secondaryButtonTextColor 次按钮文本颜色
@param secondaryAction 次按钮Action | static showAlertDialog(message: ResourceStr
, primaryButtonText: string, primaryButtonTextColor: ResourceColor | undefined, primaryAction: Callback<void>
, secondaryButtonText: string, secondaryButtonTextColor: ResourceColor | undefined, secondaryAction: Callback<void>) {
AlertDialog.show(
{
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left showAlertDialog AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left message AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | static showAlertDialog(message: ResourceStr
, primaryButtonText: string, primaryButtonTextColor: ResourceColor | undefined, primaryAction: Callback<void>
, secondaryButtonText: string, secondaryButtonTextColor: ResourceColor | undefined, secondaryAction: Callback<void>) {
AlertDialog.show(
{
... | https://github.com/JackJiang2011/harmonychat | af0c8ea9e10f863060f7087626eefd94d17cd51e | github |
aimilin6688/KeePassHO | entry/src/main/ets/storage/FileStorageFactory.ets | arkts | getAllPageConfig | 获取所有存储页面配置信息
@return Array<PageConfig> 存储实现 | public static getAllPageConfig(): Array<PageConfig> {
const pageConfigs: Array<PageConfig> = [];
for (const storage of FileStorageFactory.getInstance().getStorageMap().values()) {
pageConfigs.push(storage.getPageConfig());
}
return pageConfigs;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left getAllPageConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AS... | public static getAllPageConfig(): Array<PageConfig> {
const pageConfigs: Array<PageConfig> = [];
for (const storage of FileStorageFactory.getInstance().getStorageMap().values()) {
pageConfigs.push(storage.getPageConfig());
}
return pageConfigs;
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/FileStorageFactory.ets#L136-L142 | 056501a5baf0ea88940774b40fc32144462345c4 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/common/utils/AccessibilityConfig.ets | arkts | getComponentGap | 获取组件间距 | public getComponentGap(): number {
return this.config.isElderMode ? 16 : 12; // dp
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getComponentGap 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 getComponentGap(): number {
return this.config.isElderMode ? 16 : 12; // dp
} | https://github.com/LJ666-ui/harmony-health-care | 7ece63135568eb86092bc043af04188038ec3a4c | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelSourceManager.ets | arkts | getExecutor | 获取执行器 | private getExecutor(sourceId: string): NovelSourceExecutor | null {
if (this.executors.has(sourceId)) {
return this.executors.get(sourceId)!;
}
const source = this.sources.get(sourceId);
if (!source) {
return null;
}
const executor = new NovelSourceExecutor(source);
this.exec... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getExecutor 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... | private getExecutor(sourceId: string): NovelSourceExecutor | null {
if (this.executors.has(sourceId)) {
return this.executors.get(sourceId)!;
}
const source = this.sources.get(sourceId);
if (!source) {
return null;
}
const executor = new NovelSourceExecutor(source);
this.exec... | https://github.com/DaLongZhuaZi/manxia | faa62c0ef963dcca65a5cb2fc6be36f811772d39 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.