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 |
|---|---|---|---|---|---|---|---|---|---|---|
aimilin6688/KeePassHO | entry/src/main/ets/services/kdbx/KdbxLoadService.ets | arkts | loadDatabase | 加载数据库 | public static loadDatabase(loadParam: LoadDatabase, callback?: KdbxLoadServiceCallback): void {
if (Constants.ASYNC_LOAD_DATABASE) {
KdbxLoadService.asyncLoadDatabase(loadParam, callback);
} else {
new DatabaseLoad().handleLoadDatabase(loadParam, callback);
}
} | 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 loadDatabase AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left loadParam AST#identifier#Right AST#:#Left ... | public static loadDatabase(loadParam: LoadDatabase, callback?: KdbxLoadServiceCallback): void {
if (Constants.ASYNC_LOAD_DATABASE) {
KdbxLoadService.asyncLoadDatabase(loadParam, callback);
} else {
new DatabaseLoad().handleLoadDatabase(loadParam, callback);
}
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/kdbx/KdbxLoadService.ets#L19-L25 | 87d856817c4be7ec1b670cfba38c8e1d7601e35d | github |
SakuraNeko/Deepseek-Harmony | entry/src/main/ets/entryability/EntryAbility.ets | arkts | applyStatusBarStyle | 设置状态栏透明 + 窗口背景 + 内容颜色跟随深色/浅色模式
手机端:状态栏背景透明,透出 DeepSeek 网页顶部背景色
2in1端:窗口背景色与 DeepSeek 官网一致,隐藏标题栏 logo/文字后实现沉浸 | private applyStatusBarStyle(): void {
if (!mainWindowClass) {
return;
}
const isDark: boolean =
this.context.config.colorMode === ConfigurationConstant.ColorMode.COLOR_MODE_DARK;
// 手机端:状态栏透明 + 内容文字颜色适配
const sysBarProps: window.SystemBarProperties = {
statusBarColor: '#00000000... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left applyStatusBarStyle 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 ... | private applyStatusBarStyle(): void {
if (!mainWindowClass) {
return;
}
const isDark: boolean =
this.context.config.colorMode === ConfigurationConstant.ColorMode.COLOR_MODE_DARK;
// 手机端:状态栏透明 + 内容文字颜色适配
const sysBarProps: window.SystemBarProperties = {
statusBarColor: '#00000000... | https://github.com/SakuraNeko/Deepseek-Harmony | 3be120f3051ec150be5fdb92d6ec0d1bbd5a9fe5 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Loaders/MangaDetailLoader.ets | arkts | checkFavoriteStatus | 检查收藏状态 | private async checkFavoriteStatus(mangaId: string): Promise<boolean> {
try {
return await this.dataService.isFavorited(mangaId);
} catch (error) {
logger.warn(TAG, `获取收藏状态失败: ${String(error)}`);
return false;
}
} | 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 checkFavoriteStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left mangaId AST#identifier#Right AST#ERROR#Left AST#... | private async checkFavoriteStatus(mangaId: string): Promise<boolean> {
try {
return await this.dataService.isFavorited(mangaId);
} catch (error) {
logger.warn(TAG, `获取收藏状态失败: ${String(error)}`);
return false;
}
} | https://github.com/DaLongZhuaZi/manxia | 556b558c3c93f5af35f9637a9fb28060543a75ba | github |
buqiuz/Account | entry/src/main/ets/common/utils/TimeUtil.ets | arkts | formatYearMonth | 新增:获取年-月格式 | formatYearMonth(dateString: string): string {
let date = new Date(dateString); // 将传入的日期字符串转换为 Date 对象
let year = date.getFullYear(); // 获取年份
let month = date.getMonth() + 1; // 获取月份(0-11),加 1 转换为 1-12
// 格式化为 "YYYY-MM" 形式,确保月份有前导零
return `${year}-${month < 10 ? '0' + month : month}`;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left formatYearMonth AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left dateString AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) A... | formatYearMonth(dateString: string): string {
let date = new Date(dateString); // 将传入的日期字符串转换为 Date 对象
let year = date.getFullYear(); // 获取年份
let month = date.getMonth() + 1; // 获取月份(0-11),加 1 转换为 1-12
// 格式化为 "YYYY-MM" 形式,确保月份有前导零
return `${year}-${month < 10 ? '0' + month : month}`;
} | https://github.com/buqiuz/Account | 5e105d37a52dbe8cbca7d5c756972c82bdda168e | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/PaginationHandler.ets | arkts | calculatePageFromOffset | 从offset计算页码 | calculatePageFromOffset(offset: number, pageSize: number): number {
return Math.floor(offset / pageSize) + 1;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left calculatePageFromOffset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left offset AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AS... | calculatePageFromOffset(offset: number, pageSize: number): number {
return Math.floor(offset / pageSize) + 1;
} | https://github.com/DaLongZhuaZi/manxia | b6baae956180020346ca8d144c8f24effdb60e94 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/String.ets | arkts | fromCharCode | The String.fromCharCode() static method returns a string created from the specified sequence of UTF-16 code units
@param { int[] } codes are numbers between 0 and 65535 (0xFFFF) representing a UTF-16 code unit or NaN
@returns { String } string consisting of the specified UTF-16 code units.
@throws { NegativeArraySizeEr... | public static fromCharCode(...codes: int[]): String {
if (codes.length < 0) {
throw new NegativeArraySizeError("The value must be non negative")
}
return String.fromCharCodeImpl(codes)
} | 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 fromCharCode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#spread_element#Left AST#...#Left ... AST#...#Right AST#identifier#Left co... | public static fromCharCode(...codes: int[]): String {
if (codes.length < 0) {
throw new NegativeArraySizeError("The value must be non negative")
}
return String.fromCharCodeImpl(codes)
} | https://gitcode.com/iop123123/arkts-static-skills | 86376750f04d8c23b2c5e61f34fc235685a1689e | gitcode |
openharmony/codelabs | Media/ImageEdit/entry/src/main/ets/viewModel/Rect.ets | arkts | getCenterX | Get the center point of x.
@returns | getCenterX(): number {
return (this.left + this.getWidth() / 2);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getCenterX AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#statement_b... | getCenterX(): number {
return (this.left + this.getWidth() / 2);
} | https://gitee.com/openharmony/codelabs.git | c3d5b5ff5c1f67ce129f55825ae5ea72b2c5cbf8 | gitee |
LJ666-ui/harmony-health-care | entry/src/main/ets/ancientimage/ImagePreprocessor.ets | arkts | assessQuality | 评估图像质量
@param imageData 图像数据
@returns 质量评估结果 | async assessQuality(imageData: ImageData): Promise<QualityAssessment> {
console.info('[ImagePreprocessor] 开始质量评估');
const startTime = Date.now();
// 模拟质量评估
const clarity = 60 + Math.random() * 30;
const contrast = 50 + Math.random() * 40;
const noise = 10 + Math.random() * 30;
const over... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left assessQuality AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left imageData AST#identifier#Right AST#type_annotation#Left ... | async assessQuality(imageData: ImageData): Promise<QualityAssessment> {
console.info('[ImagePreprocessor] 开始质量评估');
const startTime = Date.now();
// 模拟质量评估
const clarity = 60 + Math.random() * 30;
const contrast = 50 + Math.random() * 40;
const noise = 10 + Math.random() * 30;
const over... | https://github.com/LJ666-ui/harmony-health-care | 1c116742c689ca6450ca91c8cbd5eaf7102985b5 | github |
axiomaster/bonio | harmonyos/entry/src/main/ets/voice/TalkModeManager.ets | arkts | handleTranscript | Process transcribed text from speech recognition.
Called by the speech recognizer callback. | public handleTranscript(text: string, isFinal: boolean): void {
const trimmed = text.trim();
if (this._isSpeaking && this.interruptOnSpeech) {
if (this.shouldInterrupt(trimmed)) {
this.stopSpeaking();
}
return;
}
if (!this._isListening) return;
if (trimmed.length > 0) ... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left handleTranscript AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left text AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | public handleTranscript(text: string, isFinal: boolean): void {
const trimmed = text.trim();
if (this._isSpeaking && this.interruptOnSpeech) {
if (this.shouldInterrupt(trimmed)) {
this.stopSpeaking();
}
return;
}
if (!this._isListening) return;
if (trimmed.length > 0) ... | https://github.com/axiomaster/bonio | 2812677f55cfc9f9ecc027e8cdb3dfb0493a988d | github |
openharmony/codelabs | Media/ImageEdit/entry/src/main/ets/viewModel/ImageEditCrop.ets | arkts | onImageDrag | Drag image.
@param offsetX
@param offsetY | private onImageDrag(offsetX: number, offsetY: number): void {
let tX = this.isFlipHorizontal ? -1 : 1;
let tY = this.isFlipVertically ? -1 : 1;
let alpha = MathUtils.formulaAngle(this.rotationAngle * tX * tY + this.sliderAngle);
let x = Math.cos(alpha) * offsetX * tX + Math.sin(alpha) * offsetY * tY;
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left onImageDrag AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left offsetX AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#... | private onImageDrag(offsetX: number, offsetY: number): void {
let tX = this.isFlipHorizontal ? -1 : 1;
let tY = this.isFlipVertically ? -1 : 1;
let alpha = MathUtils.formulaAngle(this.rotationAngle * tX * tY + this.sliderAngle);
let x = Math.cos(alpha) * offsetX * tX + Math.sin(alpha) * offsetY * tY;
... | https://gitee.com/openharmony/codelabs.git | 7f8f8b878f7fa2b57a12cffb101f0d28cbeffa20 | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/AdviceFeedback.ets | arkts | isAccepted | 判断是否已接受 | isAccepted(): boolean {
return this.feedbackStatus === FEEDBACK_ACCEPTED;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isAccepted 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#statemen... | isAccepted(): boolean {
return this.feedbackStatus === FEEDBACK_ACCEPTED;
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 7a48c3017ea52dbba5890dd03fdd609c380f1984 | github |
LZZLHY/hlib | entry/src/main/ets/viewmodel/FavoritesVM.ets | arkts | syncIdsToStorage | 同步 ID 集合到 AppStorage。 | private static async syncIdsToStorage(): Promise<void> {
const ids: number[] = await FavoritesStore.list();
AppStorage.setOrCreate<number[]>(AppStorageKeys.FAVORITE_IDS, ids);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left syncIdsToStorage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#argu... | private static async syncIdsToStorage(): Promise<void> {
const ids: number[] = await FavoritesStore.list();
AppStorage.setOrCreate<number[]>(AppStorageKeys.FAVORITE_IDS, ids);
} | https://github.com/LZZLHY/hlib | 1c30347018cb5dfe359cbd8a77aa6c93d151a191 | github |
Dabing-0x19d/berverage_HarmonyOS6.0 | entry/src/main/ets/model/yearlySpendingChart.ets | arkts | onConfigurationUpdate | 当配置变化时(深色/浅色模式切换)触发,重新绘制 | onConfigurationUpdate(): void {
this.drawChart()
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onConfigurationUpdate 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#statem... | onConfigurationUpdate(): void {
this.drawChart()
} | https://github.com/Dabing-0x19d/berverage_HarmonyOS6.0 | 379d28973915e699134121f70ec4ab5488258c62 | github |
the-wwyang/kids-learning-app | src/main/ets/services/QuestionCacheService.ets | arkts | fillPool | 填充题目池 | private fillPool(poolKey: string, type: QuestionType, difficulty: Difficulty, count: number): void {
let pool = this.questionPools.get(poolKey);
if (!pool) {
pool = [];
this.questionPools.set(poolKey, pool);
}
let generatedCount = 0;
let attempts = 0;
const maxAttempts = count * 3... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left fillPool AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left poolKey AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Rig... | private fillPool(poolKey: string, type: QuestionType, difficulty: Difficulty, count: number): void {
let pool = this.questionPools.get(poolKey);
if (!pool) {
pool = [];
this.questionPools.set(poolKey, pool);
}
let generatedCount = 0;
let attempts = 0;
const maxAttempts = count * 3... | https://github.com/the-wwyang/kids-learning-app | 8fc09c7db4ba897f97debef7b5a533431ca961ac | github |
terryma2024/happyword | harmonyos/entry/src/main/ets/services/WishlistStore.ets | arkts | attachCloudWishlist | V0.6.6 — attach the cloud-overlay service. When attached and the
cloud cache is non-empty, `list()` returns the cloud items instead
of the local catalog. Pass `undefined` to detach (e.g. on unbind). | attachCloudWishlist(svc: CloudWishlistService | undefined): void {
this.cloud = svc;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left attachCloudWishlist AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left svc AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_expression#Left AST#identifier#Left CloudWishl... | attachCloudWishlist(svc: CloudWishlistService | undefined): void {
this.cloud = svc;
} | https://github.com/terryma2024/happyword | 6624c4bda0008e84443ddfd5df8e18f3f75f90a1 | github |
XJTUWYD/ArkDiff | entry/src/main/ets/services/AnalyticsService.ets | arkts | reset | 清空全部统计 | static reset(): void {
AnalyticsService.counts = {};
AnalyticsService.errors = [];
try {
AppStorage.setOrCreate(COUNTS_KEY, '{}');
AppStorage.setOrCreate(ERRORS_KEY, '[]');
} catch (_e) {
hilog.error(DOMAIN, 'analytics', 'reset failed');
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left reset AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Rig... | static reset(): void {
AnalyticsService.counts = {};
AnalyticsService.errors = [];
try {
AppStorage.setOrCreate(COUNTS_KEY, '{}');
AppStorage.setOrCreate(ERRORS_KEY, '[]');
} catch (_e) {
hilog.error(DOMAIN, 'analytics', 'reset failed');
}
} | https://github.com/XJTUWYD/ArkDiff | 2cde942eeb65a63d004a62d7a436eb7b9a42c6e6 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelSourceExecutor.ets | arkts | getExploreKinds | ==================== 发现页功能 ==================== | getExploreKinds(): LegadoExploreKind[] {
if (!this.source.exploreUrl) {
return [];
}
const parser = new LegadoSourceParser();
return parser.parseExploreKinds(this.source.exploreUrl);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getExploreKinds 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 LegadoExploreKind AST#identifier#Right AST#[#L... | getExploreKinds(): LegadoExploreKind[] {
if (!this.source.exploreUrl) {
return [];
}
const parser = new LegadoSourceParser();
return parser.parseExploreKinds(this.source.exploreUrl);
} | https://github.com/DaLongZhuaZi/manxia | ac4953d8253fc57589d60e3fa8b778b3175180ff | github |
YANGZX22/Voot | entry/src/main/ets/services/PipSubtitleManager.ets | arkts | updateContentSize | Update PiP window content size (width and height ratio)
@param width - Content width in px
@param height - Content height in px | updateContentSize(width: number, height: number): void {
if (!this.pipController) {
console.warn(`${TAG} Cannot update content size: PiP controller not initialized`);
return;
}
try {
this.pipController.updateContentSize(width, height);
console.info(`${TAG} Content size updated to $... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateContentSize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left width AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#Right AST#,#Lef... | updateContentSize(width: number, height: number): void {
if (!this.pipController) {
console.warn(`${TAG} Cannot update content size: PiP controller not initialized`);
return;
}
try {
this.pipController.updateContentSize(width, height);
console.info(`${TAG} Content size updated to $... | https://github.com/YANGZX22/Voot | a65e2b5c1033c3db05fbfd0ee9c559ff6791f016 | github |
ASweetBite/HarmonyPulse | entry/src/main/ets/utils/managers/RdbManager.ets | arkts | deleteSongById | 根据 ID 从数据库删除单首歌曲 | async deleteSongById(songId: string): Promise<boolean> {
if (!this.rdbStore) return false;
try {
let predicates = new relationalStore.RdbPredicates(this.tableNameSong);
predicates.equalTo('id', songId);
// 同时也删除映射表中的关联记录,防止产生脏数据
let mapPredicates = new relationalStore.RdbPredicates(t... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left deleteSongById AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left songId AST#identifier#Right AST#type_annotati... | async deleteSongById(songId: string): Promise<boolean> {
if (!this.rdbStore) return false;
try {
let predicates = new relationalStore.RdbPredicates(this.tableNameSong);
predicates.equalTo('id', songId);
// 同时也删除映射表中的关联记录,防止产生脏数据
let mapPredicates = new relationalStore.RdbPredicates(t... | https://github.com/ASweetBite/HarmonyPulse/blob/a7fcf153a20bafa29ac1fb8c25743dd5350dc54c/entry/src/main/ets/utils/managers/RdbManager.ets#L199-L217 | e8bba0b034c730d8bd537eb5051da2c0820b312f | github |
openharmony-sig/applications_clock | common/src/main/ets/manager/AlarmManager.ets | arkts | clearSnoozedData | Clear snooze data in sharedPreference by alarm id.
@param alarmInfo Alarm info
@param isEditMode Whether user proactively edits the alarm
@return cleared alarm ids | async clearSnoozedData(alarmInfo: AlarmInfo, isEditMode: boolean): Promise<string[]> {
// The following situations will walk up here
// 1: User proactively edits the alarm
// 2: Close the alarm
// 3: User clicks the button for closing the notification bar
if (isEditMode) {
await SnoozeManage... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left clearSnoozedData AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left alarmInfo AST#identifier#Right AST#type_annotation#Left AST#:#... | async clearSnoozedData(alarmInfo: AlarmInfo, isEditMode: boolean): Promise<string[]> {
// The following situations will walk up here
// 1: User proactively edits the alarm
// 2: Close the alarm
// 3: User clicks the button for closing the notification bar
if (isEditMode) {
await SnoozeManage... | https://gitee.com/openharmony-sig/applications_clock.git | 2a84042031368b479915c85363c75500eeda13cd | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/SessionManager.ets | arkts | stopAll | 停止所有会话刷新 | stopAll(): void {
this.refreshTimers.forEach((timerId, sourceId) => {
clearInterval(timerId);
logger.info(TAG, `停止会话刷新: sourceId=${sourceId}`);
});
this.refreshTimers.clear();
this.sessionStates.forEach(state => {
state.isActive = false;
});
logger.info(TAG, '停止所有会话... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left stopAll AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left... | stopAll(): void {
this.refreshTimers.forEach((timerId, sourceId) => {
clearInterval(timerId);
logger.info(TAG, `停止会话刷新: sourceId=${sourceId}`);
});
this.refreshTimers.clear();
this.sessionStates.forEach(state => {
state.isActive = false;
});
logger.info(TAG, '停止所有会话... | https://github.com/DaLongZhuaZi/manxia | 7ec906ed546c37b098cfb02e84427ceb581ff167 | github |
codelably/HCompass | core/navigation/src/main/ets/GuardManager.ets | arkts | setLogEnabled | 设置是否启用日志
@param enable 是否启用 | setLogEnabled(enable: boolean): void {
this.enableLog = enable;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setLogEnabled AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left enable AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean AST#identifier#Right AST#)#Left ... | setLogEnabled(enable: boolean): void {
this.enableLog = enable;
} | https://github.com/codelably/HCompass | 446529cb1a70211a50a59ea58a58470121b72353 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedArrays.ets | arkts | from | Creates an array from an object of FixedArray<int>.
@param { FixedArray<int> } arr - An instance of the FixedArray type to convert to an array.
@returns { Int16Array } - A new Int16Array
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static from(arr: FixedArray<int>): Int16Array {
let result = new Int16Array(arr.length)
result.ofInt(stub.toValueArray(arr))
return result
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#from#Left from AST#from#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left arr AST#identifier#Righ... | public static from(arr: FixedArray<int>): Int16Array {
let result = new Int16Array(arr.length)
result.ofInt(stub.toValueArray(arr))
return result
} | https://gitcode.com/iop123123/arkts-static-skills | 45bdf2d38ccccdbc6bdefed5d6019ede6b4c0361 | gitcode |
bhengubv/aether-protocol | arkts/src/main/ets/market/PoVTokenExchangeService.ets | arkts | issueToken | Mints a witness-signed PoV token for `subjectUhid` and sends it directed
(TTL 1) over packet 43. Refuses to mint over a non-short-range transport or to
vouch for itself. Returns the token that was issued (with an empty subject
signature — the subject fills it on receipt), or null when issuance was refused. | async issueToken(subjectUhid: string, transport: PoVTransportType): Promise<PoVToken | null> {
if (subjectUhid.length === 0) {
this.logMsg('PoV issue skipped — empty subject UHID');
return null;
}
// ANTI-REMOTE-MINTING: a vicinity proof is only meaningful over a short-range
// channel.
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left issueToken AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left subjectUhid AST#identifier#Right A... | async issueToken(subjectUhid: string, transport: PoVTransportType): Promise<PoVToken | null> {
if (subjectUhid.length === 0) {
this.logMsg('PoV issue skipped — empty subject UHID');
return null;
}
// ANTI-REMOTE-MINTING: a vicinity proof is only meaningful over a short-range
// channel.
... | https://github.com/bhengubv/aether-protocol | c25c53b17bf2a6e83657dff992d6ff5d45e32172 | github |
arkui-x/samples | CodeLab/Cases/feature/addressrecognize/src/main/ets/view/AddressRecognize.ets | arkts | recognizeImageToText | 识别图片转文字
@param pixelMap | recognizeImageToText(pixelMap: image.PixelMap) {
if (!pixelMap) {
promptAction.showToast({
message: $r('app.string.addressrecognize_recognize_image_fail_text'),
duration: CommonConstants.TOAST_DURATION
});
// 清除loading
clearLoading(this.loadingId);
return;
}
/... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left recognizeImageToText AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left pixelMap AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left image... | recognizeImageToText(pixelMap: image.PixelMap) {
if (!pixelMap) {
promptAction.showToast({
message: $r('app.string.addressrecognize_recognize_image_fail_text'),
duration: CommonConstants.TOAST_DURATION
});
// 清除loading
clearLoading(this.loadingId);
return;
}
/... | https://gitcode.com/arkui-x/samples | ebafb0eac78dac92a4e4a2612acf07eb1fa0b482 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Scraper/BangumiScraper.ets | arkts | convertToMetadata | 将Bangumi条目转换为统一元数据格式 | private convertToMetadata(subject: BangumiSubject): ScrapedMetadata {
// 从infobox提取作者信息
const authors = this.extractFromInfobox(subject.infobox, ['作者', '原作', '著者']);
const artists = this.extractFromInfobox(subject.infobox, ['作画', '插图', '插画']);
const publisher = this.extractFromInfobox(subject.infobox,... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left convertToMetadata AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left subject AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifi... | private convertToMetadata(subject: BangumiSubject): ScrapedMetadata {
// 从infobox提取作者信息
const authors = this.extractFromInfobox(subject.infobox, ['作者', '原作', '著者']);
const artists = this.extractFromInfobox(subject.infobox, ['作画', '插图', '插画']);
const publisher = this.extractFromInfobox(subject.infobox,... | https://github.com/DaLongZhuaZi/manxia | b6668f70cad49c1c2156781cbb1d115ce21aac81 | github |
LZZLHY/hlib | entry/src/main/ets/utils/SecretStore.ets | arkts | makeGcmProps | HUKS GCM 通用 properties 工厂——避免散落在多个方法中容易写错。 | function makeGcmProps(purpose: number, nonce?: Uint8Array, authTag?: Uint8Array): Array<huks.HuksParam> {
const props: Array<huks.HuksParam> = [
{ tag: huks.HuksTag.HUKS_TAG_ALGORITHM, value: huks.HuksKeyAlg.HUKS_ALG_AES },
{ tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, value: huks.HuksKeySize.HUKS_AES_KEY_SIZE_256 }... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left makeGcmProps AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left purpose AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#... | function makeGcmProps(purpose: number, nonce?: Uint8Array, authTag?: Uint8Array): Array<huks.HuksParam> {
const props: Array<huks.HuksParam> = [
{ tag: huks.HuksTag.HUKS_TAG_ALGORITHM, value: huks.HuksKeyAlg.HUKS_ALG_AES },
{ tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, value: huks.HuksKeySize.HUKS_AES_KEY_SIZE_256 }... | https://github.com/LZZLHY/hlib | 8a2ab01382411da3961e6eda0f858e8c5b5a9137 | github |
OHPG/FinSdk | jellyfin/src/main/ets/api/SessionApi.ets | arkts | getPasswordResetProviders | getPasswordResetProviders
@summary Get all password reset providers.
@throws {RequiredError}
@memberof SessionApi | public async getPasswordResetProviders(): Promise<NameIdPair> {
return this.apiClient.get({path: "/Auth/PasswordResetProviders"})
} | 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 getPasswordResetProviders AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#... | public async getPasswordResetProviders(): Promise<NameIdPair> {
return this.apiClient.get({path: "/Auth/PasswordResetProviders"})
} | https://github.com/OHPG/FinSdk | 0a1743fa227d7c4c3669fbb941e3346f2251266c | github |
openharmony/applications_calendar_data | datamanager/src/main/ets/processor/alerts/AlertsProcessor.ets | arkts | queryEventIdAndCreatorByAlert | 查询待插入的 alert 数据中 event_id 与 event 表相同的结果
@param rdbStore rdb数据库
@param values 插入操作的数据
@return DataShareResultSet | async function queryEventIdAndCreatorByAlert(rdbStore: data_rdb.RdbStore, values: data_rdb.ValuesBucket) {
const eventId = values[CalendarAlertsColumns.EVENT_ID] as ValueType;
const columns = [EventColumns.ID, EventColumns.CREATOR];
let predicates = new dataSharePredicates.DataSharePredicates();
predicates.equa... | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left queryEventIdAndCreatorByAlert AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left rdbStore AST#identi... | async function queryEventIdAndCreatorByAlert(rdbStore: data_rdb.RdbStore, values: data_rdb.ValuesBucket) {
const eventId = values[CalendarAlertsColumns.EVENT_ID] as ValueType;
const columns = [EventColumns.ID, EventColumns.CREATOR];
let predicates = new dataSharePredicates.DataSharePredicates();
predicates.equa... | https://gitee.com/openharmony/applications_calendar_data.git | 8dd42aa19b68e289a3cae48f87c3484e70b88674 | gitee |
XHXYT/Pixark | entry/src/main/ets/common/utils/database/impl/IllustHistoryDao.ets | arkts | addHistory | 暴露给外界的添加历史记录接口
如果已存在相同 pid 则更新,不存在则新增
@param item 要添加的历史记录对象
@returns 操作影响的行数 | async addHistory(item: IllustHistoryInfo): Promise<number> {
logger.debug('addHistory item=' + JSON.stringify(item))
return this.save(item);
} | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left addHistory AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left item AST#identifier#Right AST#type_annotation#Left AST#:#Le... | async addHistory(item: IllustHistoryInfo): Promise<number> {
logger.debug('addHistory item=' + JSON.stringify(item))
return this.save(item);
} | https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/common/utils/database/impl/IllustHistoryDao.ets#L123-L126 | 2e6e0d14abdc29e7a1579740d93078964057d609 | github |
openharmony/applications_mms | entry/src/main/ets/service/NotificationService.ets | arkts | buildNotificationRequest | Building notification parameters
@param actionData | buildNotificationRequest(actionData): any {
let message = actionData.message;
let notificationRequest = {
content: {
contentType: Notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal: {
title: message.title,
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left buildNotificationRequest AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left actionData AST#identifier#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#a... | buildNotificationRequest(actionData): any {
let message = actionData.message;
let notificationRequest = {
content: {
contentType: Notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal: {
title: message.title,
... | https://gitee.com/openharmony/applications_mms.git | 98471a489496971dfe11ced3272f0dba88a65a84 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Date.ets | arkts | toLocaleTimeString | Gets a string with a language-sensitive representation of
the time portion of the date with respect to locale.
@param { Intl.LocalesArgument } [ locales ]
@param { Intl.DateTimeFormatOptions } [ options ]
@returns { string } Gets a string with a language-sensitive representation of
the time portion of the date
@throws ... | public toLocaleTimeString(locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string {
if (options && options.dateStyle) {
throw new TypeError("Invalid option : dateStyle")
}
const effectiveOptions = !options ? Date.TIME_FORMAT_OPTIONS : this.appendDefaultTime... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toLocaleTimeString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left locales AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST... | public toLocaleTimeString(locales?: Intl.LocalesArgument, options?: Intl.DateTimeFormatOptions): string {
if (options && options.dateStyle) {
throw new TypeError("Invalid option : dateStyle")
}
const effectiveOptions = !options ? Date.TIME_FORMAT_OPTIONS : this.appendDefaultTime... | https://gitcode.com/iop123123/arkts-static-skills | 52915c4521fefcdc7b9cf7265dc7a8b14b4d4518 | gitcode |
aimilin6688/KeePassHO | entry/src/main/ets/common/oauth2/OAuth2TokenStorageService.ets | arkts | getInstance | 获取单例实例 | public static getInstance(): OAuth2TokenStorageService {
return OAuth2TokenStorageService.instance;
} | 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 getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L... | public static getInstance(): OAuth2TokenStorageService {
return OAuth2TokenStorageService.instance;
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/oauth2/OAuth2TokenStorageService.ets#L42-L44 | f7a4c9f2f9fbcf7a3a231c63f01adad43bd8f149 | github |
iHongRen/harmony-study-demo | entry/src/main/ets/pages/myemitter/myemitter.ets | arkts | off | 移除观察者
@param observer 观察者对象 | public static off(observer: Object): void {
UserEmitter.map.delete(observer);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left off AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left observer AST#identifier#Rig... | public static off(observer: Object): void {
UserEmitter.map.delete(observer);
} | https://github.com/iHongRen/harmony-study-demo | 27dbfe70d69787c7c51e01bdbb735dc6c28af8a8 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.math.Decimal.ets | arkts | toNumber | Return the value of this Decimal converted to a number primitive. Zero keeps its sign.
@returns { double } the number type | public toNumber(): double {
return Utils.toNumber(this.valueOf());
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toNumber 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 double AST#id... | public toNumber(): double {
return Utils.toNumber(this.valueOf());
} | https://gitcode.com/iop123123/arkts-static-skills | e56fea5546910b2f0055de43774bb76d10d759f2 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | reduce | Calls the specified callback function for all the elements in an array.
The return value of the callback function is the accumulated result,
and is provided as an argument in the next call to the callback function.
@param { function } callbackfn - A function that accepts four arguments.
The reduce method calls the call... | public reduce(callbackfn: (previousValue: BigInt, currentValue: BigInt, currentIndex: int, array: BigUint64Array) => BigInt): BigInt {
if (this.lengthInt == 0) {
throw new TypeError("Reduce of empty array with no initial value")
}
let accumulatedValue = new BigInt(this.$_get(0))... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left reduce AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left callbackfn AST#identifier#Right AST#ERROR#Left AST#:#Left :... | public reduce(callbackfn: (previousValue: BigInt, currentValue: BigInt, currentIndex: int, array: BigUint64Array) => BigInt): BigInt {
if (this.lengthInt == 0) {
throw new TypeError("Reduce of empty array with no initial value")
}
let accumulatedValue = new BigInt(this.$_get(0))... | https://gitcode.com/iop123123/arkts-static-skills | fc482fd3094fb028c6cc412b2c8623b53de82390 | gitcode |
Joker-x-dev/CoolMallArkTS | feature/goods/src/main/ets/viewmodel/GoodsDetailViewModel.ets | arkts | onCouponReceive | 处理优惠券领取点击
@param {number} couponId - 优惠券 ID
@returns {void} 无返回值 | onCouponReceive(couponId: number): void {
const coupons: Coupon[] = this.data?.coupon ?? [];
const coupon: Coupon | undefined = coupons.find((item: Coupon): boolean => item.id === couponId);
if (!coupon) {
return;
}
this.receiveCoupon(coupon);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onCouponReceive AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left couponId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#)#Left ) AST... | onCouponReceive(couponId: number): void {
const coupons: Coupon[] = this.data?.coupon ?? [];
const coupon: Coupon | undefined = coupons.find((item: Coupon): boolean => item.id === couponId);
if (!coupon) {
return;
}
this.receiveCoupon(coupon);
} | https://github.com/Joker-x-dev/CoolMallArkTS | 6c191f8d449d846a980eddc48f0e7713f62da1bc | github |
apap6628114/nga_oh | entry/src/main/ets/store/AppStore.ets | arkts | toast | ---------- Facade: Toast ---------- | get toast(): ToastState {
return this.toastManager.state
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left toast 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 ToastState AST#identifier... | get toast(): ToastState {
return this.toastManager.state
} | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/store/AppStore.ets#L249-L251 | 8e3fafb0496dcb4fad8b5827cc50d3ff5911d2da | github |
OHPG/FinSdk | jellyfin/src/main/ets/api/SystemApi.ets | arkts | getPingSystem | getPingSystem
@summary Pings the system.
@throws {RequiredError}
@memberof SystemApi | public async getPingSystem(): Promise<string> {
return this.apiClient.get({ path: "/System/Ping" })
} | 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 getPingSystem AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#... | public async getPingSystem(): Promise<string> {
return this.apiClient.get({ path: "/System/Ping" })
} | https://github.com/OHPG/FinSdk | e41eea3be9690f181164124f00b3e3f9434d4b6a | github |
openharmony/codelabs | ETSUI/ChatAppDemo/entry/src/main/ets/common/I18nManager.ets | arkts | initLanguage | 初始化语言(在 EntryAbility 的 onCreate 中调用) | static initLanguage() {
let lang = AppStorage.get<string>('currentLanguage') || 'zh-Hans';
i18n.System.setAppPreferredLanguage(lang);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left initLanguage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { ... | static initLanguage() {
let lang = AppStorage.get<string>('currentLanguage') || 'zh-Hans';
i18n.System.setAppPreferredLanguage(lang);
} | https://gitcode.com/openharmony/codelabs | 3ad06b3d37d61aa70711c27d04b634109b22fb5b | gitcode |
LongLiveY96/chatcube | entry/src/main/ets/services/AIApiService.ets | arkts | createAssistantWithToolCalls | 创建带工具调用的 assistant 消息 | static createAssistantWithToolCalls(content: string, toolCalls: ToolCall[]): RequestMessage {
const msg = new RequestMessage('assistant', content)
msg.toolCalls = toolCalls
return msg
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createAssistantWithToolCalls 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 stri... | static createAssistantWithToolCalls(content: string, toolCalls: ToolCall[]): RequestMessage {
const msg = new RequestMessage('assistant', content)
msg.toolCalls = toolCalls
return msg
} | https://github.com/LongLiveY96/chatcube | 50031e52eccc54145e408485a61b1879cc47a022 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@arkts.collections.ets | arkts | values | Returns an iterable of values in the bit vector
@returns { IterableIterator<int> } A new iterable iterator object.
@throws { BusinessError } 10200011 - The values method cannot be bound.
@throws { BusinessError } 10200201 - Concurrent modification error.
@syscap SystemCapability.Utils.Lang
@crossplatform
@atomicservic... | public values(): IterableIterator<int> {
return this.$_iterator();
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left values AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_stat... | public values(): IterableIterator<int> {
return this.$_iterator();
} | https://gitcode.com/iop123123/arkts-static-skills | 8ebf19ca8d3055853f715ba370bc8602b9163f90 | gitcode |
Countly/countly-sdk-hos | library/src/main/ets/internal/Storage.ets | arkts | setString | Returns true on successful persist, false on failure (e.g. preferences not
initialized, disk full, etc.). Callers use the return to decide whether to
trust the in-memory queue as authoritative. | public async setString(key: string, value: string): Promise<boolean> {
if (!this.prefs) {
this.logger.w(`[Storage] setString, preferences not initialized; '${key}' not persisted`);
return false;
}
try {
await this.prefs.put(key, value);
await this.prefs.flush();
return true;
... | 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 setString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Ri... | public async setString(key: string, value: string): Promise<boolean> {
if (!this.prefs) {
this.logger.w(`[Storage] setString, preferences not initialized; '${key}' not persisted`);
return false;
}
try {
await this.prefs.put(key, value);
await this.prefs.flush();
return true;
... | https://github.com/Countly/countly-sdk-hos | 5fd48c470eb8f6c4455818f0de33ca1eab8a1858 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/Char.ets | arkts | toUpperCase | toUpperCase() converts the underlying char to upper case if it is in lower case, otherwise the char unchanged | public toUpperCase(): void {
this.value = Char.toUpperCase(this.value);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left toUpperCase AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression... | public toUpperCase(): void {
this.value = Char.toUpperCase(this.value);
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 6a6d6a01dafbac004eca4a0915b95fdc81d6f649 | gitee |
iHongRen/harmony-study-demo | entry/src/main/ets/pages/blur/BlurDemo.ets | arkts | isSwipeGesture | 判断是否为快速滑动 | isSwipeGesture(distance: number, duration: number): boolean {
const speed = distance / duration;
return speed > 0.5; // 速度阈值
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isSwipeGesture AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left distance AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , AST#... | isSwipeGesture(distance: number, duration: number): boolean {
const speed = distance / duration;
return speed > 0.5; // 速度阈值
} | https://github.com/iHongRen/harmony-study-demo | 8201a3f8eb4b1864256324a891a3f69524c12a37 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Error.ets | arkts | name | Gets the name of the error.
@returns { string } - Current error name
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | get name(): string {
return this.name_
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left name AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ER... | get name(): string {
return this.name_
} | https://gitcode.com/iop123123/arkts-static-skills | 417e329af2c1e79cfa1966a1168ff61d2865c704 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | includes | Checks if specified argument is in Uint8ClampedArray
@param e search element
@param fromIndex start index to search from
@returns true if e is in Uint8ClampedArray, false otherwise | public includes(e: number, fromIndex: number): boolean {
return this.includes(e as number, fromIndex as int)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left includes AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left e AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST... | public includes(e: number, fromIndex: number): boolean {
return this.includes(e as number, fromIndex as int)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | a43b7717cfd4ba796389cf55f22c14a139b2053b | gitee |
HarmonyOS_Samples/accountkit-samplecode-clientdemo-arkts | hmos-account-kit-quicklogin-client/assets/QuickLoginPage.ets | arkts | jumpToPrivacyWebView | 跳转华为账号用户认证协议页,该页面需在工程main_pages.json文件配置 | jumpToPrivacyWebView() {
try {
// 需在module.json5中配置"ohos.permission.GET_NETWORK_INFO"权限
const checkNetConn = connection.hasDefaultNetSync();
if (!checkNetConn) {
this.showToast('服务或网络异常,请稍后重试');
return;
}
} catch (error) {
const message = error.message as string;
... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left jumpToPrivacyWebView 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_blo... | jumpToPrivacyWebView() {
try {
// 需在module.json5中配置"ohos.permission.GET_NETWORK_INFO"权限
const checkNetConn = connection.hasDefaultNetSync();
if (!checkNetConn) {
this.showToast('服务或网络异常,请稍后重试');
return;
}
} catch (error) {
const message = error.message as string;
... | https://gitcode.com/HarmonyOS_Samples/accountkit-samplecode-clientdemo-arkts | 2edb39e77003ac577a4b87226c4b8f691ab01188 | gitcode |
HarmonyOS_Samples/BestPracticeSnippets | ComponentReuse/entry/src/main/ets/view/WithFuncParam.ets | arkts | getWithFuncParam | [End opt_funcParam]
[Start with_func_param] | @Builder
function getWithFuncParam(name: string): void {
if (name === Constants.NAV_DESTINATION_ITEM_3) {
NavDestination() {
WithFuncParam()
}
.title(title())
.backgroundColor('#F1F3F5')
}
} | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Builder AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left getWithFuncParam AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#... | @Builder
function getWithFuncParam(name: string): void {
if (name === Constants.NAV_DESTINATION_ITEM_3) {
NavDestination() {
WithFuncParam()
}
.title(title())
.backgroundColor('#F1F3F5')
}
} | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | 3c148d12604c1f08a19bd8f64a1fbd29310bdb74 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/tests/ets-templates/03.types/07.value_types/01.integer_types_and_operations/unsigned_right_shift/unsigned_right_shift_uint.ets | arkts | main | ---
desc: check unsigned right shift operation for unsigned integer
--- | function main(): void {
const a: uint = {{v.left}}
const b: int = {{v.right}}
assert (a >>> b) == {{v.result}} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left main AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefined_type#Left A... | function main(): void {
const a: uint = {{v.left}}
const b: int = {{v.right}}
assert (a >>> b) == {{v.result}} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 828f1b9f90ba83a5ec2430415f0068695f776a70 | gitee |
richshaw2015/nds | ohos/entry/src/main/ets/types/MelonDSNative.ets | arkts | getSettingsConfig | 获取配置值 (扩展版本,支持更多类型)
@param key 配置键
@returns 配置值,如果键不存在则返回 undefined
Requirements: 13.2 | static getSettingsConfig(key: string): SettingsConfigValue | undefined {
return MelonDSNative.native.getSettingsConfig(key);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getSettingsConfig AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left key AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | static getSettingsConfig(key: string): SettingsConfigValue | undefined {
return MelonDSNative.native.getSettingsConfig(key);
} | https://github.com/richshaw2015/nds | 2b933d1f71780316e0a091c96798bfaacfdc0337 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets | arkts | findDirectChildrenByTag | 按标签名查找直接子元素 | private findDirectChildrenByTag(html: string, tag: string): string[] {
return this.findDirectChildren(html).filter(el => this.getTagName(el) === tag.toLowerCase());
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left findDirectChildrenByTag AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left html AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#ident... | private findDirectChildrenByTag(html: string, tag: string): string[] {
return this.findDirectChildren(html).filter(el => this.getTagName(el) === tag.toLowerCase());
} | https://github.com/DaLongZhuaZi/manxia | c231b075267ce5d743c159973e171ed054e5ef35 | github |
Harrisonls2004/WaterFlow | entry/src/main/ets/common/utils/FavoritesManager.ets | arkts | getAllFavorites | Get all favorites | private static async getAllFavorites(): Promise<IFavorite[]> {
try {
if (!FavoritesManager.preferencesInstance) {
console.error('FavoritesManager: Preferences not initialized');
return [];
}
const favoritesJson = await FavoritesManager.preferencesInstance.get(FavoritesManager.FA... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left getAllFavorites AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#argum... | private static async getAllFavorites(): Promise<IFavorite[]> {
try {
if (!FavoritesManager.preferencesInstance) {
console.error('FavoritesManager: Preferences not initialized');
return [];
}
const favoritesJson = await FavoritesManager.preferencesInstance.get(FavoritesManager.FA... | https://github.com/Harrisonls2004/WaterFlow | 79333fe44095d077da5028590d6f9bd4bbdff90d | github |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/MainMenuPage.ets | arkts | getDynamicFilterSelectedCount | 获取动态书架当前已选筛选条件总数 | private getDynamicFilterSelectedCount(): number {
const selectedSourceCount = this.sourceFeaturesEnabled ? this.dynamicFilterSelectedSources.size : 0;
return this.dynamicFilterSelectedAuthors.size +
this.dynamicFilterSelectedTags.size +
this.dynamicFilterSelectedKeywords.size +
selectedSourc... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getDynamicFilterSelectedCount 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#numbe... | private getDynamicFilterSelectedCount(): number {
const selectedSourceCount = this.sourceFeaturesEnabled ? this.dynamicFilterSelectedSources.size : 0;
return this.dynamicFilterSelectedAuthors.size +
this.dynamicFilterSelectedTags.size +
this.dynamicFilterSelectedKeywords.size +
selectedSourc... | https://github.com/DaLongZhuaZi/manxia | 5bfe4fd654ba25b4a9d394657503da5aceb4b6ab | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Array.ets | arkts | reverseArray | Creates a new `Object[]` primitive array and populates
it with same elements ordered towards the direction opposite to that previously stated.
@returns Primitive array of `Object`s, constructed from `this` in reverse order. | private reverseArray(): T[] {
let res = new T[this.data.length];
for (let i: int = 0; i < this.data.length; i++) {
res[i] = this.data[this.data.length-i-1];
}
return res;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left reverseArray AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left T AST#... | private reverseArray(): T[] {
let res = new T[this.data.length];
for (let i: int = 0; i < this.data.length; i++) {
res[i] = this.data[this.data.length-i-1];
}
return res;
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 6d79d6d76b71b74a0729d565c8bbd947f3901598 | gitee |
Octo-o-o-o/harmonyos-ai-workspace | samples/templates/list/item-data-source.ets | arkts | add | ─── 改数据要走这些方法 · 不要直接 push items[] ──── | add(item: T): void {
this.items.push(item);
this.notifyDataAdd(this.items.length - 1);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left add AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left item AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left T AST#identifier#Right AST#ERROR#Right AST#)#Left ) AST#)#Right AST#... | add(item: T): void {
this.items.push(item);
this.notifyDataAdd(this.items.length - 1);
} | https://github.com/Octo-o-o-o/harmonyos-ai-workspace | fbf90ac2acbc922e3c77fd9638fbd32a4bc1067e | github |
Kira-Yagami-Light/Kira-Projects | TodoTask/entry/src/main/ets/data/repository/TaskRepository.ets | arkts | getTasksByCategory | 根据分类获取任务
@param categoryId 分类 ID
@returns Promise<Array<TaskListData>> 任务模型数组 | async getTasksByCategory(categoryId: number): Promise<Array<TaskListData>> {
try {
const records = await this.dao.queryByCategory(categoryId);
return records.map(r => TaskListData.fromRecord(r));
} catch (err) {
Logger.error(this.LOG_TAG, `Failed to get tasks by category: ${JSON.stringify(er... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getTasksByCategory AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left categoryId AST#identifier#Right AST#type_annotation#Left AST... | async getTasksByCategory(categoryId: number): Promise<Array<TaskListData>> {
try {
const records = await this.dao.queryByCategory(categoryId);
return records.map(r => TaskListData.fromRecord(r));
} catch (err) {
Logger.error(this.LOG_TAG, `Failed to get tasks by category: ${JSON.stringify(er... | https://github.com/Kira-Yagami-Light/Kira-Projects | ab8a53028f388130f99b7f578c3dba2e335a7c70 | github |
openharmony/applications_contacts | entry/src/main/ets/model/ContactAbilityModel.ets | arkts | getAllFavorite | Querying the Mobile Numbers of All Favorites
@param {string} DAHelper
@param {Object} callBack | async getAllFavorite(callBack: Function, context?: common.UIAbilityContext | Context) {
HiLog.i(TAG, 'getAllFavorite start.');
if (context) {
ContactRepository.getInstance().init(context);
ContactRepository.getInstance().findAllFavorite((favoriteList) => {
if (ArrayUtil.isEmpty(favoriteLis... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getAllFavorite AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left callBack AST#identifier#Right AST#type_annotation#Left ... | async getAllFavorite(callBack: Function, context?: common.UIAbilityContext | Context) {
HiLog.i(TAG, 'getAllFavorite start.');
if (context) {
ContactRepository.getInstance().init(context);
ContactRepository.getInstance().findAllFavorite((favoriteList) => {
if (ArrayUtil.isEmpty(favoriteLis... | https://gitee.com/openharmony/applications_contacts.git | 0269d897da622252ab6daf2f4289623c486fc4a3 | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | findIndex | Finds an index of the first element in the Uint8ClampedArray that satisfies the condition
@param fn condition
@returns the index of the first element that satisfies fn | public findIndex(fn: (val: number, index: int, array: Uint8ClampedArray) => boolean): int {
for (let i = 0; i < this.length; ++i) {
let val = this.at(i)
if (fn(val, i, this)) {
return i
}
}
return -1
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left findIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#... | public findIndex(fn: (val: number, index: int, array: Uint8ClampedArray) => boolean): int {
for (let i = 0; i < this.length; ++i) {
let val = this.at(i)
if (fn(val, i, this)) {
return i
}
}
return -1
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | cba304e874cfc8e40410330df939eb2db5bb9be4 | gitee |
LJ666-ui/harmony-health-care | entry/src/main/ets/ar/PathPlanner.ets | arkts | getAvailableCategories | 获取所有可用分类 | public getAvailableCategories(): DestinationCategory[] {
if (!this.buildingData) return [];
const categories = new Set<DestinationCategory>();
for (const poi of this.buildingData.pois) {
categories.add(poi.category);
}
return Array.from(categories);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getAvailableCategories 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... | public getAvailableCategories(): DestinationCategory[] {
if (!this.buildingData) return [];
const categories = new Set<DestinationCategory>();
for (const poi of this.buildingData.pois) {
categories.add(poi.category);
}
return Array.from(categories);
} | https://github.com/LJ666-ui/harmony-health-care | 09ca8d339dab103701fed8aafacf988079ce7e72 | github |
codelably/HCompass | core/spatialization/oh_modules/@core/util/src/main/ets/logger/LoggerUtil.ets | arkts | debug | 调试级别日志
@param data 日志内容
@param tag 自定义标签 | static debug(data: Any, tag?: string) {
Logger.log(LogLevel.DEBUG, data, tag);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left debug AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left data AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#... | static debug(data: Any, tag?: string) {
Logger.log(LogLevel.DEBUG, data, tag);
} | https://github.com/codelably/HCompass | febdd0efdffb94d040f015bd622730cc4ac763f6 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets | arkts | equals | Checks for equality this instance with provided object, treated as a DoubleType
@param {Type} other type to be checked against
@returns {boolean} true if object also has NullType
@throws {Error} - Input parameter error.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public override equals(other: Type): boolean {
return other instanceof NullType
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left equals AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left other AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#... | public override equals(other: Type): boolean {
return other instanceof NullType
} | https://gitcode.com/iop123123/arkts-static-skills | b2e87d8cc6dfb8492619248739bf94574682a534 | gitcode |
chendi126/harmonyOS-TCP | entry/src/main/ets/common/SafeAreaUtils.ets | arkts | getNavigationBarHeight | 获取导航栏高度 | public static getNavigationBarHeight(): number {
return navigationBarHeight;
} | 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 getNavigationBarHeight AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Ri... | public static getNavigationBarHeight(): number {
return navigationBarHeight;
} | https://github.com/chendi126/harmonyOS-TCP | 75a6237f247e437b78716e442e240804a4e3a213 | github |
Blue1-0/wanandroid_harmonyos | entry/src/main/ets/core/DataManager.ets | arkts | fetchProjectTypeLst | 根据项目分类拉取列表 | fetchProjectTypeLst(cid: string, page: number): ChainableRequest<ProjectListEntity> {
const url = WanAndroidApi.projectList.replace('{page}', page.toString()) + "?cid=" + cid
return AxiosUtils.get<ProjectListEntity>(url)
} | AST#program#Left AST#ERROR#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fetchProjectTypeLst AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left cid AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST... | fetchProjectTypeLst(cid: string, page: number): ChainableRequest<ProjectListEntity> {
const url = WanAndroidApi.projectList.replace('{page}', page.toString()) + "?cid=" + cid
return AxiosUtils.get<ProjectListEntity>(url)
} | https://github.com/Blue1-0/wanandroid_harmonyos/blob/bb01bf64e40a14c6304363a3290077ea7baaed81/entry/src/main/ets/core/DataManager.ets#L42-L45 | e419fc47be1cf47cdec42bc88a02296327773800 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/AsyncRWLock.ets | arkts | PrepareReadLock | Computes the new state when a reader attempts to acquire the lock.
Increments the reader count and, if there is no writer lock, sets READ_LOCKED.
@param { long } state Current lock state
@returns { long } Updated state with reader count and lock state encoded
@throws { RangeError } If the reader count would overflow th... | public static PrepareReadLock(state: long): long {
return State.IncReaders(state) | (State.HasWriteLock(state) ? 0 : State.READ_LOCKED);
} | 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 PrepareReadLock AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left state AST#identifier#Right AST#ERROR#Left AST#:#Left :... | public static PrepareReadLock(state: long): long {
return State.IncReaders(state) | (State.HasWriteLock(state) ? 0 : State.READ_LOCKED);
} | https://gitcode.com/iop123123/arkts-static-skills | eae7590d92071230239df452beec8056e9321be4 | gitcode |
arkui-x/samples | CodeLab/Cases/feature/gridexchange/src/main/ets/view/GridExchange.ets | arkts | changeIndex | 交换应用位置函数
@param itemIndex 目标网格元素的index
@param insertIndex 被切换网格元素的index | changeIndex(itemIndex: number, insertIndex: number): void {
this.appInfoList.splice(insertIndex, 0, this.appInfoList.splice(itemIndex, 1)[0]);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left changeIndex AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left itemIndex AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , AST#,#... | changeIndex(itemIndex: number, insertIndex: number): void {
this.appInfoList.splice(insertIndex, 0, this.appInfoList.splice(itemIndex, 1)[0]);
} | https://gitcode.com/arkui-x/samples | 9965e064f32ac6efffc82adc57c5d3eaca35b15e | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/DialogAnimationState.ets | arkts | reset | 重置到初始隐藏状态(无动画) | reset(): void {
this.opacity = 0;
this.scale = this.initialScale;
this.translateY = this.initialTranslateY;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left reset AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left A... | reset(): void {
this.opacity = 0;
this.scale = this.initialScale;
this.translateY = this.initialTranslateY;
} | https://github.com/DaLongZhuaZi/manxia | af30f357523b58a55e4caca440bc48d1be42bbab | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/ar/PathPlanner.ets | arkts | getSystemStatus | 获取系统状态信息 | public getSystemStatus(): SystemStatusInfo {
return {
isInitialized: this.isInitialized,
graphSize: this.graph.size,
cacheSize: this.pathCache.size,
historySize: this.navigationHistory.length,
poiCount: this.buildingData?.pois.length ?? 0,
floorCount: this.buildingData?.floors.... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getSystemStatus 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 System... | public getSystemStatus(): SystemStatusInfo {
return {
isInitialized: this.isInitialized,
graphSize: this.graph.size,
cacheSize: this.pathCache.size,
historySize: this.navigationHistory.length,
poiCount: this.buildingData?.pois.length ?? 0,
floorCount: this.buildingData?.floors.... | https://github.com/LJ666-ui/harmony-health-care | 7fb93d2a6951b291232cea0becccf257163afb6f | github |
CLMC2025/Vignette | entry/src/main/ets/manager/UserStateManager.ets | arkts | isCommonWord | 判断是否为常见词 | private isCommonWord(word: string): boolean {
// 常见词汇(CET4级别)
const commonWords = ['important', 'necessary', 'available', 'different', 'similar'];
return commonWords.includes(word) || word.length <= 8;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left isCommonWord AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left word AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ... | private isCommonWord(word: string): boolean {
// 常见词汇(CET4级别)
const commonWords = ['important', 'necessary', 'available', 'different', 'similar'];
return commonWords.includes(word) || word.length <= 8;
} | https://github.com/CLMC2025/Vignette | e74e0510e31fc30c07f6a9242a546ec1a631d72f | github |
fangmingtao/Ohs_ArkTs_Eyepetizer | entry/src/main/ets/common/DateUtil.ets | arkts | formatTimestamp | 将时间戳(毫秒)格式化为日期时间字符串
默认格式:yyyy/MM/dd HH:mm
@param milliseconds 13 位毫秒时间戳
@returns 如:2024/12/20 14:30:45 | static formatTimestamp(milliseconds: number): string {
if (milliseconds <= 0) {
return '';
}
const date: Date = new Date(milliseconds);
const year: number = date.getFullYear();
const month: number = date.getMonth() + 1; // 0-11 → 1-12
const day: number = date.getDate();
const hours: ... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left formatTimestamp AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left milliseconds AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#n... | static formatTimestamp(milliseconds: number): string {
if (milliseconds <= 0) {
return '';
}
const date: Date = new Date(milliseconds);
const year: number = date.getFullYear();
const month: number = date.getMonth() + 1; // 0-11 → 1-12
const day: number = date.getDate();
const hours: ... | https://gitcode.com/fangmingtao/Ohs_ArkTs_Eyepetizer | da6823d5ce76a21abdae61013604e113e5ca72c0 | gitcode |
dingzhilin1990/zhilinclaw | src/security/OAuthGateway.ets | arkts | handleCallback | 处理回调(交换授权码获取令牌)
@param providerId 提供商 ID
@param code 授权码
@param state 状态参数 | public async handleCallback(
providerId: string,
code: string,
state: string
): Promise<boolean> {
const provider = this.providers.get(providerId);
if (!provider) {
console.error(`[OAuthGateway] 提供商不存在:${providerId}`);
return false;
}
try {
// 从保险柜获取客户端密钥
const c... | 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 handleCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left providerId AST#identifier#Right AST#ERROR#Left AST#:#Lef... | public async handleCallback(
providerId: string,
code: string,
state: string
): Promise<boolean> {
const provider = this.providers.get(providerId);
if (!provider) {
console.error(`[OAuthGateway] 提供商不存在:${providerId}`);
return false;
}
try {
// 从保险柜获取客户端密钥
const c... | https://github.com/dingzhilin1990/zhilinclaw | 991e3648956cf3894c189615248378ee0b1acab2 | github |
Cool_foolisher1/ArkTSRepository | GraphicalCode/products/phone/src/main/ets/viewmodel/HomeViewModel.ets | arkts | sendEvent | 发送事件
@param eventType HomeEventTypeEnum | public sendEvent(eventType: HomeEventTypeEnum): void {
if (eventType === HomeEventTypeEnum.JUMP_TO_HOME_VIEW) {
this.jumpToHomeView()
} else if (eventType === HomeEventTypeEnum.PRELOAD_RESOURCES) {
this.preloadResources()
} else if (eventType === HomeEventTypeEnum.CHECK_FIRST_START) {
th... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left sendEvent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left eventType AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left H... | public sendEvent(eventType: HomeEventTypeEnum): void {
if (eventType === HomeEventTypeEnum.JUMP_TO_HOME_VIEW) {
this.jumpToHomeView()
} else if (eventType === HomeEventTypeEnum.PRELOAD_RESOURCES) {
this.preloadResources()
} else if (eventType === HomeEventTypeEnum.CHECK_FIRST_START) {
th... | https://gitcode.com/Cool_foolisher1/ArkTSRepository | ebc32625bcfe1c824e85508d1b7158000a88aaba | gitcode |
codelably/tuniao-ui | packages/main/src/main/ets/viewmodel/TnThemeViewModel.ets | arkts | applyCustomColor | 应用自定义颜色作为 primary 主色
@param hex 十六进制颜色字符串,如 "#FF6B6B" | applyCustomColor(hex: string): void {
const cleaned = hex.startsWith("#") ? hex : `#${hex}`;
if (cleaned.length !== 7) {
return;
}
this.customColor = cleaned;
this.isCustomTheme = true;
TnUISetUIBaseStyle({
primary: new CustomColorWrapper(cleaned),
success: new ResourceColorW... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left applyCustomColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left hex AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left )... | applyCustomColor(hex: string): void {
const cleaned = hex.startsWith("#") ? hex : `#${hex}`;
if (cleaned.length !== 7) {
return;
}
this.customColor = cleaned;
this.isCustomTheme = true;
TnUISetUIBaseStyle({
primary: new CustomColorWrapper(cleaned),
success: new ResourceColorW... | https://github.com/codelably/tuniao-ui | fa26bcff21acb6d41be00e08089a92b269d3dce5 | github |
Cool_foolisher1/ArkTSRepository | GuardianAssistant/entry/src/main/ets/database/privacyRecorderDB.ets | arkts | constructor | 类的构造器,new 的时候会自动触发 | constructor() {
// 创建/打开数据库文件
this.getStoreInstance()
.then(store => {
// 执行 sql 语句,用于创建数据库的表
store.executeSql(this.sqlCreate)
})
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left A... | constructor() {
// 创建/打开数据库文件
this.getStoreInstance()
.then(store => {
// 执行 sql 语句,用于创建数据库的表
store.executeSql(this.sqlCreate)
})
} | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 55a0310a94649c26ed92276def2769ae18f17a1b | gitcode |
Cool_foolisher1/ArkTSRepository | GuardianAssistant/entry/src/main/ets/database/PrivacyNoteDB.ets | arkts | delete | 删除
@param ids
@returns 影响的行数 | async delete(ids: number[]) {
const store = await this.getStoreInstance()
const predicates = new relationalStore.RdbPredicates(this.tableName)
predicates.in('id', ids)
// 删除完成,返回受影响的行数
return store.delete(predicates)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left delete AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left ids AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Rig... | async delete(ids: number[]) {
const store = await this.getStoreInstance()
const predicates = new relationalStore.RdbPredicates(this.tableName)
predicates.in('id', ids)
// 删除完成,返回受影响的行数
return store.delete(predicates)
} | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 24e730173529dae83ffe874c4d3e04c5ce0b3709 | gitcode |
arkui-x/samples | CodeLab/Cases/feature/bottompanelslide/src/main/ets/model/DataSource.ets | arkts | getData | 获取指定索引数据
@param {number} index - 索引值
@returns {PanelDataType} 返回指定索引数据 | public getData(index: number): PanelDataType {
return this.dataArray[index];
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number ... | public getData(index: number): PanelDataType {
return this.dataArray[index];
} | https://gitcode.com/arkui-x/samples | 2f9cccca322b4fc1bffe983ece95a5c9875e93c3 | gitcode |
openharmony-sig/applications_clock | common/src/main/ets/manager/DatabaseManager.ets | arkts | getRdbStore | 获取关系数据库存储对象
如果已初始化过,则直接返回之前获取的对象
如果没有初始化过,则使用接口获取对象,并执行数据库建表命令,如果表未创建,则会创建一张新的表
@param createTableSql 创建新表使用的 SQL
@return 关系数据库存储对象 | async getRdbStore(createTableSql: string): Promise<dataRdb.RdbStore> {
if (this.rdbStore) {
return this.rdbStore;
}
try {
this.rdbStore = await dataRdb.getRdbStore(GlobalContext.getContext()
.getObject('clockContext') as Context, STORE_CONFIG);
let noNewColumn = await this.hasNo... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getRdbStore AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left createTableSql AST#identifier#Rig... | async getRdbStore(createTableSql: string): Promise<dataRdb.RdbStore> {
if (this.rdbStore) {
return this.rdbStore;
}
try {
this.rdbStore = await dataRdb.getRdbStore(GlobalContext.getContext()
.getObject('clockContext') as Context, STORE_CONFIG);
let noNewColumn = await this.hasNo... | https://gitee.com/openharmony-sig/applications_clock.git | c2c6d62d4a40204863996ecc923181cc603c27e7 | gitee |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.util.Stack.ets | arkts | pop | Removes and returns the first element in the Stack.
@returns The first element in the Stack, or undefined if the Stack is empty. | public pop(): T | undefined {
this.checkEmptyContainer();
return this.buffer.pop();
} | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left pop AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call... | public pop(): T | undefined {
this.checkEmptyContainer();
return this.buffer.pop();
} | https://gitcode.com/iop123123/arkts-static-skills | 82b56d2801cd48b921bdc42978895a09069b7b81 | gitcode |
qiuhaotc/HarmonyOSPlayground | entry/src/main/ets/pages/BillListPage.ets | arkts | calculateStatistics | 计算统计数据 | calculateStatistics() {
const stats = BillStatisticsUtil.calculateStatistics(this.bills);
this.totalIncome = stats.totalIncome;
this.totalExpense = stats.totalExpense;
this.balance = stats.balance;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left calculateStatistics 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_bloc... | calculateStatistics() {
const stats = BillStatisticsUtil.calculateStatistics(this.bills);
this.totalIncome = stats.totalIncome;
this.totalExpense = stats.totalExpense;
this.balance = stats.balance;
} | https://github.com/qiuhaotc/HarmonyOSPlayground | 6f733ed2ba8faec64fbbf0c8381ac0c21b0fabb4 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/WebViewImageLoader.ets | arkts | build | 构建请求信息 | build(): ImageRequestInfo {
return {
url: this.url,
chapterId: this.chapterId,
pageIndex: this.pageIndex,
headers: this.headers,
timeout: this.timeout,
retryCount: this.retryCount,
createTime: Date.now()
};
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#identifier#Left ImageRequestInfo AST#identifier#Right AST#ERROR#Right AS... | build(): ImageRequestInfo {
return {
url: this.url,
chapterId: this.chapterId,
pageIndex: this.pageIndex,
headers: this.headers,
timeout: this.timeout,
retryCount: this.retryCount,
createTime: Date.now()
};
} | https://github.com/DaLongZhuaZi/manxia | 0ef24c65c3e9069e60c82da0bdb315b92a0fc6d6 | github |
robotzzh/AgricultureApp | entry/src/main/ets/models/StringUtils.ets | arkts | arrayBuffer2String | ArrayBuffer 转 String
@param input
@returns | arrayBuffer2String(input: ArrayBuffer) {
return this.uint8Array2String(new Uint8Array(input))
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left arrayBuffer2String AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left input AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left ArrayBuffer AST#ident... | arrayBuffer2String(input: ArrayBuffer) {
return this.uint8Array2String(new Uint8Array(input))
} | https://github.com/robotzzh/AgricultureApp | e6a4fa24dd0ceb54b57baf428d7b982e3f62773a | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/components/YAxis.ets | arkts | setPosition | sets the position of the y-labels
@param pos | public setPosition(pos: YAxisLabelPosition): void {
this.mPosition = pos;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setPosition AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left pos AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left YAxis... | public setPosition(pos: YAxisLabelPosition): void {
this.mPosition = pos;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | d697eff15eaf80273f566cc1506ea5dacfc534cf | gitee |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/renderer/XAxisRenderer.ets | arkts | drawGridLine | Draws the grid line at the specified position using the provided path.
@param c
@param x
@param y
@param gridLinePath | protected drawGridLine(c: CanvasRenderingContext2D, x: number, y: number): void {
Utils.resetContext2DWithoutFont(c, this.mGridPaint);
c.beginPath();
c.moveTo(x, (this.mViewPortHandler ? this.mViewPortHandler.contentBottom() : 0));
c.lineTo(x, (this.mViewPortHandler ? this.mViewPortHandler.contentTop(... | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left drawGridLine AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left c AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | protected drawGridLine(c: CanvasRenderingContext2D, x: number, y: number): void {
Utils.resetContext2DWithoutFont(c, this.mGridPaint);
c.beginPath();
c.moveTo(x, (this.mViewPortHandler ? this.mViewPortHandler.contentBottom() : 0));
c.lineTo(x, (this.mViewPortHandler ? this.mViewPortHandler.contentTop(... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 8b5d520c953a90d71bb5f08048a4c7cb06bc8630 | gitee |
CLMC2025/Vignette | entry/src/main/ets/manager/ReviewTimeManager.ets | arkts | getSessionStats | 获取当前会话统计 | getSessionStats(): ReviewTimeStats {
// 更新当前会话时长
this.sessionStats.currentSessionDuration = Date.now() - this.sessionStats.currentSessionStartTime;
const stats: ReviewTimeStats = {
totalWordsReviewed: this.sessionStats.totalWordsReviewed,
totalTimeSpent: this.sessionStats.totalTimeSpent,
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getSessionStats 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 ReviewTimeStats AST#identifier#Right AST#ERROR... | getSessionStats(): ReviewTimeStats {
// 更新当前会话时长
this.sessionStats.currentSessionDuration = Date.now() - this.sessionStats.currentSessionStartTime;
const stats: ReviewTimeStats = {
totalWordsReviewed: this.sessionStats.totalWordsReviewed,
totalTimeSpent: this.sessionStats.totalTimeSpent,
... | https://github.com/CLMC2025/Vignette | f8c34dd4858aa0b9b20e694111d92c29b4a4556a | github |
ASweetBite/HarmonyPulse | entry/src/main/ets/pages/views/PlaylistView.ets | arkts | aboutToAppear | 3. 生命周期:加载数据库数据 | aboutToAppear() {
this.refreshPlaylists();
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left aboutToAppear AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#;#Left AST#;#Right AST#expression_statement#Right AST#statement_block#Left... | aboutToAppear() {
this.refreshPlaylists();
} | https://github.com/ASweetBite/HarmonyPulse/blob/a7fcf153a20bafa29ac1fb8c25743dd5350dc54c/entry/src/main/ets/pages/views/PlaylistView.ets#L99-L101 | acddef3bd6cd17f461246f970803c167b7f5a6e8 | github |
HarmonyOS_Codelabs/readerkit_codelab_arkts | entry/src/main/ets/utils/BookUtils.ets | arkts | convertSourceTypeToSuffix | Convert the suffix of a book file based on the book type
@param sourceType - {BOOK_FILE_TYPE}
@returns Book File Suffix | public static convertSourceTypeToSuffix(sourceType: number): string {
switch (sourceType) {
case BOOK_FILE_TYPE.TXT:
return EXTENSION_FILE_TXT;
case BOOK_FILE_TYPE.EPUB:
return EXTENSION_FILE_EPUB;
case BOOK_FILE_TYPE.MOBI:
return EXTENSION_FILE_MOBI;
case BOOK_FILE... | 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 convertSourceTypeToSuffix AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sourceType AST#identifier#Right AST#ERROR#Le... | public static convertSourceTypeToSuffix(sourceType: number): string {
switch (sourceType) {
case BOOK_FILE_TYPE.TXT:
return EXTENSION_FILE_TXT;
case BOOK_FILE_TYPE.EPUB:
return EXTENSION_FILE_EPUB;
case BOOK_FILE_TYPE.MOBI:
return EXTENSION_FILE_MOBI;
case BOOK_FILE... | https://gitcode.com/HarmonyOS_Codelabs/readerkit_codelab_arkts | 0c9c5e60d9f2a20f94ec54b964df868a31e2f641 | gitcode |
CPF-ApplicationTPC/openharmony_tpc_samples | SwipeMenuListView/library/src/main/ets/utils/Logger.ets | arkts | getInstance | 获取Logger单例 | public static getInstance(): Logger {
if (!Logger.instance) {
Logger.instance = new Logger();
}
return Logger.instance;
} | 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 getInstance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L... | public static getInstance(): Logger {
if (!Logger.instance) {
Logger.instance = new Logger();
}
return Logger.instance;
} | https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples | 4186bec534afbb91d775fc6527a423fd1ac87f1f | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/concurrency/AsyncRWLock.ets | arkts | executeReadLock | Acquires a read lock. Blocks if a writer holds the lock.
@returns { Promise<void> } A promise that resolves when the read lock is acquired
@syscap SystemCapability.Utils.Lang | public async executeReadLock(): Promise<void> {
let oldState = this.state_.load();
let newState: long = State.PrepareReadLock(oldState);
while (this.state_.compareAndSwap(oldState, newState) != oldState) {
oldState = this.state_.load();
newState = State.PrepareReadLoc... | 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 executeReadLock AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#... | public async executeReadLock(): Promise<void> {
let oldState = this.state_.load();
let newState: long = State.PrepareReadLock(oldState);
while (this.state_.compareAndSwap(oldState, newState) != oldState) {
oldState = this.state_.load();
newState = State.PrepareReadLoc... | https://gitcode.com/iop123123/arkts-static-skills | b69538023b6fc1c637d10fd5e3fe9461a81977f0 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | fill | Fills the Uint8ClampedArray with specified value
@param { number } value - new valuy
@param { int } [start] - start index to begin fill from
@param { int } [end] - last index to end fill from, excluded
@returns { Uint8ClampedArray } - modified Uint8ClampedArray
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public fill(value: number, start?: int, end?: int): Uint8ClampedArray {
this.fill(Uint8ClampedArray.toUint8Clamped(value), start, end)
return this
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left fill AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERR... | public fill(value: number, start?: int, end?: int): Uint8ClampedArray {
this.fill(Uint8ClampedArray.toUint8Clamped(value), start, end)
return this
} | https://gitcode.com/iop123123/arkts-static-skills | 3e2f0467b6be718205b5c602e37011e4ab580194 | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/LineRadarDataSet.ets | arkts | setFillColor | Sets the color that is used for filling the area below the line.
Resets an eventually set "fillDrawable".
@param color | public setFillColor(color: number): void {
this.mFillColor = color;
this.mFillDrawable = null;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setFillColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left color AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left nu... | public setFillColor(color: number): void {
this.mFillColor = color;
this.mFillDrawable = null;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | af1e16a35ce94cf951d00bacf020b83515f33d4e | gitee |
m-harmongos/harmongos-projects | AlarmClock/entry/src/main/ets/viewmodel/DetailViewModel.ets | arkts | setAlarmRemind | 设置闹钟提醒 | public async setAlarmRemind(alarmItem: AlarmItem) {
alarmItem.hour = this.getAlarmTime(1);
alarmItem.minute = this.getAlarmTime(2);
let index = await this.findAlarmWithId(alarmItem.id);
if (index !== -1) {
this.reminderService.deleteReminder(alarmItem.id);
} else {
index = this.alarms.... | 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 setAlarmRemind AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left alarmItem AST#identifier#Right AST#:#Left... | public async setAlarmRemind(alarmItem: AlarmItem) {
alarmItem.hour = this.getAlarmTime(1);
alarmItem.minute = this.getAlarmTime(2);
let index = await this.findAlarmWithId(alarmItem.id);
if (index !== -1) {
this.reminderService.deleteReminder(alarmItem.id);
} else {
index = this.alarms.... | https://github.com/m-harmongos/harmongos-projects | 18d9ace253c7582513ade11b5cb490a768a9c89e | github |
HarmonyOS_Samples/hmosworld | HMOSWorld/Application/commons/aspect/src/main/ets/service/AspectNetFunc.ets | arkts | uploadAspectInfo | Uploading Tracing Point Data. | public uploadAspectInfo(params: AspectInfoParams): Promise<void> {
return new Promise((resolve: () => void, reject: (error: BusinessError) => void) => {
Request.call(AspectTrigger.UPLOAD_ASPECT, params).then(() => {
Logger.info(TAG, 'uploadAspectInfo success');
resolve();
}).catch((err... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left uploadAspectInfo AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left params AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Le... | public uploadAspectInfo(params: AspectInfoParams): Promise<void> {
return new Promise((resolve: () => void, reject: (error: BusinessError) => void) => {
Request.call(AspectTrigger.UPLOAD_ASPECT, params).then(() => {
Logger.info(TAG, 'uploadAspectInfo success');
resolve();
}).catch((err... | https://gitcode.com/HarmonyOS_Samples/hmosworld | 74e3fb408cb8a589efc0fef8a85262d155e08089 | gitcode |
openharmony/codelabs | Data/DeviceHealth/entry/src/main/ets/pages/eventpages/ScreenPage.ets | arkts | updateStatusText | 状态映射函数
将底层的 ScreenEvent 枚举值转换为用户友好的中文描述。
@param event - 原始屏幕事件类型 | updateStatusText(event: ScreenEvent) {
const map: Record<string, string> = {
'SCREEN_ON': '屏幕已点亮',
'SCREEN_OFF': '屏幕已熄灭',
'LOCKED': '设备已锁定',
'UNLOCKED': '设备已解锁'
};
this.currentStatus = map[event] || event;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left updateStatusText 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 ScreenEvent AST#identif... | updateStatusText(event: ScreenEvent) {
const map: Record<string, string> = {
'SCREEN_ON': '屏幕已点亮',
'SCREEN_OFF': '屏幕已熄灭',
'LOCKED': '设备已锁定',
'UNLOCKED': '设备已解锁'
};
this.currentStatus = map[event] || event;
} | https://gitcode.com/openharmony/codelabs | 046b8a255a234ac319d39b29b942f82f642500e5 | gitcode |
webabcd/HarmonyDemo | entry/src/main/ets/pages/background/MyWorkSchedulerExtensionAbility.ets | arkts | onWorkStart | 延迟任务开始时的回调 | onWorkStart(workInfo: workScheduler.WorkInfo) {
MyLog.d(`onWorkStart: ${JSON.stringify(workInfo)}`);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left onWorkStart AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left workInfo AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Lef... | onWorkStart(workInfo: workScheduler.WorkInfo) {
MyLog.d(`onWorkStart: ${JSON.stringify(workInfo)}`);
} | https://github.com/webabcd/HarmonyDemo | ec0d72ae67f30273c6c4b3becf031fc9c1006393 | github |
wanrenhuifu/JLU | harmonyos-鸿蒙实训/tkbrush-app/tkbrush-app/entry/src/main/ets/utils/UserStore.ets | arkts | setUserToken | 设置token | async setUserToken(userData: UserData) {
const store = await this.getUserStore()
store.putSync(this.key, JSON.stringify(userData))
store.flush()
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left setUserToken AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left userData AST#identifier#Right AST#type_annotation#Left AST#:#Left ... | async setUserToken(userData: UserData) {
const store = await this.getUserStore()
store.putSync(this.key, JSON.stringify(userData))
store.flush()
} | https://github.com/wanrenhuifu/JLU | c2f6e120dbd9f4f11d742ef08dd4a42aac654cf9 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/ImageCacheManager.ets | arkts | shouldUsePermanentCache | 判断是否应该使用永久缓存 | private shouldUsePermanentCache(options?: LoadOptions): boolean {
return !!(
options?.sourceId !== undefined &&
options?.mangaId &&
options?.chapterId &&
options?.pageIndex !== undefined
);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left shouldUsePermanentCache AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left options AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Rig... | private shouldUsePermanentCache(options?: LoadOptions): boolean {
return !!(
options?.sourceId !== undefined &&
options?.mangaId &&
options?.chapterId &&
options?.pageIndex !== undefined
);
} | https://github.com/DaLongZhuaZi/manxia | ac3e6d311fb62d75fec303e63cca487cbfd847a1 | github |
dingzhilin1990/zhilinclaw | src/security/CredentialVault.ets | arkts | logAccess | 记录访问日志 | private async logAccess(
id: string,
executor: string,
success: boolean,
reason?: string
): Promise<void> {
await this.securityContext.log({
action: 'access_credential',
executor,
securityLevel: SecurityLevel.CRITICAL,
success,
details: { credentialId: id },
... | 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 logAccess AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left id AST#identifier#Right AST#:#Left : AST#:#... | private async logAccess(
id: string,
executor: string,
success: boolean,
reason?: string
): Promise<void> {
await this.securityContext.log({
action: 'access_credential',
executor,
securityLevel: SecurityLevel.CRITICAL,
success,
details: { credentialId: id },
... | https://github.com/dingzhilin1990/zhilinclaw | 429928d15676e5aa50c6a3260ede15f568c15559 | github |
OSpark-Team/Free-PCM | library/src/main/ets/utils/AudioRendererPlayer.ets | arkts | setOnTimeUpdate | 设置时间更新回调
@param callback - 时间更新回调函数,接收当前播放位置(毫秒)
@remarks
- 默认每 100ms 触发一次
- 可以通过 setTimeUpdateEnabled() 控制启用/禁用
- 播放开始时自动启用,暂停/停止时自动禁用 | public setOnTimeUpdate(callback: (positionMs: number) => void): void {
this.onTimeUpdateCallback = callback;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left setOnTimeUpdate AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST... | public setOnTimeUpdate(callback: (positionMs: number) => void): void {
this.onTimeUpdateCallback = callback;
} | https://github.com/OSpark-Team/Free-PCM/blob/3440e7220d07d28815d172b4b3237145434075ee/library/src/main/ets/utils/AudioRendererPlayer.ets#L344-L346 | b8f73fee4a1c65d856b8c1e00898613a9fab02de | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Float.ets | arkts | toString | toString(f: float): String -- returns a string representation of f by radix 10 | public static toString(f: float): String {
return Float.toString(f, 10);
} | 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 toString AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left f AST#identifier#Right AST#:#Left : AST#:#Righ... | public static toString(f: float): String {
return Float.toString(f, 10);
} | https://gitcode.com/iop123123/arkts-static-skills | a5b89785e7a6ed5abf66cb3b8d72cdd441a9e500 | gitcode |
cpdd5201314/harmonyOS-music-app | products/phone/src/main/ets/pages/SearchHistoryManager.ets | arkts | getPopularKeywords | 获取热门搜索关键词 | static async getPopularKeywords(limit: number = 10): Promise<string[]> {
try {
const records = await SearchHistoryManager.getSearchHistory()
const keywordCount = new Map<string, number>()
// 统计关键词出现频次
for (let i = 0; i < records.length; i++) {
const record = records[i]
con... | 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 getPopularKeywords AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left limit AST#identifier#Right AST#:#Left... | static async getPopularKeywords(limit: number = 10): Promise<string[]> {
try {
const records = await SearchHistoryManager.getSearchHistory()
const keywordCount = new Map<string, number>()
// 统计关键词出现频次
for (let i = 0; i < records.length; i++) {
const record = records[i]
con... | https://github.com/cpdd5201314/harmonyOS-music-app | 9097e9f249d5c83083441abc7f3aedc2ce5e7e2e | github |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.