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 |
|---|---|---|---|---|---|---|---|---|---|---|
LJ666-ui/harmony-health-care | entry/src/main/ets/rag/HybridRetriever.ets | arkts | mergeResults | 结果融合 - Reciprocal Rank Fusion (RRF)
@param vectorResults 向量检索结果
@param keywordResults 关键词检索结果
@returns 融合后的结果 | private mergeResults(
vectorResults: RetrievalResult[],
keywordResults: RetrievalResult[]
): RetrievalResult[] {
const k = 60; // RRF参数
const scoreMap = new Map<string, { result: RetrievalResult; score: number }>();
// 向量检索结果打分
vectorResults.forEach((result, index) => {
const rrfScore... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left mergeResults AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left vectorResults AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscri... | private mergeResults(
vectorResults: RetrievalResult[],
keywordResults: RetrievalResult[]
): RetrievalResult[] {
const k = 60; // RRF参数
const scoreMap = new Map<string, { result: RetrievalResult; score: number }>();
// 向量检索结果打分
vectorResults.forEach((result, index) => {
const rrfScore... | https://github.com/LJ666-ui/harmony-health-care | 89853358ece860a301c24ef35099da2bd890dd66 | github |
openharmony/codelabs | ETSUI/LifeTrack/entry/src/main/ets/services/RepeatService.ets | arkts | generateFutureInstances | 生成未来实例 | generateFutureInstances(event: CalendarEvent, repeatRule: RepeatRule): EventInstance[] {
const instances: EventInstance[] = [];
// 根据结束条件确定最大实例数
let maxInstances = 100; // 默认最多100个
let endDate: number | null = null;
if (repeatRule.endType === 'count') {
maxInstances = Math.min(repeatRule.e... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left generateFutureInstances AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left event AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left CalendarEvent AS... | generateFutureInstances(event: CalendarEvent, repeatRule: RepeatRule): EventInstance[] {
const instances: EventInstance[] = [];
// 根据结束条件确定最大实例数
let maxInstances = 100; // 默认最多100个
let endDate: number | null = null;
if (repeatRule.endType === 'count') {
maxInstances = Math.min(repeatRule.e... | https://gitcode.com/openharmony/codelabs | c3a430fe155a281c5fdef02a217780c422d1c4ca | gitcode |
openharmony/codelabs | Distributed/HandleGameApplication/GameEtsOpenHarmony/entry/src/main/ets/MainAbility/pages/index.ets | arkts | movePlaneByHandle | 收到手柄指令后移动飞机 | movePlaneByHandle() {
this.planePosX += Math.cos((this.angle + 90) * (Math.PI / 180)) * 10
this.planePosY -= Math.sin((this.angle + 90) * (Math.PI / 180)) * 10
if (this.planePosX < 0) {
this.planePosX = 0
}
if (this.planePosY < 0) {
this.planePosY = 0
}
if (this.planePosX > t... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left movePlaneByHandle 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#... | movePlaneByHandle() {
this.planePosX += Math.cos((this.angle + 90) * (Math.PI / 180)) * 10
this.planePosY -= Math.sin((this.angle + 90) * (Math.PI / 180)) * 10
if (this.planePosX < 0) {
this.planePosX = 0
}
if (this.planePosY < 0) {
this.planePosY = 0
}
if (this.planePosX > t... | https://gitee.com/openharmony/codelabs.git | 806572fe0812b0898e6acddb37542e6468db8df2 | gitee |
revalue-o/HarmonyOS-Next-Hook-demo | source_codes/ArkTS-inject/entry/src/main/ets/utils/NativeLocationUtil.ets | arkts | isLocationEnabled | 检查位置服务是否启用(Native 层同步调用) | static isLocationEnabled(): boolean {
try {
const enabled = nativeIsLocationEnabled();
hilog.info(DOMAIN, 'NativeLocationUtil', 'Location enabled (native): %{public}s', enabled.toString());
return enabled;
} catch (err) {
hilog.error(DOMAIN, 'NativeLocationUtil', 'Check location enable... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isLocationEnabled 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... | static isLocationEnabled(): boolean {
try {
const enabled = nativeIsLocationEnabled();
hilog.info(DOMAIN, 'NativeLocationUtil', 'Location enabled (native): %{public}s', enabled.toString());
return enabled;
} catch (err) {
hilog.error(DOMAIN, 'NativeLocationUtil', 'Check location enable... | https://github.com/revalue-o/HarmonyOS-Next-Hook-demo | f6ed28c21970bfd3a3a544a71184850737041cf4 | github |
openharmony/developtools_profiler | host/smartperf/client/client_ui/entry/src/main/ets/common/profiler/item/Power.ets | arkts | readCurrentNow | TODO 电流是否取绝对值累加 | readCurrentNow(): string {
let powerQueue: string[] = globalThis.powerCurArr;
let lastValue = 0;
while (powerQueue.length >= 4) {
lastValue += StringUtils.s2L(powerQueue.pop().toString());
}
let avgCurrentNum = (lastValue / 4).toString();
return avgCurrentNum;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left readCurrentNow 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... | readCurrentNow(): string {
let powerQueue: string[] = globalThis.powerCurArr;
let lastValue = 0;
while (powerQueue.length >= 4) {
lastValue += StringUtils.s2L(powerQueue.pop().toString());
}
let avgCurrentNum = (lastValue / 4).toString();
return avgCurrentNum;
} | https://gitee.com/openharmony/developtools_profiler.git | bbc92dc9b426c753c8a7f06c38a8f0e2ec696b05 | gitee |
751496032/DSBridge-HarmonyOS | library/src/main/ets/core/WebViewControllerProxy.ets | arkts | getWebViewController | @deprecated
@see webviewController
@returns | getWebViewController(): webview.WebviewController {
return this.controller
} | AST#program#Left AST#expression_statement#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left getWebViewController 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#... | getWebViewController(): webview.WebviewController {
return this.controller
} | https://github.com/751496032/DSBridge-HarmonyOS/blob/6e69923a816e400710e23c8bab549fe790545bc6/library/src/main/ets/core/WebViewControllerProxy.ets#L161-L163 | f949f1209574265e67086d0a4fcc9ff8985d6089 | github |
tdcare/tdwebrtc | src/main/ets/WebRTCManager.ets | arkts | setupMediaTracksForCall | 根据通话类型设置媒体轨道 | public setupMediaTracksForCall(enableVideo: boolean): void {
// 始终添加音频轨道(使用 PCMU 编码,payload type 0)
if (!this.hasTrackOfKind('audio')) {
this.addAudioTrack('ARDAMSa0', 'PCMU');
}
// v36: 根据设备编码能力动态选择发送编解码器
// SDP 的 codec 顺序由 Rust MediaEngine 注册顺序决定(bestRecvCodec 优先),与本地发送轨道无关
const vide... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setupMediaTracksForCall AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left enableVideo AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#boolean#Left bool... | public setupMediaTracksForCall(enableVideo: boolean): void {
// 始终添加音频轨道(使用 PCMU 编码,payload type 0)
if (!this.hasTrackOfKind('audio')) {
this.addAudioTrack('ARDAMSa0', 'PCMU');
}
// v36: 根据设备编码能力动态选择发送编解码器
// SDP 的 codec 顺序由 Rust MediaEngine 注册顺序决定(bestRecvCodec 优先),与本地发送轨道无关
const vide... | https://github.com/tdcare/tdwebrtc | f7a28a7a127c03e779590c98bde59ce072b65f7a | github |
aimilin6688/KeePassHO | entry/src/main/ets/common/oauth2/BaseOAuth2Provider.ets | arkts | revokeToken | 撤销访问令牌
@param accessToken 访问令牌
@return Promise<void>
@throws 如果撤销令牌失败则抛出异常 | public async revokeToken(accessToken: string): Promise<void> {
const revokeUrl = this.getRevokeUrl();
if (!revokeUrl) {
hilog.warn(DOMAIN, TAG, 'Revoke URL not configured, token revocation skipped');
return;
}
try {
const requestBody: Record<string, string> = {};
requestBody['... | 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 revokeToken AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left accessToken AST#identifier#Right AST#ERROR#Left AST#:#Left ... | public async revokeToken(accessToken: string): Promise<void> {
const revokeUrl = this.getRevokeUrl();
if (!revokeUrl) {
hilog.warn(DOMAIN, TAG, 'Revoke URL not configured, token revocation skipped');
return;
}
try {
const requestBody: Record<string, string> = {};
requestBody['... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/oauth2/BaseOAuth2Provider.ets#L145-L163 | 0af835ebeae0fdd36840ab7828e50196a2a10b18 | github |
xiaofenger_705/protobuf-arkts-generator | runtime/arkpb/Reader.ets | arkts | bool | Read boolean (varint) | bool(): boolean { return this.uint32() !== 0 } | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left bool 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#statement_bloc... | bool(): boolean { return this.uint32() !== 0 } | https://gitcode.com/xiaofenger_705/protobuf-arkts-generator | 743eaac250911891d70caefbe158a632d2555b8d | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Animation/AnimatedGridState.ets | arkts | updateItems | 更新条目列表
@param newItems 新的条目列表
@param animationType 动画类型(如果不指定则自动检测) | public updateItems(newItems: T[], animationType?: AnimationType): void {
// 保存旧状态
this.previousItems = this.currentItems.slice();
const newPrevPositions = new Map<string, ItemPosition>();
this.currentPositions.forEach((value, key) => {
newPrevPositions.set(key, value);
});
this.previousP... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left updateItems AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left newItems AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier... | public updateItems(newItems: T[], animationType?: AnimationType): void {
// 保存旧状态
this.previousItems = this.currentItems.slice();
const newPrevPositions = new Map<string, ItemPosition>();
this.currentPositions.forEach((value, key) => {
newPrevPositions.set(key, value);
});
this.previousP... | https://github.com/DaLongZhuaZi/manxia | 1981f5b1724a68c359e290956ae652a54641cc0e | github |
tdcare/tdwebrtc | src/main/ets/utils/StrUtil.ets | arkts | bytesToStr | Bytes转字符串
@param bytes
@returns | public static bytesToStr(bytes: Uint8Array): string {
let str = ""
for (let i = 0; i < bytes.length; i++) {
str += String.fromCharCode(bytes[i]);
}
return str;
} | 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 bytesToStr AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left bytes AST#identifier#Right AST#:#Left : AST#... | public static bytesToStr(bytes: Uint8Array): string {
let str = ""
for (let i = 0; i < bytes.length; i++) {
str += String.fromCharCode(bytes[i]);
}
return str;
} | https://github.com/tdcare/tdwebrtc | b12c59d487a4e7d57574c0072e8d03acd185db19 | github |
codelably/HCompass | entry/src/main/ets/entryability/AppInterceptors.ets | arkts | splitLines | 按换行符拆分字符串 | private splitLines(value: string): string[] {
if (!value) {
return [""];
}
return value.split("\n");
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left splitLines 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 s... | private splitLines(value: string): string[] {
if (!value) {
return [""];
}
return value.split("\n");
} | https://github.com/codelably/HCompass | 7f96283fa3f1ce87d62bdc526b7810f7b6ee3543 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Services/GlobalSearchService.ets | arkts | searchOnlineManga | ==================== 在线搜索 ====================
搜索在线漫画(单个图源)
支持两种图源格式:
- HTTP 格式(features配置):使用 SourceExecutor
- WebView 格式(workflows配置):使用 MangaSourceEngine | async searchOnlineManga(
sourceId: number,
keyword: string,
page: number = 1,
sourceInfo?: SourceInfo,
signal?: GlobalSearchCancelSignal,
searchGeneration?: number
): Promise<UnifiedSearchItem[]> {
try {
// 获取图源信息
const source = sourceInfo ? sourceInfo : null;
const sou... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left searchOnlineManga AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceId AST#identifier#Right AST#type_annotation#Left AST#:#... | async searchOnlineManga(
sourceId: number,
keyword: string,
page: number = 1,
sourceInfo?: SourceInfo,
signal?: GlobalSearchCancelSignal,
searchGeneration?: number
): Promise<UnifiedSearchItem[]> {
try {
// 获取图源信息
const source = sourceInfo ? sourceInfo : null;
const sou... | https://github.com/DaLongZhuaZi/manxia | f14c7014cbf5e16e4e6ee888370d9460ccbb017c | github |
HarmonyOS_Samples/hmosworld | HMOSWorld/Application/features/challenge/src/main/ets/components/ZoneDetailModal.ets | arkts | handleShowChange | Recalculate the size of the pop-up window when the modal pop-up window is changed. | handleShowChange() {
this.detailSheetWidth =
this.currentBreakpoint === BreakpointTypeEnum.SM ? this.deviceWidth :
Const.MODAL_MAX_WIDTH;
this.detailSheetMinHeight = this.detailSheetWidth * Const.IMG_ASPECT_RATIO + Const.MODAL_BOTTOM_HEIGHT;
this.detailSheetHeight = this.detailSheetMinHeight;
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left handleShowChange 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... | handleShowChange() {
this.detailSheetWidth =
this.currentBreakpoint === BreakpointTypeEnum.SM ? this.deviceWidth :
Const.MODAL_MAX_WIDTH;
this.detailSheetMinHeight = this.detailSheetWidth * Const.IMG_ASPECT_RATIO + Const.MODAL_BOTTOM_HEIGHT;
this.detailSheetHeight = this.detailSheetMinHeight;
... | https://gitcode.com/HarmonyOS_Samples/hmosworld | 1de95555fa0b686ce4b3e00be7daab82bc1b6fcd | gitcode |
terryma2024/happyword | harmonyos/entry/src/ohosTest/ets/test/ConfigFlow.ui.test.ets | arkts | scrollToParentPinButton | V0.6.5.1: scroll iteratively until ConfigParentPinButton is on
screen. The packPickerSection between autoSpeak and parentPin can
require multiple swipes on the landscape emulator viewport.
V0.6.7.7 — strengthen the visibility check. Pre-V0.6.7.7 this
helper exited on the first non-null `findComponent`, which on the
emu... | async function scrollToParentPinButton(driver: Driver): Promise<void> {
// The OpenHarmony emulator dumps land button bounds as a 25-pixel
// clipped slice (Y top = ~1235, Y bottom = 1260) when the row is
// pinned to the very bottom of the visible Scroll. 100px padding
// guarantees the button has enough hit-t... | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left scrollToParentPinButton AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left driver AST#identifier#Rig... | async function scrollToParentPinButton(driver: Driver): Promise<void> {
// The OpenHarmony emulator dumps land button bounds as a 25-pixel
// clipped slice (Y top = ~1235, Y bottom = 1260) when the row is
// pinned to the very bottom of the visible Scroll. 100px padding
// guarantees the button has enough hit-t... | https://github.com/terryma2024/happyword | a5552b158ba60c530c39d69d0d16676a07b422bb | github |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/services/LightSensingService.ets | arkts | getRecommendedTheme | 获取建议的主题模式 | getRecommendedTheme(): string {
return this.currentLux < 300 ? 'dark' : 'light';
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getRecommendedTheme AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#st... | getRecommendedTheme(): string {
return this.currentLux < 300 ? 'dark' : 'light';
} | https://github.com/Mydstiny/RemoteDeskHarmonyOS | 3190619d7ee81dc458b08fb753bed29bf24c16da | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/StatisticsDAO.ets | arkts | insertMonthly | ================== 月度统计 ================== | static async insertMonthly(stat: MonthlyStatistics) {
if (!stat.validate()) throw new Error('[StatisticsDAO] 月度统计验证失败');
const store = DatabaseManager.getDatabase();
const now = new Date().toISOString();
stat.createdAt = now;
stat.updatedAt = now;
const sql = `
INSERT INTO monthly_stat... | 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 insertMonthly AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left stat AST#identifier#Right AST#:#Left : AST... | static async insertMonthly(stat: MonthlyStatistics) {
if (!stat.validate()) throw new Error('[StatisticsDAO] 月度统计验证失败');
const store = DatabaseManager.getDatabase();
const now = new Date().toISOString();
stat.createdAt = now;
stat.updatedAt = now;
const sql = `
INSERT INTO monthly_stat... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | cc555ca5158dc086128a2d2d3bb7f1c205d480a9 | github |
jjjjjjava/ffmpeg_tools | src/main/ets/ffmpeg/FFmpegFactory.ets | arkts | downloadRtsp | ============================================================
网络流媒体
============================================================
RTSP 流录制 | public static downloadRtsp(rtspUrl: string, output: string, duration?: number): string[] {
const cmd: string[] = ['ffmpeg', '-rtsp_transport', 'tcp', '-i', rtspUrl, '-c:v', 'copy', '-c:a', 'aac'];
if (duration !== undefined) {
cmd.push('-t', duration.toString());
}
cmd.push('-tag:v', 'hvc1', '-f... | 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 downloadRtsp AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left rtspUrl AST#identifier#Right AST#ERROR#Left AST#:#Left : ... | public static downloadRtsp(rtspUrl: string, output: string, duration?: number): string[] {
const cmd: string[] = ['ffmpeg', '-rtsp_transport', 'tcp', '-i', rtspUrl, '-c:v', 'copy', '-c:a', 'aac'];
if (duration !== undefined) {
cmd.push('-t', duration.toString());
}
cmd.push('-tag:v', 'hvc1', '-f... | https://github.com/jjjjjjava/ffmpeg_tools | 9f009f48616f98a44cf649c63e65162713c38b97 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Int.ets | arkts | sub | Performs integral subtraction of this instance with provided one, returns the result as new instance
@param other Right hand side of the subtraction
@returns Result of the subtraction | public sub(other: Int): Int {
return new Int(this.value - other.toInt())
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left sub AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left other AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#iden... | public sub(other: Int): Int {
return new Int(this.value - other.toInt())
} | https://gitcode.com/iop123123/arkts-static-skills | 7feb4dabd951a9df97de68e0d0a4f1207cc05f06 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Services/CacheStatusService.ets | arkts | calculateProgress | 计算缓存进度百分比 | calculateProgress(stats: ContentCacheStats): number {
if (stats.contentType === CacheContentType.MANGA) {
if (stats.totalPageCount > 0) {
return Math.round((stats.cachedPageCount / stats.totalPageCount) * 100);
}
if (stats.totalChapterCount === 0) return 0;
return Math.round((stats... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left calculateProgress AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left stats AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ContentCacheStats AST#identifier#Righ... | calculateProgress(stats: ContentCacheStats): number {
if (stats.contentType === CacheContentType.MANGA) {
if (stats.totalPageCount > 0) {
return Math.round((stats.cachedPageCount / stats.totalPageCount) * 100);
}
if (stats.totalChapterCount === 0) return 0;
return Math.round((stats... | https://github.com/DaLongZhuaZi/manxia | 48634a6fd3ea78d6c9177bd074975716346bb4bd | github |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/system/windows/classes/meowUiHost.ets | arkts | sideAreaShrunkBlocked | Whether the side area is blocked from shrinking. | get sideAreaShrunkBlocked() {
return this.sideAreaShrinkBlock_menu || this.sideAreaShrinkBlock_drag;
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left sideAreaShrunkBlocked AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { ... | get sideAreaShrunkBlocked() {
return this.sideAreaShrinkBlock_menu || this.sideAreaShrinkBlock_drag;
} | https://github.com/awaLiny2333/LinysBrowser_NEXT | 262b18eff0a25b2f2dd7d9659bb63415f29c4814 | github |
David8Idira/AI-OA | packages/harmonyos/commons/src/main/ets/services/ApprovalService.ets | arkts | getApprovalHistory | 获取审批历史记录
@param approvalId 审批ID | async getApprovalHistory(approvalId: string): Promise<ApiResponse<any[]>> {
return this.client.get<any[]>(`/api/v1/approval/approvals/${approvalId}/history`)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getApprovalHistory AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left approvalId AST#identifier#Right AST#type_annotation#Left AST... | async getApprovalHistory(approvalId: string): Promise<ApiResponse<any[]>> {
return this.client.get<any[]>(`/api/v1/approval/approvals/${approvalId}/history`)
} | https://github.com/David8Idira/AI-OA | dd9aa586a57dd9feb33c52a76538be8bc84b27b9 | github |
openharmony/codelabs | ETSUI/ContactManager/entry/src/main/ets/pages/ContactListPage.ets | arkts | categorizeContacts | 根据元数据分类联系人 | categorizeContacts(): void {
this.emergencyContacts = []
this.importantContacts = []
this.contactList.forEach((contact: Contact) => {
const importance = this.markedContactsMap.get(contact.key)
if (importance === ImportanceLevel.EMERGENCY) {
this.emergencyContacts.push(contact)
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left categorizeContacts 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... | categorizeContacts(): void {
this.emergencyContacts = []
this.importantContacts = []
this.contactList.forEach((contact: Contact) => {
const importance = this.markedContactsMap.get(contact.key)
if (importance === ImportanceLevel.EMERGENCY) {
this.emergencyContacts.push(contact)
... | https://gitcode.com/openharmony/codelabs | c0082aacc59b39f100b859144428b9c7d636a31a | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelChapterCacheManager.ets | arkts | cancelDownload | 取消下载任务 | cancelDownload(taskId: string): void {
const task = this.downloadTasks.get(taskId);
if (task) {
task.status = 'failed';
task.errorMessage = '用户取消';
task.updateTime = Date.now();
this.activeDownloads.delete(taskId);
this.downloadCallbacks.delete(taskId);
logger.info(TAG, `下载... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left cancelDownload AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left taskId AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ... | cancelDownload(taskId: string): void {
const task = this.downloadTasks.get(taskId);
if (task) {
task.status = 'failed';
task.errorMessage = '用户取消';
task.updateTime = Date.now();
this.activeDownloads.delete(taskId);
this.downloadCallbacks.delete(taskId);
logger.info(TAG, `下载... | https://github.com/DaLongZhuaZi/manxia | b0488822ced624d63030691e14c3ac2777ddfc16 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/export/utils/EncryptionModule.ets | arkts | base64Decode | Base64 解码
@param str Base64 编码的字符串
@returns 解码后的字节数组 | private static base64Decode(str: string): Uint8Array {
// 移除填充字符
const cleanStr = str.replace(/[^A-Za-z0-9+/=]/g, '');
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
const result: Array<number> = [];
let i = 0;
while (i < cleanStr.length) {
co... | 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 base64Decode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : A... | private static base64Decode(str: string): Uint8Array {
// 移除填充字符
const cleanStr = str.replace(/[^A-Za-z0-9+/=]/g, '');
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
const result: Array<number> = [];
let i = 0;
while (i < cleanStr.length) {
co... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 2ef3ece9185e1a275ffe55e3e8de8454ec231c12 | github |
FinalScave/SweetEditor | platform/OHOS/sweeteditor/src/main/ets/core/EditorCore.ets | arkts | scrollToLine | ==================== Scroll/Navigation ==================== | scrollToLine(line: number, behavior: ScrollBehavior = ScrollBehavior.GOTO_CENTER): EditorActionResult {
return CoreProtocol.decodeEditorActionResult(native.editorScrollToLine(this.handle, line, behavior as number));
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left scrollToLine AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left line AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Left , AS... | scrollToLine(line: number, behavior: ScrollBehavior = ScrollBehavior.GOTO_CENTER): EditorActionResult {
return CoreProtocol.decodeEditorActionResult(native.editorScrollToLine(this.handle, line, behavior as number));
} | https://github.com/FinalScave/SweetEditor | fb40ded1ca5f3c47a39ec3a3bf38e5068dfb0f05 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | slice | Creates a slice of current Int32Array using range [begin, this.length).
@param begin start index to be taken into slice
@returns a new Int32Array with elements of current Int32Array[begin, this.length) | public slice(begin: number): Int32Array {
return this.slice(begin as int)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left slice AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left begin AST#identifier#Right AST#:#Left : AST#:#Right AST#ER... | public slice(begin: number): Int32Array {
return this.slice(begin as int)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 44d9a3c1498815027bb973888042d3311b24f929 | gitee |
HarmonyOS_Samples/MusicHome | features/player/src/main/ets/view/LrcView.ets | arkts | playLyrics | Starts or pauses the lyric animator when isPlay toggles. | playLyrics() {
if (this.isPlay) {
this.animator.play();
} else {
this.animator.pause();
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left playLyrics 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... | playLyrics() {
if (this.isPlay) {
this.animator.play();
} else {
this.animator.pause();
}
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | 0abdfcf9ac68fad30b34c7001e4925b7f599f842 | gitcode |
openharmony-sig/flutter_engine | shell/platform/ohos/flutter_embedding/flutter/src/main/ets/embedding/engine/FlutterNapi.ets | arkts | getSystemLanguages | 获取系统语言列表
@param rate | getSystemLanguages() {
Log.d(TAG, "called getSystemLanguages ")
let index: number;
let systemLanguages = i18n.System.getPreferredLanguageList();
for (index = 0; index < systemLanguages.length; index++) {
Log.d(TAG, "systemlanguages "+ index + ":" + systemLanguages[index]);
}
if (!this.is... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getSystemLanguages 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... | getSystemLanguages() {
Log.d(TAG, "called getSystemLanguages ")
let index: number;
let systemLanguages = i18n.System.getPreferredLanguageList();
for (index = 0; index < systemLanguages.length; index++) {
Log.d(TAG, "systemlanguages "+ index + ":" + systemLanguages[index]);
}
if (!this.is... | https://gitee.com/openharmony-sig/flutter_engine.git | 3e35a1f72703ea6b4e1272878fea43d7665bab33 | gitee |
Joker-x-dev/CoolMallArkTS | core/network/src/main/ets/datasource/feedback/FeedbackNetworkDataSourceImpl.ets | arkts | getFeedbackPage | 获取反馈分页列表
@param {PageRequest} params - 分页参数
@returns {Promise<NetworkResponse<NetworkPageData<Feedback>>>} 反馈分页数据 | async getFeedbackPage(params: PageRequest): Promise<NetworkResponse<NetworkPageData<Feedback>>> {
const resp: AxiosResponse<NetworkResponse<NetworkPageData<Feedback>>> =
await NetworkClient.http.post("app/feedback/page", params);
return resp.data;
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getFeedbackPage AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left params AST#identifier#Right AST#type_annotation#Left AST#:#Left... | async getFeedbackPage(params: PageRequest): Promise<NetworkResponse<NetworkPageData<Feedback>>> {
const resp: AxiosResponse<NetworkResponse<NetworkPageData<Feedback>>> =
await NetworkClient.http.post("app/feedback/page", params);
return resp.data;
} | https://github.com/Joker-x-dev/CoolMallArkTS | ed55fd1565f16f9a399f0d069a456017fe68c663 | github |
Nekofox-POT/LinMusic | entry/src/main/ets/建筑垃圾堆/class_audio_player_old.ets | arkts | seek | 更改播放进度 // | seek(time: number) {
this.av_player.audio_seek(time)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left seek AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left time AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#)#Le... | seek(time: number) {
this.av_player.audio_seek(time)
} | https://github.com/Nekofox-POT/LinMusic | 6aa8f75215e619922ddd10f848afb44ba577babc | github |
arkui-x/samples | CodeLab/Cases/feature/handwritingtoimage/src/main/ets/model/RenderNodeModel.ets | arkts | draw | 新建路径对象,用于绘制手指移动轨迹
RenderNode进行绘制时会调用draw方法 | draw(context: DrawContext): void {
const canvas = context.canvas;
// 创建一个画笔Pen对象,Pen对象用于形状的边框线绘制
const pen = new drawing.Pen();
// 设置画笔开启反走样,可以使得图形的边缘在显示时更平滑
pen.setAntiAlias(true);
// 设置画笔颜色为黑色
const pen_color: common2D.Color = { alpha: 0xFF, red: 0x00, green: 0x00, blue: 0x00 };
pen.... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left draw AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left DrawContext AST#identifier#Right AST#)#Left ) AS... | draw(context: DrawContext): void {
const canvas = context.canvas;
// 创建一个画笔Pen对象,Pen对象用于形状的边框线绘制
const pen = new drawing.Pen();
// 设置画笔开启反走样,可以使得图形的边缘在显示时更平滑
pen.setAntiAlias(true);
// 设置画笔颜色为黑色
const pen_color: common2D.Color = { alpha: 0xFF, red: 0x00, green: 0x00, blue: 0x00 };
pen.... | https://gitcode.com/arkui-x/samples | f19787ce1548d8dd43e0134d01820c28bc6cdae1 | gitcode |
Open-Tech-Project/OpenBoard | entry/src/main/ets/InputMethodExtensionAbility/model/PredictionModel.ets | arkts | load | Load all models from preferences | async load(): Promise<void> {
if (!this.context) {
console.warn('OpenBoard: Cannot load prediction data - context not set');
return;
}
try {
const pref = await preferences.getPreferences(this.context, 'OpenBoard_prediction_data');
const data = await pref.get('models', '');
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left load 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... | async load(): Promise<void> {
if (!this.context) {
console.warn('OpenBoard: Cannot load prediction data - context not set');
return;
}
try {
const pref = await preferences.getPreferences(this.context, 'OpenBoard_prediction_data');
const data = await pref.get('models', '');
... | https://github.com/Open-Tech-Project/OpenBoard/blob/bb49f3c9e04bdcc0d5b6d40e9a7cd3a3790da74a/entry/src/main/ets/InputMethodExtensionAbility/model/PredictionModel.ets#L536-L563 | 7c9f0d5843d4505eff62e8b0e20ef9ab6ab95ac9 | github |
wuba/omni-ui | omni_component/src/main/ets/components/popup/BasePopup.ets | arkts | popupHeight | 弹窗高度
@returns | popupHeight(): Length | undefined {
return undefined
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left popupHeight 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#identifie... | popupHeight(): Length | undefined {
return undefined
} | https://github.com/wuba/omni-ui | 7e73e5efd98fa71749411f5809ca5bfc8ba633fb | github |
TDCQCX/ShiHuaMusic-Harmony | entry/src/main/ets/utils/HttpUtil.ets | arkts | clearToken | 清除Token | static clearToken(): void {
HttpUtil.token = '';
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left clearToken AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_... | static clearToken(): void {
HttpUtil.token = '';
} | https://github.com/TDCQCX/ShiHuaMusic-Harmony | 8c3af454270240dbd64e2b6a89966c79cc02c0bc | github |
arkui-x/samples | CodeLab/Cases/feature/clickanimation/src/main/ets/model/BasicDataSource.ets | arkts | pushData | 在数据尾部增加一个元素
@param data 元素对象 | public pushData(data: T): void {
this.originDataArray.push(data);
this.notifyDataAdd(this.originDataArray.length - 1);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left pushData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left data AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#Right ... | public pushData(data: T): void {
this.originDataArray.push(data);
this.notifyDataAdd(this.originDataArray.length - 1);
} | https://gitcode.com/arkui-x/samples | d5b0bc3645935536593bac1287f89fd7b55a3fd2 | gitcode |
openharmony-sig/applications_clock | common/src/main/ets/manager/ResourceManager.ets | arkts | getStringSync | 获取string资源值
@param resource Resource资源类 | getStringSync(resource: ResourceStr | undefined): string {
if (!resource) {
LogUtil.error(TAG, 'resource is null');
return '';
}
if (typeof resource === 'string') {
return resource;
}
let resourceManager = GlobalContext.getContext().getObject('resourceManager') as resmgr.Resource... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getStringSync AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left resource AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#identifier#Left ResourceStr... | getStringSync(resource: ResourceStr | undefined): string {
if (!resource) {
LogUtil.error(TAG, 'resource is null');
return '';
}
if (typeof resource === 'string') {
return resource;
}
let resourceManager = GlobalContext.getContext().getObject('resourceManager') as resmgr.Resource... | https://gitee.com/openharmony-sig/applications_clock.git | 61a7cd4907a1fc20cf9c9e08593573683648d946 | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/AppSettingsService.ets | arkts | getAllSettings | 获取所有设置 | static async getAllSettings(): Promise<AppSettings> {
return {
theme: await AppSettingsService.getTheme(),
language: await AppSettingsService.getLanguage(),
currencySymbol: await AppSettingsService.getCurrencySymbol()
};
} | 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 getAllSettings AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:... | static async getAllSettings(): Promise<AppSettings> {
return {
theme: await AppSettingsService.getTheme(),
language: await AppSettingsService.getLanguage(),
currencySymbol: await AppSettingsService.getCurrencySymbol()
};
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | a87c8f475c0b93067193f21488fefc6c3f369bea | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/ar/ARNavigationService.ets | arkts | getNextWaypoint | 获取下一个途经点 | private getNextWaypoint(): Waypoint | null {
if (!this.navigationState.currentPath) return null;
const index = this.navigationState.currentWaypointIndex;
return this.navigationState.currentPath.waypoints[index + 1] || null;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getNextWaypoint AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#L... | private getNextWaypoint(): Waypoint | null {
if (!this.navigationState.currentPath) return null;
const index = this.navigationState.currentWaypointIndex;
return this.navigationState.currentPath.waypoints[index + 1] || null;
} | https://github.com/LJ666-ui/harmony-health-care | f15360735ae61e70fcd33df86682c9b4b1d55c5b | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/viewmodel/StreamViewModel.ets | arkts | resumeFromBackground | 从后台恢复串流
当应用从后台切回前台时调用此方法 | resumeFromBackground(): void {
console.info('[StreamViewModel] 从后台恢复串流');
if (!this.streamingSession) {
console.warn('[StreamViewModel] 没有活跃的串流会话,无需恢复');
return;
}
// 通知 native 层恢复解码和渲染
try {
this.streamingSession.resumeDecoder();
console.info('[StreamViewModel] 解... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left resumeFromBackground AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#stateme... | resumeFromBackground(): void {
console.info('[StreamViewModel] 从后台恢复串流');
if (!this.streamingSession) {
console.warn('[StreamViewModel] 没有活跃的串流会话,无需恢复');
return;
}
// 通知 native 层恢复解码和渲染
try {
this.streamingSession.resumeDecoder();
console.info('[StreamViewModel] 解... | https://github.com/AlkaidLab/moonlight-harmony | c07e0efe2eca21024e907b85fdea7f187ad5c5b6 | github |
Gramony/Gramony | features/home/src/main/ets/utils/push.ets | arkts | autoRegisterIfNeeded | 自动注册推送(如果需要) | async autoRegisterIfNeeded(): Promise<void> {
try {
const nickname = await this.loadNickname();
if (!nickname) {
Logger.debug('PushService autoRegisterIfNeeded: No nickname saved, skipping auto registration');
return;
}
const shouldRegister = await this.shouldRegisterPush... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left autoRegisterIfNeeded AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST... | async autoRegisterIfNeeded(): Promise<void> {
try {
const nickname = await this.loadNickname();
if (!nickname) {
Logger.debug('PushService autoRegisterIfNeeded: No nickname saved, skipping auto registration');
return;
}
const shouldRegister = await this.shouldRegisterPush... | https://github.com/Gramony/Gramony | ef3b0f4450a82d18c643ceaca9c785472e91398e | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/viewmodel/AppViewModel.ets | arkts | isSearchEmpty | 搜索结果是否为空 | get isSearchEmpty(): boolean {
return this.searchKeyword.trim() !== '' && this.filteredApps.length === 0;
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left isSearchEmpty 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#... | get isSearchEmpty(): boolean {
return this.searchKeyword.trim() !== '' && this.filteredApps.length === 0;
} | https://github.com/AlkaidLab/moonlight-harmony | 3788b1d19dc84ae47088ec5c36994547e22b6b6c | github |
Countly/countly-sdk-hos | library/src/main/ets/internal/modules/ModuleContent.ets | arkts | isAllowedContentOrigin | Prefix-match URL origin against the allowlist. Normalised by stripping
trailing slashes off both sides so `https://foo.com` matches
`https://foo.com/`, `https://foo.com/a/b`, etc., while
`https://foo.com.evil.com` does NOT match `https://foo.com` because the
next char after the match must be `/`, `?`, `#`, or end-of-st... | private isAllowedContentOrigin(url: string): boolean {
if (url.length === 0) return false;
for (let i = 0; i < this.allowedOrigins.length; i++) {
const raw: string = this.allowedOrigins[i];
if (raw.length === 0) continue;
const origin: string = Utils.stripTrailingSlashes(raw);
if (!url... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left isAllowedContentOrigin AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identif... | private isAllowedContentOrigin(url: string): boolean {
if (url.length === 0) return false;
for (let i = 0; i < this.allowedOrigins.length; i++) {
const raw: string = this.allowedOrigins[i];
if (raw.length === 0) continue;
const origin: string = Utils.stripTrailingSlashes(raw);
if (!url... | https://github.com/Countly/countly-sdk-hos | ab2b0c7be8126b68d75febddbc8caf8885d9cb67 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/EnumConstant.ets | arkts | getValue | getValue
@returns { int } get current object's value
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public getValue(): int {
return this.intVal
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left int AST#ident... | public getValue(): int {
return this.intVal
} | https://gitcode.com/iop123123/arkts-static-skills | 2885b343fd37d6be99721ae404dd336a4bc30b50 | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/LineDataSet.ets | arkts | setMode | Returns the drawing mode for this LineDataSet
@return | public setMode(mode: Mode): void {
this.mMode = mode;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setMode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left mode AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Mode AST... | public setMode(mode: Mode): void {
this.mMode = mode;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 7113d4655ae9e44f6d491a7673348afd2a7eb6a9 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Source/SourceManager.ets | arkts | deleteSource | 删除图源
@param sourceId 图源ID
@param pkg 图源包名(可选,用于删除文件)
@param sourceName 图源名称(可选,用于清理WebView缓存) | async deleteSource(sourceId: number, pkg?: string, sourceName?: string): Promise<void> {
// 【关键】获取图源名称(如果未提供),用于清理WebView引擎缓存
let actualSourceName = sourceName;
if (!actualSourceName) {
try {
const sourceRecord = await this.dataManager.getComicSourceById(sourceId);
if (sourceRecord) ... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left deleteSource AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sourceId AST#identifier#Right AST#type_annotation#Left AS... | async deleteSource(sourceId: number, pkg?: string, sourceName?: string): Promise<void> {
// 【关键】获取图源名称(如果未提供),用于清理WebView引擎缓存
let actualSourceName = sourceName;
if (!actualSourceName) {
try {
const sourceRecord = await this.dataManager.getComicSourceById(sourceId);
if (sourceRecord) ... | https://github.com/DaLongZhuaZi/manxia | 04ea6c2ad316ade137b96c9d96b162980a61fec3 | github |
huaweicloud/huaweicloud-iot-device-sdk-arkts | huaweicloud_iot_device_library/src/main/ets/service/AbstractDevice.ets | arkts | onPropertiesGet | 属性查询回调,由SDK自动调用
@param requestId 请求id
@param propsGet 属性查询请求 | public onPropertiesGet(requestId: string, propsGet: PropsGet): void {
let serviceProperties: ServiceProperty[] = [];
// 查询所有
if (propsGet.service_id === null || propsGet.service_id === undefined) {
this.services.forEach((service: AbstractService, serviceId: string) => {
const deviceService ... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left onPropertiesGet AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left requestId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#stri... | public onPropertiesGet(requestId: string, propsGet: PropsGet): void {
let serviceProperties: ServiceProperty[] = [];
// 查询所有
if (propsGet.service_id === null || propsGet.service_id === undefined) {
this.services.forEach((service: AbstractService, serviceId: string) => {
const deviceService ... | https://github.com/huaweicloud/huaweicloud-iot-device-sdk-arkts | 8825a03d98f5d60acba0e8296beca0d20d7e35c6 | github |
IoTAccessControl/ArkTSAnalysis | TestApps/NewsData/entry/src/main/ets/viewmodel/NewsViewModel.ets | arkts | getNewsTypeList | Get news type list from server.
@return NewsTypeBean[] newsTypeList | getNewsTypeList(): Promise<NewsTypeModel[]> {
return new Promise((resolve: Function, reject: Function) => {
let url = `${Const.SERVER}/${Const.GET_NEWS_TYPE}`;
httpRequestGet(url).then((data: ResponseResult) => {
if (data.code === Const.SERVER_CODE_SUCCESS) {
resolve(data.data);
... | AST#program#Left AST#expression_statement#Left AST#instantiation_expression#Left AST#call_expression#Left AST#identifier#Left getNewsTypeList 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 AS... | getNewsTypeList(): Promise<NewsTypeModel[]> {
return new Promise((resolve: Function, reject: Function) => {
let url = `${Const.SERVER}/${Const.GET_NEWS_TYPE}`;
httpRequestGet(url).then((data: ResponseResult) => {
if (data.code === Const.SERVER_CODE_SUCCESS) {
resolve(data.data);
... | https://github.com/IoTAccessControl/ArkTSAnalysis | f9f2836da3a5e9b109300b19d6808641473ca9fa | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Components/FontAware.ets | arkts | getTitleStyle | ==================== 便捷样式应用接口 ====================
获取标题文字样式参数
@param mode 应用模式 | public static getTitleStyle(mode: FontApplyMode = FontApplyMode.FONT_AND_SCALE): TextStyleParams {
const baseFontSize = 18;
return FontAwareHelper.buildTextStyle(baseFontSize, FontScene.APP_UI, mode);
} | 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 getTitleStyle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left mode AST#identifier#Right AST#:#Left : AS... | public static getTitleStyle(mode: FontApplyMode = FontApplyMode.FONT_AND_SCALE): TextStyleParams {
const baseFontSize = 18;
return FontAwareHelper.buildTextStyle(baseFontSize, FontScene.APP_UI, mode);
} | https://github.com/DaLongZhuaZi/manxia | 1b3638cbe4236338a825732f25cc84fb99b88c4d | github |
the-wwyang/kids-learning-app | src/main/ets/services/WrongQuestionService.ets | arkts | markAsMastered | 标记错题为已掌握
@param record 错题记录
@returns 更新后的记录 | static markAsMastered(record: WrongQuestionRecord): WrongQuestionRecord {
return {
id: record.id,
question: record.question,
userAnswer: record.userAnswer,
correctAnswer: record.correctAnswer,
errorCount: record.errorCount,
firstErrorTime: record.firstErrorTime,
lastError... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left markAsMastered AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left record AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | static markAsMastered(record: WrongQuestionRecord): WrongQuestionRecord {
return {
id: record.id,
question: record.question,
userAnswer: record.userAnswer,
correctAnswer: record.correctAnswer,
errorCount: record.errorCount,
firstErrorTime: record.firstErrorTime,
lastError... | https://github.com/the-wwyang/kids-learning-app | e642fc961de87342e70913dfca6993eea81f93bd | github |
terryma2024/happyword | harmonyos/entry/src/ohosTest/ets/test/ParentBindingFlow.ui.test.ets | arkts | resetMockAndPrefsToUnbound | ParentBindingFlow runs after PackManagerFlow. PackManager may leave both
the mock server's binding slot and `wordmagic_cloud` prefs populated; the
first unbound-only case must start clean. | async function resetMockAndPrefsToUnbound(): Promise<void> {
await unbindMockBinding();
await wipeBoundDeviceState();
} | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left resetMockAndPrefsToUnbound AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotati... | async function resetMockAndPrefsToUnbound(): Promise<void> {
await unbindMockBinding();
await wipeBoundDeviceState();
} | https://github.com/terryma2024/happyword | 7b992bd59ef15078297e0e1ebcdb85e2365b5583 | github |
bluedeer000/HarmonyCalendar | entry/src/main/ets/services/CalendarSyncService.ets | arkts | adapterForAccount | -------- 适配器辅助方法 -------- | private adapterForAccount(account: CalendarAccount): CalendarSourceAdapter {
return CalendarSourceAdapterRegistry.getInstance().getAdapter(account);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left adapterForAccount AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left account AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi... | private adapterForAccount(account: CalendarAccount): CalendarSourceAdapter {
return CalendarSourceAdapterRegistry.getInstance().getAdapter(account);
} | https://github.com/bluedeer000/HarmonyCalendar | 861b8be2eb00bf95b052c004d816f51340e08813 | github |
TDCQCX/ShiHuaMusic-Harmony | entry/src/main/ets/utils/GlobalDataManager.ets | arkts | processImageUrlsInData | 批量处理数据中的图片URL
@param data 数据对象或数组
@param fields 图片字段名数组 | processImageUrlsInData(data: ProcessedData[] | ProcessedData, fields: string[]): ProcessedData[] | ProcessedData {
if (!Array.isArray(data)) return data;
return data.map(item => {
const processedItem: ProcessedData = { ...item };
fields.forEach(field => {
if (processedItem[field]) {
... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left processImageUrlsInData 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#binary_... | processImageUrlsInData(data: ProcessedData[] | ProcessedData, fields: string[]): ProcessedData[] | ProcessedData {
if (!Array.isArray(data)) return data;
return data.map(item => {
const processedItem: ProcessedData = { ...item };
fields.forEach(field => {
if (processedItem[field]) {
... | https://github.com/TDCQCX/ShiHuaMusic-Harmony | 346aea333d4ad28ff26cf3c4300a934f4084c9ea | github |
openharmony/applications_contacts | entry/src/main/ets/presenter/contact/detail/DetailPresenter.ets | arkts | getDescriptionByDuration | Obtains the call duration based on the specified timestamp. The unit is s.
@param {number} timeDuration
@return {Object} Return time unit | getDescriptionByDuration(timeDuration: number) {
if (timeDuration < 60) {
// Less than one minute
return $r('app.string.secondsFormat', timeDuration);
} else {
let minutes = Math.floor(timeDuration / 60);
if (minutes < 60) {
// Within an hour
return $r('app.string.minutesSecondsFormat', ... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getDescriptionByDuration AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left timeDuration AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#... | getDescriptionByDuration(timeDuration: number) {
if (timeDuration < 60) {
// Less than one minute
return $r('app.string.secondsFormat', timeDuration);
} else {
let minutes = Math.floor(timeDuration / 60);
if (minutes < 60) {
// Within an hour
return $r('app.string.minutesSecondsFormat', ... | https://gitee.com/openharmony/applications_contacts.git | 0d8fb874f1d1c77c3ab1049217b34270dd8f2683 | gitee |
arkui-x/samples | CodeLab/Cases/feature/customdialog/src/main/ets/components/SubWindowApi.ets | arkts | showSubWindow | 显示当前窗口 | private showSubWindow() {
if (this.subWindow) {
this.subWindow.showWindow((err: BusinessError) => {
if (err.code) {
console.error('Fail to show window, Cause: ' + JSON.stringify(err));
}
})
}
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left showSubWindow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Lef... | private showSubWindow() {
if (this.subWindow) {
this.subWindow.showWindow((err: BusinessError) => {
if (err.code) {
console.error('Fail to show window, Cause: ' + JSON.stringify(err));
}
})
}
} | https://gitcode.com/arkui-x/samples | 7ace6d875bac22501b2d30aac108867cedb3caea | gitcode |
zcg741/chengyu-game | entry/src/main/ets/viewmodel/GameViewModel.ets | arkts | getCurrentLevel | 获取当前关卡(闯关模式) | getCurrentLevel(): number {
return this.session.currentLevel;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCurrentLevel 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... | getCurrentLevel(): number {
return this.session.currentLevel;
} | https://github.com/zcg741/chengyu-game | 8928d14bb2c20c9fa02a78239284e246014913d6 | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/RecentFilesService.ets | arkts | addRecentFile | 添加最近打开的文件
@param fileParam 文件参数
@throws KeePassHoError 路经不存在或者没有持久性授权 | public static async addRecentFile(recentFile: RecentFile): Promise<void> {
return RecentFilesService.getInstance().addRecentFile(recentFile);
} | 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 addRecentFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left rece... | public static async addRecentFile(recentFile: RecentFile): Promise<void> {
return RecentFilesService.getInstance().addRecentFile(recentFile);
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/RecentFilesService.ets#L95-L97 | afe2195b609b96ac335cc3dec392569a1373d7c0 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Animation/SnapshotCapture.ets | arkts | captureComponent | 捕获单个组件的快照
@param componentId 组件ID
@param options 快照选项
@returns PixelMap或null | public async captureComponent(
componentId: string,
options?: Partial<SnapshotOptions>
): Promise<PixelMap | null> {
const uiContext = this.uiContext;
if (!uiContext) {
logger.error(TAG, 'UIContext未初始化');
return null;
}
const opts: SnapshotOptions = {
scale: options?.scale... | 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 captureComponent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left componentId AST#identifier#Right AST#ERROR#Left AST#:#... | public async captureComponent(
componentId: string,
options?: Partial<SnapshotOptions>
): Promise<PixelMap | null> {
const uiContext = this.uiContext;
if (!uiContext) {
logger.error(TAG, 'UIContext未初始化');
return null;
}
const opts: SnapshotOptions = {
scale: options?.scale... | https://github.com/DaLongZhuaZi/manxia | 8d6530dfe6962b3387417cfbb908b11dc3edb5ad | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/OCRRecognitionDAO.ets | arkts | update | 更新识别记录 | static async update(record: OCRRecognitionRecord): Promise<boolean> {
try {
const store = DatabaseManager.getDatabase();
record.updatedAt = new Date().toISOString();
const values: relationalStore.ValuesBucket = {
bill_id: record.billId || null,
image_path: record.imagePath,
... | 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 update AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left record AST#identifier#Right AST#:#Left : AST#:#Ri... | static async update(record: OCRRecognitionRecord): Promise<boolean> {
try {
const store = DatabaseManager.getDatabase();
record.updatedAt = new Date().toISOString();
const values: relationalStore.ValuesBucket = {
bill_id: record.billId || null,
image_path: record.imagePath,
... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 6f45757ab5d0736734b8aa024d0e72ff18b0c11c | github |
aimilin6688/KeePassHO | entry/src/main/ets/storage/cache/CacheStorage.ets | arkts | getCacheInfo | 获取缓存文件信息
@param cachePath 缓存文件路径
@returns 文件信息 | private async getCacheInfo(cachePath: string): Promise<FileInfo> {
let file: fs.File | null = null;
try {
file = await fs.open(cachePath, fs.OpenMode.READ_ONLY);
const stat = await fs.stat(file.fd);
const fileName: string = cachePath.split('/').pop() ?? '';
const fileInfo: FileInfo = {... | 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 getCacheInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left cachePath AST#identifier#Right AST#ERROR#Left AST#:#Lef... | private async getCacheInfo(cachePath: string): Promise<FileInfo> {
let file: fs.File | null = null;
try {
file = await fs.open(cachePath, fs.OpenMode.READ_ONLY);
const stat = await fs.stat(file.fd);
const fileName: string = cachePath.split('/').pop() ?? '';
const fileInfo: FileInfo = {... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/cache/CacheStorage.ets#L328-L349 | f75a3e9347378704b8b31aced69a8c207fdcace7 | github |
AGenUI/AGenUI | playground/harmony/entry/src/ohosTest/ets/test/tests/FunctionCallTest.ets | arkts | runFixtureTest | 通用验证辅助:加载 fixture,发送消息,等待渲染,验证组件 ID
提取为模块级函数以避免 ArkTS arkts-no-nested-funcs 限制 | async function runFixtureTest(
sm: SurfaceManager,
context: common.UIAbilityContext,
fixturePath: string
): Promise<void> {
const fixture = await loadFixture(context.resourceManager, fixturePath);
const surfaceId = getSurfaceId(fixture);
const json = getMessagesAsString(fixture);
const surface = await se... | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left runFixtureTest AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left sm AST#identifier#Right AST#type_a... | async function runFixtureTest(
sm: SurfaceManager,
context: common.UIAbilityContext,
fixturePath: string
): Promise<void> {
const fixture = await loadFixture(context.resourceManager, fixturePath);
const surfaceId = getSurfaceId(fixture);
const json = getMessagesAsString(fixture);
const surface = await se... | https://github.com/AGenUI/AGenUI | b5101995a069e70d50c448016ac39408adb24487 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoRhinoEngine.ets | arkts | getCurrentEngineType | 获取当前引擎类型 | getCurrentEngineType(): JsEngineType {
return this.currentEngineType;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCurrentEngineType 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 JsEngineType AST#identifier#Right AST#ERR... | getCurrentEngineType(): JsEngineType {
return this.currentEngineType;
} | https://github.com/DaLongZhuaZi/manxia | 459fca6b13bf9a7bcad2473f03f8b6c26028417a | github |
cpdd5201314/harmonyOS-music-app | products/phone/src/main/ets/pages/MusicPlayerService.ets | arkts | setVolume | 设置音量(0-1) | async setVolume(volume: number): Promise<void> {
try {
if (this.avPlayer) {
this.avPlayer.setVolume(Math.max(0, Math.min(1, volume)));
console.info(`[MusicPlayer] 音量设置为: ${volume}`);
}
} catch (error) {
const err = error as Error;
console.error('[MusicPlayer] 设置音量失败:', ... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left setVolume AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left volume AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST... | async setVolume(volume: number): Promise<void> {
try {
if (this.avPlayer) {
this.avPlayer.setVolume(Math.max(0, Math.min(1, volume)));
console.info(`[MusicPlayer] 音量设置为: ${volume}`);
}
} catch (error) {
const err = error as Error;
console.error('[MusicPlayer] 设置音量失败:', ... | https://github.com/cpdd5201314/harmonyOS-music-app | be3c2b1e35073b76dc85eddaff8bd254443aae5c | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/components/charts/line/LineChartRenderer.ets | arkts | mapY | Y坐标映射 | private mapY(value: number): number {
if (this.yRange.max === this.yRange.min) {
return this.plotArea.y + this.plotArea.height / 2;
}
const ratio = (value - this.yRange.min) / (this.yRange.max - this.yRange.min);
return this.plotArea.y + this.plotArea.height - ratio * this.plotArea.height;
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left private AST#identifier#Right AST#ERROR#Left AST#identifier#Left mapY 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... | private mapY(value: number): number {
if (this.yRange.max === this.yRange.min) {
return this.plotArea.y + this.plotArea.height / 2;
}
const ratio = (value - this.yRange.min) / (this.yRange.max - this.yRange.min);
return this.plotArea.y + this.plotArea.height - ratio * this.plotArea.height;
... | https://github.com/LJ666-ui/harmony-health-care | fc0958004a82deaebaaa4fc72098ab8120630cbc | github |
openharmony/arkui_ace_engine | advanced_ui_component_static/assembled_advanced_ui_component/@ohos.arkui.advanced.DialogV2.ets | arkts | getEnumNumberByResourceId | get enum number
@param resourceId resource id
@param defaultValue default value
@returns number | function getEnumNumberByResourceId(resourceId: long, defaultValue: number): number {
return defaultValue;
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left getEnumNumberByResourceId AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left resourceId AST#identifier#Right AST#type_annotation#Left AST... | function getEnumNumberByResourceId(resourceId: long, defaultValue: number): number {
return defaultValue;
} | https://gitcode.com/openharmony/arkui_ace_engine | b20dd083e3d4f16c31a275615bc94285e3d2eeff | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/WeakMap.ets | arkts | set | The set() method adds a new element with a specified key and value to a WeakMap object
@param { K } key - The key to set, must be an object type
@param { V } val - The value to set
@returns { WeakMap<K, V> } Returns the WeakMap instance itself, supporting chaining
@throws { TypeError } When the key is not a garbage-col... | set(key: K, val: V): WeakMap<K, V> {
if (!WeakMap.validateKey(key)) {
throw new TypeError(`Invalid value used as weak map key: ${key}`)
}
const keyHash = Runtime.getHashCode(key)
const keyRefs = this.keyHashToKeyRefs.get(keyHash)
if (keyRefs !== undefin... | AST#program#Left AST#ERROR#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left set AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left key AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left K AST#identifier#Right AST#ERROR#Right AST... | set(key: K, val: V): WeakMap<K, V> {
if (!WeakMap.validateKey(key)) {
throw new TypeError(`Invalid value used as weak map key: ${key}`)
}
const keyHash = Runtime.getHashCode(key)
const keyRefs = this.keyHashToKeyRefs.get(keyHash)
if (keyRefs !== undefin... | https://gitcode.com/iop123123/arkts-static-skills | fb7d7095dbc67ff661194b60c86c9f9a81d8c8b6 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/WelcomeGuideManager.ets | arkts | shouldShowGuide | 检查是否需要显示引导 | public shouldShowGuide(): boolean {
return this.isFirstTimeLaunch();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left shouldShowGuide AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean A... | public shouldShowGuide(): boolean {
return this.isFirstTimeLaunch();
} | https://github.com/DaLongZhuaZi/manxia | fe14cf144f3c514db1738d0c7c395e28870f6a7f | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/UserSessionService.ets | arkts | register | 用户注册
@param username 用户名
@param email 邮箱
@param password 密码
@returns 注册结果 | static async register(username: string, email: string, password: string): Promise<LoginResult> {
try {
// 1. 验证邮箱格式
if (!UserSessionService.validateEmail(email)) {
return new LoginResult(false, '邮箱格式不正确');
}
// 2. 检查邮箱是否已存在
const users: User[] = await UserDAO.getAll();
... | 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 register AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left username AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#... | static async register(username: string, email: string, password: string): Promise<LoginResult> {
try {
// 1. 验证邮箱格式
if (!UserSessionService.validateEmail(email)) {
return new LoginResult(false, '邮箱格式不正确');
}
// 2. 检查邮箱是否已存在
const users: User[] = await UserDAO.getAll();
... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | e3d3b617d078b4ac7e5a2fe4d37a7d8de051b08f | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/CategoryDAO.ets | arkts | restore | 恢复已删除分类 | static async restore(userId: number, categoryId: number): Promise<void> {
const store = DatabaseManager.getDatabase();
const now = new Date().toISOString();
const sql = `UPDATE categories SET is_deleted = 0, updated_at = ? WHERE category_id = ? AND user_id = ?`;
try {
await store.executeSql(sql,... | 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 restore AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : AST#:#R... | static async restore(userId: number, categoryId: number): Promise<void> {
const store = DatabaseManager.getDatabase();
const now = new Date().toISOString();
const sql = `UPDATE categories SET is_deleted = 0, updated_at = ? WHERE category_id = ? AND user_id = ?`;
try {
await store.executeSql(sql,... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 15c0edf8df14587de23d271ef7297311e0aef108 | github |
richshaw2015/nds | ohos/entry/src/main/ets/utils/RomConfigManager.ets | arkts | getCustomName | 获取游戏的自定义显示名称 | public getCustomName(romPath: string): string | null {
return this.configCache.get(romPath)?.customName ?? null;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCustomName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left romPath AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#R... | public getCustomName(romPath: string): string | null {
return this.configCache.get(romPath)?.customName ?? null;
} | https://github.com/richshaw2015/nds | a9a6e15a22d2ded07c1b7f64979556960813d623 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/components/PageCurlEffectV2.ets | arkts | onAnimateToTargetChange | 内部动画控制:当 animateToTarget 变化时触发
高性能模式:动画循环完全在组件内部执行,避免每帧更新 @Prop
动画时长由脱手速度(animateVelocity)决定,使动画无缝延续用户的翻页力度:
- 有速度时:duration = 3 * Δ / v(easeOutCubic 初始斜率=3 → 动画开始速度 = 用户脱手速度)
- 无速度时:使用基于进度的默认时长 | onAnimateToTargetChange(): void {
if (this.animateToTarget < 0) {
this.pendingAnimateAfterReady = false;
return;
}
if (!this.isReady) {
this.pendingAnimateAfterReady = true;
return;
}
this.pendingAnimateAfterReady = false;
// 停止之前的动画
this.stopAnimation();
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onAnimateToTargetChange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#stat... | onAnimateToTargetChange(): void {
if (this.animateToTarget < 0) {
this.pendingAnimateAfterReady = false;
return;
}
if (!this.isReady) {
this.pendingAnimateAfterReady = true;
return;
}
this.pendingAnimateAfterReady = false;
// 停止之前的动画
this.stopAnimation();
... | https://github.com/DaLongZhuaZi/manxia | 249ce5080a2f2060c136571d1796b43b05c78aeb | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/ThemeManager.ets | arkts | saveTheme | 保存主题到首选项 | private async saveTheme(theme: ThemeType): Promise<void> {
try {
if (!this.preferencesStore) {
await this.initializePreferences();
}
if (this.preferencesStore) {
await this.preferencesStore.put(this.THEME_KEY, theme);
await this.preferencesStore.flush();
logger.i... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left saveTheme AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left theme AST#identifier#Right AST#:#Left : AST... | private async saveTheme(theme: ThemeType): Promise<void> {
try {
if (!this.preferencesStore) {
await this.initializePreferences();
}
if (this.preferencesStore) {
await this.preferencesStore.put(this.THEME_KEY, theme);
await this.preferencesStore.flush();
logger.i... | https://github.com/DaLongZhuaZi/manxia | 9058edb54a96def4cb8ed3774954828d5377c5f7 | github |
popsiclelmlm/Hey | entry/src/main/ets/services/BackupManager.ets | arkts | applyBackup | 用备份覆盖现有配置(覆盖语义)。调用方应在此之前先留一份安全副本。 | static async applyBackup(context: common.Context, backup: ConfigBackup): Promise<void> {
await ProfileStore.save(context, backup.profile.outboundJson, backup.profile.configType ?? 'outbound');
await SubscriptionStore.restoreProfile(context, backup.subscriptions);
await SettingsStore.save(context, backup.s... | 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 applyBackup AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AS... | static async applyBackup(context: common.Context, backup: ConfigBackup): Promise<void> {
await ProfileStore.save(context, backup.profile.outboundJson, backup.profile.configType ?? 'outbound');
await SubscriptionStore.restoreProfile(context, backup.subscriptions);
await SettingsStore.save(context, backup.s... | https://github.com/popsiclelmlm/Hey | 84d5453a475756ebe2e483d3727bcdd74730d850 | github |
offlinecat-dev/OCNetORM | src/main/ets/query/DataTransformTask.ets | arkts | createSuccess | 创建成功结果
@param entityName 实体名称
@param entities 转换后的实体数据数组
@returns TransformTaskResult 实例 | static createSuccess(entityName: string, entities: Array<TransformedEntityItem>): TransformTaskResult {
const result = new TransformTaskResult()
result.entityName = entityName
result.entities = entities
result.success = true
return result
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createSuccess AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left entityName AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#strin... | static createSuccess(entityName: string, entities: Array<TransformedEntityItem>): TransformTaskResult {
const result = new TransformTaskResult()
result.entityName = entityName
result.entities = entities
result.success = true
return result
} | https://github.com/offlinecat-dev/OCNetORM | 3f6483f6033feae06eb1b7a88b5d9c437e027bee | github |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/CocosEngineHost.ets | arkts | notifyPageShow | Relay from CocosBattlePage.onPageShow; resumes the render loop ONLY if
the surface is still alive (covers foreground-after-background while in
battle). On re-entry after a page exit the page shows before the new
XComponent surface exists — surfaceAlive is false and the resume rides
notifySurfaceLoaded() instead, AFTER ... | notifyPageShow(): void {
if (!this.booted) {
return;
}
const pageLifecycle: context = cocos.getContext(ContextType.JSPAGE_LIFECYCLE);
pageLifecycle.onPageShow();
this.pageActive = true;
this.updateVisibility();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left notifyPageShow AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_blo... | notifyPageShow(): void {
if (!this.booted) {
return;
}
const pageLifecycle: context = cocos.getContext(ContextType.JSPAGE_LIFECYCLE);
pageLifecycle.onPageShow();
this.pageActive = true;
this.updateVisibility();
} | https://github.com/terryma2024/happyword | 6783b13d3f627258ccd9a67c742d1e4f490642d0 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/02.floating-point_types_and_operations/greater_or_equal/greater_or_equal_float.ets | arkts | main | ---
desc: check greater or equal operation for two floats
--- | function main(): void {
const a: float = {{v.left}} as float
const b: float = {{v.right}} as float
assert (a >= b) == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
const a: float = {{v.left}} as float
const b: float = {{v.right}} as float
assert (a >= b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 732e28c8f1fc448133ab0ccc10f9b3f59dca5a35 | gitee |
richshaw2015/nds | ohos/entry/src/main/ets/utils/CheatManager.ets | arkts | readFileContent | ========================================================================
文件 I/O 工具
======================================================================== | private readFileContent(path: string): string | null {
try {
const file = fileIo.openSync(path, fileIo.OpenMode.READ_ONLY);
try {
const stat = fileIo.statSync(file.fd);
const buf = new ArrayBuffer(stat.size);
fileIo.readSync(file.fd, buf);
// 使用 TextDecoder 处理 UTF-8
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left readFileContent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | private readFileContent(path: string): string | null {
try {
const file = fileIo.openSync(path, fileIo.OpenMode.READ_ONLY);
try {
const stat = fileIo.statSync(file.fd);
const buf = new ArrayBuffer(stat.size);
fileIo.readSync(file.fd, buf);
// 使用 TextDecoder 处理 UTF-8
... | https://github.com/richshaw2015/nds | 524d9ffdc5cd219f33839a13d6442b374a05bfd4 | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/RdpConnectionManager.ets | arkts | setTimeoutThreshold | 默认30秒超时
设置超时阈值 | setTimeoutThreshold(seconds: number) {
this.timeoutThreshold = seconds
if (qemuModule.rdpSetTimeout) {
qemuModule.rdpSetTimeout(seconds)
}
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setTimeoutThreshold AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left seconds AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Righ... | setTimeoutThreshold(seconds: number) {
this.timeoutThreshold = seconds
if (qemuModule.rdpSetTimeout) {
qemuModule.rdpSetTimeout(seconds)
}
} | https://github.com/AetheriumSimulator/qemu-hmos | e50a0c886b87b56f8a72e3119cd1503f984b5de2 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets | arkts | checkIsJSON | 检查内容是否为JSON | private checkIsJSON(content: string): boolean {
const trimmed = content.trim();
return (trimmed.startsWith('{') && trimmed.endsWith('}')) ||
(trimmed.startsWith('[') && trimmed.endsWith(']'));
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left checkIsJSON AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left content AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#... | private checkIsJSON(content: string): boolean {
const trimmed = content.trim();
return (trimmed.startsWith('{') && trimmed.endsWith('}')) ||
(trimmed.startsWith('[') && trimmed.endsWith(']'));
} | https://github.com/DaLongZhuaZi/manxia | 7db9564edc072dd2dc832ab6156b25bd7ee6a329 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/mindsphere/MindSporeLiteEngine.ets | arkts | initialize | 初始化引擎,加载模型 | async initialize(): Promise<boolean> {
try {
console.info('[MindSpore] 正在初始化推理引擎...');
// 检查模型文件是否存在(实际项目中需要真实检查)
const modelExists = await this.checkModelFile(this.riskModelConfig.modelPath);
if (modelExists) {
this.useRealModel = true;
console.info('[MindSpore] 模型文件存在,将... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left initialize 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 initialize(): Promise<boolean> {
try {
console.info('[MindSpore] 正在初始化推理引擎...');
// 检查模型文件是否存在(实际项目中需要真实检查)
const modelExists = await this.checkModelFile(this.riskModelConfig.modelPath);
if (modelExists) {
this.useRealModel = true;
console.info('[MindSpore] 模型文件存在,将... | https://github.com/LJ666-ui/harmony-health-care | 870077e138d0ff8e870d1fda9eca13ad330bbed2 | github |
who7708/harmonyos-codelabs | HmosWorld/commons/common/src/main/ets/service/repository/UserAccountRepository.ets | arkts | getUserData | Obtain user-related resource data from the network
@returns UserData | getUserData(): Promise<UserData> {
return this.loginService.getUserData();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST#member_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left getUserData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right ... | getUserData(): Promise<UserData> {
return this.loginService.getUserData();
} | https://github.com/who7708/harmonyos-codelabs | 34691e53661cb1c4861c517ca2c8e6cc032b1d35 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/ThemeManager.ets | arkts | getUserCoverCornerRadius | 获取用户配置的封面图片圆角大小 | public getUserCoverCornerRadius(): number {
try {
return UserThemeConfigManager.getInstance().coverCornerRadius;
} catch {
return 12;
}
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getUserCoverCornerRadius 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 n... | public getUserCoverCornerRadius(): number {
try {
return UserThemeConfigManager.getInstance().coverCornerRadius;
} catch {
return 12;
}
} | https://github.com/DaLongZhuaZi/manxia | 48741cef8fdcc5387ea78e57f2c2fb76659d682d | github |
sibeichen/HarmonyOSSlidingUpPanel | SlidingUpPanel/src/main/ets/components/SlidingUpPanel/SlidingUpPanelConfigurator.ets | arkts | setPanelPositionYWeightArray | 上层的背景色 | setPanelPositionYWeightArray(panelPositionYWeightArray:number[]):void{
this.panelPositionYWeightArray = panelPositionYWeightArray;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setPanelPositionYWeightArray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left panelPositionYWeightArray AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AS... | setPanelPositionYWeightArray(panelPositionYWeightArray:number[]):void{
this.panelPositionYWeightArray = panelPositionYWeightArray;
} | https://github.com/sibeichen/HarmonyOSSlidingUpPanel | c279599309c99e1bc4bc6572d5343c2058554731 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets | arkts | setSeconds | Sets the seconds for a specified date according to local time.
@param { int } value new seconds
@param { int } ms
@returns { long } get new date value
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public setSeconds(value: int, ms: int): long {
this.setSeconds(value);
this.setMilliseconds(ms);
return this.ms;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setSeconds AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left value AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left int AST#identifier#R... | public setSeconds(value: int, ms: int): long {
this.setSeconds(value);
this.setMilliseconds(ms);
return this.ms;
} | https://gitcode.com/iop123123/arkts-static-skills | 378ec1069972be6e9da0e7661abfb78f899c4b68 | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/medicalimaging/ModelManager.ets | arkts | unloadModel | 卸载模型
释放模型占用的内存
@param imagingType 影像类型 | async unloadModel(imagingType: ImagingType): Promise<void> {
try {
const model = this.modelCache.get(imagingType);
if (!model) {
console.info(`ModelManager: 模型未加载,无需卸载 ${imagingType}`);
return;
}
// 模拟模型卸载(实际项目中调用MindSpore API)
// await model.unload();
// 从缓存中... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left unloadModel AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left imagingType AST#identifier#Right AST#type_annotation#Left AST#:#Lef... | async unloadModel(imagingType: ImagingType): Promise<void> {
try {
const model = this.modelCache.get(imagingType);
if (!model) {
console.info(`ModelManager: 模型未加载,无需卸载 ${imagingType}`);
return;
}
// 模拟模型卸载(实际项目中调用MindSpore API)
// await model.unload();
// 从缓存中... | https://github.com/LJ666-ui/harmony-health-care | c81a8eeea959db49d6d17ab779186d5dee9d5e34 | github |
somnio-software/my-bot-pal | entry/src/main/ets/features/settings/view/pages/DevicePermissionsPage.ets | arkts | aboutToAppear | Flag to prevent multiple simultaneous events | aboutToAppear(): void {
this.loadPermissions();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_bloc... | aboutToAppear(): void {
this.loadPermissions();
} | https://github.com/somnio-software/my-bot-pal | 0f88d56879829fd7865b106bd1e5d47981acd3f9 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/AsyncLinkedConcurrentQueue.ets | arkts | constructor | Creates a LinkedConcurrentQueue with the default capacity.
Uses the implementation maximum capacity for an unbounded queue.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public constructor() {
this.actualCapacity = Int.MAX_VALUE;
this.initializeQueueState();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { A... | public constructor() {
this.actualCapacity = Int.MAX_VALUE;
this.initializeQueueState();
} | https://gitcode.com/iop123123/arkts-static-skills | 9affa164abd2c7b70bfdaa8a6347f233b96992a1 | gitcode |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/UserProfile.ets | arkts | isStrictBudgetExecutor | 判断预算执行是否严格 | isStrictBudgetExecutor(): boolean {
return this.budgetExecutionPattern === EXECUTION_STRICT;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isStrictBudgetExecutor 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 ... | isStrictBudgetExecutor(): boolean {
return this.budgetExecutionPattern === EXECUTION_STRICT;
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 99dcc969172375eb3d2b780a8c6a4b2051c783da | github |
webabcd/HarmonyDemo | entry/src/main/ets/pages/background/DeferredTaskDemo.ets | arkts | stopWork | 取消延迟任务 | stopWork() {
try {
// 取消延迟任务
workScheduler.stopWork(this.myWorkInfo);
this.message = `stopWork 成功`;
} catch (error) {
let err = error as BusinessError;
this.message =`stopWork 失败, errCode:${err.code}, errMessage:${err.message}`;
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left stopWork AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#try_statement#Left AST#try#L... | stopWork() {
try {
// 取消延迟任务
workScheduler.stopWork(this.myWorkInfo);
this.message = `stopWork 成功`;
} catch (error) {
let err = error as BusinessError;
this.message =`stopWork 失败, errCode:${err.code}, errMessage:${err.message}`;
}
} | https://github.com/webabcd/HarmonyDemo | 2e600f676e6f63986a0e8a1bc212a32e1480cd51 | github |
arkui-x/samples | CodeLab/Cases/feature/customanimationtab/src/main/ets/model/ComponentFactory.ets | arkts | getBar | 获取tabBar
@param name - tab项标题
@returns: tabBar | public getBar(name: string): WrappedBuilder<[TabBarItemInterface]> | undefined {
return this.tabsInfo.get(name)?.barBuilder;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getBar 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 AS... | public getBar(name: string): WrappedBuilder<[TabBarItemInterface]> | undefined {
return this.tabsInfo.get(name)?.barBuilder;
} | https://gitcode.com/arkui-x/samples | 2347a54a3a4f93a9b7b1d87081b1a54b725da383 | gitcode |
openharmony-tpc/openharmony_tpc_samples | OhosVideoCache/entry/src/main/ets/pages/DiyCacheCountPage.ets | arkts | setScaleType | 设置视频缩放接口 | setScaleType(sacleValue: number): void {
Logger.info(TAG, 'set videoScaleType value is:' + sacleValue);
switch (sacleValue) {
case 0:
if (this.avPlayer != undefined) {
this.avPlayer.videoScaleType = media.VideoScaleType.VIDEO_SCALE_TYPE_FIT;
}
break;
case 1:
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setScaleType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sacleValue AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) AST#... | setScaleType(sacleValue: number): void {
Logger.info(TAG, 'set videoScaleType value is:' + sacleValue);
switch (sacleValue) {
case 0:
if (this.avPlayer != undefined) {
this.avPlayer.videoScaleType = media.VideoScaleType.VIDEO_SCALE_TYPE_FIT;
}
break;
case 1:
... | https://gitee.com/openharmony-tpc/openharmony_tpc_samples.git | 05196fee8c363905c9562b6a64e71bd2105389ec | gitee |
offlinecat-dev/OCNetORM | src/main/ets/mapping/ViewModelMapper.ets | arkts | toViewModelWithConfig | 将 EntityData 转换为 ViewModel(使用配置)
@param entityData EntityData 实例
@param config 映射配置
@returns ViewModel 实例 | static toViewModelWithConfig<T>(entityData: EntityData, config: ViewModelMappingConfig<T>): T {
if (config.factory === null) {
throw new EntityMappingError(entityData.entityName, 'ViewModel 工厂函数未配置')
}
const viewModel = config.factory()
const mappers = config.getMappers()
for (let i = 0; i <... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#binary_expression#Left AST#identifier#Left toViewModelWithConfig AST#identifier#Right AST#<#Left < AST#<#Right AST#identifier#Left T AST#identifier#Right AST#binary_expression#Right AST#>#Left > AST#>#Right AST#formal_parameters#Left AST#(#Left... | static toViewModelWithConfig<T>(entityData: EntityData, config: ViewModelMappingConfig<T>): T {
if (config.factory === null) {
throw new EntityMappingError(entityData.entityName, 'ViewModel 工厂函数未配置')
}
const viewModel = config.factory()
const mappers = config.getMappers()
for (let i = 0; i <... | https://github.com/offlinecat-dev/OCNetORM | 92a9aad698e8db55522ea13978942bbb2b45e6fd | github |
openharmony/applications_settings | product/phone/src/main/ets/pages/dateAndTime.ets | arkts | existApp | Cancel Dialog | existApp() {
LogUtil.info(MODULE_TAG + 'Cancel dialog!');
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left existApp AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#expression_statement#Left AS... | existApp() {
LogUtil.info(MODULE_TAG + 'Cancel dialog!');
} | https://gitee.com/openharmony/applications_settings.git | 80842471f1633b53cbfb0dbc6f3877624fb2d103 | gitee |
chendi126/harmonyOS-TCP | entry/src/main/ets/common/GlassStyles.ets | arkts | getAnimationDuration | 获取动画持续时间 | static getAnimationDuration(): number {
return 300;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getAnimationDuration 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 numbe... | static getAnimationDuration(): number {
return 300;
} | https://github.com/chendi126/harmonyOS-TCP | c52fdd921c0e2c69f8a4efcabad24272f681d0f5 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/02.lexical_elements/09.literals/05.string_literals/neg.ets | arkts | main | ---
desc: String literals consist of zero or more characters enclosed between single or double quotes.
tags: [negative, compile-only]
--- | function main() {
let s: string = {{case}}
assert s instanceof Object
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#lexical_declaration#Le... | function main() {
let s: string = {{case}}
assert s instanceof Object
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 537e86bfe6c26cfc613d03104d05aa9a81b63bee | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoJsExtensions.ets | arkts | getZipStringContent | 获取zip文件中指定文件的内容(字符串) | async getZipStringContent(url: string, path: string, charsetName?: string): Promise<string> {
try {
const byteArray = await this.getZipByteArrayContent(url, path);
if (!byteArray) return '';
const decoder = new util.TextDecoder(charsetName || 'utf-8');
return decoder.decodeToString(... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getZipStringContent AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left url AST#identifier#Right AST#type_annotation#Left AST#:#Lef... | async getZipStringContent(url: string, path: string, charsetName?: string): Promise<string> {
try {
const byteArray = await this.getZipByteArrayContent(url, path);
if (!byteArray) return '';
const decoder = new util.TextDecoder(charsetName || 'utf-8');
return decoder.decodeToString(... | https://github.com/DaLongZhuaZi/manxia | 1a00fae77764013d3928270517e6c078d3015de3 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Map.ets | arkts | set | Puts a pair of key and value into the Map
@param k the key to put into the Map
@param v the value to put into the Map | set(k: K, v: V): void {
this.tree = addToTree(this.tree, k, v);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left set AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left k AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left K AST#identifier#Right AST#,#Left , AST#,#Right AST#ERR... | set(k: K, v: V): void {
this.tree = addToTree(this.tree, k, v);
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 1509c669f2d1251d973203e13c9f53bc48137097 | gitee |
pangpang20/antennaPodHM | entry/src/main/ets/common/UIUtils.ets | arkts | setUIContext | 页面初始化时调用 | static setUIContext(context: UIContext): void {
UIUtils.uiContext = context;
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left setUIContext 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 setUIContext(context: UIContext): void {
UIUtils.uiContext = context;
} | https://github.com/pangpang20/antennaPodHM | 9b1428120aa6a3545c9f932c5e060f102e983da7 | github |
codelably/tuniao-ui | packages/main/src/main/ets/viewmodel/TnInputViewModel.ets | arkts | setTextareaValue | 设置多行文本域的内容
@param value 新的文本域内容 | setTextareaValue(value: string): void {
this.textareaValue = value;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setTextareaValue 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 string AST#identifier#Right AST#)#Left... | setTextareaValue(value: string): void {
this.textareaValue = value;
} | https://github.com/codelably/tuniao-ui | fbcd13f1318c51a808d11f20ee5bf513371c9d54 | github |
CPF-ApplicationTPC/imageknifepro | entry/src/main/ets/pages/TestDesiredSizeDecode.ets | arkts | parseDimensionRaw | 解析输入框尺寸字符串,保留原始数值(含负数、超大数);NaN 返回 0。 | public static parseDimensionRaw(s: string): number {
const n = Number.parseInt(s.trim(), 10)
return Number.isNaN(n) ? 0 : n
} | 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 parseDimensionRaw AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left s AST#identifier#Right AST#:#Left : A... | public static parseDimensionRaw(s: string): number {
const n = Number.parseInt(s.trim(), 10)
return Number.isNaN(n) ? 0 : n
} | https://gitcode.com/CPF-ApplicationTPC/imageknifepro/blob/5b2c39b2925d2e6c4a267ce62edc340b3150dcb9/entry/src/main/ets/pages/TestDesiredSizeDecode.ets#L348-L351 | 7d00b39efff0e54ee458886f68c890b34854bb11 | gitcode |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.