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 |
|---|---|---|---|---|---|---|---|---|---|---|
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/microphone/MicrophoneConfig.ets | arkts | getOpusBitrate | 获取当前配置的 Opus 比特率 (bps) | static getOpusBitrate(): number {
return MicrophoneConfig.opusBitrateKbps * 1000;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getOpusBitrate 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#... | static getOpusBitrate(): number {
return MicrophoneConfig.opusBitrateKbps * 1000;
} | https://github.com/AlkaidLab/moonlight-harmony | f5a58d0e374884de6941fc34fc08c6403f8e49ef | github |
richshaw2015/nds | ohos/entry/src/main/ets/types/MelonDSNative.ets | arkts | unregisterGamepadCallbacks | 注销手柄事件回调 | static unregisterGamepadCallbacks(): void {
MelonDSNative.native.unregisterGamepadCallbacks();
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left unregisterGamepadCallbacks 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... | static unregisterGamepadCallbacks(): void {
MelonDSNative.native.unregisterGamepadCallbacks();
} | https://github.com/richshaw2015/nds | 9c454d42f35649543c6b39a452804dd538734753 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/store/AppStore.ets | arkts | addAppointment | Action: 添加预约 | public addAppointment(appointment: Omit<Appointment, 'id' | 'createdAt' | 'updatedAt'>): void {
const newAppointment: Appointment = {
title: appointment.title,
date: appointment.date,
time: appointment.time,
doctor: appointment.doctor,
hospital: appointment.hospital,
status: ap... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addAppointment AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left appointment AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Ri... | public addAppointment(appointment: Omit<Appointment, 'id' | 'createdAt' | 'updatedAt'>): void {
const newAppointment: Appointment = {
title: appointment.title,
date: appointment.date,
time: appointment.time,
doctor: appointment.doctor,
hospital: appointment.hospital,
status: ap... | https://github.com/LJ666-ui/harmony-health-care | 4f642aa3b9e8531a3d53ec51cac45a9019f2af26 | github |
uboy/xts-selector | tests/fixtures/xts_usage/sample_project/entry/src/main/ets/pages/AmbiguousPage.ets | arkts | setupSlider | A plain TypeScript function that looks like an attribute call but has no component context | function setupSlider(s: SliderAttribute): void {
s.step(5)
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left setupSlider AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left s AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right A... | function setupSlider(s: SliderAttribute): void {
s.step(5)
} | https://github.com/uboy/xts-selector | 9b2f1cd622e74b0cf7a4014d7ad6b920e7529341 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/WebViewDataCacheManager.ets | arkts | cleanExpired | 清理所有过期缓存 | cleanExpired(): void {
this.cleanExpiredCache(this.mangaDetailCache);
this.cleanExpiredCache(this.chapterListCache);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left cleanExpired 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... | cleanExpired(): void {
this.cleanExpiredCache(this.mangaDetailCache);
this.cleanExpiredCache(this.chapterListCache);
} | https://github.com/DaLongZhuaZi/manxia | 9828640a4fdc8f3fb945c1d1398218cefc90ee61 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Enforcement/UnifiedDetailPageEnforcer.ets | arkts | isForceEnabled | 检查强制模式是否启用
默认为 true(强制启用统一详情页) | isForceEnabled(): boolean {
if (!this.settingsManager) {
return true; // 默认启用
}
return this.settingsManager.getBoolean(EnforcementSettingKeys.FORCE_UNIFIED_DETAIL_PAGE, true);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isForceEnabled 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#stat... | isForceEnabled(): boolean {
if (!this.settingsManager) {
return true; // 默认启用
}
return this.settingsManager.getBoolean(EnforcementSettingKeys.FORCE_UNIFIED_DETAIL_PAGE, true);
} | https://github.com/DaLongZhuaZi/manxia | 5b11d5600d16a107b066fe890019bbf7a10fc7ea | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Theme/AppColors.ets | arkts | withAlpha | 获取带透明度的颜色
@param role 颜色角色
@param alpha 透明度 (0-1)
@returns 带透明度的颜色字符串 | static withAlpha(role: ColorRole, alpha: number): string {
const color = getColorForCurrentTheme(role);
const alphaHex = Math.round(alpha * 255).toString(16).padStart(2, '0');
// 将 #RRGGBB 转换为 #AARRGGBB
if (color.length === 7) {
return `#${alphaHex}${color.substring(1)}`;
}
// 如果已经有透明度,替... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left withAlpha AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left role AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ColorR... | static withAlpha(role: ColorRole, alpha: number): string {
const color = getColorForCurrentTheme(role);
const alphaHex = Math.round(alpha * 255).toString(16).padStart(2, '0');
// 将 #RRGGBB 转换为 #AARRGGBB
if (color.length === 7) {
return `#${alphaHex}${color.substring(1)}`;
}
// 如果已经有透明度,替... | https://github.com/DaLongZhuaZi/manxia | e84f304199d579739692cd3c6ff8ff7d1ef15160 | github |
arkui-x/samples | CodeLab/Cases/feature/customscan/src/main/ets/model/ScanSize.ets | arkts | updateXComponentSize | 更新XComponent
@param width
@param height
@param offsetX
@param offsetY | public updateXComponentSize(width: number, height: number, offsetX: number, offsetY: number): void {
logger.info('Start to update XComponent size.');
this.xComponentSize.width = width;
this.xComponentSize.height = height;
this.xComponentSize.offsetX = offsetX;
this.xComponentSize.offsetY = offsetY... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left updateXComponentSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left width AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier... | public updateXComponentSize(width: number, height: number, offsetX: number, offsetY: number): void {
logger.info('Start to update XComponent size.');
this.xComponentSize.width = width;
this.xComponentSize.height = height;
this.xComponentSize.offsetX = offsetX;
this.xComponentSize.offsetY = offsetY... | https://gitcode.com/arkui-x/samples | 64263e5f5a402836393390e2f81d76cc616d49f4 | gitcode |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/model/SessionState.ets | arkts | getSession | Get a session by instance | static getSession(instance: number): SessionState | undefined {
return GlobalSessionManager.sessions.get(instance);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getSession AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left instance AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Rig... | static getSession(instance: number): SessionState | undefined {
return GlobalSessionManager.sessions.get(instance);
} | https://github.com/tangwengang-del/freerdp-harmonyos | 8ece44a94d68ea3786e7cb408f5f8c93cf045f77 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/BarData.ets | arkts | getGroupWidth | In case of grouped bars, this method returns the space an individual group of bar needs on the x-axis.
@param groupSpace
@param barSpace
@return | public getGroupWidth(groupSpace: number, barSpace: number): number {
if (this.mDataSets) {
return this.mDataSets.listSize * (this.mBarWidth + barSpace) + groupSpace;
}
return 0;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getGroupWidth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left groupSpace AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#numbe... | public getGroupWidth(groupSpace: number, barSpace: number): number {
if (this.mDataSets) {
return this.mDataSets.listSize * (this.mBarWidth + barSpace) + groupSpace;
}
return 0;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | c7c3bea39355e871e1bc66175a6a3475ef5a938c | gitee |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/ChartData.ets | arkts | setValueTextColors | Sets the same list of value-colors for all DataSets this
data object contains.
@param colors | public setValueTextColors(colors: JArrayList<Number>): void {
if (this.mDataSets) {
for (let data of this.mDataSets.dataSource) {
data.setValueTextColors(colors);
}
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setValueTextColors AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left colors AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiati... | public setValueTextColors(colors: JArrayList<Number>): void {
if (this.mDataSets) {
for (let data of this.mDataSets.dataSource) {
data.setValueTextColors(colors);
}
}
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | fc5642d355dde30d8620e503db00e96ab611a166 | gitee |
daugf2527/harmonyos-libretro-emulator | deprecated/legacy/archive/entry/src/main/ets/pages/Game2048Native.ets | arkts | startPerformanceMonitor | 启动性能监控 | startPerformanceMonitor() {
// TODO: 实现 FPS 和 CPU 监控
// 这里可以调用 Native 层的性能统计接口
setInterval(() => {
this.fps = 60; // 模拟数据
this.cpuUsage = 25; // 模拟数据
}, 1000);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left startPerformanceMonitor 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_... | startPerformanceMonitor() {
// TODO: 实现 FPS 和 CPU 监控
// 这里可以调用 Native 层的性能统计接口
setInterval(() => {
this.fps = 60; // 模拟数据
this.cpuUsage = 25; // 模拟数据
}, 1000);
} | https://github.com/daugf2527/harmonyos-libretro-emulator | 7bff0a47651dff7f3388a06dcf25587a902d9b05 | github |
richshaw2015/nds | ohos/entry/src/main/ets/utils/GamepadManager.ets | arkts | dispatchResult | 分发处理结果到对应的回调 | private dispatchResult(result: ProcessResult): void {
if (result.type === 'nds_key' && result.ndsKey !== undefined) {
this.onNdsKeyEvent(result.ndsKey as NDSKey, result.isDown)
} else if (result.type === 'frontend_action' && result.frontendAction !== undefined) {
if (result.isDown) {
this.... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left dispatchResult AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left result AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | private dispatchResult(result: ProcessResult): void {
if (result.type === 'nds_key' && result.ndsKey !== undefined) {
this.onNdsKeyEvent(result.ndsKey as NDSKey, result.isDown)
} else if (result.type === 'frontend_action' && result.frontendAction !== undefined) {
if (result.isDown) {
this.... | https://github.com/richshaw2015/nds | 1dadf668423eaca8fdaca8ebd2c74afd8fc5002a | github |
HarmonyOS_Samples/BestPracticeSnippets | AvoidTimeComsume/entry/src/main/ets/views/NegativeOfLazyForEach.ets | arkts | build | [StartExclude about_to_reuse]
[EndExclude about_to_reuse]
[Start about_to_reuse] | build() {
Column() {
Image($r('app.media.app_icon'))
.width(48)
.height(48)
.margin({ bottom: 12 })
Text(`image${this.item}`)
.fontSize(12)
.textAlign(TextAlign.Center)
}
.width('100%')
.height(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() {
Image($r('app.media.app_icon'))
.width(48)
.height(48)
.margin({ bottom: 12 })
Text(`image${this.item}`)
.fontSize(12)
.textAlign(TextAlign.Center)
}
.width('100%')
.height(100)
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 5a7537988fa3e80583bee0f1e9b58f0dcd6acc64 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/UIContextManager.ets | arkts | setAbilityContext | 设置Ability上下文 | public setAbilityContext(abilityContext: common.UIAbilityContext): void {
this.abilityContext = abilityContext;
logger.debug(TAG, 'Ability上下文已设置');
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setAbilityContext AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left abilityContext AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Rig... | public setAbilityContext(abilityContext: common.UIAbilityContext): void {
this.abilityContext = abilityContext;
logger.debug(TAG, 'Ability上下文已设置');
} | https://github.com/DaLongZhuaZi/manxia | 1a8955efd2774e8cffacca62887a0dac5acadc14 | github |
harmonyos/codelabs | AlarmClock/entry/src/main/ets/common/utils/DimensionUtil.ets | arkts | getPx | Obtains the screen horizontal adaptation px.
@return number | static getPx(value: Resource): number {
let beforeVp = context.resourceManager.getNumber(value.id);
return DimensionUtil.adaptDimension(beforeVp);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left getPx AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ER... | static getPx(value: Resource): number {
let beforeVp = context.resourceManager.getNumber(value.id);
return DimensionUtil.adaptDimension(beforeVp);
} | https://gitee.com/harmonyos/codelabs.git | 49f93623768d299f9681e94f6342879c61badceb | gitee |
Countly/countly-sdk-hos | library/src/main/ets/internal/modules/ModuleRequestQueue.ets | arkts | removeDifferentAppKeysFromQueue | Drop queued requests that carry an app_key other than the current one. | public async removeDifferentAppKeysFromQueue(): Promise<void> {
if (this.rejectIfHalted('ModuleRequestQueue', 'removeDifferentAppKeysFromQueue')) return;
await this.core.requestQueue.removeDifferentAppKeys();
} | 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 removeDifferentAppKeysFromQueue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expre... | public async removeDifferentAppKeysFromQueue(): Promise<void> {
if (this.rejectIfHalted('ModuleRequestQueue', 'removeDifferentAppKeysFromQueue')) return;
await this.core.requestQueue.removeDifferentAppKeys();
} | https://github.com/Countly/countly-sdk-hos | 100d0d4a882f9b3b9db30eb24de376359036969e | github |
erosTeam/NextE | feature/home/src/main/ets/pages/HomePage.ets | arkts | gallerySourcePageBuilder | Global @Builder (no `this`) so passing it to RetainedSubtabHost's @BuilderParam under @ComponentV2
can't hit the instance-@Builder `this`-loss crash. Renders one retained gallery-source page per key,
handed the SHARED active-key signal (so cached pages still get their first-activation load). | @Builder
function gallerySourcePageBuilder(
key: string,
active: ActiveKeyState,
scroller: Scroller,
onDidScroll: (offset: number, state: ScrollState) => void,
) {
GallerySourcePage({ sourceKey: key, active: active, scroller: scroller, onDidScroll: onDidScroll })
} | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Builder AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left gallerySourcePageBuilder AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Ri... | @Builder
function gallerySourcePageBuilder(
key: string,
active: ActiveKeyState,
scroller: Scroller,
onDidScroll: (offset: number, state: ScrollState) => void,
) {
GallerySourcePage({ sourceKey: key, active: active, scroller: scroller, onDidScroll: onDidScroll })
} | https://github.com/erosTeam/NextE | f453880873299a571f242527ac4132538da29099 | github |
Harrisonls2004/WaterFlow | entry/src/main/ets/common/utils/CommentManager.ets | arkts | toggleLike | Toggle like on a comment | static async toggleLike(commentId: string, username: string): Promise<boolean> {
try {
if (!CommentManager.preferencesInstance) {
console.error('Preferences not initialized');
return false;
}
const comments = await CommentManager.getAllComments();
// 先在顶级评论中查找
... | 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 toggleLike AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left commentId AST#identifier#Right AST#ERROR#Left AST#:#Left : A... | static async toggleLike(commentId: string, username: string): Promise<boolean> {
try {
if (!CommentManager.preferencesInstance) {
console.error('Preferences not initialized');
return false;
}
const comments = await CommentManager.getAllComments();
// 先在顶级评论中查找
... | https://github.com/Harrisonls2004/WaterFlow | 4246f9722c4c1bb37f2c781177fd48e795fcea91 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/MangaSourceAPIEngine.ets | arkts | getValueByPath | 通过路径获取值(支持点号和数组索引) | private getValueByPath(obj: Object, path: string): Object | Object[] | null {
const parts = path.split('.');
let current: Object | Object[] | null = obj;
let isArray = false;
for (let i = 0; i < parts.length; i++) {
const part = parts[i];
// [修复] 如果当前对象为空,无法继续深入,返回 null
if (!curren... | 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#identifier#Left... | private getValueByPath(obj: Object, path: string): Object | Object[] | null {
const parts = path.split('.');
let current: Object | Object[] | null = obj;
let isArray = false;
for (let i = 0; i < parts.length; i++) {
const part = parts[i];
// [修复] 如果当前对象为空,无法继续深入,返回 null
if (!curren... | https://github.com/DaLongZhuaZi/manxia | 8684a934cb173868a1eb901b76114d7282d56eb0 | github |
HarmonyOS_Codelabs/arkts-basic-syntax-demo | entry/src/main/ets/pages/BasicPage.ets | arkts | showIfStatements | 语句
if语句 | function showIfStatements() {
let hasTicket = true;
if (hasTicket) {
console.log('Ticket verified!');
} else {
console.log('Entry prohibited!');
}
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left showIfStatements 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 showIfStatements() {
let hasTicket = true;
if (hasTicket) {
console.log('Ticket verified!');
} else {
console.log('Entry prohibited!');
}
} | https://gitcode.com/HarmonyOS_Codelabs/arkts-basic-syntax-demo | 3fb0cd729224b8c07402184f0498d365baf7a8ae | gitcode |
tdcare/tdwebrtc | src/main/ets/SignalingClient.ets | arkts | buildForwardEnvelope | 构造转发消息外层 | private buildForwardEnvelope(toMac: string): SignalingEnvelope {
const env: SignalingEnvelope = {
type: CmdType.TYPE_FORWARD,
from_mac: this.mac,
to_mac: toMac,
is_echo: '0',
};
return env;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildForwardEnvelope AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left toMac AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif... | private buildForwardEnvelope(toMac: string): SignalingEnvelope {
const env: SignalingEnvelope = {
type: CmdType.TYPE_FORWARD,
from_mac: this.mac,
to_mac: toMac,
is_echo: '0',
};
return env;
} | https://github.com/tdcare/tdwebrtc | 1db8d356d51406dc56b122edfa55f66fb50ef5b2 | github |
offlinecat-dev/OCNetORM | src/main/ets/repository/Repository.ets | arkts | attach | 建立多对多关联
在中间表中插入一条关联记录
@param sourceId 源实体主键值
@param targetId 目标实体主键值
@param relationName 关联属性名
@returns Promise<SaveResult>
@throws RelationNotFoundError 如果关联关系未注册
Requirements: 5.5 | async attach(sourceId: ValueType, targetId: ValueType, relationName: string): Promise<SaveResult> {
this.ensureWritePathAllowed('ATTACH')
return await this.withSessionStore(async (repo) => {
const result = await repo.relationManager.attach(sourceId, targetId, relationName)
return repo.ensureSaveRe... | 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 attach AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceId AS... | async attach(sourceId: ValueType, targetId: ValueType, relationName: string): Promise<SaveResult> {
this.ensureWritePathAllowed('ATTACH')
return await this.withSessionStore(async (repo) => {
const result = await repo.relationManager.attach(sourceId, targetId, relationName)
return repo.ensureSaveRe... | https://github.com/offlinecat-dev/OCNetORM | 5f7db5411684de3b5626344717a09ec8e86de0a9 | github |
HarmonyOS_Codelabs/arkts-intermediate-syntax | entry/src/main/ets/model/SmartLock.ets | arkts | constructor | 构造函数:调用父类构造函数初始化核心属性
注意:设备类型固定为DeviceType.Lock,无需外部传入(封装细节) | constructor(id: string, name: string, location: Location) {
super(id, name, DeviceType.Lock, location);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST... | constructor(id: string, name: string, location: Location) {
super(id, name, DeviceType.Lock, location);
} | https://gitcode.com/HarmonyOS_Codelabs/arkts-intermediate-syntax | 141a250872c92de8fd093139025d7499bceea380 | gitcode |
the-wwyang/kids-learning-app | src/main/ets/services/AchievementService.ets | arkts | calculateProgress | 计算成就进度百分比
@param achievementId 成就ID
@param currentValue 当前进度值
@returns 进度百分比 (0-100) | static calculateProgress(achievementId: string, currentValue: number): number {
const config = AchievementService.getAchievementById(achievementId);
if (!config) return 0;
const progress = (currentValue / config.targetValue) * 100;
return Math.min(100, Math.round(progress));
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left calculateProgress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left achievementId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AS... | static calculateProgress(achievementId: string, currentValue: number): number {
const config = AchievementService.getAchievementById(achievementId);
if (!config) return 0;
const progress = (currentValue / config.targetValue) * 100;
return Math.min(100, Math.round(progress));
} | https://github.com/the-wwyang/kids-learning-app | e393e1d14c43e81297a151217d202821cc2581ac | github |
openharmony-sig/flutter_packages | packages/camera/camera_ohos/ohos/src/main/ets/io/flutter/plugins/camera/Camera.ets | arkts | getCurSession | 获取当前场景(拍照模式、视频模式)的Session实例 | getCurSession(): camera.PhotoSession | camera.VideoSession {
return this.isVideoMode ? this.videoSession! : this.photoSession!;
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getCurSession 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#:#Lef... | getCurSession(): camera.PhotoSession | camera.VideoSession {
return this.isVideoMode ? this.videoSession! : this.photoSession!;
} | https://gitee.com/openharmony-sig/flutter_packages.git | 0deb24089a12c171f93e86daa8154e4fffd27fc3 | gitee |
Lycorius03/studyos | apps/harmonyos/entry/src/main/ets/bridge/StudyOsBridge.ets | arkts | createTopic | ---- Topic management ---- | createTopic(name: string, description?: string): Topic {
this.ensureInit();
const json: string = nativeModule.studyosCreateTopic(
this.handle, name, description ?? '');
const parsed: Topic = JSON.parse(json) as Topic;
return parsed;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left createTopic AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST... | createTopic(name: string, description?: string): Topic {
this.ensureInit();
const json: string = nativeModule.studyosCreateTopic(
this.handle, name, description ?? '');
const parsed: Topic = JSON.parse(json) as Topic;
return parsed;
} | https://github.com/Lycorius03/studyos | 20f82b3320a972552a0100641d1dacec33d3893d | github |
jiahaozheng406/huawei-travel-app-HarmonyOS | entry/src/main/ets/pages/LoginPage.ets | arkts | aboutToDisappear | 退出页面时清除定时器 | aboutToDisappear() {
clearTimeout(this.timeOutId);
this.timeOutId = -1;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToDisappear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#L... | aboutToDisappear() {
clearTimeout(this.timeOutId);
this.timeOutId = -1;
} | https://github.com/jiahaozheng406/huawei-travel-app-HarmonyOS | f187d140e528fadef5913f94c1151b4a6d6a935a | github |
honjow/Next2V | shared/src/main/ets/services/CheckinNotifier.ets | arkts | ensureEnabled | Ask once for consent so a backgrounded result can surface. Safe to call repeatedly: HarmonyOS only
shows the dialog on the first undecided call and otherwise settles without UI. Call while foreground
(the dialog needs a window) — do it early so the notification can post by the time a failure happens. | static ensureEnabled(context: common.UIAbilityContext): void {
try {
if (notificationManager.isNotificationEnabledSync()) {
return
}
notificationManager.requestEnableNotification(context).catch((_error: Error) => {})
} catch (error) {
DiagnosticLogger.warn(
'auto_daily_... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left ensureEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expressi... | static ensureEnabled(context: common.UIAbilityContext): void {
try {
if (notificationManager.isNotificationEnabledSync()) {
return
}
notificationManager.requestEnableNotification(context).catch((_error: Error) => {})
} catch (error) {
DiagnosticLogger.warn(
'auto_daily_... | https://github.com/honjow/Next2V | 9960a8f69f633355b422e090c9c7535e5a624e2b | github |
AGenUI/AGenUI | playground/harmony/entry/src/main/ets/utils/PlaygroundRuntimeLogger.ets | arkts | saveLogToFile | Asynchronously save log to file | private saveLogToFile(level: number, timestamp: string, tag: string, func: string, line: number, message: string): void {
if (!this.currentLogFile) {
return;
}
// Use setTimeout to make it asynchronous
setTimeout(() => {
try {
const levelName = PlaygroundRuntimeLogger.getLevel... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left saveLogToFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left level AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | private saveLogToFile(level: number, timestamp: string, tag: string, func: string, line: number, message: string): void {
if (!this.currentLogFile) {
return;
}
// Use setTimeout to make it asynchronous
setTimeout(() => {
try {
const levelName = PlaygroundRuntimeLogger.getLevel... | https://github.com/AGenUI/AGenUI | 5bf9aad747884065a879e634787c41e052540aa2 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Theme/UserThemeConfig.ets | arkts | mergeTransparency | 合并透明度配置(用partial覆盖base) | function mergeTransparency(base: TransparencyConfig, partial: Partial<TransparencyConfig>): TransparencyConfig {
return {
navigationBar: partial.navigationBar !== undefined ? partial.navigationBar : base.navigationBar,
tabBar: partial.tabBar !== undefined ? partial.tabBar : base.tabBar,
card: partial.card... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left mergeTransparency AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left base AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#... | function mergeTransparency(base: TransparencyConfig, partial: Partial<TransparencyConfig>): TransparencyConfig {
return {
navigationBar: partial.navigationBar !== undefined ? partial.navigationBar : base.navigationBar,
tabBar: partial.tabBar !== undefined ? partial.tabBar : base.tabBar,
card: partial.card... | https://github.com/DaLongZhuaZi/manxia | b39a31bbc5a019dc21415ae14fbd3df6745f96c3 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | internal | Creates a copy with replaced value on index
@param index
@param value
@returns an Uint32Array with replaced value on index
public | /* public */ internal with(index: int, value: number): Uint32Array {
let res = new Uint32Array(this)
res.set(index, value)
return res
} | AST#program#Left AST#comment#Left /* public */ AST#comment#Right AST#ERROR#Left AST#identifier#Left internal AST#identifier#Right AST#ERROR#Right AST#with_statement#Left AST#with#Left with AST#with#Right AST#parenthesized_expression#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#R... | /* public */ internal with(index: int, value: number): Uint32Array {
let res = new Uint32Array(this)
res.set(index, value)
return res
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | c59506afcb40273d036aff5b61bc972ab9d73db3 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Components/ConsolePanel.ets | arkts | getHidebugInfo | 获取hidebug性能信息 | getHidebugInfo(): string {
if (!this.hidebugData) {
return '暂无hidebug性能数据';
}
const memory = this.hidebugData.memory;
const cpu = this.hidebugData.cpu;
const gc = this.hidebugData.gc;
const debug = this.hidebugData.debug;
const summary = this.hidebugCollector.getPerformanceSummary()... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getHidebugInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#stateme... | getHidebugInfo(): string {
if (!this.hidebugData) {
return '暂无hidebug性能数据';
}
const memory = this.hidebugData.memory;
const cpu = this.hidebugData.cpu;
const gc = this.hidebugData.gc;
const debug = this.hidebugData.debug;
const summary = this.hidebugCollector.getPerformanceSummary()... | https://github.com/DaLongZhuaZi/manxia | 20aafaf0a12c4d10dde43e2b1945f3748e488f8f | github |
Countly/countly-sdk-hos | library/src/main/ets/CountlyInstance.ets | arkts | hasAnyActiveTimers | Test seam — true while ANY of this instance's internally-owned timers
is still armed. Aggregates RequestQueue (processor + backoff),
ModuleConsent (snapshot coalesce), ModuleHealthCheck (deferred initial
send), and ModuleConfiguration (periodic SBS refresh). Used by leak
tests to assert that `halt()` cancels every pend... | public hasAnyActiveTimers(): boolean {
return this.requestQueue.hasActiveTimers()
|| this.consentModule.hasActiveTimers()
|| this.healthCheckModule.hasActiveTimers()
|| this.configurationModule.hasActiveTimers();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left hasAnyActiveTimers 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 boolea... | public hasAnyActiveTimers(): boolean {
return this.requestQueue.hasActiveTimers()
|| this.consentModule.hasActiveTimers()
|| this.healthCheckModule.hasActiveTimers()
|| this.configurationModule.hasActiveTimers();
} | https://github.com/Countly/countly-sdk-hos | b7375fab1b345020426b839442729ec9cdea0a10 | github |
harmonyos/codelabs | HarmonyOS_NEXT/DistributedMail/entry/src/main/ets/pages/MailHomePage.ets | arkts | readFile | Reading image streams from distributed file systems. | readFile(): void {
this.appendix.forEach((item: AppendixBean) => {
let filePath: string = this.distributedPath + item.fileName;
let savePath: string = getContext().filesDir + '/' + item.fileName;
let saveFile = fs.openSync(savePath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE);
let file = ... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left readFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Lef... | readFile(): void {
this.appendix.forEach((item: AppendixBean) => {
let filePath: string = this.distributedPath + item.fileName;
let savePath: string = getContext().filesDir + '/' + item.fileName;
let saveFile = fs.openSync(savePath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE);
let file = ... | https://gitee.com/harmonyos/codelabs.git | 440961ba417962196163fb2925db9010f34f778e | gitee |
openharmony/developtools_profiler | host/smartperf/client/client_ui/entry/src/main/ets/common/ui/detail/chart/animation/ChartAnimator.ets | arkts | animateXY | Animates values along both the X and Y axes, in a linear fashion.
@param durationMillisX animation duration along the X axis
@param durationMillisY animation duration along the Y axis | public animateXY(durationMillisX: number, durationMillisY: number) {
animateXY(durationMillisX, durationMillisY, Easing.Linear, Easing.Linear);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left animateXY AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left durationMillisX AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#numb... | public animateXY(durationMillisX: number, durationMillisY: number) {
animateXY(durationMillisX, durationMillisY, Easing.Linear, Easing.Linear);
} | https://gitee.com/openharmony/developtools_profiler.git | c8fbc2aa8aea524eedfe584552862f5682714518 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Storage/SandboxManager.ets | arkts | getStorageStats | 获取存储统计信息 | public async getStorageStats(): Promise<StorageStats> {
try {
const cacheSize = await this.getDirectorySize(this.directories.cache);
const comicsSize = await this.getDirectorySize(this.directories.comics);
const coversSize = await this.getDirectorySize(this.directories.covers);
const chapt... | 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 getStorageStats AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#... | public async getStorageStats(): Promise<StorageStats> {
try {
const cacheSize = await this.getDirectorySize(this.directories.cache);
const comicsSize = await this.getDirectorySize(this.directories.comics);
const coversSize = await this.getDirectorySize(this.directories.covers);
const chapt... | https://github.com/DaLongZhuaZi/manxia | c2752e3705f96ceb89fafe859f66bddda846fbdf | github |
Joker-x-dev/CoolMallArkTS | core/designsystem/src/main/ets/component/Scroll.ets | arkts | build | 构建带中等内边距的垂直滚动布局
@returns {void} 无返回值 | build(): void {
VerticalScroll({
scroller: this.scroller,
fillMaxSize: this.fillMaxSize,
fillMaxWidth: this.fillMaxWidth,
widthValue: this.widthValue,
heightValue: this.heightValue,
scrollBarState: this.scrollBarState,
paddingValue: $r("app.float.space_padding_medium"),
... | 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 {
VerticalScroll({
scroller: this.scroller,
fillMaxSize: this.fillMaxSize,
fillMaxWidth: this.fillMaxWidth,
widthValue: this.widthValue,
heightValue: this.heightValue,
scrollBarState: this.scrollBarState,
paddingValue: $r("app.float.space_padding_medium"),
... | https://github.com/Joker-x-dev/CoolMallArkTS | dbb817799e4841e715896913384726a517082373 | github |
tangwengang-del/freerdp-harmonyos | entry/src/main/ets/services/RdpBackgroundService.ets | arkts | cancelNotification | Cancel notification | private async cancelNotification(): Promise<void> {
try {
await notificationManager.cancel(NOTIFICATION_ID);
console.info(`${TAG}: Notification cancelled`);
} catch (error) {
const err = error as BusinessError;
console.error(`${TAG}: Failed to cancel notification: ${err.code} - ${err.m... | 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 cancelNotification AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ... | private async cancelNotification(): Promise<void> {
try {
await notificationManager.cancel(NOTIFICATION_ID);
console.info(`${TAG}: Notification cancelled`);
} catch (error) {
const err = error as BusinessError;
console.error(`${TAG}: Failed to cancel notification: ${err.code} - ${err.m... | https://github.com/tangwengang-del/freerdp-harmonyos | d679e3cd9329f67b0bc58af7949a6f5b3cda51a9 | github |
Tencent-RTC/TUIKit_Harmony | atomic_x/src/main/ets/messagelist/components/MessageList.ets | arkts | getIsMultiSelectMode | Check if currently in multi-select mode | getIsMultiSelectMode(): boolean {
return this.isMultiSelectMode;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getIsMultiSelectMode 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 AS... | getIsMultiSelectMode(): boolean {
return this.isMultiSelectMode;
} | https://github.com/Tencent-RTC/TUIKit_Harmony | 2a7422b7a43a9a81d6977402470e880b6eb18352 | github |
aimilin6688/KeePassHO | entry/src/main/ets/storage/onedrive/OneDriveConfig.ets | arkts | setAccessToken | 设置访问令牌
@param accessToken 访问令牌 | public setAccessToken(accessToken: string): void {
this.accessToken = Sm4Utils.encryptWithPrefix(accessToken);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setAccessToken AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left accessToken AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#str... | public setAccessToken(accessToken: string): void {
this.accessToken = Sm4Utils.encryptWithPrefix(accessToken);
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/onedrive/OneDriveConfig.ets#L85-L87 | 23cadccb50af048a24742effa3463ffbe1ce1b57 | github |
openharmony/multimedia_camera_framework | frameworks/js/camera_napi/cameraAnimSample/entry/src/main/ets/common/utils/DateTimeUtil.ets | arkts | fill | 日期不足两位补充0
@param value-数据值 | fill(value: number): string {
let maxNumber = 9;
return (value > maxNumber ? '' : '0') + value;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left fill AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Left ) AST#)#Rig... | fill(value: number): string {
let maxNumber = 9;
return (value > maxNumber ? '' : '0') + value;
} | https://gitee.com/openharmony/multimedia_camera_framework.git | ea06f88022cd2d79f7ffce09b8adcb2fc101441a | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Initialization/DataInitializer.ets | arkts | initializeDatabaseManager | 初始化数据库管理器 | private async initializeDatabaseManager(config: DatabaseConfig): Promise<void> {
try {
// 这里需要导入并初始化DatabaseManager
// const databaseManager = DatabaseManager.getInstance();
// await databaseManager.initialize(config);
logger.debug(TAG, '数据库管理器初始化占位符');
} catch (error) {
t... | 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 initializeDatabaseManager AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right... | private async initializeDatabaseManager(config: DatabaseConfig): Promise<void> {
try {
// 这里需要导入并初始化DatabaseManager
// const databaseManager = DatabaseManager.getInstance();
// await databaseManager.initialize(config);
logger.debug(TAG, '数据库管理器初始化占位符');
} catch (error) {
t... | https://github.com/DaLongZhuaZi/manxia | a82c79480beb41331b01814ef8298b47532b47b6 | github |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/app/scratchingboard/scripts/url.ets | arkts | findFirstUrlInToken | Finds the first URL in a token.
@param token The token.
@returns UrlMatch | null
@author DeepSeek Web @ May 13 2026, optimized by Liny and ChatGLM Web @ May 14 2026 | function findFirstUrlInToken(token: string): UrlMatch | null {
const startTime = Date.now();
// 宽松的正则:用于快速定位可能的 URL 起始位置,并提取最大合法字符序列
// 1. Scheme: [A-Za-z][A-Za-z0-9+.-]*: (如 http:, mailto:, data:)
// 2. Protocol-relative: //
// 3. Scheme-less 域名/IP: 必须包含点 (如 example.com, 192.168.1.1)
// 4. localhost
// ... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left findFirstUrlInToken AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left token AST#identifier#Right AST#type_annotation#Left AST#:#Left : A... | function findFirstUrlInToken(token: string): UrlMatch | null {
const startTime = Date.now();
// 宽松的正则:用于快速定位可能的 URL 起始位置,并提取最大合法字符序列
// 1. Scheme: [A-Za-z][A-Za-z0-9+.-]*: (如 http:, mailto:, data:)
// 2. Protocol-relative: //
// 3. Scheme-less 域名/IP: 必须包含点 (如 example.com, 192.168.1.1)
// 4. localhost
// ... | https://github.com/awaLiny2333/LinysBrowser_NEXT | f15e366a112e9687b0d2cb34838e5640f92ba0bd | github |
silence17/harmonydemo | entry/src/main/ets/pages/LoginPage.ets | arkts | onPageShow | 每次可见时回调 | onPageShow() {
PreferencesUtil.getInstance().getString("cellphone").then((result) => {
this.phone = result
})
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onPageShow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left AS... | onPageShow() {
PreferencesUtil.getInstance().getString("cellphone").then((result) => {
this.phone = result
})
} | https://github.com/silence17/harmonydemo | 3cc65dc970aee447247b68e1d5f298b275fb306d | github |
LongLiveY96/chatcube | entry/src/main/ets/services/WebDAVService.ets | arkts | downloadBackup | 下载备份文件到本地缓存,返回本地路径 | async downloadBackup(
config: WebDAVConfig,
remoteFileName: string,
onProgress?: BinaryProgressCallback,
controller?: HttpRequestController
): Promise<string> {
if (this.context === null) {
throw new Error('WebDAVService not initialized')
}
const url = this.joinPath(config.serverUr... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left downloadBackup AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left config AST#identifier#Right AS... | async downloadBackup(
config: WebDAVConfig,
remoteFileName: string,
onProgress?: BinaryProgressCallback,
controller?: HttpRequestController
): Promise<string> {
if (this.context === null) {
throw new Error('WebDAVService not initialized')
}
const url = this.joinPath(config.serverUr... | https://github.com/LongLiveY96/chatcube | cbf8cffb88325e17178566ef5b5cfd84e4668c2c | github |
aimilin6688/KeePassHO | entry/src/main/ets/common/utils/WebImageDownloader.ets | arkts | processImageData | 处理图片数据
@param arrayBuffer 图片数据
@param contentType 图片类型
@param size 目标尺寸
@returns base64编码的图片 | private static async processImageData(arrayBuffer: ArrayBuffer, contentType: string, size: number): Promise<string> {
try {
// 创建图片源
const imageSource = image.createImageSource(arrayBuffer);
if (!imageSource) {
throw new Error('Failed to create image source');
}
// 配置解码选项
... | 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 processImageData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Lef... | private static async processImageData(arrayBuffer: ArrayBuffer, contentType: string, size: number): Promise<string> {
try {
// 创建图片源
const imageSource = image.createImageSource(arrayBuffer);
if (!imageSource) {
throw new Error('Failed to create image source');
}
// 配置解码选项
... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/WebImageDownloader.ets#L103-L162 | 646dd746b300270ee184f7e95078369e032916c3 | github |
apap6628114/nga_oh | entry/src/main/ets/store/settings/domain/ThemeSettings.ets | arkts | setTheme | 设置主题并立即应用(持久化 + 切换颜色模式 + 更新状态栏) | setTheme(theme: string): void {
this.ctx.state.theme = theme
this.applyCurrentTheme()
this.ctx.persist()
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setTheme 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#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)... | setTheme(theme: string): void {
this.ctx.state.theme = theme
this.applyCurrentTheme()
this.ctx.persist()
} | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/store/settings/domain/ThemeSettings.ets#L24-L28 | 56cd3c5cf8042448634ed0f0c77b217faa3facc1 | github |
ibestservices/ibest-ui | library/src/main/ets/apis/IBestToast.ets | arkts | open | 根据参数打开弹框 | private async open(option: ResourceStr | ToastOption) {
if(this.isLock){
return
}
if(this.toastContent){
await this.hide()
}
this.isLock = true
let windowClass = GlobalStore.getMainWindow()
let uiContext = windowClass.getUIContext()
this.promptAction = uiContext.getPromptA... | 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 open AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left option AST#identifier#Right AST#:#Left : AST#:#R... | private async open(option: ResourceStr | ToastOption) {
if(this.isLock){
return
}
if(this.toastContent){
await this.hide()
}
this.isLock = true
let windowClass = GlobalStore.getMainWindow()
let uiContext = windowClass.getUIContext()
this.promptAction = uiContext.getPromptA... | https://github.com/ibestservices/ibest-ui/blob/4c1aee7f9a949ed2c5ef0f0fc9f6d8a2beb9a30e/library/src/main/ets/apis/IBestToast.ets#L146-L184 | 101068e950cd7e8e154c972fca3288bc2d707d3e | github |
Dabing-0x19d/berverage_HarmonyOS6.0 | entry/src/main/ets/model/CoffeeDao.ets | arkts | countByShop | 按店铺名称查询记录数量(用于排序) | async countByShop(shopName: string): Promise<number> {
const rdbStore = this.getRdbStore()
if (!rdbStore) {
return 0;
}
const predicates = new relationalStore.RdbPredicates(this.tableName);
predicates.equalTo('shopName', shopName);
try {
const resultSet = await rdbStore.query(pre... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left countByShop AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left shopName AST#identifier#Right AST#type_annotation#Left AST#:#Left :... | async countByShop(shopName: string): Promise<number> {
const rdbStore = this.getRdbStore()
if (!rdbStore) {
return 0;
}
const predicates = new relationalStore.RdbPredicates(this.tableName);
predicates.equalTo('shopName', shopName);
try {
const resultSet = await rdbStore.query(pre... | https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0 | 772c91fdc28e61839d14997d33ac6f609e91ac19 | github |
daugf2527/harmonyos-libretro-emulator | deprecated/legacy/archive/entry/src/main/ets/pages/Game2048Native.ets | arkts | loadEmulatorConfig | 加载模拟器配置 | loadEmulatorConfig(emulatorType: EmulatorType) {
this.currentEmulatorType = emulatorType;
this.emulatorConfig = getEmulatorConfig(emulatorType);
if (this.emulatorConfig) {
hilog.info(0xD003, 'TriMorphEmulator',
`加载模拟器: ${this.emulatorConfig.fullName} (${this.emulatorConfig.aspectRatio}... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left loadEmulatorConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left emulatorType AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left EmulatorType A... | loadEmulatorConfig(emulatorType: EmulatorType) {
this.currentEmulatorType = emulatorType;
this.emulatorConfig = getEmulatorConfig(emulatorType);
if (this.emulatorConfig) {
hilog.info(0xD003, 'TriMorphEmulator',
`加载模拟器: ${this.emulatorConfig.fullName} (${this.emulatorConfig.aspectRatio}... | https://github.com/daugf2527/harmonyos-libretro-emulator | e48f589a5203cf5368bc282c4aad2f5ccde0aecc | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Distributed/DistributedReadingService.ets | arkts | requestProxyDownload | 目标端(无网设备)向源端发送代理下载请求 | public requestProxyDownload(bookId: string, chapterIndex: number, chapterUrl: string, sourceType: string): void {
logger.info(TAG, `Requesting proxy download from source device for chapter ${chapterIndex}`);
const payload = JSON.stringify({
chapterUrl,
sourceType
});
distributedDataSyncMan... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left requestProxyDownload AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bookId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie... | public requestProxyDownload(bookId: string, chapterIndex: number, chapterUrl: string, sourceType: string): void {
logger.info(TAG, `Requesting proxy download from source device for chapter ${chapterIndex}`);
const payload = JSON.stringify({
chapterUrl,
sourceType
});
distributedDataSyncMan... | https://github.com/DaLongZhuaZi/manxia | ef841d4a6187a34e0d17d21995b02b2d5c71a775 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/GamepadManager.ets | arkts | allocateSlot | ==================== Game Controller Kit 事件处理 ====================
通用槽位分配方法
@param deviceKey 设备唯一标识
@param keyToSlotMap 设备key到槽位的映射
@param logPrefix 日志前缀
@returns 分配的槽位 (0-3),失败返回 -1 | private allocateSlot(deviceKey: string, keyToSlotMap: Map<string, number>, logPrefix: string): number {
// 检查是否已有槽位
const existingSlot = keyToSlotMap.get(deviceKey);
if (existingSlot !== undefined) {
return existingSlot;
}
// 分配第一个空闲槽位
for (let i = 0; i < GamepadManager.MAX_CONTROLL... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left allocateSlot AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left deviceKey AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#stri... | private allocateSlot(deviceKey: string, keyToSlotMap: Map<string, number>, logPrefix: string): number {
// 检查是否已有槽位
const existingSlot = keyToSlotMap.get(deviceKey);
if (existingSlot !== undefined) {
return existingSlot;
}
// 分配第一个空闲槽位
for (let i = 0; i < GamepadManager.MAX_CONTROLL... | https://github.com/AlkaidLab/moonlight-harmony | c427b82a84f3161d986d89735ca912cac733680d | github |
openharmony/codelabs | ETSUI/ItemManagerAPP/entry/src/main/ets/store/ItemStore.ets | arkts | offItemCountChange | 移除物品数量监听 | offItemCountChange(callback: (count: number) => void): void {
const index = this.listeners.indexOf(callback);
if (index > -1) {
console.info('ItemStore: 移除物品数量监听器');
this.listeners.splice(index, 1);
}
} | AST#program#Left AST#ERROR#Left AST#identifier#Left offItemCountChange AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifie... | offItemCountChange(callback: (count: number) => void): void {
const index = this.listeners.indexOf(callback);
if (index > -1) {
console.info('ItemStore: 移除物品数量监听器');
this.listeners.splice(index, 1);
}
} | https://gitcode.com/openharmony/codelabs | 7dedf32050ab67a25ba7767e97d839a4634753a9 | gitcode |
openharmony-sig/applications_clock | common/src/main/ets/manager/SnoozeManager.ets | arkts | getSnoozedAlarmId | Obtains the ids of all snooze alarms.
@param snooze alarms ids
@return all snoozed alarm ids | async getSnoozedAlarmId(): Promise<string[]> {
const preferences = await this.getPreferences();
const snoozeIds = await preferences.get(SNOOZE_ID, '');
return snoozeIds ? snoozeIds.toString().split(SNOOZE_SEPARATOR) : [];
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getSnoozedAlarmId 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#ge... | async getSnoozedAlarmId(): Promise<string[]> {
const preferences = await this.getPreferences();
const snoozeIds = await preferences.get(SNOOZE_ID, '');
return snoozeIds ? snoozeIds.toString().split(SNOOZE_SEPARATOR) : [];
} | https://gitee.com/openharmony-sig/applications_clock.git | 7476d7fe78793c3c85e5f6b2610d98070cf51c84 | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | reverse | Creates a new Uint8Array using reversed data from the current one
@returns a new Uint8Array using reversed data from the current one | public reverse(): Uint8Array {
let res = new Uint8Array(this)
for (let i = 0; i < this.length; ++i) {
res.set(this.length - 1 - i, this.at(i))
}
return res
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left reverse 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 Uint8Array AST... | public reverse(): Uint8Array {
let res = new Uint8Array(this)
for (let i = 0; i < this.length; ++i) {
res.set(this.length - 1 - i, this.at(i))
}
return res
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | ebb8aaf5ee98244da9a4c27a049fdfc19a911082 | gitee |
openharmony-sig/ohos_highlightguide | library/src/main/ets/highlightguide/core/Controller.ets | arkts | savePreferencesData | 更新并保存已显示的引导页次数
@param label 引导页组件的标签名称
@param count 已显示的组件次数 | private savePreferencesData(label: string, count: number): void {
if (!this.preferences) {
return;
}
try {
this.preferences.putSync(label, count)
this.preferences.flush()
.then(() => {
hilog.info(0x0000, GlobalContext.HILOG_TAG, '%{public}s', 'Succeeded in flushing.');
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left savePreferencesData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left label AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi... | private savePreferencesData(label: string, count: number): void {
if (!this.preferences) {
return;
}
try {
this.preferences.putSync(label, count)
this.preferences.flush()
.then(() => {
hilog.info(0x0000, GlobalContext.HILOG_TAG, '%{public}s', 'Succeeded in flushing.');
... | https://gitee.com/openharmony-sig/ohos_highlightguide.git | e1ddde8087b1832393a351e2fed9165a0f75640f | gitee |
honjow/Next2V | shared/src/main/ets/parser/V2exSessionParser.ets | arkts | extractUsername | 从 HTML 中提取当前登录用户名(member name)。
典型形态: <a href="/member/xxx" class="top">xxx</a>
V2EX 页面属性顺序/额外属性可能变化,因此按完整 a 标签解析。 | static extractUsername(html: string): string {
if (!html) {
return ''
}
const links = html.match(/<a\b[^>]*>/gi) || []
for (const link of links) {
const href = V2exSessionParser.extractAttr(link, 'href')
const className = V2exSessionParser.extractAttr(link, 'class')
const memb... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left extractUsername AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left html AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | static extractUsername(html: string): string {
if (!html) {
return ''
}
const links = html.match(/<a\b[^>]*>/gi) || []
for (const link of links) {
const href = V2exSessionParser.extractAttr(link, 'href')
const className = V2exSessionParser.extractAttr(link, 'class')
const memb... | https://github.com/honjow/Next2V | 5571d279f8523be3454d59f450350fbf50300934 | github |
TDCQCX/ShiHuaMusic-Harmony | entry/src/main/ets/utils/GlobalDataManager.ets | arkts | checkLoginStatus | 检查登录状态并验证token有效性 | async checkLoginStatus(): Promise<boolean> {
if (!this.isLoggedIn || !this.token) {
return false;
}
try {
const result = await this.request({
url: '/user/getUserInfo',
method: 'GET'
});
if (result.success || result.code === 0) {
this.userInfo = result.data... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left checkLoginStatus AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Lef... | async checkLoginStatus(): Promise<boolean> {
if (!this.isLoggedIn || !this.token) {
return false;
}
try {
const result = await this.request({
url: '/user/getUserInfo',
method: 'GET'
});
if (result.success || result.code === 0) {
this.userInfo = result.data... | https://github.com/TDCQCX/ShiHuaMusic-Harmony | 14a9d6caac29888848bae24be5b15aae3651fb1f | github |
LiHuaJZOAQ/GuardSysAPP | entry/src/main/ets/pages/WifiManager.ets | arkts | connectWifi | 连接WiFi | static async connectWifi(ssid: string, password: string): Promise<boolean> {
try {
const config: wifiManager.WifiDeviceConfig = {
ssid: ssid,
preSharedKey: password,
securityType: wifiManager.WifiSecurityType.WIFI_SEC_TYPE_PSK
};
const networkId: number = await wifiManag... | 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 connectWifi AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ssid AST#identifier#Right AST#:#Left : AST#:... | static async connectWifi(ssid: string, password: string): Promise<boolean> {
try {
const config: wifiManager.WifiDeviceConfig = {
ssid: ssid,
preSharedKey: password,
securityType: wifiManager.WifiSecurityType.WIFI_SEC_TYPE_PSK
};
const networkId: number = await wifiManag... | https://github.com/LiHuaJZOAQ/GuardSysAPP | 4dde1b00dd0c998454442f07a9053bb2f8d4a47a | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | forEach | Applies a function over all elements of Float32Array
@param fn function to apply
@returns undefined | public forEach(fn: (val: float) => float): void {
let newF: (val: float, index: int, array: Float32Array) => float =
(val: float, index: int, array: Float32Array): float => { return fn(val) }
this.forEach(newF)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left forEach AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#... | public forEach(fn: (val: float) => float): void {
let newF: (val: float, index: int, array: Float32Array) => float =
(val: float, index: int, array: Float32Array): float => { return fn(val) }
this.forEach(newF)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 687ba32263518e014f342c95760ba92b72ea390c | gitee |
arkui-x/samples | CodeLab/Cases/feature/customkeyboardtoh5/src/main/ets/components/TitleBar.ets | arkts | changeDialogClose | 监听dialogClose触发关闭弹窗事件 | changeDialogClose() {
if (this.dialogClose) {
this.dialogController?.close();
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left changeDialogClose 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#... | changeDialogClose() {
if (this.dialogClose) {
this.dialogController?.close();
}
} | https://gitcode.com/arkui-x/samples | e81000190b1a703da7b25201415334ed2efe726c | gitcode |
jiahaozheng406/huawei-travel-app-HarmonyOS | entry/src/main/ets/viewmodel/SearchViewModel.ets | arkts | getRecommondItemData | list 热门推荐 | getRecommondItemData(): string[] {
let cur_idxs:number[] = []
while (cur_idxs.length < 8) {
// 获取随机索引
let index: number = Math.floor(Math.random() * 15)
if (cur_idxs.indexOf(index) == -1) {
cur_idxs.push(index)
}
hilog.info(0x0000, 'testTag', '%{public}s', cur_idxs.length... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getRecommondItemData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#stri... | getRecommondItemData(): string[] {
let cur_idxs:number[] = []
while (cur_idxs.length < 8) {
// 获取随机索引
let index: number = Math.floor(Math.random() * 15)
if (cur_idxs.indexOf(index) == -1) {
cur_idxs.push(index)
}
hilog.info(0x0000, 'testTag', '%{public}s', cur_idxs.length... | https://github.com/jiahaozheng406/huawei-travel-app-HarmonyOS | c3f2e7ffa5cba132d96e7f6797b3a81fd13f8461 | github |
popsiclelmlm/Hey | entry/src/main/ets/features/runtime/RuntimeController.ets | arkts | eventToEntry | 诊断事件本身带 level/source,归一化等级。心跳(vpn-stats)渲染成带流量/状态的友好文案,
其余沿用既有格式化输出(供复制/分享)。 | private static eventToEntry(event: DiagnosticEvent, language: AppLanguage, coreLabel: string): LogEntry {
const time = formatClockTime(event.at);
const level = normalizeLogLevel(event.level);
if (event.source === 'vpn-stats') {
const message = localizeDiagnosticHeartbeat(
language,
e... | 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 eventToEntry AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:#Left :... | private static eventToEntry(event: DiagnosticEvent, language: AppLanguage, coreLabel: string): LogEntry {
const time = formatClockTime(event.at);
const level = normalizeLogLevel(event.level);
if (event.source === 'vpn-stats') {
const message = localizeDiagnosticHeartbeat(
language,
e... | https://github.com/popsiclelmlm/Hey | e28d8af46a8549b09be593ad0cf5e368a3d5fd97 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets | arkts | isNegative | Return true if the value of this Decimal is negative, otherwise return false.
@returns { boolean } the boolean type | public isNegative(): boolean {
return this.sign < 0;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isNegative 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#bo... | public isNegative(): boolean {
return this.sign < 0;
} | https://gitcode.com/iop123123/arkts-static-skills | 90a796aa00b2d4ab2d7eb6be4c347c50e2e4cd7e | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/mock/smartwardMock.ets | arkts | generatePatientInfo | 生成患者信息 | public generatePatientInfo(): WardPatientInfo {
const surname = this.surnames[Math.floor(Math.random() * this.surnames.length)];
const name = this.names[Math.floor(Math.random() * this.names.length)];
const riskLevels = [PatientRiskLevel.LOW, PatientRiskLevel.MEDIUM, PatientRiskLevel.HIGH, PatientRiskLeve... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left generatePatientInfo 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 Wa... | public generatePatientInfo(): WardPatientInfo {
const surname = this.surnames[Math.floor(Math.random() * this.surnames.length)];
const name = this.names[Math.floor(Math.random() * this.names.length)];
const riskLevels = [PatientRiskLevel.LOW, PatientRiskLevel.MEDIUM, PatientRiskLevel.HIGH, PatientRiskLeve... | https://github.com/LJ666-ui/harmony-health-care | 9afb721c0db6b20aead5e688e2c7d2caa6d4081e | github |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/services/DataCrypto.ets | arkts | base64Encode | ============================================================
编码辅助
============================================================
Base64 编码 | private base64Encode(data: Uint8Array): string {
const helper = new util.Base64Helper();
return helper.encodeToStringSync(data);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left base64Encode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | private base64Encode(data: Uint8Array): string {
const helper = new util.Base64Helper();
return helper.encodeToStringSync(data);
} | https://github.com/Mydstiny/RemoteDeskHarmonyOS | 7671ebf690bcf5dd1adce4d101cdba8b7ce48a6f | github |
Yebingiscn/SweetVideo | entry/src/main/ets/database/Preferences.ets | arkts | getRecentPlay | 最近播放视频数据 | static getRecentPlay(context: Context) {
return PreferencesUtil.getPreferencesValue(context, DATA_BASE_NAME, 'recent_play', []) as VideoMetadata[]
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getRecentPlay AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | static getRecentPlay(context: Context) {
return PreferencesUtil.getPreferencesValue(context, DATA_BASE_NAME, 'recent_play', []) as VideoMetadata[]
} | https://github.com/Yebingiscn/SweetVideo | dceec66abd12ba20c4fd31f6348f77b76d6a1a3d | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | toLocaleString | Converts Int32Array to a string with respect to locale
@param locales
@param options
@returns string representation | public toLocaleString(locales: Object, options: Object): string {
throw new Error("Int32Array.toLocaleString: not implemented")
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toLocaleString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left locales AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Object AST#ide... | public toLocaleString(locales: Object, options: Object): string {
throw new Error("Int32Array.toLocaleString: not implemented")
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 7560e98aa087a6dd26c0655529440f49c0b66af0 | gitee |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test22_original_index.ets | arkts | testNumberStatics | --- Number static methods --- | function testNumberStatics(): string {
let a: boolean = Number.isInteger(42);
let b: boolean = Number.isInteger(3.14);
let c: boolean = Number.isFinite(100);
let d: boolean = Number.isNaN(NaN);
return String(a) + ',' + String(b) + ',' + String(c) + ',' + String(d);
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testNumberStatics AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefine... | function testNumberStatics(): string {
let a: boolean = Number.isInteger(42);
let b: boolean = Number.isInteger(3.14);
let c: boolean = Number.isFinite(100);
let d: boolean = Number.isNaN(NaN);
return String(a) + ',' + String(b) + ',' + String(c) + ',' + String(d);
} | https://github.com/miaochiahao/ark-ghidra | 9b38f8d5d0a58068bf708ff56a7d49fac29d362a | github |
openharmony-sig/ohos_vlayout | library/src/main/ets/components/common/DefaultLayoutHelper.ets | arkts | build | 获取的listItem高度 | build() {
Column() {
List({ space: this.vLayoutAttribute?.dividerHeight }) {
ForEach(this.vLayoutDataLocal, (item: ESObject, position: number) => {
ListItem() {
this.vLayoutContent(item, position, this.oneRowHeight)
}
.height(this.oneRowHeight)
.on... | 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() {
List({ space: this.vLayoutAttribute?.dividerHeight }) {
ForEach(this.vLayoutDataLocal, (item: ESObject, position: number) => {
ListItem() {
this.vLayoutContent(item, position, this.oneRowHeight)
}
.height(this.oneRowHeight)
.on... | https://gitee.com/openharmony-sig/ohos_vlayout.git | 8ccc5371e17f9756d58e3d9f41a4870b51f81c58 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/FontManager.ets | arkts | getSettings | 获取当前字体设置 | getSettings(): FontSettings {
return this.copySettings(this.settings);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getSettings 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 FontSettings AST#identifier#Right AST#ERROR#Right ... | getSettings(): FontSettings {
return this.copySettings(this.settings);
} | https://github.com/DaLongZhuaZi/manxia | 28fa2d8a0a68d05ffda31f4be26ad1a9ef78ba13 | github |
CPF-ApplicationTPC/openharmony_tpc_samples | bc_ohos/library/src/main/ets/ISO9797Alg3Mac.ets | arkts | getAlgorithmName | 获取算法名称
@returns 算法名称 | getAlgorithmName(): string {
return 'ISO9797Alg3';
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getAlgorithmName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#state... | getAlgorithmName(): string {
return 'ISO9797Alg3';
} | https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples | f7ff82e2914e6a623e8cb5b275488920c0c59a7b | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/ar/PathPlanner.ets | arkts | extractFloorChanges | 提取楼层切换信息
@param pathNodes 路径节点列表 | private extractFloorChanges(pathNodes: GraphNode[]): FloorChange[] {
const floorChanges: FloorChange[] = [];
for (let i = 0; i < pathNodes.length - 1; i++) {
const current = pathNodes[i];
const next = pathNodes[i + 1];
if (current.floor !== next.floor) {
floorChanges.push({
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left extractFloorChanges AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pathNodes AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subs... | private extractFloorChanges(pathNodes: GraphNode[]): FloorChange[] {
const floorChanges: FloorChange[] = [];
for (let i = 0; i < pathNodes.length - 1; i++) {
const current = pathNodes[i];
const next = pathNodes[i + 1];
if (current.floor !== next.floor) {
floorChanges.push({
... | https://github.com/LJ666-ui/harmony-health-care | 306274dfeb8c29886781607f68bc6724ca7de5a2 | github |
fbinba3955/Flymby | common/src/main/ets/utils/VolumeUtil.ets | arkts | decreaseVolume | 减少音量
@param step 减少的步长 (0-1) | public static async decreaseVolume(step: number = 0.1): Promise<void> {
try {
const currentVolume = await VolumeUtil.getMediaVolume();
const newVolume = Math.max(currentVolume - step, VolumeUtil.MIN_VOLUME);
await VolumeUtil.setMediaVolume(newVolume);
LogUtil.info(`VolumeUtil 减少音量: ${curre... | 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 decreaseVolume AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ste... | public static async decreaseVolume(step: number = 0.1): Promise<void> {
try {
const currentVolume = await VolumeUtil.getMediaVolume();
const newVolume = Math.max(currentVolume - step, VolumeUtil.MIN_VOLUME);
await VolumeUtil.setMediaVolume(newVolume);
LogUtil.info(`VolumeUtil 减少音量: ${curre... | https://github.com/fbinba3955/Flymby | 32c61796a43b6a06d3ae11bcffd5d2708e413f54 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/CacheConfigManager.ets | arkts | validateConfig | 验证配置有效性 | public validateConfig(config: CacheConfig): ValidationResult {
const errors: string[] = [];
if (config.memoryCache) {
if (config.memoryCache.maxCount !== undefined && config.memoryCache.maxCount < 1) {
errors.push('内存缓存数量必须大于0');
}
if (config.memoryCache.maxSize !== undefined &&... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left validateConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | public validateConfig(config: CacheConfig): ValidationResult {
const errors: string[] = [];
if (config.memoryCache) {
if (config.memoryCache.maxCount !== undefined && config.memoryCache.maxCount < 1) {
errors.push('内存缓存数量必须大于0');
}
if (config.memoryCache.maxSize !== undefined &&... | https://github.com/DaLongZhuaZi/manxia | 2a475e200446371caef9ce801067a9b678340d29 | github |
openharmony-sig/flutter_engine | shell/platform/ohos/flutter_embedding/flutter/src/main/ets/plugin/platform/PlatformView.ets | arkts | onFlutterViewDetached | Called by the {@link io.flutter.embedding.engine.FlutterEngine} that owns this {@code
PlatformView} when the DynamicView responsible for rendering a Flutter UI is detached
and disassociated from the {@link io.flutter.embedding.engine.FlutterEngine}.
<p>This means that our associated {@link io.flutter.embedding.engine.F... | onFlutterViewDetached(): void {} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onFlutterViewDetached 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_expr... | onFlutterViewDetached(): void {} | https://gitee.com/openharmony-sig/flutter_engine.git | b45b33c09b2da976c8f1d06be5eaa0efdfad5ba4 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/WebViewMangaLoader.ets | arkts | onLoadSuccess | 加载成功回调 | onLoadSuccess(request: ImageRequestInfo, response: WebViewLoadingResult): void {
logger.debug(TAG, `图片加载成功: ${request.url}`);
// 更新章节加载进度
this.updateChapterProgress(request.chapterId, true, false);
// 转发给其他监听器
this.loadListeners.forEach(listener => {
try {
listener.onLoadSu... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onLoadSuccess AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left request AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ImageRequestInfo AST#identifier#Right A... | onLoadSuccess(request: ImageRequestInfo, response: WebViewLoadingResult): void {
logger.debug(TAG, `图片加载成功: ${request.url}`);
// 更新章节加载进度
this.updateChapterProgress(request.chapterId, true, false);
// 转发给其他监听器
this.loadListeners.forEach(listener => {
try {
listener.onLoadSu... | https://github.com/DaLongZhuaZi/manxia | a45ba0458a0fcca5dea65845032412441008ac68 | github |
Joker-x-dev/CoolMallArkTS | feature/goods/src/main/ets/viewmodel/GoodsCommentViewModel.ets | arkts | requestListData | 请求商品评论分页数据
@returns {Promise<NetworkResponse<NetworkPageData<Comment>>>} 网络请求 Promise | protected requestListData(): Promise<NetworkResponse<NetworkPageData<Comment>>> {
const request: GoodsCommentPageRequest = new GoodsCommentPageRequest({
goodsId: `${this.goodsId}`
});
request.page = this.currentPage;
request.size = this.pageSize;
return this.repository.getGoodsCommentPage(re... | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left requestListData 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 A... | protected requestListData(): Promise<NetworkResponse<NetworkPageData<Comment>>> {
const request: GoodsCommentPageRequest = new GoodsCommentPageRequest({
goodsId: `${this.goodsId}`
});
request.page = this.currentPage;
request.size = this.pageSize;
return this.repository.getGoodsCommentPage(re... | https://github.com/Joker-x-dev/CoolMallArkTS | 9d8343ca463b7766307352d1f2114b055c9edaf3 | github |
HarmonyOS_Samples/BestPracticeSnippets | ApiUsingStandards/entry/src/main/ets/pages/AVImageGenerator.ets | arkts | fetchFrame | [Start av_image_generator_class] | async fetchFrame(): Promise<void> {
await this.fetchMeta();
if (canIUse("SystemCapability.Multimedia.Media.AVImageGenerator")) {
this.pixelMap = new Array;
let avImageGenerator: media.AVImageGenerator = await media.createAVImageGenerator();
// raw fd
avImageGenerator.fdSrc = fs.openSyn... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left fetchFrame AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_t... | async fetchFrame(): Promise<void> {
await this.fetchMeta();
if (canIUse("SystemCapability.Multimedia.Media.AVImageGenerator")) {
this.pixelMap = new Array;
let avImageGenerator: media.AVImageGenerator = await media.createAVImageGenerator();
// raw fd
avImageGenerator.fdSrc = fs.openSyn... | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 8f0a3b30b156549a03303cdd3485418d4b34cb57 | gitcode |
xblLab/HarmonyProjectTemplate | products/phone/src/main/ets/common/AppUtils.ets | arkts | setColorMode | 设置应用深浅色 | public static setColorMode() {
Logger.info(TAG, 'setColorMode PersistenceV2 keys: ' + JSON.stringify(PersistenceV2.keys()));
const context = getContext() as common.UIAbilityContext;
const settingInfo: SettingModel = PersistenceV2.connect(SettingModel, () => new SettingModel())!;
const mode = settingIn... | 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 setColorMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ER... | public static setColorMode() {
Logger.info(TAG, 'setColorMode PersistenceV2 keys: ' + JSON.stringify(PersistenceV2.keys()));
const context = getContext() as common.UIAbilityContext;
const settingInfo: SettingModel = PersistenceV2.connect(SettingModel, () => new SettingModel())!;
const mode = settingIn... | https://github.com/xblLab/HarmonyProjectTemplate | ac5bb08c8f08ad94700cad39f784495012d35bf9 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/Legend.ets | arkts | setCustom | Sets a custom legend's entries array.
* A null label will start a group.
This will disable the feature that automatically calculates the legend
entries from the datasets.
Call resetCustom() to re-enable automatic calculation (and then
notifyDataSetChanged() is needed to auto-calculate the legend again) | public setCustom(entries: JArrayList<LegendEntry>): void {
this.mEntries = []
for (let i: number = 0; i < entries.size(); i++) {
this.mEntries[i] = entries.at(i);
}
this.mIsLegendCustom = true;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setCustom AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left entries AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#instantiation_expre... | public setCustom(entries: JArrayList<LegendEntry>): void {
this.mEntries = []
for (let i: number = 0; i < entries.size(); i++) {
this.mEntries[i] = entries.at(i);
}
this.mIsLegendCustom = true;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 16d689f4586e1ebf87d89ef50a6fa2d6f344ab78 | gitee |
tdcare/tdwebrtc | src/main/ets/utils/StrUtil.ets | arkts | getErrorStr | 获取Error的JSON字符串 | static getErrorStr(error: BusinessError): string {
const errObj: Record<string, string | number> = {};
errObj['name'] = error.name;
errObj['code'] = error.code;
errObj['message'] = error.message;
errObj['stack'] = error.stack ?? '';
return JSON.stringify(errObj);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getErrorStr AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left error AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Bus... | static getErrorStr(error: BusinessError): string {
const errObj: Record<string, string | number> = {};
errObj['name'] = error.name;
errObj['code'] = error.code;
errObj['message'] = error.message;
errObj['stack'] = error.stack ?? '';
return JSON.stringify(errObj);
} | https://github.com/tdcare/tdwebrtc | f62dea37e7cc337ac41214d6f8aa32cd2e0ea8b7 | github |
cpdd5201314/harmonyOS-music-app | products/phone/src/main/ets/pages/MusicDetailPage.ets | arkts | getPlayModeText | 获取当前模式的文本描述 | getPlayModeText(): string {
switch (this.playMode) {
case MusicPlayMode.SEQUENCE:
return '顺序播放';
case MusicPlayMode.LOOP_ONE:
return '单曲循环';
case MusicPlayMode.RANDOM:
return '随机播放';
default:
return '未知模式';
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getPlayModeText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statem... | getPlayModeText(): string {
switch (this.playMode) {
case MusicPlayMode.SEQUENCE:
return '顺序播放';
case MusicPlayMode.LOOP_ONE:
return '单曲循环';
case MusicPlayMode.RANDOM:
return '随机播放';
default:
return '未知模式';
}
} | https://github.com/cpdd5201314/harmonyOS-music-app | 81c2a7c5322a6b610ae408c7e6838ae7fab9e649 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Object.ets | arkts | entries | Returns an array of key/values of properties of a record
@param rec record that contains the fields
@returns array representation of key/value | public static entries(rec: Record<PropertyKey, Any>): NullishEntryType[] {
const entries: NullishEntryType[] = new NullishEntryType[rec.size.toInt()](undefined)
let i = 0
for (const entry of rec.entries()) {
entries[i] = entry
i++
}
return entries
... | 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 entries AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left rec AST#identifier#Right AST#:#Left : AST#:#Rig... | public static entries(rec: Record<PropertyKey, Any>): NullishEntryType[] {
const entries: NullishEntryType[] = new NullishEntryType[rec.size.toInt()](undefined)
let i = 0
for (const entry of rec.entries()) {
entries[i] = entry
i++
}
return entries
... | https://gitcode.com/iop123123/arkts-static-skills | 8cdfa2528274f7a2a8139d7be589a1f343e9bcc0 | gitcode |
CLMC2025/Vignette | entry/src/main/ets/sync/DataExportImport.ets | arkts | getSummary | 获取摘要信息 | getSummary(): string {
return `导入: ${this.imported}, 更新: ${this.updated}, 冲突: ${this.conflicts}, 跳過: ${this.skipped}`;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getSummary AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement_b... | getSummary(): string {
return `导入: ${this.imported}, 更新: ${this.updated}, 冲突: ${this.conflicts}, 跳過: ${this.skipped}`;
} | https://github.com/CLMC2025/Vignette | c436d2d6565e510122ec2f87fa2209a2933b88c0 | github |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test2_original_index.ets | arkts | testTemplateLiteral | === Template Literal with expressions === | function testTemplateLiteral(name: string, age: number): string {
return `Name: ${name}, Age: ${String(age)}`;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testTemplateLiteral AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left name AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS... | function testTemplateLiteral(name: string, age: number): string {
return `Name: ${name}, Age: ${String(age)}`;
} | https://github.com/miaochiahao/ark-ghidra | b7d71c978da8547b55dbf432d9494e6498f20bce | github |
openharmony-sig/ohos_danmaku_flame_master | library/src/main/ets/components/common/master/flame/danmaku/danmaku/model/ohos/DanmakuContext.ets | arkts | addUserHashBlackList | ��������û�
@param hashes
@return | public addUserHashBlackList(hashes: string[]): DanmakuContext{
if (hashes == null || hashes.length == 0) {
return this;
}
this.mUserHashBlackList.push(...hashes);
this.setFilterData(DanmakuFilters.TAG_USER_HASH_FILTER, this.mUserHashBlackList);
this.mGlobalFlagValues.updateFilterFlag();
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left addUserHashBlackList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left hashes AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript... | public addUserHashBlackList(hashes: string[]): DanmakuContext{
if (hashes == null || hashes.length == 0) {
return this;
}
this.mUserHashBlackList.push(...hashes);
this.setFilterData(DanmakuFilters.TAG_USER_HASH_FILTER, this.mUserHashBlackList);
this.mGlobalFlagValues.updateFilterFlag();
... | https://gitee.com/openharmony-sig/ohos_danmaku_flame_master.git | 31bebda3a3b0a13d22b216b99e74fc45618b8af9 | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | filter | Creates a new Int32Array from current Int32Array based on a condition fn.
@param fn the condition to apply for each element
@returns a new Int32Array with elements from current Int32Array that satisfy condition fn | public filter(fn: (val: int, index: int, array: Int32Array) => boolean): Int32Array {
let markers = new boolean[this.length]
let resLen = 0
for (let i = 0; i < this.length; ++i) {
markers[i] = fn(this.at(i), i, this)
if (markers[i]) {
++resLen
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left filter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#R... | public filter(fn: (val: int, index: int, array: Int32Array) => boolean): Int32Array {
let markers = new boolean[this.length]
let resLen = 0
for (let i = 0; i < this.length; ++i) {
markers[i] = fn(this.at(i), i, this)
if (markers[i]) {
++resLen
... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 2305446a31b6e19267851215c01bbbc88bcd8498 | gitee |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/usbdriver/UsbDriverService.ets | arkts | checkAndRescanDevices | 检查并重新扫描设备
如果有控制器断开但设备仍然连接,尝试重新初始化 | private async checkAndRescanDevices(): Promise<void> {
// 检查是否有断开的控制器但设备仍然存在
try {
const currentDevices = usbManager.getDevices();
// 检查已处理的设备是否有断开的控制器
for (const device of currentDevices) {
// 使用完整的物理位置 key
const deviceKey = `${device.vendorId}:${device.productId}:${d... | 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 checkAndRescanDevices AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#R... | private async checkAndRescanDevices(): Promise<void> {
// 检查是否有断开的控制器但设备仍然存在
try {
const currentDevices = usbManager.getDevices();
// 检查已处理的设备是否有断开的控制器
for (const device of currentDevices) {
// 使用完整的物理位置 key
const deviceKey = `${device.vendorId}:${device.productId}:${d... | https://github.com/AlkaidLab/moonlight-harmony | 50927c5934872c06c3d21964830f089c502328dc | github |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/FamilyPackMerge.ets | arkts | parseIsoMs | Best-effort ISO-8601 → ms parser. Returns 0 on failure. | function parseIsoMs(iso: string | undefined): number {
if (typeof iso !== 'string' || iso.length === 0) {
return 0;
}
const parsed: number = Date.parse(iso);
if (Number.isNaN(parsed)) {
return 0;
}
return parsed;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left parseIsoMs AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left iso AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right ... | function parseIsoMs(iso: string | undefined): number {
if (typeof iso !== 'string' || iso.length === 0) {
return 0;
}
const parsed: number = Date.parse(iso);
if (Number.isNaN(parsed)) {
return 0;
}
return parsed;
} | https://github.com/terryma2024/happyword | daea2a0cc8be8ac73aca1b1436adf49d31954425 | github |
HarmonyOS_Samples/HarmonyOSComponentUXExamples | commons/componentuxexamplesbase/src/main/ets/model/BreakpointModel.ets | arkts | isExtraLargeScreen | Checks if the current device is considered an extra large screen.
A screen is considered extra large if the width breakpoint is WIDTH_XL.
@returns {boolean} True if the current screen is extra large, false otherwise. | public isExtraLargeScreen(): boolean {
return this.currentWidthBreakpoint === WidthBreakpoint.WIDTH_XL;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isExtraLargeScreen 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 boolea... | public isExtraLargeScreen(): boolean {
return this.currentWidthBreakpoint === WidthBreakpoint.WIDTH_XL;
} | https://gitcode.com/HarmonyOS_Samples/HarmonyOSComponentUXExamples | 5a681fef7cb299be016e8f2b5fb2168e44aef310 | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/usbdriver/AbstractController.ets | arkts | getCapabilities | 获取控制器能力 | getCapabilities(): number {
return this.capabilities;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCapabilities 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#statem... | getCapabilities(): number {
return this.capabilities;
} | https://github.com/AlkaidLab/moonlight-harmony | 9db280c635850ed5a20996cf085ff52e66cb035f | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/skill/utils/SkillTestTool.ets | arkts | addResult | 添加测试结果 | private addResult(
testName: string,
input: string,
passed: boolean,
result: any,
error?: string,
elapsedTime?: number
): void {
const testResult: TestResult = {
testName,
input,
passed,
timestamp: new Date().toISOString(),
response: result ? {
t... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left addResult AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left testName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#R... | private addResult(
testName: string,
input: string,
passed: boolean,
result: any,
error?: string,
elapsedTime?: number
): void {
const testResult: TestResult = {
testName,
input,
passed,
timestamp: new Date().toISOString(),
response: result ? {
t... | https://github.com/LJ666-ui/harmony-health-care | 3413d8e0fba20aff9ca768aaebb19e756c17f3a6 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Value.ets | arkts | of | ----- | public static of(v: FixedArray<boolean>): Value {
return new ArrayValue(ArrayType.BOOLEAN_VAL, v)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#of#Left of AST#of#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left v AST#identifier#Right AST#:#... | public static of(v: FixedArray<boolean>): Value {
return new ArrayValue(ArrayType.BOOLEAN_VAL, v)
} | https://gitcode.com/iop123123/arkts-static-skills | fc5f294b747a2caed8fab0459fc493e649d9cdac | gitcode |
erosTeam/NextE | shared/src/main/ets/services/CommentTranslationService.ets | arkts | needsTranslation | Local, network-free language pre-check: a comment "needs translation" only when its dominant script
differs from the current UI language's. Cheap heuristic — it cannot tell apart latin-script languages
(en/fr/de all read as "latin") or kana-less Japanese, so it errs toward translating when unsure. Used
to skip AUTO-tra... | static needsTranslation(text: string): boolean {
const t: string = text.trim()
if (t.length === 0) {
return false
}
const script: string = CommentTranslationService.detectScript(t)
if (script === 'unknown') {
return true
}
return script !== CommentTranslationService.targetScrip... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left needsTranslation AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | static needsTranslation(text: string): boolean {
const t: string = text.trim()
if (t.length === 0) {
return false
}
const script: string = CommentTranslationService.detectScript(t)
if (script === 'unknown') {
return true
}
return script !== CommentTranslationService.targetScrip... | https://github.com/erosTeam/NextE | fd4f2a72934de3509e8e3ff2057e931cd07e956f | github |
DaLongZhuaZi/manxia | entry/src/main/ets/libs/htmlparser/Matcher.ets | arkts | parseAttributeSelector | 解析属性选择器 | private static parseAttributeSelector(selector: string, startIndex: number): AttributeSelectorResult | null {
let i = startIndex;
const len = selector.length;
let name = '';
while (i < len && /[a-zA-Z0-9_-]/.test(selector[i])) {
name += selector[i];
i++;
}
if (!name) return null;... | 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 parseAttributeSelector AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left selector AST#identifier#Right AST#ERROR#Left... | private static parseAttributeSelector(selector: string, startIndex: number): AttributeSelectorResult | null {
let i = startIndex;
const len = selector.length;
let name = '';
while (i < len && /[a-zA-Z0-9_-]/.test(selector[i])) {
name += selector[i];
i++;
}
if (!name) return null;... | https://github.com/DaLongZhuaZi/manxia | 4de9f56300a1a26abba5c7cef12686ab19c93455 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/medicalimaging/ModelManager.ets | arkts | getLoadedModelCount | 获取已加载模型数量
@returns 已加载模型数量 | getLoadedModelCount(): number {
let count = 0;
this.modelInfoMap.forEach(info => {
if (info.status === ModelStatus.LOADED) {
count++;
}
});
return count;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getLoadedModelCount 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#st... | getLoadedModelCount(): number {
let count = 0;
this.modelInfoMap.forEach(info => {
if (info.status === ModelStatus.LOADED) {
count++;
}
});
return count;
} | https://github.com/LJ666-ui/harmony-health-care | d5a095a6836360188b5588382953bab743219f8b | github |
offlinecat-dev/OCNetORM | src/main/ets/mapping/ResultSetUtils.ets | arkts | getValueByType | 根据列类型从 ResultSet 获取值
@param resultSet 结果集
@param columnIndex 列索引
@param columnType 列类型
@returns 列值 | static getValueByType(
resultSet: relationalStore.ResultSet,
columnIndex: number,
columnType: string
): DbValueType {
try {
switch (columnType) {
case ColumnType.INTEGER:
case 'INTEGER':
// getLong 返回 number 类型
return resultSet.getLong(columnIndex) as number... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getValueByType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resultSet AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expre... | static getValueByType(
resultSet: relationalStore.ResultSet,
columnIndex: number,
columnType: string
): DbValueType {
try {
switch (columnType) {
case ColumnType.INTEGER:
case 'INTEGER':
// getLong 返回 number 类型
return resultSet.getLong(columnIndex) as number... | https://github.com/offlinecat-dev/OCNetORM | 42e5c58c989d31677478b35914f76bc8588c9e1e | github |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/LearningRecorder.ets | arkts | recordAnswer | Record a single answer. Updates counters, schedules a debounced
flush, and marks the word as newly-learned if this is the first
correct answer we've seen for it. | recordAnswer(wordId: string, correct: boolean): void {
if (wordId.length === 0) {
return;
}
const stat: WordStat = this.findOrCreateStat(wordId);
const wasLearned: boolean = this.sessionStartLearnedIds.has(wordId);
stat.seenCount += 1;
if (correct) {
stat.correctCount += 1;
s... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left recordAnswer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left wordId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , ... | recordAnswer(wordId: string, correct: boolean): void {
if (wordId.length === 0) {
return;
}
const stat: WordStat = this.findOrCreateStat(wordId);
const wasLearned: boolean = this.sessionStartLearnedIds.has(wordId);
stat.seenCount += 1;
if (correct) {
stat.correctCount += 1;
s... | https://github.com/terryma2024/happyword | b6138408a72ec46c89fe383b722a02cc2d39b283 | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.