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 |
|---|---|---|---|---|---|---|---|---|---|---|
ZestBox-18/kitebook-frontend | commons/data_core/src/main/ets/services/CategoryManager.ets | arkts | getCategoriesByType | 查询指定类型的分类列表,按排序号和主键稳定输出。 | static async getCategoriesByType(type: string): Promise<CategoryBean[]> {
const predicates = new relationalStore.RdbPredicates(TABLE_NAME);
predicates.equalTo('type', type);
predicates.orderByAsc('sort_order');
predicates.orderByAsc('id');
return new Promise<CategoryBean[]>((resolve, reject) => {... | 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 getCategoriesByType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left... | static async getCategoriesByType(type: string): Promise<CategoryBean[]> {
const predicates = new relationalStore.RdbPredicates(TABLE_NAME);
predicates.equalTo('type', type);
predicates.orderByAsc('sort_order');
predicates.orderByAsc('id');
return new Promise<CategoryBean[]>((resolve, reject) => {... | https://github.com/ZestBox-18/kitebook-frontend | 115c80926dd31f192e43e94f476331a1e1a08bab | github |
UnbalancedCat/ohos-ssh-core | ssh_lib/src/main/ets/core/SshClient.ets | arkts | getState | Get the current connection state. | getState(): SshState {
return this.state;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getState 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 SshState AST#identifier#Right AST#ERROR#Right AST#sta... | getState(): SshState {
return this.state;
} | https://github.com/UnbalancedCat/ohos-ssh-core | 6568d47f94044b820eed57aa0ef7eb8d432b0613 | github |
2763981847/Clock-Alarm | entry/src/main/ets/common/util/GlobalContext.ets | arkts | getContext | 获取全局上下文实例。
@return 全局上下文实例 | public static getContext(): GlobalContext {
if (!GlobalContext.instance) {
GlobalContext.instance = new GlobalContext();
}
return GlobalContext.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 getContext AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Le... | public static getContext(): GlobalContext {
if (!GlobalContext.instance) {
GlobalContext.instance = new GlobalContext();
}
return GlobalContext.instance;
} | https://github.com/2763981847/Clock-Alarm | 7aa113c34f961d8c683ec7da279d78382ea428bd | github |
openharmony-sig/qr-code-generator | library/src/main/ets/components/MainPage/qrcodegen.ets | arkts | drawFinderPattern | Draws a 9*9 finder pattern including the border separator,
with the center module at (x, y). Modules can be out of bounds. | private drawFinderPattern(x: int, y: int): void {
for (let dy = -4; dy <= 4; dy++) {
for (let dx = -4; dx <= 4; dx++) {
const dist: int = Math.max(Math.abs(dx), Math.abs(dy)); // Chebyshev/infinity norm
const xx: int = x + dx;
const yy: int = y + dy;
if (0 <= xx... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left drawFinderPattern AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left x AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | private drawFinderPattern(x: int, y: int): void {
for (let dy = -4; dy <= 4; dy++) {
for (let dx = -4; dx <= 4; dx++) {
const dist: int = Math.max(Math.abs(dx), Math.abs(dy)); // Chebyshev/infinity norm
const xx: int = x + dx;
const yy: int = y + dy;
if (0 <= xx... | https://gitee.com/openharmony-sig/qr-code-generator.git | 41963b444f0c824a5c4a9fad2c509caf87786807 | gitee |
Amaz1ny/HarmonyDO-public | entry/src/main/ets/models/Notification.ets | arkts | description | 获取通知描述 | get description(): string {
const username: string = this.data.displayUsername !== null
? this.data.displayUsername
: (this.data.originalUsername !== null
? this.data.originalUsername
: (this.data.username !== null ? this.data.username : ''));
if (this.notificationTypeId === Notif... | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left description 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... | get description(): string {
const username: string = this.data.displayUsername !== null
? this.data.displayUsername
: (this.data.originalUsername !== null
? this.data.originalUsername
: (this.data.username !== null ? this.data.username : ''));
if (this.notificationTypeId === Notif... | https://github.com/Amaz1ny/HarmonyDO-public | a0e5de88ebbf1bb7fb7f67bba77099675293eae9 | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/utils/DeviceTypeUtil.ets | arkts | isPhone | 判断是否为手机设备 | public isPhone(): boolean {
return this.currentDeviceType === DeviceType.PHONE;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left isPhone 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#boole... | public isPhone(): boolean {
return this.currentDeviceType === DeviceType.PHONE;
} | https://github.com/LJ666-ui/harmony-health-care | e2b2ea04bc97e7af2dd266d49e93cb71c1963c58 | github |
NissonCX/CQU-HarmonyOS-APP-Dev-Final | entry/src/main/ets/utils/ReminderManager.ets | arkts | sendTestNotification | 发送测试通知 | private async sendTestNotification(reminder: ReminderSettings): Promise<void> {
try {
const notificationRequest: notificationManager.NotificationRequest = {
id: this.getNotificationId(reminder.id),
content: {
notificationContentType: notificationManager.ContentType.NOTIFICATION_CON... | 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 sendTestNotification AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left reminder AST#identifier#Right AS... | private async sendTestNotification(reminder: ReminderSettings): Promise<void> {
try {
const notificationRequest: notificationManager.NotificationRequest = {
id: this.getNotificationId(reminder.id),
content: {
notificationContentType: notificationManager.ContentType.NOTIFICATION_CON... | https://github.com/NissonCX/CQU-HarmonyOS-APP-Dev-Final | f2379bebde7a88d89c5684d6a13e89ffd0caf81e | github |
openharmony/applications_app_samples | code/ArkTS1.2/TabsSample/entry/src/main/ets/pages/functionalScenes/FunctionalScenes.ets | arkts | aboutToReuse | 组件的生命周期回调,在可复用组件从复用缓存中加入到组件树之前调用
@param params:组件更新时所需参数 | aboutToReuse(params: Record<string, SceneModuleInfo>): void {
const listData = params['listData'];
if (listData) {
this.listData = listData as SceneModuleInfo;
}
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left aboutToReuse 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#instantiation_expression#Left AST#identifier#Left Record ... | aboutToReuse(params: Record<string, SceneModuleInfo>): void {
const listData = params['listData'];
if (listData) {
this.listData = listData as SceneModuleInfo;
}
} | https://github.com/openharmony/applications_app_samples | b389c060e9b896c9a0fafd24ffba906ce8005379 | github |
harmonyos/codelabs | HarmonyOS_NEXT/OxHornCampus/entry/src/main/ets/view/ImageAnimate.ets | arkts | getImgCoefficients | Get the image offset coefficients.
@param index
@returns offset coefficients | getImgCoefficients(index: number) {
let coefficient = this.imageId - index;
let tempCoefficient = Math.abs(coefficient);
if (tempCoefficient <= Const.HALF_COUNT) {
return coefficient;
}
let dataLength = this.introductionData.imageList.length;
let tempOffset = dataLength - tempCoefficient... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getImgCoefficients AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier... | getImgCoefficients(index: number) {
let coefficient = this.imageId - index;
let tempCoefficient = Math.abs(coefficient);
if (tempCoefficient <= Const.HALF_COUNT) {
return coefficient;
}
let dataLength = this.introductionData.imageList.length;
let tempOffset = dataLength - tempCoefficient... | https://gitee.com/harmonyos/codelabs.git | 176950b2cabae7d33caac90f6f5a6796284aed29 | gitee |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/TouchInputHandler.ets | arkts | mouseCancelTouch | 取消主手指手势(第二根手指出现时调用) | private mouseCancelTouch(): void {
this.mouseCancelled = true;
this.cancelMouseLongPressTimer();
this.cancelMouseTapDownTimer();
if (this.mouseConfirmedLongPress) {
this.nativeInput.sendMouseButton(BUTTON_ACTION_RELEASE, BUTTON_RIGHT);
} else if (this.mouseConfirmedTap) {
this.nativeI... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left mouseCancelTouch 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#ex... | private mouseCancelTouch(): void {
this.mouseCancelled = true;
this.cancelMouseLongPressTimer();
this.cancelMouseTapDownTimer();
if (this.mouseConfirmedLongPress) {
this.nativeInput.sendMouseButton(BUTTON_ACTION_RELEASE, BUTTON_RIGHT);
} else if (this.mouseConfirmedTap) {
this.nativeI... | https://github.com/AlkaidLab/moonlight-harmony | d0f2576d6bdfbe54f2382f097c4e2b60f8987eaa | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/ar/PathPlanner.ets | arkts | buildGraph | 构建图结构
将医院建筑数据转换为图结构(邻接表) | private async buildGraph(): Promise<void> {
if (!this.buildingData) return;
this.graph.clear();
// 1. 为每个POI创建图节点
for (const poi of this.buildingData.pois) {
const node: GraphNode = {
id: poi.id,
position: poi.position,
floor: poi.floor,
type: WaypointType.ARRIV... | 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 buildGraph AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#... | private async buildGraph(): Promise<void> {
if (!this.buildingData) return;
this.graph.clear();
// 1. 为每个POI创建图节点
for (const poi of this.buildingData.pois) {
const node: GraphNode = {
id: poi.id,
position: poi.position,
floor: poi.floor,
type: WaypointType.ARRIV... | https://github.com/LJ666-ui/harmony-health-care | a645136e873d446c2628326990cd7497d8b7ce4d | github |
encorexin/WordPressCMS | harmonyos/entry/src/main/ets/pages/ArticleEditorPage.ets | arkts | handleGenerate | AI 生成文章 | handleGenerate(): void {
if (this.keywords.length === 0) {
UiFeedback.showToast({ message: '请输入关键词' })
return
}
const aiSettings = this.getEffectiveAiSettings()
if (!aiSettings) {
UiFeedback.showToast({ message: '请先在 AI 设置中创建配置' })
return
}
this.selectedAiSettingsId = ... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left handleGenerate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#{#Left { AST#{#Right AST#meth... | handleGenerate(): void {
if (this.keywords.length === 0) {
UiFeedback.showToast({ message: '请输入关键词' })
return
}
const aiSettings = this.getEffectiveAiSettings()
if (!aiSettings) {
UiFeedback.showToast({ message: '请先在 AI 设置中创建配置' })
return
}
this.selectedAiSettingsId = ... | https://github.com/encorexin/WordPressCMS | c601404090988f4a31289dbe728fec55e2ba2241 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/AnomalyDetectionDAO.ets | arkts | getByUserId | 获取用户的所有异常记录 | static async getByUserId(userId: number): Promise<AnomalyRecord[]> {
let resultSet: relationalStore.ResultSet | null = null;
try {
const store = DatabaseManager.getDatabase();
const predicates = new relationalStore.RdbPredicates(AnomalyRecord.tableName);
predicates.equalTo('user_id', userId)... | 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 getByUserId AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : AST... | static async getByUserId(userId: number): Promise<AnomalyRecord[]> {
let resultSet: relationalStore.ResultSet | null = null;
try {
const store = DatabaseManager.getDatabase();
const predicates = new relationalStore.RdbPredicates(AnomalyRecord.tableName);
predicates.equalTo('user_id', userId)... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 5f6a70c90e50a52a5b651b66ae3de84a1369c759 | github |
openharmony/applications_permission_manager | permissionmanager/src/main/ets/GlobalExtAbility/GlobalDialogModel.ets | arkts | setMicrophoneMute | 设置麦克风全局开关
@param context ServiceExtensionContext | UIAbilityContext
@param flag 全局开关状态
@param isKill 是否销毁ability
return | private setMicrophoneMute(
context: common.ServiceExtensionContext | common.UIAbilityContext, flag: boolean, isKill: boolean
): void {
try {
let audioManager = audio.getAudioManager();
let audioVolumeManager = audioManager.getVolumeManager();
let audioVolumeGroupManager = audioVolumeManage... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left setMicrophoneMute AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#binary_e... | private setMicrophoneMute(
context: common.ServiceExtensionContext | common.UIAbilityContext, flag: boolean, isKill: boolean
): void {
try {
let audioManager = audio.getAudioManager();
let audioVolumeManager = audioManager.getVolumeManager();
let audioVolumeGroupManager = audioVolumeManage... | https://gitee.com/openharmony/applications_permission_manager.git | 51edba0b699a96387135280c9da3a7595c56604b | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | from | Creates an array from an array of the same type.
@param { Uint8ClampedArray } arr - An array to convert to a new array.
@returns { Uint8ClampedArray } - A new Uint8ClampedArray
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static from(arr: Uint8ClampedArray): Uint8ClampedArray {
let result = new Uint8ClampedArray(arr.length)
result.set(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: Uint8ClampedArray): Uint8ClampedArray {
let result = new Uint8ClampedArray(arr.length)
result.set(arr)
return result
} | https://gitcode.com/iop123123/arkts-static-skills | 96803d66807ef1f4251a340cd64f1cde616f7858 | gitcode |
openharmony/applications_app_samples | code/BasicFeature/Media/QRCodeScan/Feature/src/main/ets/qrcodescan/QRCodeParser.ets | arkts | getImageSource | 获取图片的属性
@param context
@param imageSrc | async getImageSource(imageSrc: string): Promise<ImageAttribute> {
Logger.info(`getImageSource start`);
let media = photoAccessHelper.getPhotoAccessHelper(AppStorage.get<common.UIAbilityContext>('context'));
let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicat... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getImageSource AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left imageSrc AST#identifier#Right AST#type_annotation#Left ... | async getImageSource(imageSrc: string): Promise<ImageAttribute> {
Logger.info(`getImageSource start`);
let media = photoAccessHelper.getPhotoAccessHelper(AppStorage.get<common.UIAbilityContext>('context'));
let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicat... | https://github.com/openharmony/applications_app_samples | 69c59c42b371d5cc7de19ab9579346eb9c629cf9 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/TypeGuards.ets | arkts | isValidDownloadStatus | 检查值是否为有效的下载状态
@param value - 要检查的值
@returns 是否为有效下载状态 | static isValidDownloadStatus(value: Object): boolean {
if (!TypeGuards.isString(value)) {
return false;
}
const strValue = value as string;
// 使用显式枚举值检查替代Object.values
return strValue === DownloadStatus.PENDING ||
strValue === DownloadStatus.DOWNLOADING ||
strValue ==... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isValidDownloadStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie... | static isValidDownloadStatus(value: Object): boolean {
if (!TypeGuards.isString(value)) {
return false;
}
const strValue = value as string;
// 使用显式枚举值检查替代Object.values
return strValue === DownloadStatus.PENDING ||
strValue === DownloadStatus.DOWNLOADING ||
strValue ==... | https://github.com/DaLongZhuaZi/manxia | 352ac28cd8f4f7e5d54a8a202feecf14e9d792d0 | github |
openharmony/arkui_advanced_ui_component | atomicserviceweb/source/atomicserviceweb.ets | arkts | addEventProcessor | 添加处理者 | private static addEventProcessor(): number {
let processor: hiAppEvent.Processor = {
name: 'ha_app_event',
appId: 'com_huawei_hmos_sdk_ocg',
routeInfo: 'AUTO',
eventConfigs: [
{
domain: 'api_diagnostic',
name: 'api_exec_end',
isRealTime: false
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left addEventProcessor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Righ... | private static addEventProcessor(): number {
let processor: hiAppEvent.Processor = {
name: 'ha_app_event',
appId: 'com_huawei_hmos_sdk_ocg',
routeInfo: 'AUTO',
eventConfigs: [
{
domain: 'api_diagnostic',
name: 'api_exec_end',
isRealTime: false
... | https://gitee.com/openharmony/arkui_advanced_ui_component.git | 7030f7015648b8d4eeefe6215cc9a9cef028a998 | gitee |
HarmonyCandies/image_cropper | image_cropper/src/main/ets/common/ImageCropperLayerPainter.ets | arkts | paintMask | / Draw the mask over the crop area | protected paintMask(config: ImageCropperLayerPainterConfig): void {
const cropRect = config.cropRect;
const maskColor = config.maskColor;
const canvas = config.canvas;
const rect = config.layoutRect;
canvas.save();
canvas.fillStyle = maskColor;
canvas.beginPath();
canvas.moveTo(rect.le... | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left paintMask AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left config AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#... | protected paintMask(config: ImageCropperLayerPainterConfig): void {
const cropRect = config.cropRect;
const maskColor = config.maskColor;
const canvas = config.canvas;
const rect = config.layoutRect;
canvas.save();
canvas.fillStyle = maskColor;
canvas.beginPath();
canvas.moveTo(rect.le... | https://github.com/HarmonyCandies/image_cropper/blob/dd3664946b413166307b736a5763f998084364e1/image_cropper/src/main/ets/common/ImageCropperLayerPainter.ets#L79-L97 | 286b01cc0b4df43718e90fd87388b1ddab63ad7c | github |
Countly/countly-sdk-hos | library/src/main/ets/CountlyInstance.ets | arkts | halt | Halt the instance AND wipe every persisted SDK key from storage,
device ID, request queue, server-config cache, health-check counters,
user-profile cache, remote-config cache, etc. This matches Android's
`Countly.halt()` behavior (which clears `countlyStore`).
After `halt()`, a fresh `Countly.initShared(cfg)` starts fr... | public async halt(): Promise<void> {
await this.stop();
if (this.config.storage) {
const ok: boolean = await this.config.storage.clear();
if (!ok) {
this.config.logger.w('halt, storage.clear() returned false, persisted data may not be fully wiped');
} else {
this.config.logge... | 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 halt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AS... | public async halt(): Promise<void> {
await this.stop();
if (this.config.storage) {
const ok: boolean = await this.config.storage.clear();
if (!ok) {
this.config.logger.w('halt, storage.clear() returned false, persisted data may not be fully wiped');
} else {
this.config.logge... | https://github.com/Countly/countly-sdk-hos | 07aa28cb8c10829d8d0c3ca44335c281b7bb02dc | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Parsers/EpubParser.ets | arkts | extractMetadata | 提取元数据 | async extractMetadata(filePath: string): Promise<EBookMetadata> {
const fileName = filePath.substring(filePath.lastIndexOf('/') + 1);
const title = fileName.substring(0, fileName.lastIndexOf('.')) || '未命名EPUB书籍';
return {
title: title,
author: '未知作者',
publisher: '',
publishDate: '... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left extractMetadata AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left filePath AST#identifier#Right AST#type_annotation#Left AST#:#Le... | async extractMetadata(filePath: string): Promise<EBookMetadata> {
const fileName = filePath.substring(filePath.lastIndexOf('/') + 1);
const title = fileName.substring(0, fileName.lastIndexOf('.')) || '未命名EPUB书籍';
return {
title: title,
author: '未知作者',
publisher: '',
publishDate: '... | https://github.com/DaLongZhuaZi/manxia | 222060d512b0cc8ff84a75221e7c899e4339152a | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Box.ets | arkts | box | Creates a new Box instance with the specified initial value.
@param { TT } value - The initial value to be wrapped
@returns {Box<TT>} A new Box instance containing the specified value
@static
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public static box<TT>(value: TT): Box<TT> {
return new Box<TT>(value);
} | AST#program#Left AST#ERROR#Left AST#binary_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left static AST#identifier#Right AST#identifier#Left box AST#identifier#Right AST#ERROR#Right AST#<#Left < AST#<#Right AST#identifier#Left TT AST#identifier#Right AST#binary_expressio... | public static box<TT>(value: TT): Box<TT> {
return new Box<TT>(value);
} | https://gitcode.com/iop123123/arkts-static-skills | e4b880435b795c748a206d789f0a71e1d760ef82 | gitcode |
pangpang20/antennaPodHM | entry/src/main/ets/service/DatabaseService.ets | arkts | addToQueue | 添加到待听队列 | async addToQueue(episodeId: string): Promise<void> {
if (!this.rdbStore) return;
try {
// 检查是否已在队列中
const checkPredicates = new relationalStore.RdbPredicates(Constants.TABLE_QUEUE);
checkPredicates.equalTo('episodeId', episodeId);
const existResult = await this.rdbStore.query(checkPre... | AST#program#Left AST#expression_statement#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left addToQueue AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left episode... | async addToQueue(episodeId: string): Promise<void> {
if (!this.rdbStore) return;
try {
// 检查是否已在队列中
const checkPredicates = new relationalStore.RdbPredicates(Constants.TABLE_QUEUE);
checkPredicates.equalTo('episodeId', episodeId);
const existResult = await this.rdbStore.query(checkPre... | https://github.com/pangpang20/antennaPodHM | f0ee8d26eee96761455f6fc764e843b1feb8a4e0 | github |
offlinecat-dev/OCNetORM | src/main/ets/repository/Repository.ets | arkts | findAllAsync | 异步查询所有实体(使用 TaskPool 优化大数据量场景)
当数据量超过阈值时,使用 TaskPool 在后台线程执行数据转换
如果实体启用了软删除,默认只查询未删除的数据
查询成功后对每条记录执行 afterLoad 钩子
@param includeDeleted 是否包含已删除的数据,默认 false
@returns Promise<Array<EntityData>>
Requirements: 1.3 | async findAllAsync(includeDeleted: boolean = false): Promise<Array<EntityData>> {
const startTime = Date.now()
return await this.withSessionStore(async (repo) => {
try {
// 创建查询构建器
const queryBuilder = repo.createQueryBuilder()
// 处理软删除
if (includeDeleted) {
qu... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left findAllAsync AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left includeDeleted AST#identifier#Right AST#type_annotation#Left AST#:... | async findAllAsync(includeDeleted: boolean = false): Promise<Array<EntityData>> {
const startTime = Date.now()
return await this.withSessionStore(async (repo) => {
try {
// 创建查询构建器
const queryBuilder = repo.createQueryBuilder()
// 处理软删除
if (includeDeleted) {
qu... | https://github.com/offlinecat-dev/OCNetORM | 6c8bb14d18382be0e440505a834de2bbbc33e5a5 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Data/DataManager.ets | arkts | generateId | ==================== 工具方法 ====================
生成唯一ID - 使用UUID生成器 | private generateId(): string {
return generateDbId('id');
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left generateId 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#s... | private generateId(): string {
return generateDbId('id');
} | https://github.com/DaLongZhuaZi/manxia | 348814fd1165b091b995c34cdb20de0aa83372a9 | github |
iop123123/arkts-static-skills | cli/arkts-static-cli/runtime/ark/es2panda/linux/etc/sdk/api/@ohos.uri.ets | arkts | query | Sets the query portion of the URI
@param { string } input | set query(input: string) {
this.uriEntry.setQuery(encodeURIComponent(input));
} | AST#program#Left AST#ERROR#Left AST#set#Left set AST#set#Right AST#call_expression#Left AST#identifier#Left query 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 string AST#identif... | set query(input: string) {
this.uriEntry.setQuery(encodeURIComponent(input));
} | https://gitcode.com/iop123123/arkts-static-skills | 86d6aefb658c24b89d7cc4f5c6efb3c9ad05729a | gitcode |
HarmonyOS_Samples/push-kit-sample-code-client-atomic-arkts | entry/src/main/ets/utils/Logger.ets | arkts | debug | Outputs debug-level logs
@param format format Indicates the log format string
@param args args Indicates the log parameters | debug(format: string, ...args: Object[]): void {
hilog.debug(this.domain, this.prefix, format, args);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left debug AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left format AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#R... | debug(format: string, ...args: Object[]): void {
hilog.debug(this.domain, this.prefix, format, args);
} | https://gitcode.com/HarmonyOS_Samples/push-kit-sample-code-client-atomic-arkts | a057b704a40a84bc5213f114bc5355ebaff21a80 | gitcode |
YDYm233/EasyRandom_HarmonyNextApp | common/VitalUI/src/main/ets/components/ColorPickerComponent/ColorPickerDialog.ets | arkts | hslToRgbComponents | ═══════════════════════════════════════════════════════════════════════
颜色转换工具函数
═══════════════════════════════════════════════════════════════════════
HSL → RGB 整数分量(0-255),不含 Alpha。
供 hslToHex / hslToRgbaString 共用,避免重复实现。 | function hslToRgbComponents(h: number, s: number, l: number): RgbComponents {
s /= 100
l /= 100
const chroma = s * Math.min(l, 1 - l)
const hueNorm = h / 30
const compute = (n: number): number => {
const k = (n + hueNorm) % 12
return Math.round((l - chroma * Math.max(Math.min(k - 3, 9 - k, 1), -1)) * ... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left hslToRgbComponents AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left h AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#... | function hslToRgbComponents(h: number, s: number, l: number): RgbComponents {
s /= 100
l /= 100
const chroma = s * Math.min(l, 1 - l)
const hueNorm = h / 30
const compute = (n: number): number => {
const k = (n + hueNorm) % 12
return Math.round((l - chroma * Math.max(Math.min(k - 3, 9 - k, 1), -1)) * ... | https://github.com/YDYm233/EasyRandom_HarmonyNextApp | 9f03f78508bd196971c180b71d65a03d0beb7af0 | github |
Cool_foolisher1/ArkTSRepository | GuardianAssistant/entry/src/main/ets/pages/Privacy/Auth/AuthPatternLockPage.ets | arkts | clearErrorMessage | 清空错误信息 | clearErrorMessage() {
// 清空错误提示语
this.errorMessage = ''
// 标记为正确
this.patternLockController.setChallengeResult(PatternLockChallengeResult.CORRECT)
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left clearErrorMessage 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#... | clearErrorMessage() {
// 清空错误提示语
this.errorMessage = ''
// 标记为正确
this.patternLockController.setChallengeResult(PatternLockChallengeResult.CORRECT)
} | https://gitcode.com/Cool_foolisher1/ArkTSRepository | 2b201f34ff4b7f456d5d76c0ac314d9f24d0027b | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Components/GroupManagementDialog.ets | arkts | getFilteredGroups | 获取筛选后的分组列表 | getFilteredGroups(): GroupInfo[] {
if (!this.searchKeyword) {
return this.groups;
}
return this.groups.filter(g => g.name.includes(this.searchKeyword));
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getFilteredGroups AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left GroupInfo AST#identifier#Righ... | getFilteredGroups(): GroupInfo[] {
if (!this.searchKeyword) {
return this.groups;
}
return this.groups.filter(g => g.name.includes(this.searchKeyword));
} | https://github.com/DaLongZhuaZi/manxia | 1ce05aa94e6933de46d35863085d97ff1b34c333 | github |
OHPG/FinMusic | entry/src/main/ets/data/Repository.ets | arkts | getMostAudio | 查询最多播放音频
@returns | public async getMostAudio(): Promise<Array<BaseItemDto>> {
return this.requireApi().getMostAudio(this.currentLibrary?.Id)
} | 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 getMostAudio AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#L... | public async getMostAudio(): Promise<Array<BaseItemDto>> {
return this.requireApi().getMostAudio(this.currentLibrary?.Id)
} | https://github.com/OHPG/FinMusic | d802ef57ad463532f46ee75f7974a37b2570b7f9 | github |
aimilin6688/KeePassHO | entry/src/main/ets/common/utils/FilenameUtils.ets | arkts | getFileName | 获取文件名
@param filePath 文件路径 | public static getFileName(filePath: string): string {
if (!filePath) {
return "";
}
const fileNameMatch = filePath.match(/[^/]+$/);
return fileNameMatch ? decodeURIComponent(fileNameMatch[0]) : '';
} | 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 getFileName AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath AST#identifier#Right AST#ERROR#Left AST#:#Left : ... | public static getFileName(filePath: string): string {
if (!filePath) {
return "";
}
const fileNameMatch = filePath.match(/[^/]+$/);
return fileNameMatch ? decodeURIComponent(fileNameMatch[0]) : '';
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/FilenameUtils.ets#L16-L22 | edf07d9fc5eb84d9cc4ba467a7ac37520abf3bcd | github |
751496032/DSBridge-HarmonyOS | library/src/main/ets/core/WebViewControllerProxy.ets | arkts | callJsNoParam | 调用JS方法,无参数
@param method
@param jsReturnValueHandler | callJsNoParam(method: string, jsReturnValueHandler?: OnReturnValue): void {
this.bridge.callJsNoParam(method, jsReturnValueHandler)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left callJsNoParam AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left method AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left ,... | callJsNoParam(method: string, jsReturnValueHandler?: OnReturnValue): void {
this.bridge.callJsNoParam(method, jsReturnValueHandler)
} | https://github.com/751496032/DSBridge-HarmonyOS/blob/6e69923a816e400710e23c8bab549fe790545bc6/library/src/main/ets/core/WebViewControllerProxy.ets#L91-L93 | 25ffd33cb47c84fff36e52a430bb0bb131ae8978 | github |
m-harmongos/harmongos-projects | AlarmClock/entry/src/main/ets/view/Detail/dialog/RenameDialog.ets | arkts | build | = new CustomDialogController({
builder: RenameDialog(),
autoCancel: true,
}); | build() {
Flex() {
CommonDialog({
title: '闹钟名',
controller: this.controller,
onConfirm: () => {
this.alarmItem.name = this.name;
}
}) {
TextArea({ text: this.alarmItem.name })
.width('100%')
.margin({ bottom: 20 })
.onChan... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#object#Left AST#{#Left { AST#{#Right AST#method_def... | build() {
Flex() {
CommonDialog({
title: '闹钟名',
controller: this.controller,
onConfirm: () => {
this.alarmItem.name = this.name;
}
}) {
TextArea({ text: this.alarmItem.name })
.width('100%')
.margin({ bottom: 20 })
.onChan... | https://github.com/m-harmongos/harmongos-projects | aa4f1576d352a3459c4abd702111d17d4dce7ae5 | github |
honjow/Next2V | shared/src/main/ets/network/ApiService.ets | arkts | getMember | Get user info | async getMember(username: string): Promise<V2exMemberProfile> {
const clean = (username || '').trim()
if (!clean) {
throw ApiErrors.invalidUsername()
}
try {
const html = await this.http.getText(`/member/${encodeURIComponent(clean)}`)
return ApiService.memberProfileFromHtml(clean, ht... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getMember AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left username AST#identifier#Right AST#type_annotation#Left AST#:#Left : A... | async getMember(username: string): Promise<V2exMemberProfile> {
const clean = (username || '').trim()
if (!clean) {
throw ApiErrors.invalidUsername()
}
try {
const html = await this.http.getText(`/member/${encodeURIComponent(clean)}`)
return ApiService.memberProfileFromHtml(clean, ht... | https://github.com/honjow/Next2V | e2face9c271b928094117a3a094d7ebb3e226a9f | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/SmartCategoryDAO.ets | arkts | getByType | 根据训练类型查询 | static async getByType(
userId: number,
trainingType: 'manual' | 'auto' | 'correction',
limit: number = 50
): Promise<SmartCategoryTraining[]> {
try {
const store = DatabaseManager.getDatabase();
const sql = `
SELECT *
FROM ${SmartCategoryTraining.tableName}
WHERE... | 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 getByType AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : AST#:... | static async getByType(
userId: number,
trainingType: 'manual' | 'auto' | 'correction',
limit: number = 50
): Promise<SmartCategoryTraining[]> {
try {
const store = DatabaseManager.getDatabase();
const sql = `
SELECT *
FROM ${SmartCategoryTraining.tableName}
WHERE... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 375a9dbbc3e6633d9c53789a156dd5bdd776c14c | github |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/hosts/app/tabs/classes/meowTabInfo.ets | arkts | isLoading | Statuses | get isLoading() {
return this.progress != -1;
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left isLoading AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#statement_block#Left AST#{#Left { AST#{#Right ... | get isLoading() {
return this.progress != -1;
} | https://github.com/awaLiny2333/LinysBrowser_NEXT | b5df920dd5ed147101548831cadc09c12a14faa3 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/EntryAbility.ets | arkts | notifyFileOpenToUI | 通知UI层有新文件需要处理(仅用于onNewWant场景)
通过递增AppStorage计数器触发MainMenuPage的@Watch监听器,
解决app在前台时onPageShow不会重新触发的问题 | private notifyFileOpenToUI(): void {
const current = AppStorage.get<number>('fileOpenNewWantTrigger') || 0;
AppStorage.setOrCreate('fileOpenNewWantTrigger', current + 1);
logger.info('EntryAbility', `📣 通知UI处理新文件 (trigger: ${current + 1})`);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left notifyFileOpenToUI 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 A... | private notifyFileOpenToUI(): void {
const current = AppStorage.get<number>('fileOpenNewWantTrigger') || 0;
AppStorage.setOrCreate('fileOpenNewWantTrigger', current + 1);
logger.info('EntryAbility', `📣 通知UI处理新文件 (trigger: ${current + 1})`);
} | https://github.com/DaLongZhuaZi/manxia | 78a1bdd6b6a9f89c8a885eb3100a7a046f8a1493 | github |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/charts/RadarChartModel.ets | arkts | getSkipWebLineCount | Returns the modulus that is used for skipping web-lines.
@return | public getSkipWebLineCount() {
return this.mSkipWebLineCount;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getSkipWebLineCount 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#{#... | public getSkipWebLineCount() {
return this.mSkipWebLineCount;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | d3bc9b18446bb6262931b07140e8893cdfef5c8b | gitee |
HarmonyOS_Samples/MusicHome | features/playlist/src/main/ets/view/PlaylistDetailSongListSection.ets | arkts | build | Builds header, sort affordance, and multi-lane lazy list of songs. | build() {
Column() {
Row() {
Row({ space: 8 }) {
SymbolGlyph($r('sys.symbol.play_round_triangle_fill'))
.fontSize(32)
.fontWeight(FontWeight.Regular)
.height(32)
.fontColor([$r('app.color.playlist_play_all_icon')])
Text($r('app.stri... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Column() {
Row() {
Row({ space: 8 }) {
SymbolGlyph($r('sys.symbol.play_round_triangle_fill'))
.fontSize(32)
.fontWeight(FontWeight.Regular)
.height(32)
.fontColor([$r('app.color.playlist_play_all_icon')])
Text($r('app.stri... | https://gitcode.com/HarmonyOS_Samples/MusicHome | e1020ca53bf46b06ed2d77ccf4b9df879e56a3dd | gitcode |
Joker-x-dev/CoolMallArkTS | core/util/src/main/ets/image/ImageUtil.ets | arkts | pixelMapToBase64 | PixelMap转base64
@param {image.PixelMap} pixelMap 图像的PixelMap对象
@param {string} format 目标格式(默认png,当前只支持jpg、webp和png)
@returns {Promise<string>} 返回图像的base64字符串 | static async pixelMapToBase64(pixelMap: image.PixelMap, format: string = 'image/png'): Promise<string> {
const options: image.PackingOption = { format: format, quality: 100 };
const arrayBuffer: ArrayBuffer = await ImageUtil.packingFromPixelMap(pixelMap, options);
const base64Helper: util.Base64Helper = n... | 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 pixelMapToBase64 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left pixelMap AST#identifier#Rig... | static async pixelMapToBase64(pixelMap: image.PixelMap, format: string = 'image/png'): Promise<string> {
const options: image.PackingOption = { format: format, quality: 100 };
const arrayBuffer: ArrayBuffer = await ImageUtil.packingFromPixelMap(pixelMap, options);
const base64Helper: util.Base64Helper = n... | https://github.com/Joker-x-dev/CoolMallArkTS | 6fca530d0b989d54f73c66b16884ff962725ad49 | github |
XHXYT/Pixark | entry/src/main/ets/viewmodel/MoreViewModel.ets | arkts | displayName | 获取显示名称:优先 nickname,其次 name | get displayName(): ResourceStr {
if (this.currentUser) {
return this.currentUser.name || this.currentUser.account || '未知用户';
}
return $r('app.string.not_logged_in');
} | AST#program#Left AST#ERROR#Left AST#get#Left get AST#get#Right AST#call_expression#Left AST#identifier#Left displayName 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 ResourceStr AST#ide... | get displayName(): ResourceStr {
if (this.currentUser) {
return this.currentUser.name || this.currentUser.account || '未知用户';
}
return $r('app.string.not_logged_in');
} | https://github.com/XHXYT/Pixark/blob/fd28e9760e7566d4db095653f7fc4664a819fa5c/entry/src/main/ets/viewmodel/MoreViewModel.ets#L28-L33 | 700aa3828b585880ec59620f03dc7ff125da1b40 | github |
AGenUI/AGenUI | platforms/harmony/agenui/src/main/ets/agenui/hybrid/HybridBaseProperty.ets | arkts | updateStyle | Updates styles. | protected updateStyle(styleMap: Map<number, StyleItem>) {
styleMap.forEach((value, key) => {
switch (key) {
case Keys.NODE_PROPERTY_BACKGROUND_COLOR:
this.handleStyle_background_color(value.toString());
break;
case Keys.NODE_PROPERTY_BORDER_COLOR:
this.handleSty... | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left updateStyle AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left styleMap AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:... | protected updateStyle(styleMap: Map<number, StyleItem>) {
styleMap.forEach((value, key) => {
switch (key) {
case Keys.NODE_PROPERTY_BACKGROUND_COLOR:
this.handleStyle_background_color(value.toString());
break;
case Keys.NODE_PROPERTY_BORDER_COLOR:
this.handleSty... | https://github.com/AGenUI/AGenUI | bf227dce65fad80e2bc72b99d1adb82d2fdc1a18 | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/containers/LinkedBlockingQueue.ets | arkts | size | Returns the size of a BlockingQueue.
@returns { int } the size of the BlockingQueue. | override get size(): int {
return this.atomicsGetSize();
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left override AST#identifier#Right AST#ERROR#Left AST#identifier#Left get AST#identifier#Right AST#identifier#Left size AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AS... | override get size(): int {
return this.atomicsGetSize();
} | https://gitcode.com/iop123123/arkts-static-skills | 0b795d16695ff900151ba1cc9f0dc4c085ad7bde | gitcode |
openharmony/codelabs | ETSUI/PositioningDemo/entry/src/main/ets/service/ReminderService.ets | arkts | checkDurationReminder | 检查并触发运动时长提醒 | checkDurationReminder(sportData: SportData): void {
const config = this.settings.getReminderConfig(ReminderType.SPORT_DURATION);
if (config && config.enabled && config.interval) {
const now = Date.now();
if (now - this.state.lastDurationReminder >= config.interval * 1000) {
const durationM... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left checkDurationReminder AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left sportData AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left SportData AST#identifier#Righ... | checkDurationReminder(sportData: SportData): void {
const config = this.settings.getReminderConfig(ReminderType.SPORT_DURATION);
if (config && config.enabled && config.interval) {
const now = Date.now();
if (now - this.state.lastDurationReminder >= config.interval * 1000) {
const durationM... | https://gitcode.com/openharmony/codelabs | b4d7f143d057c864d83278016acc8bf49605d7c3 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/testing/arktest.ets | arkts | final | Using run() to run a test suite in case when it contains async tests is strongly discouraged
and will cause a runtime error in future.
Please use runAsync() in such cases.
Runs all tests in the test suite, synchronously waiting for completion of async tests.
@returns {int} The number of failed tests.
@syscap SystemCapa... | final run(): int {
let startMs = Date.now();
for (let test of this.tests) {
let runner: () => boolean;
if (test instanceof ArkTestAsync) {
runner = () => waitForCompletion(() => (test as ArkTestAsync).runAsync());
} else... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left final AST#identifier#Right AST#ERROR#Left AST#identifier#Left run 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#:#Right ... | final run(): int {
let startMs = Date.now();
for (let test of this.tests) {
let runner: () => boolean;
if (test instanceof ArkTestAsync) {
runner = () => waitForCompletion(() => (test as ArkTestAsync).runAsync());
} else... | https://gitcode.com/iop123123/arkts-static-skills | 3b67739c7429d9cefad91589011d2445dae1ed01 | gitcode |
openharmony/codelabs | ETSUI/LifeTrack/entry/src/main/ets/pages/StepManager.ets | arkts | calculateDistance | 计算行走距离(估算值,基于平均步幅) | private calculateDistance(steps: number): number {
// 平均步幅约为0.7米
return Math.round(steps * 0.7 * 100) / 100; // 保留两位小数
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left calculateDistance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left steps AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier... | private calculateDistance(steps: number): number {
// 平均步幅约为0.7米
return Math.round(steps * 0.7 * 100) / 100; // 保留两位小数
} | https://gitcode.com/openharmony/codelabs | ee22bf3a3ee2fb2e5407ed9232feae3633c1e8b9 | gitcode |
LongLiveY96/chatcube | entry/src/main/ets/state/AppSettingsStore.ets | arkts | upsertAssistant | ============================================================================
Assistant —— 写入(DB + state)
============================================================================
新增或更新 assistant:写 DB + 同步内存数组。
insert=true 时调用 createAssistant(走自增 sort_order 路径),否则 saveAssistant(原地更新) | async upsertAssistant(assistant: Assistant, insert: boolean): Promise<void> {
if (insert) {
await this.db.createAssistant(assistant)
} else {
await this.db.saveAssistant(assistant)
}
const current = this.getAssistants()
const next: Assistant[] = []
let replaced = false
for (let... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left upsertAssistant AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left assistant AST#identifier#Righ... | async upsertAssistant(assistant: Assistant, insert: boolean): Promise<void> {
if (insert) {
await this.db.createAssistant(assistant)
} else {
await this.db.saveAssistant(assistant)
}
const current = this.getAssistants()
const next: Assistant[] = []
let replaced = false
for (let... | https://github.com/LongLiveY96/chatcube | 58b72c20e87e27cb8b3c4a5aaed6b2b263bc25be | github |
openharmony/applications_call | entry/src/main/ets/model/CallServiceProxy.ets | arkts | muteRinger | Stops the ringtone. | public muteRinger() {
LogUtils.i(TAG, 'muteRinger')
call.muteRinger((err) => {
LogUtils.e(TAG, `muteRinger callback: err->${JSON.stringify(err)}`);
});
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left muteRinger 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 { AS... | public muteRinger() {
LogUtils.i(TAG, 'muteRinger')
call.muteRinger((err) => {
LogUtils.e(TAG, `muteRinger callback: err->${JSON.stringify(err)}`);
});
} | https://gitee.com/openharmony/applications_call.git | d1ae9f74ec0293e6eb74f0fc32da8961667eb408 | gitee |
CPF-ApplicationTPC/openharmony_tpc_samples | SwipeMenuListView/library/src/main/ets/utils/SwipeMenuListUtils.ets | arkts | distance | 计算两点之间的距离
@param point1 第一个点
@param point2 第二个点
@returns number 两点间的距离 | public static distance(
point1: Point,
point2: Point
): number {
const dx = point1.x - point2.x;
const dy = point1.y - point2.y;
return Math.sqrt(dx * dx + dy * dy);
} | 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 distance AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left point1 AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:... | public static distance(
point1: Point,
point2: Point
): number {
const dx = point1.x - point2.x;
const dy = point1.y - point2.y;
return Math.sqrt(dx * dx + dy * dy);
} | https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples | 0e3e152a4c4cd5ac6b572e29422af48ecd3b02fc | gitcode |
YANGZX22/Voot | entry/src/main/ets/services/ContinuityService.ets | arkts | getTrustedDevices | 获取已连接(可信任)的设备列表 | getTrustedDevices(): DeviceInfo[] {
if (!this.dmInstance) {
return [];
}
try {
const deviceList = this.dmInstance.getAvailableDeviceListSync();
const result: DeviceInfo[] = [];
for (const device of deviceList) {
const info: DeviceInfo = {
deviceId: device.deviceI... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getTrustedDevices AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left DeviceInfo AST#identifier#Rig... | getTrustedDevices(): DeviceInfo[] {
if (!this.dmInstance) {
return [];
}
try {
const deviceList = this.dmInstance.getAvailableDeviceListSync();
const result: DeviceInfo[] = [];
for (const device of deviceList) {
const info: DeviceInfo = {
deviceId: device.deviceI... | https://github.com/YANGZX22/Voot | 638dcd243fc9cf907eefd3378ce245e482943d17 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/GamepadManager.ets | arkts | continueGCDeviceRegistration | 继续 GCK 设备注册流程(在异步验证通过后调用)
包含去重检查和槽位分配 | private continueGCDeviceRegistration(deviceId: string, info: GameControllerDeviceInfo): void {
// 防止异步期间已有其他路径注册了此设备
if (this.gcDeviceIdToSlot.has(deviceId)) {
return;
}
const hadNoGcDevices = this.gcDeviceIdToSlot.size === 0;
const slot = this.allocateSlotForGCDevice(deviceId);
if (sl... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left continueGCDeviceRegistration AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left deviceId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left ... | private continueGCDeviceRegistration(deviceId: string, info: GameControllerDeviceInfo): void {
// 防止异步期间已有其他路径注册了此设备
if (this.gcDeviceIdToSlot.has(deviceId)) {
return;
}
const hadNoGcDevices = this.gcDeviceIdToSlot.size === 0;
const slot = this.allocateSlotForGCDevice(deviceId);
if (sl... | https://github.com/AlkaidLab/moonlight-harmony | dccc5aa2110df015968a7dc5a5bb1b26c2d510d1 | github |
HarmonyOS_Samples/multi-tab-navigation | entry/src/main/ets/pages/RudderStyleTab.ets | arkts | build | [End Builder_tab] | build() {
Column() {
Stack({ alignContent: Alignment.BottomStart }) {
// [Start Rudder_style_tab_tabs]
Tabs({ barPosition: BarPosition.End, controller: this.controller }) {
ForEach(this.tabArray, (item: BottomTabModel, index: number) => {
if (index === Constants.TAB_IND... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left build AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#member_expression#Left AST... | build() {
Column() {
Stack({ alignContent: Alignment.BottomStart }) {
// [Start Rudder_style_tab_tabs]
Tabs({ barPosition: BarPosition.End, controller: this.controller }) {
ForEach(this.tabArray, (item: BottomTabModel, index: number) => {
if (index === Constants.TAB_IND... | https://gitcode.com/HarmonyOS_Samples/multi-tab-navigation | 764ce7a2e0c4eb63c549a0845ba489ba8cc1e9de | gitcode |
openharmony/applications_permission_manager | permissionmanager/src/main/ets/common/utils/permissionUtils.ets | arkts | revokePermissionWithResult | 撤销权限并返回操作结果
@param permission 操作权限
@param flag 授权flag
@param tokenId 应用token
return | public static async revokePermissionWithResult(
permission: Permission, flag: number, tokenId: number
): Promise<optionAndState> {
try {
let atManager = abilityAccessCtrl.createAtManager();
await atManager.revokeUserGrantedPermission(tokenId, permission, flag);
Log.info(`revoke permission ... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left static AST#identifier#Right AST#async#Left async AST#async#Right AST#call_expression#Left AST#identifier#Left revokePermissionWithResult AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identif... | public static async revokePermissionWithResult(
permission: Permission, flag: number, tokenId: number
): Promise<optionAndState> {
try {
let atManager = abilityAccessCtrl.createAtManager();
await atManager.revokeUserGrantedPermission(tokenId, permission, flag);
Log.info(`revoke permission ... | https://gitee.com/openharmony/applications_permission_manager.git | 10ce38bd2bc66de9e376a1071e107c4c8326c1e4 | gitee |
Joker-x-dev/CoolMallArkTS | core/navigation/src/main/ets/launch/LaunchNavigator.ets | arkts | toGuide | 跳转到引导页
@param {boolean} [fromSettings] - 是否从设置页进入
@returns {void} 无返回值 | static toGuide(fromSettings?: boolean): void {
if (fromSettings !== undefined) {
const params: LaunchGuideParam = { fromSettings };
navigateTo(LaunchRoutes.Guide, params);
return;
}
navigateTo(LaunchRoutes.Guide);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left toGuide AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left fromSettings AST#identifier#Right AST#ERROR#Left AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#boolean... | static toGuide(fromSettings?: boolean): void {
if (fromSettings !== undefined) {
const params: LaunchGuideParam = { fromSettings };
navigateTo(LaunchRoutes.Guide, params);
return;
}
navigateTo(LaunchRoutes.Guide);
} | https://github.com/Joker-x-dev/CoolMallArkTS | a86358b51aa87725819b2ace83b7da9a4bc16c78 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/ContentFilterManager.ets | arkts | shouldFilterContent | 检查内容是否应该被过滤
@param isNSFW 内容是否为NSFW
@returns true表示应该过滤(隐藏),false表示应该显示 | public shouldFilterContent(isNSFW?: boolean): boolean {
if (!this.sfwModeEnabled) {
return false; // SFW模式未启用,不过滤任何内容
}
return isNSFW === true; // SFW模式启用时,过滤NSFW内容
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left shouldFilterContent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left isNSFW AST#identifier#Right AST#?#Left ? AST#?#Right AST#:#Left : AST#:#Right AST#E... | public shouldFilterContent(isNSFW?: boolean): boolean {
if (!this.sfwModeEnabled) {
return false; // SFW模式未启用,不过滤任何内容
}
return isNSFW === true; // SFW模式启用时,过滤NSFW内容
} | https://github.com/DaLongZhuaZi/manxia | a387845b2a00ccc35464bd78b5b45f14e4386932 | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/TotpService.ets | arkts | base32Decode | 解码Base32字符串为字节数组
@param base32 Base32编码的字符串
@returns 解码后的字节数组 | private base32Decode(base32: string): Uint8Array {
// 标准Base32字符集
const ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567';
// 移除所有空格和连字符
let cleanedInput = base32.replace(/[\s-]/g, '').toUpperCase();
// 如果字符串末尾有填充字符(=),移除它们
cleanedInput = cleanedInput.replace(/=+$/, '');
// 计算输出长度
const... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left base32Decode AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left base32 AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | private base32Decode(base32: string): Uint8Array {
// 标准Base32字符集
const ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567';
// 移除所有空格和连字符
let cleanedInput = base32.replace(/[\s-]/g, '').toUpperCase();
// 如果字符串末尾有填充字符(=),移除它们
cleanedInput = cleanedInput.replace(/=+$/, '');
// 计算输出长度
const... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/TotpService.ets#L286-L325 | 6709f96c5f47b4c7512bf91883c1dda201e74a1e | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/String.ets | arkts | localeCompareWeightL1 | Weights are copied from the ICU-backed localeCompare ASCII fast path in ets_runtime js_collator.cpp.
Primary (L1) weights compare base order. Weight 0 marks characters that must use Intl.Collator. | private static localeCompareWeightL1(code: int): int {
if (code >= 9 && code <= 13) {
return code - 8;
}
if (code >= 48 && code <= 57) {
return code - 9;
}
if (code >= 65 && code <= 90) {
return code - 16;
}
if (code >= 97 &... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left localeCompareWeightL1 AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left code AST#identifier#Right AST#ERROR#Left AST#... | private static localeCompareWeightL1(code: int): int {
if (code >= 9 && code <= 13) {
return code - 8;
}
if (code >= 48 && code <= 57) {
return code - 9;
}
if (code >= 65 && code <= 90) {
return code - 16;
}
if (code >= 97 &... | https://gitcode.com/iop123123/arkts-static-skills | 329eb85ed93dd69eaae8092480846ee11894e112 | gitcode |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | findLastIndex | Finds an index of the last element in the Uint8ClampedArray that satisfies the condition
@param fn condition
@returns the index of the last element that satisfies fn, -1 otherwise | public findLastIndex(fn: (val: number, index: int, array: Uint8ClampedArray) => boolean): int {
for (let i = this.length - 1; i >= 0; --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 findLastIndex 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 : ... | public findLastIndex(fn: (val: number, index: int, array: Uint8ClampedArray) => boolean): int {
for (let i = this.length - 1; i >= 0; --i) {
let val = this.at(i)
if (fn(val, i, this)) {
return i
}
}
return -1
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 81889b27654582cec3c123c3999b521caa9c57c6 | gitee |
openharmony-sig/ohos_danmaku_flame_master | library/src/main/ets/components/common/master/flame/danmaku/danmaku/model/ohos/DanmakuFactory.ets | arkts | fillTranslationData | Initial translation data of the special danmaku
@param item
@param beginX
@param beginX
@param beginY
@param endX
@param endY
@param translationDuration
@param translationStartDelay | public fillTranslationData(item: BaseDanmaku, beginX: number, beginY: number,
endX: number, endY: number, translationDuration: number, translationStartDelay: number,
scaleX: number, scaleY: number) {
if (item.getType() != BaseDanmaku.TYPE_SPECIAL)
re... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left fillTranslationData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left item AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#L... | public fillTranslationData(item: BaseDanmaku, beginX: number, beginY: number,
endX: number, endY: number, translationDuration: number, translationStartDelay: number,
scaleX: number, scaleY: number) {
if (item.getType() != BaseDanmaku.TYPE_SPECIAL)
re... | https://gitee.com/openharmony-sig/ohos_danmaku_flame_master.git | 558c876e0259582224e50f0fb410fab0a4f3a3a2 | gitee |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | of | Creates a new Int32Array using initializer
@param data initializer
@returns a new Int32Array from data | public of(data: Object[]): Int32Array {
throw new Error("Int32Array.of: not implemented")
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left of AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#... | public of(data: Object[]): Int32Array {
throw new Error("Int32Array.of: not implemented")
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 4f85d06e2531cfbf926c411182ee52355a4f7cd5 | gitee |
webabcd/HarmonyDemo | entry/src/main/ets/pages/security/CryptoDemo.ets | arkts | getRsaKeyPair | 将 rsa1024 的指定的公钥数据和私钥数据转为 cryptoFramework.KeyPair 对象 | public static getRsaKeyPair(publicKeyData: Uint8Array | null, privateKeyData: Uint8Array | null): cryptoFramework.KeyPair {
let publicKeyBlob: cryptoFramework.DataBlob | null = publicKeyData ? { data: publicKeyData } : null;
let privateKeyBlob: cryptoFramework.DataBlob | null = privateKeyData? { data: private... | 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 getRsaKeyPair AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#identifier#Left publicKeyData AST#identifier#... | public static getRsaKeyPair(publicKeyData: Uint8Array | null, privateKeyData: Uint8Array | null): cryptoFramework.KeyPair {
let publicKeyBlob: cryptoFramework.DataBlob | null = publicKeyData ? { data: publicKeyData } : null;
let privateKeyBlob: cryptoFramework.DataBlob | null = privateKeyData? { data: private... | https://github.com/webabcd/HarmonyDemo | 4eda891b63bf7a4e69137e96b0f50fe80efb5638 | github |
openharmony/applications_contacts | entry/src/main/ets/presenter/dialer/DialerPresenter.ets | arkts | deleteTeleNum | Change the font size when deleting a number. | deleteTeleNum() {
// this.callHistorySearch()
let number: string|undefined = AppStorage.Get('tele_number');
if(number === undefined){
return;
}
if (this.all_number.length < this.NUM_TEXT_MAX_LENGTH) {
AppStorage.SetOrCreate('tele_number', this.all_number);
} else {
AppStorage... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left deleteTeleNum 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... | deleteTeleNum() {
// this.callHistorySearch()
let number: string|undefined = AppStorage.Get('tele_number');
if(number === undefined){
return;
}
if (this.all_number.length < this.NUM_TEXT_MAX_LENGTH) {
AppStorage.SetOrCreate('tele_number', this.all_number);
} else {
AppStorage... | https://gitee.com/openharmony/applications_contacts.git | a9ce530e440cc6b0605b15d694afca60ca4129e6 | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/SharedLedger.ets | arkts | hasPermission | 检查是否有某项权限 | hasPermission(permission: string): boolean {
const permissions = this.getPermissions();
for (let i = 0; i < permissions.length; i++) {
if (permissions[i] === permission) {
return true;
}
}
return false;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasPermission AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left permission AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#)#Left ) AST... | hasPermission(permission: string): boolean {
const permissions = this.getPermissions();
for (let i = 0; i < permissions.length; i++) {
if (permissions[i] === permission) {
return true;
}
}
return false;
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | ae878fc49c1950ce7e0162283a4e908fc2bf51a0 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/ThemeManager.ets | arkts | getCurrentThemeSync | 获取当前主题(同步,用于UI组件快速访问)
注意:如果ThemeManager未初始化,返回默认值 | public getCurrentThemeSync(): ThemeType {
return this.currentTheme;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getCurrentThemeSync 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 Th... | public getCurrentThemeSync(): ThemeType {
return this.currentTheme;
} | https://github.com/DaLongZhuaZi/manxia | a22a2d76bf092da0478604fb2fbf8fc5304691f3 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/WebView/MangaSourceSelectorEngine.ets | arkts | validateSelectorLegacy | 原始验证方法(已废弃,保留兼容性) | private validateSelectorLegacy(selector: Selector): boolean {
if (!selector.type) {
return false;
}
switch (selector.type) {
case SelectorType.CSS:
return this.validateCSSSelector(selector.value);
case SelectorType.XPATH:
return this.validateXPathSelector(selector.value)... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left validateSelectorLegacy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left selector AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#id... | private validateSelectorLegacy(selector: Selector): boolean {
if (!selector.type) {
return false;
}
switch (selector.type) {
case SelectorType.CSS:
return this.validateCSSSelector(selector.value);
case SelectorType.XPATH:
return this.validateXPathSelector(selector.value)... | https://github.com/DaLongZhuaZi/manxia | 7a01edff64d402a3a6734c384d3edbe3967b9ec7 | github |
hiyuey3/Hixy_MyMemories | entry/src/main/ets/pages/DeveloperMode.ets | arkts | onDestroy | no MemoryStore subscription; refresh from DB on lifecycle hooks | onDestroy(): void {
// no-op
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onDestroy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#expression_statement#Left AST#unary_expression#Left ... | onDestroy(): void {
// no-op
} | https://github.com/hiyuey3/Hixy_MyMemories/blob/9769d82c97a877be3d464456e79f66c5c84a9590/entry/src/main/ets/pages/DeveloperMode.ets#L34-L36 | 953666764bea3eef4d95a7c8a1aac74bb7524eaa | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Editor/FileEditorService.ets | arkts | closeSession | 结束编辑会话 | public closeSession(sessionId: string): void {
const session = this.sessions.get(sessionId);
if (this.sessions.delete(sessionId)) {
if (session) {
this.pageStates.delete(session.instanceId);
}
this.pageStates.delete(sessionId);
logger.info(TAG, `关闭文件编辑器会话: ${sessionId}`);
}... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left closeSession AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left sessionId AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#... | public closeSession(sessionId: string): void {
const session = this.sessions.get(sessionId);
if (this.sessions.delete(sessionId)) {
if (session) {
this.pageStates.delete(session.instanceId);
}
this.pageStates.delete(sessionId);
logger.info(TAG, `关闭文件编辑器会话: ${sessionId}`);
}... | https://github.com/DaLongZhuaZi/manxia | cf0828649100db78e4f8da8e68010b4d7a827813 | github |
RoooyHe/toona-ohos | toona/src/main/ets/utils/AppLogger.ets | arkts | fatal | FATAL 级别日志 | fatal(msg: string, ...args: object[]): void {
this.logger.fatal(this.buildMsg(msg, args));
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left fatal AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left msg AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,#Righ... | fatal(msg: string, ...args: object[]): void {
this.logger.fatal(this.buildMsg(msg, args));
} | https://github.com/RoooyHe/toona-ohos | 29f4d4d0b97a2a938fc28908ead0e2eadd57d60c | github |
LJ666-ui/harmony-health-care | entry/src/main/ets/core/AutomationEngine.ets | arkts | getValue | 从数据中获取属性值 | private getValue(key: string, data: any): any {
if (typeof data === 'object' && data !== null) {
return data[key];
}
return undefined;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getValue 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 strin... | private getValue(key: string, data: any): any {
if (typeof data === 'object' && data !== null) {
return data[key];
}
return undefined;
} | https://github.com/LJ666-ui/harmony-health-care | d30a0ae373801ffaa34695159d96f31e7711e574 | github |
awaLiny2333/LinysBrowser_NEXT | home/src/main/ets/catstypicalframework/utils/catsLogger.ets | arkts | formatEventInfoString | Formats the crash info (hiAppEvent.AppEventInfo) into a single string.
@param eventInfo The event info to format.
@returns The info string. | function formatEventInfoString(eventInfo: hiAppEvent.AppEventInfo) {
return `Domain: ${eventInfo.domain}
Name: ${eventInfo.name}
EventType: ${eventInfo.eventType}
Time: ${eventInfo.params['time']} (${new Date(eventInfo.params['time']).toString()})
Crash_type: ${eventInfo.params['crash_type']}
Foreground: ${eventInfo.... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left formatEventInfoString AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left eventInfo AST#identifier#Right AST#type_annotation#Left AST#:#Le... | function formatEventInfoString(eventInfo: hiAppEvent.AppEventInfo) {
return `Domain: ${eventInfo.domain}
Name: ${eventInfo.name}
EventType: ${eventInfo.eventType}
Time: ${eventInfo.params['time']} (${new Date(eventInfo.params['time']).toString()})
Crash_type: ${eventInfo.params['crash_type']}
Foreground: ${eventInfo.... | https://github.com/awaLiny2333/LinysBrowser_NEXT | 0414f3e1bcd28995ea9a37bbfb0b06ca65ad3ead | github |
Nekofox-POT/LinMusic | entry/src/main/ets/package/audio_player/class_audio_player.ets | arkts | ms_to_times | dsd格式集
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
函数集 //
////////
毫秒 转化 分:秒 | function ms_to_times(duration: number): string {
const minutes = Math.floor(duration / 60000)
const seconds = Math.floor((duration % 60000) / 1000)
const formattedDuration = `${minutes}:${seconds.toString().padStart(2, '0')}`
return formattedDuration
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left ms_to_times AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left duration AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#... | function ms_to_times(duration: number): string {
const minutes = Math.floor(duration / 60000)
const seconds = Math.floor((duration % 60000) / 1000)
const formattedDuration = `${minutes}:${seconds.toString().padStart(2, '0')}`
return formattedDuration
} | https://github.com/Nekofox-POT/LinMusic | 7a640ee492cd348ceff7ce2a72d81f0ed0da613f | github |
openharmony-sig/online_event | college_growth_program/growth_project/张观宇 智能电饼铛/Demo源码/openharmony/electricitycakeclangdemo/entry/src/main/ets/MainAbility/pages/test01.ets | arkts | add | napi_property_descriptor desc[] = {
DECLARE_NAPI_FUNCTION("switchLed", SwitchLed),
DECLARE_NAPI_FUNCTION("JSCallback", JSCallback),
DECLARE_NAPI_FUNCTION("ServerStart", ServerStart),
DECLARE_NAPI_FUNCTION("ServerRead", ServerRead),
DECLARE_NAPI_FUNCTION("ServerStop", ServerStop),
DECLARE_NAPI_FUNCTION("ServerWrite", Se... | async function add(hh){
hh.inSetValue = 2;
console.log("test0002 test1");
} | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left add AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left hh AST#identifier#Right AST#required_paramete... | async function add(hh){
hh.inSetValue = 2;
console.log("test0002 test1");
} | https://gitee.com/openharmony-sig/online_event.git | 7340d4a09ff7089dea0152f0771bd8de12863f19 | gitee |
CLMC2025/Vignette | entry/src/main/ets/utils/Logger.ets | arkts | formatMessage | 格式化日志消息 | private formatMessage(level: string, message: string): string {
const parts: string[] = [];
if (this.config.enableTimestamp) {
parts.push(`[${this.formatTimestamp()}]`);
}
if (this.config.enableTag) {
parts.push(`[${this.tag}]`);
}
parts.push(`[${level}]`);
parts.push(messag... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left formatMessage AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left level AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | private formatMessage(level: string, message: string): string {
const parts: string[] = [];
if (this.config.enableTimestamp) {
parts.push(`[${this.formatTimestamp()}]`);
}
if (this.config.enableTag) {
parts.push(`[${this.tag}]`);
}
parts.push(`[${level}]`);
parts.push(messag... | https://github.com/CLMC2025/Vignette | ea2b70774b89fa12c96d1e09e959aa903722556e | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/SeasonalityDetectionService.ets | arkts | calculateConfidence | 计算综合置信度 | private static calculateConfidence(
acfScore: number,
cvScore: number,
peakCount: number,
troughCount: number,
dataLength: number
): number {
// 权重分配
const weights:ConfidenceWeights = {
acf: 0.4,
cv: 0.3,
peaks: 0.2,
troughs: 0.1
};
// 峰值和低谷得分(归一化)
co... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left static AST#identifier#Right AST#call_expression#Left AST#identifier#Left calculateConfidence AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left acfScore AST#identifier#Right AST#ERROR#Left AS... | private static calculateConfidence(
acfScore: number,
cvScore: number,
peakCount: number,
troughCount: number,
dataLength: number
): number {
// 权重分配
const weights:ConfidenceWeights = {
acf: 0.4,
cv: 0.3,
peaks: 0.2,
troughs: 0.1
};
// 峰值和低谷得分(归一化)
co... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 34e76aeb6c689b6a462375879bb99d8e883e8de5 | github |
PollenWang6/HiXD | entry/src/main/ets/services/CasLoginService.ets | arkts | encryptPassword | ========== 加密工具 ==========
AES 加密密码 | private async encryptPassword(password: string, salt: string): Promise<string> {
// 构建待加密文本
const prefix: string = 'xidianscriptsxduxidianscriptsxduxidianscriptsxduxidianscriptsxdu';
const plainText: string = prefix + password;
// Key: salt 的 UTF-8 字节(取前 16 字节用于 AES-128)
const textEncoder: util.T... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left encryptPassword AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left password AST#identifier#Right AST#ERROR#Left AST#:#L... | private async encryptPassword(password: string, salt: string): Promise<string> {
// 构建待加密文本
const prefix: string = 'xidianscriptsxduxidianscriptsxduxidianscriptsxduxidianscriptsxdu';
const plainText: string = prefix + password;
// Key: salt 的 UTF-8 字节(取前 16 字节用于 AES-128)
const textEncoder: util.T... | https://github.com/PollenWang6/HiXD | 8183a5d78b01ca5947b21e25c38bc809a404fa8c | github |
Joker-x-dev/CoolMallArkTS | feature/auth/src/main/ets/component/AnimatedAuthPage.ets | arkts | build | 构建认证页面基础布局
@returns {void} 无返回值 | build(): void {
LargePaddingVerticalScroll({ fillMaxSize: true }) {
ColumnStartCenter({ widthValue: P100 }) {
Column() {
Text(this.title)
.fontSize(28)
.fontWeight(FontWeight.Medium)
.fontColor($r("app.color.text_primary"))
.width(P100)
... | 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#void#Left void AST#void#Right AST#ERROR#Right AST#statement_block#Left A... | build(): void {
LargePaddingVerticalScroll({ fillMaxSize: true }) {
ColumnStartCenter({ widthValue: P100 }) {
Column() {
Text(this.title)
.fontSize(28)
.fontWeight(FontWeight.Medium)
.fontColor($r("app.color.text_primary"))
.width(P100)
... | https://github.com/Joker-x-dev/CoolMallArkTS | b6cbf3fbc782375e8c3cc45e49aced3f3f9785ab | github |
offlinecat-dev/OCNetORM | src/main/ets/query/AggregateResult.ets | arkts | empty | 创建空结果
@returns 空的聚合结果 | static empty(): AggregateResult {
return new AggregateResult()
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left static AST#identifier#Right AST#ERROR#Left AST#identifier#Left empty 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 empty(): AggregateResult {
return new AggregateResult()
} | https://github.com/offlinecat-dev/OCNetORM | 771e5cb515d37a29b79c493621ceb5594799822b | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/components/RDPDisplay.ets | arkts | createAuthenticationData | 创建认证数据 | static createAuthenticationData(username: string, password: string, domain?: string): ArrayBuffer {
// HarmonyOS ArkTS 不内置 TextEncoder,这里使用简易 UTF-8 编码器
const encode = (s: string): Uint8Array => {
const out: number[] = []
for (let i = 0; i < s.length; i++) {
const c = s.charCodeAt(i)
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createAuthenticationData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left username AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string ... | static createAuthenticationData(username: string, password: string, domain?: string): ArrayBuffer {
// HarmonyOS ArkTS 不内置 TextEncoder,这里使用简易 UTF-8 编码器
const encode = (s: string): Uint8Array => {
const out: number[] = []
for (let i = 0; i < s.length; i++) {
const c = s.charCodeAt(i)
... | https://github.com/AetheriumSimulator/qemu-hmos | 3f650e7286af3df87781417b79070e16947bcffb | github |
openharmony/codelabs | Distributed/HandleGameApplication/GameEtsOpenHarmony/entry/src/main/ets/MainAbility/pages/index.ets | arkts | FinishCommonEventCallBack | 完成本次有序公共事件处理回调 | function FinishCommonEventCallBack() {
} | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left FinishCommonEventCallBack AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#statement_block#Left AST#{#Left { AST#{#Right AST#}... | function FinishCommonEventCallBack() {
} | https://gitee.com/openharmony/codelabs.git | 6a2d29fc16f8440cf367e8e272ac9cbd03c4fa46 | gitee |
tdcare/tdwebrtc | src/main/ets/utils/NetworkUtil.ets | arkts | hasNetMobile | 判断当前网络是否是蜂窝网络(移动网络)。 | static hasNetMobile(): boolean {
return NetworkUtil.hasNetBearType(connection.NetBearType.BEARER_CELLULAR);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left hasNetMobile 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#... | static hasNetMobile(): boolean {
return NetworkUtil.hasNetBearType(connection.NetBearType.BEARER_CELLULAR);
} | https://github.com/tdcare/tdwebrtc | a3f14a06c7efaa5cf8bf649f7ec0f4fe4eae9c1f | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoJsExtensions.ets | arkts | htmlFormat | HTML格式化(移除标签) | htmlFormat(str: string): string {
return str
.replace(/<script[^>]*>[\s\S]*?<\/script>/gi, '')
.replace(/<style[^>]*>[\s\S]*?<\/style>/gi, '')
.replace(/<[^>]+>/g, '')
.replace(/ /g, ' ')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/&/g, '&')
.re... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left htmlFormat AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left str AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)... | htmlFormat(str: string): string {
return str
.replace(/<script[^>]*>[\s\S]*?<\/script>/gi, '')
.replace(/<style[^>]*>[\s\S]*?<\/style>/gi, '')
.replace(/<[^>]+>/g, '')
.replace(/ /g, ' ')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/&/g, '&')
.re... | https://github.com/DaLongZhuaZi/manxia | d80d1909e7f1c82e7b300090ec9a509169a39a2f | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/DataView.ets | arkts | constructor | Constructs view
@param buffer underlying buffer
@param byteOffset offset to start from
@param byteLength lenth of bytes to take
@throws RangeError if provided indicies are invalid | public constructor(buffer: ArrayBuffer, byteOffset: number, byteLength: number) {
this(buffer, byteOffset as int, byteLength as int)
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left constructor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left buffer AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Ar... | public constructor(buffer: ArrayBuffer, byteOffset: number, byteLength: number) {
this(buffer, byteOffset as int, byteLength as int)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 7b1c32ddbe629ef9b4bd37fdcffc30fa066c5cd5 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Theme/UserThemeConfig.ets | arkts | copyHdsTabEffects | 复制 HdsTab 特效配置 | function copyHdsTabEffects(source: HdsTabEffectsConfig): HdsTabEffectsConfig {
return {
opacityRatio: source.opacityRatio,
minOpacity: source.minOpacity,
maxOpacity: source.maxOpacity,
lightHighlightOpacity: source.lightHighlightOpacity,
darkHighlightOpacity: source.darkHighlightOpacity,
mater... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left copyHdsTabEffects AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left source AST#identifier#Right AST#type_annotation#Left AST#:#Left : AS... | function copyHdsTabEffects(source: HdsTabEffectsConfig): HdsTabEffectsConfig {
return {
opacityRatio: source.opacityRatio,
minOpacity: source.minOpacity,
maxOpacity: source.maxOpacity,
lightHighlightOpacity: source.lightHighlightOpacity,
darkHighlightOpacity: source.darkHighlightOpacity,
mater... | https://github.com/DaLongZhuaZi/manxia | 45bd5d61574a73539ec9ec5d4312bf30252382b9 | github |
RedRackham-R/WanAndroidHarmoney | entry/src/main/ets/net/wanAPI/WanHttpClient.ets | arkts | query | 搜索
https://www.wanandroid.com/article/query/{index}/json?k={words}
@param words 关键字
@param index 页码 从0开始
@returns | public query(words: string, index: number): Promise<AxiosResponse<IWanCommonResponse<IWanCommonListData<IArticle>>>> {
return this.postRequest("/article/query/" + index + "/json",
{},
{
headers: {
"Content-Type": 'text/plain; charset=UTF-8',
},
params: {
k: ... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left query AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#ident... | public query(words: string, index: number): Promise<AxiosResponse<IWanCommonResponse<IWanCommonListData<IArticle>>>> {
return this.postRequest("/article/query/" + index + "/json",
{},
{
headers: {
"Content-Type": 'text/plain; charset=UTF-8',
},
params: {
k: ... | https://github.com/RedRackham-R/WanAndroidHarmoney | 9c5ae2a3e86459c353ee78b499abec37e210ef44 | github |
ibestservices/ibest-ui-v2 | entry/src/main/ets/entryability/EntryAbility.ets | arkts | onWindowStageCreate | onDestroy(): void {
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');
} | onWindowStageCreate(windowStage: window.WindowStage): void {
let mainWindow = windowStage.getMainWindowSync()
mainWindow.setWindowLayoutFullScreen(true)
windowStage.loadContent('pages/Splash', (err, data) => {
GlobalStore.init(windowStage, this.context)
// 组件库初始化
IBestInit(windowStage, this.context)
... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left onWindowStageCreate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left windowStage AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left window AST#identif... | onWindowStageCreate(windowStage: window.WindowStage): void {
let mainWindow = windowStage.getMainWindowSync()
mainWindow.setWindowLayoutFullScreen(true)
windowStage.loadContent('pages/Splash', (err, data) => {
GlobalStore.init(windowStage, this.context)
// 组件库初始化
IBestInit(windowStage, this.context)
... | https://github.com/ibestservices/ibest-ui-v2/blob/6d385eaa20c466e6ade180801d5549908f20417f/entry/src/main/ets/entryability/EntryAbility.ets#L17-L33 | d1d972cb2359956d328a3ff605570871cc0fc163 | github |
openharmony-sig/node_pool | nodepool/src/main/ets/lib/NodePool.ets | arkts | executeRecycleCallback | 执行recycleCallback方法
@param type 节点类型
@param node 节点 | private executeRecycleCallback(type: string, node: NodeItem) {
if (this.typeReuseConfigMap.get(type)?.recycleCallback) {
this.typeReuseConfigMap.get(type)?.recycleCallback!(node);
} else if (this.nodePoolConfig.recycleCallback) {
this.nodePoolConfig.recycleCallback!(node)
}
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left executeRecycleCallback AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi... | private executeRecycleCallback(type: string, node: NodeItem) {
if (this.typeReuseConfigMap.get(type)?.recycleCallback) {
this.typeReuseConfigMap.get(type)?.recycleCallback!(node);
} else if (this.nodePoolConfig.recycleCallback) {
this.nodePoolConfig.recycleCallback!(node)
}
} | https://gitee.com/openharmony-sig/node_pool.git | 5abbb5881e4d79627f0fbb8caa4f148bb035e76b | gitee |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/StoragePaths.ets | arkts | verifyPublicStructure | 检查公共目录结构是否符合预期 | private static async verifyPublicStructure(appDir: string): Promise<boolean> {
try {
// 检查版本文件
const versionFile = `${appDir}/${StoragePaths.VERSION_FILE}`
try {
const file = await fs.open(versionFile, fs.OpenMode.READ_ONLY)
const buf = new ArrayBuffer(64)
const readLen =... | 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 verifyPublicStructure AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifie... | private static async verifyPublicStructure(appDir: string): Promise<boolean> {
try {
// 检查版本文件
const versionFile = `${appDir}/${StoragePaths.VERSION_FILE}`
try {
const file = await fs.open(versionFile, fs.OpenMode.READ_ONLY)
const buf = new ArrayBuffer(64)
const readLen =... | https://github.com/AetheriumSimulator/qemu-hmos | b5d572048099089c74659cf757acdeb84dfa6fb7 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Services/DataService.ets | arkts | getAvailableComicSources | ==================== 漫画源服务 ====================
获取可用的漫画源列表 | public async getAvailableComicSources(): Promise<ComicSource[]> {
try {
const sources = await this.dataManager.getAllComicSources();
const enabledSources: ComicSource[] = [];
for (let i = 0; i < sources.length; i++) {
const source = sources[i] as ComicSource;
if (source.isEnabled... | 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 getAvailableComicSources AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#R... | public async getAvailableComicSources(): Promise<ComicSource[]> {
try {
const sources = await this.dataManager.getAllComicSources();
const enabledSources: ComicSource[] = [];
for (let i = 0; i < sources.length; i++) {
const source = sources[i] as ComicSource;
if (source.isEnabled... | https://github.com/DaLongZhuaZi/manxia | 72af885d14702d0ba0142dd10b30c27f8c870ebc | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedArrays.ets | arkts | find | Finds the first element in the Int32Array that satisfies the condition
@param fn condition
@returns the first element that satisfies fn | public find(fn: (val: int) => boolean): int {
let newF: (val: int, index: int, array: Int32Array) => boolean =
(val: int, index: int, array: Int32Array): boolean => { return fn(val) }
return this.find(newF)
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left public AST#identifier#Right AST#ERROR#Left AST#identifier#Left find AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left fn AST#identifier#Righ... | public find(fn: (val: int) => boolean): int {
let newF: (val: int, index: int, array: Int32Array) => boolean =
(val: int, index: int, array: Int32Array): boolean => { return fn(val) }
return this.find(newF)
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 0c666d4f5ecd07ca6c250ef09f4691d29cab1b42 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/ThemeManager.ets | arkts | getTextSecondaryColor | 获取次要文字颜色 | public getTextSecondaryColor(): string {
return AppColors.textSecondary;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getTextSecondaryColor 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 stri... | public getTextSecondaryColor(): string {
return AppColors.textSecondary;
} | https://github.com/DaLongZhuaZi/manxia | 32e0af9504b244ab3947cb133da77372e9b03dfa | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Preload/ChapterPreloadManager.ets | arkts | setReaderActive | 设置阅读器活跃状态
[优化] 阅读器活跃时降低预加载优先级而非完全暂停 | public setReaderActive(active: boolean): void {
this.isReaderActive = active;
logger.info(TAG, `阅读器活跃状态: ${active}`);
if (active) {
// 阅读器激活:降低预加载并发数(而非完全暂停)
logger.info(TAG, '阅读器已激活,降低预加载优先级');
} else {
// 阅读器关闭:恢复预加载
logger.info(TAG, '阅读器已关闭,恢复预加载');
this.processNextTa... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setReaderActive AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left active AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Lef... | public setReaderActive(active: boolean): void {
this.isReaderActive = active;
logger.info(TAG, `阅读器活跃状态: ${active}`);
if (active) {
// 阅读器激活:降低预加载并发数(而非完全暂停)
logger.info(TAG, '阅读器已激活,降低预加载优先级');
} else {
// 阅读器关闭:恢复预加载
logger.info(TAG, '阅读器已关闭,恢复预加载');
this.processNextTa... | https://github.com/DaLongZhuaZi/manxia | 3535dcc63ca5140f74e4c6e96faa57d996f14f59 | github |
openharmony-sig/applications_calculator | common/src/main/ets/util/CommonUtil.ets | arkts | checkIfDeviceIsFold | Check whether the phone is foldable.
@return {boolean} Whether the phone is foldable. | static checkIfDeviceIsFold(): boolean {
return display.isFoldable();
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left checkIfDeviceIsFold 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 boole... | static checkIfDeviceIsFold(): boolean {
return display.isFoldable();
} | https://gitee.com/openharmony-sig/applications_calculator.git | 6c44f6b900be20e62314c0d9ca18342c7c4f0093 | gitee |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/FinalizationRegistry.ets | arkts | unregister | Removes all entries with the specific token
@param token object specified which entries should be removed | public unregister(token: Object): void {
this.mutex.lock();
try {
const bucketIdx = this.getBucketIndex(Runtime.getHashCode(token));
if (this.buckets[bucketIdx] != undefined) {
let currNode = this.buckets[bucketIdx];
while (currNode != undefine... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left unregister AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left token AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left Obje... | public unregister(token: Object): void {
this.mutex.lock();
try {
const bucketIdx = this.getBucketIndex(Runtime.getHashCode(token));
if (this.buckets[bucketIdx] != undefined) {
let currNode = this.buckets[bucketIdx];
while (currNode != undefine... | https://gitcode.com/iop123123/arkts-static-skills | ab2440fd54071582dacc230fd5963e69d57a708e | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Type.ets | arkts | getTypeParametersNum | Returns number of type parameters of this class
@returns {long} number of type parameters
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public getTypeParametersNum(): long {
return 0
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getTypeParametersNum 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 l... | public getTypeParametersNum(): long {
return 0
} | https://gitcode.com/iop123123/arkts-static-skills | 28e58d02d5ca9e7b2bacd4d983cd1c0e13d96e18 | gitcode |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/TypedUArrays.ets | arkts | fill | Fills the BigUint64Array with specified value
@param { BigInt } value - new valuy
@param { int } [start] - start index to begin fill from
@param { int } [end] - last index to end fill from, excluded
@returns { BigUint64Array } - modified BigUint64Array
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public fill(value: BigInt, start?: int, end?: int): BigUint64Array {
this.fill(value.getULong(), 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: BigInt, start?: int, end?: int): BigUint64Array {
this.fill(value.getULong(), start, end)
return this
} | https://gitcode.com/iop123123/arkts-static-skills | 1c49bfef110de23f363ca7d18531f5c8dbb886e5 | gitcode |
RoooyHe/toona-ohos | toona/src/main/ets/network/clients/DeviceHttpClient.ets | arkts | getDevices | ==========================================
1. 基础设备管理模块 (包含 UIA)
==========================================
✅ 修复 Error 23: 恢复返回 DevicesResponse 类型 | async getDevices(): Promise<DevicesResponse> {
return await this.get<DevicesResponse>('/devices');
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getDevices AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#generic_t... | async getDevices(): Promise<DevicesResponse> {
return await this.get<DevicesResponse>('/devices');
} | https://github.com/RoooyHe/toona-ohos | 09dfaee16e681739bd4ed3417db7bd596f8bea33 | github |
YANGZX22/Voot | entry/src/main/ets/services/ContinuityService.ets | arkts | deserializeState | 反序列化流转状态 | static deserializeState(json: string): ContinuityState | null {
try {
return JSON.parse(json) as ContinuityState;
} catch (e) {
console.error('[ContinuityService] deserializeState failed: ' + JSON.stringify(e));
return null;
}
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left deserializeState AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left json AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | static deserializeState(json: string): ContinuityState | null {
try {
return JSON.parse(json) as ContinuityState;
} catch (e) {
console.error('[ContinuityService] deserializeState failed: ' + JSON.stringify(e));
return null;
}
} | https://github.com/YANGZX22/Voot | 2f4a5217f318c5ca4f461b4e6a7abb0f8e940946 | github |
openharmony/applications_app_samples | code/BasicFeature/Media/VideoTrimmer/entry/src/main/ets/videotrimmer/RangeSeekBarView.ets | arkts | rightThumbUpdate | 更新右边滑块位置 | rightThumbUpdate(deltaX: number) {
let deltaPx = deltaX;
// 右边距
if (deltaPx >= 0 && ((this.rightThumbRect[2] + deltaPx) >= this.componentMaxWidth - this.rightPadding)) {
deltaPx = this.componentMaxWidth - this.rightPadding - this.rightThumbRect[2];
}
// 左边距
if (deltaPx <= 0 && ((this.rig... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left rightThumbUpdate AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left deltaX AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number AST#identifier#... | rightThumbUpdate(deltaX: number) {
let deltaPx = deltaX;
// 右边距
if (deltaPx >= 0 && ((this.rightThumbRect[2] + deltaPx) >= this.componentMaxWidth - this.rightPadding)) {
deltaPx = this.componentMaxWidth - this.rightPadding - this.rightThumbRect[2];
}
// 左边距
if (deltaPx <= 0 && ((this.rig... | https://github.com/openharmony/applications_app_samples | fd7151e75b0b1711ef1f6387a6fec3b9e9ccefcc | github |
HarmonyOS_Samples/MusicHome | features/player/src/main/ets/model/MediaService.ets | arkts | getCurrentTime | Current playback position in ms from AVPlayer, or 0 if not prepared. | private getCurrentTime() {
if (this.isPrepared && this.avPlayer) {
return this.avPlayer.currentTime;
}
return 0;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left getCurrentTime 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#{#Le... | private getCurrentTime() {
if (this.isPrepared && this.avPlayer) {
return this.avPlayer.currentTime;
}
return 0;
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | 4ee12f82e9da3846846453a5692edb70ef3b52c4 | gitcode |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.