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 |
|---|---|---|---|---|---|---|---|---|---|---|
AGenUI/AGenUI | platforms/harmony/agenui/src/main/ets/agenui/bridge/AGenUIEngineBridge.ets | arkts | initialize | MARK: - Global Initialization
Initializes the SDK once.
Registers HybridView ETS callbacks, URL hooks, and device information,
then starts the engine.
@param context UIAbilityContext | initialize(context: common.UIAbilityContext): void {
if (AGenUIEngineBridge._initialized) {
return;
}
AGenUIEngineBridge._initialized = true;
// Register built-in HybridView ETS callbacks.
registerEtsFunction('createHybridView', createHybridView);
registerEtsFunction('updateHybridView',... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left initialize AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_expression#Left AST#identifier#Left common AST#iden... | initialize(context: common.UIAbilityContext): void {
if (AGenUIEngineBridge._initialized) {
return;
}
AGenUIEngineBridge._initialized = true;
// Register built-in HybridView ETS callbacks.
registerEtsFunction('createHybridView', createHybridView);
registerEtsFunction('updateHybridView',... | https://github.com/AGenUI/AGenUI | 84e9a75662131deee93b8ccae7d6c39f90ac20fd | github |
harmonyos/codelabs | HarmonyOS_NEXT/TargetManagement/entry/src/main/ets/viewmodel/DataModel.ets | arkts | getLatestProgressValue | Get the latest progress. | getLatestProgressValue(): number {
if (this.targetData.length === 0) {
return 0;
}
return this.targetData[this.targetData.length - CommonConstants.ONE_TASK].progressValue;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getLatestProgressValue AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST... | getLatestProgressValue(): number {
if (this.targetData.length === 0) {
return 0;
}
return this.targetData[this.targetData.length - CommonConstants.ONE_TASK].progressValue;
} | https://gitee.com/harmonyos/codelabs.git | 1a2c34ddfc2b896bd7b780c63b85eb5c9cfaff3e | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/service/CloudSyncService.ets | arkts | getLastSyncTime | 获取最后一次成功同步的时间 | static async getLastSyncTime(userId: number): Promise<string | null> {
try {
const lastSync: CloudSyncRecord | null = await CloudSyncRecordDAO.getLastSuccessfulSync(userId);
return lastSync?.endTime || null;
} catch (error) {
console.error('[CloudSyncService] 获取最后同步时间失败:', error);
retu... | 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 getLastSyncTime AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left :... | static async getLastSyncTime(userId: number): Promise<string | null> {
try {
const lastSync: CloudSyncRecord | null = await CloudSyncRecordDAO.getLastSuccessfulSync(userId);
return lastSync?.endTime || null;
} catch (error) {
console.error('[CloudSyncService] 获取最后同步时间失败:', error);
retu... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | cae2b2adf06d7dbd05cbc2e19b7219709820762f | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/DownloadSyncManager.ets | arkts | initialize | 初始化Download同步目录
在APP启动时调用,检查并创建保留文件夹 | async initialize(): Promise<void> {
if (this.initialized) {
logger.info(TAG, 'Download同步管理器已初始化,跳过');
return;
}
try {
// 从AppStorage获取已保存的Download同步目录路径
const downloadDirPath = AppStorage.get<string>('downloadSyncDirPath');
if (!downloadDirPath) {
logger.info(... | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left initialize AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#... | async initialize(): Promise<void> {
if (this.initialized) {
logger.info(TAG, 'Download同步管理器已初始化,跳过');
return;
}
try {
// 从AppStorage获取已保存的Download同步目录路径
const downloadDirPath = AppStorage.get<string>('downloadSyncDirPath');
if (!downloadDirPath) {
logger.info(... | https://github.com/DaLongZhuaZi/manxia | 15cd06b6d13bdeb180906cd85f416c948286ea09 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/StreamInputHandler.ets | arkts | setOnShowStreamMenu | 设置打开串流菜单的回调(由 StreamPage 注入) | setOnShowStreamMenu(callback: () => void): void {
this.onShowStreamMenu = callback;
} | AST#program#Left AST#ERROR#Left AST#identifier#Left setOnShowStreamMenu AST#identifier#Right AST#(#Left ( AST#(#Right AST#call_expression#Left AST#identifier#Left callback AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AS... | setOnShowStreamMenu(callback: () => void): void {
this.onShowStreamMenu = callback;
} | https://github.com/AlkaidLab/moonlight-harmony | 8d49f48e799ced0b6c2a1d1e3b840b211b822680 | github |
aimilin6688/KeePassHO | entry/src/main/ets/storage/ftp/FTPStorage.ets | arkts | exists | 检查文件是否存在 | public async exists(path: string): Promise<boolean> {
try {
const handler = await this.ensureConnected();
return await handler.exists(this.getFullPath(path));
} catch (error) {
if (error instanceof StorageError) {
const err = error as StorageError;
if (err.message && err.mess... | 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 exists AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Left : AST#:#Righ... | public async exists(path: string): Promise<boolean> {
try {
const handler = await this.ensureConnected();
return await handler.exists(this.getFullPath(path));
} catch (error) {
if (error instanceof StorageError) {
const err = error as StorageError;
if (err.message && err.mess... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/storage/ftp/FTPStorage.ets#L212-L226 | 0821ed8d32c48578107db847e1a152c9bf1a3cf6 | github |
AetheriumSimulator/qemu-hmos | entry/src/main/ets/utils/RDPDriveManager.ets | arkts | copyFromVMSharedToOneDrive | 从 VM 共享目录复制文件到 OneDrive 缓存 | public async copyFromVMSharedToOneDrive(vmName: string, fileName: string): Promise<boolean> {
try {
const sourcePath = `${this.getVMSharedPath(vmName)}/${fileName}`;
const targetPath = `${this.config.oneDrivePath}/${fileName}`;
// 创建传输任务
const task = this.createTransferTask(sourcePa... | 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 copyFromVMSharedToOneDrive AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left vmName AST#identifier#Right A... | public async copyFromVMSharedToOneDrive(vmName: string, fileName: string): Promise<boolean> {
try {
const sourcePath = `${this.getVMSharedPath(vmName)}/${fileName}`;
const targetPath = `${this.config.oneDrivePath}/${fileName}`;
// 创建传输任务
const task = this.createTransferTask(sourcePa... | https://github.com/AetheriumSimulator/qemu-hmos | 492c208f6e4056f9ebb41e0b2f8cad63a93d96fb | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/SparseArray.ets | arkts | constructor | Creates a new instance of SparseArray with the given elements.
@param { T[] } values The rest of the elements to initialize the array with.
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public constructor(...values: T[]) {
this.buffer = new Map<int, T>()
this.maxLength = values.length
for (let i: int = 0; i < values.length; i++) {
this.buffer.set(i, values[i])
}
} | 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#spread_element#Left AST#...#Left ... AST#...#Right AST#identifier#Left values AST#identifier#Right AST#spread_element#Righ... | public constructor(...values: T[]) {
this.buffer = new Map<int, T>()
this.maxLength = values.length
for (let i: int = 0; i < values.length; i++) {
this.buffer.set(i, values[i])
}
} | https://gitcode.com/iop123123/arkts-static-skills | 34d4bb23f0b9c90875299aa280e2179b76a7f18f | gitcode |
LJ666-ui/harmony-health-care | entry/src/main/ets/aiagent/MultiAgentOrchestrator.ets | arkts | invokeAgentsParallel | 并行调用智能体
@param agents 智能体列表
@param question 用户问题
@param context 对话上下文
@returns 智能体回答列表 | private async invokeAgentsParallel(
agents: MedicalAgent[],
question: string,
context?: any
): Promise<AgentAnswer[]> {
const promises = agents.map(agent =>
agent.process(question, context).catch(error => {
// 单个智能体失败不影响其他智能体
console.error(`Agent ${agent.getId()} failed:`, erro... | 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 invokeAgentsParallel AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left agents AST#identifier#Right AST#... | private async invokeAgentsParallel(
agents: MedicalAgent[],
question: string,
context?: any
): Promise<AgentAnswer[]> {
const promises = agents.map(agent =>
agent.process(question, context).catch(error => {
// 单个智能体失败不影响其他智能体
console.error(`Agent ${agent.getId()} failed:`, erro... | https://github.com/LJ666-ui/harmony-health-care | 52afc354984c8fb6dce71402250034214157ad76 | github |
HarmonyOS_Samples/BestPracticeSnippets | SegmentedPhotograph/entry/src/main/ets/mode/CameraService.ets | arkts | createCameraInputFn | Creates a cameraInput output object | createCameraInputFn(cameraManager: camera.CameraManager,
cameraDevice: camera.CameraDevice): camera.CameraInput | undefined {
Logger.info(TAG, 'createCameraInputFn is called.');
let cameraInput: camera.CameraInput;
try {
cameraInput = cameraManager.createCameraInput(cameraDevice);
Logger.i... | AST#program#Left AST#expression_statement#Left AST#binary_expression#Left AST#member_expression#Left AST#call_expression#Left AST#identifier#Left createCameraInputFn AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#member_expression#Left AST#identifier#Left cameraManager AST#identifier#Right AST#ERR... | createCameraInputFn(cameraManager: camera.CameraManager,
cameraDevice: camera.CameraDevice): camera.CameraInput | undefined {
Logger.info(TAG, 'createCameraInputFn is called.');
let cameraInput: camera.CameraInput;
try {
cameraInput = cameraManager.createCameraInput(cameraDevice);
Logger.i... | https://gitcode.com/HarmonyOS_Samples/BestPracticeSnippets | d4e6eaae2d026549b87dcc2e93d1de9db41e5059 | gitcode |
Joker-x-dev/CoolMallArkTS | core/network/src/main/ets/NetworkClient.ets | arkts | http | 静态访问属性,方便直接通过 NetworkClient.http 调用 | public static get http(): AxiosInstance {
return NetworkClient.getInstance().getAxios();
} | 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#get#Left get AST#get#Right AST#identifier#Left http AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AS... | public static get http(): AxiosInstance {
return NetworkClient.getInstance().getAxios();
} | https://github.com/Joker-x-dev/CoolMallArkTS | 4da26c8b81b248641e04ac1630c1595f1142141b | github |
iop123123/arkts-static-skills | docs/ArkTS-Language-Guide/08-Stdlib/stdlib-source/std/core/Tuple.ets | arkts | $_iterator | Iterable interface implementation
@returns { IterableIterator<Any> } - iterator over all elements
@syscap SystemCapability.Utils.Lang
@FaAndStageModel | public override $_iterator(): IterableIterator<Any> {
return new TupleIterator(this);
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#identifier#Left override AST#identifier#Right AST#call_expression#Left AST#identifier#Left $_iterator AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#... | public override $_iterator(): IterableIterator<Any> {
return new TupleIterator(this);
} | https://gitcode.com/iop123123/arkts-static-skills | 88b8cff29a9056fce4d9e33a780d8ea13e6a6c0d | gitcode |
CPF-ApplicationTPC/imageknifepro | library/src/main/ets/ImageKnife.ets | arkts | setGlobalDynamicDns | 为默认的网络下载设置全局的动态Dns回调
设置该动态Dns回调,会覆盖其他Dns设置
@param dynamicDns 异步动态Dns回调,期望返回ip地址列表
@param timeout 回调执行的超时时间 | setGlobalDynamicDns(dynamicDns:(host:string, port:number) => Promise<Array<string>>, timeout:number = 50) {
nativeNode.setGlobalDynamicDns(dynamicDns, timeout);
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setGlobalDynamicDns AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#binary_expression#Left AST#call_expression#Left AST#identifier#Left dynamicDns AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right... | setGlobalDynamicDns(dynamicDns:(host:string, port:number) => Promise<Array<string>>, timeout:number = 50) {
nativeNode.setGlobalDynamicDns(dynamicDns, timeout);
} | https://gitcode.com/CPF-ApplicationTPC/imageknifepro/blob/5b2c39b2925d2e6c4a267ce62edc340b3150dcb9/library/src/main/ets/ImageKnife.ets#L309-L311 | 1d5f4145bf2d82530d6f78f5ebe4bf22b5533d91 | gitcode |
openharmony/codelabs | Data/PersonalAssistantPro/entry/src/main/ets/common/utils/PermissionUtils.ets | arkts | requestPermissions | 请求权限
@param context 上下文
@param permissions 权限列表 | public static async requestPermissions(context: common.UIAbilityContext,
permissions: Array<Permissions>): Promise<boolean> {
// ❌ Fix: this.logger -> PermissionUtils.logger
PermissionUtils.logger.info(`Requesting permissions: ${JSON.stringify(permissions)}`);
try {
const atManager = abilityAcc... | 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 requestPermissions AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left... | public static async requestPermissions(context: common.UIAbilityContext,
permissions: Array<Permissions>): Promise<boolean> {
// ❌ Fix: this.logger -> PermissionUtils.logger
PermissionUtils.logger.info(`Requesting permissions: ${JSON.stringify(permissions)}`);
try {
const atManager = abilityAcc... | https://gitcode.com/openharmony/codelabs | 6849c8d1f3f59abb9bd8ece14903dd73b6d73804 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/libs/htmlparser/Node.ets | arkts | clone | 克隆节点(子类需要重写) | clone(): Node {
const newRange: [number, number] = [this.range[0], this.range[1]];
return new Node(this.nodeType, null, newRange);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left clone 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 Node AST#identifier#Right AST#ERROR#Right AST#statement_... | clone(): Node {
const newRange: [number, number] = [this.range[0], this.range[1]];
return new Node(this.nodeType, null, newRange);
} | https://github.com/DaLongZhuaZi/manxia | 66e2b1f6df33e834e3ab06f3c43163b4ab2b30d3 | github |
cpdd5201314/harmonyOS-music-app | products/phone/src/main/ets/pages/MusicSearchService.ets | arkts | removeDuplicateMusic | 去除重复音乐 | private removeDuplicateMusic(musicList: MusicInfo[]): MusicInfo[] {
const uniqueMap = new Map<string, MusicInfo>()
for (let i = 0; i < musicList.length; i++) {
const music = musicList[i]
const key = `${music.name.toLowerCase()}_${music.singer.toLowerCase()}`.replace(/\s+/g, '')
if (!uniqueM... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left removeDuplicateMusic AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left musicList AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#sub... | private removeDuplicateMusic(musicList: MusicInfo[]): MusicInfo[] {
const uniqueMap = new Map<string, MusicInfo>()
for (let i = 0; i < musicList.length; i++) {
const music = musicList[i]
const key = `${music.name.toLowerCase()}_${music.singer.toLowerCase()}`.replace(/\s+/g, '')
if (!uniqueM... | https://github.com/cpdd5201314/harmonyOS-music-app | a96bed338b4a1bd4e04b7f380a6c15d2185e6cf7 | github |
the-wwyang/kids-learning-app | src/main/ets/services/QuestionCacheService.ets | arkts | getQuestion | ========== 核心API ==========
获取题目(从缓存池中取出,自动补充)
@param type 题型
@param difficulty 难度(可选,不传则使用自适应难度)
@returns 题目对象 | getQuestion(type: QuestionType, difficulty?: Difficulty): MathQuestion {
// 如果未指定难度,使用智能难度调节
const targetDifficulty = difficulty || this.getAdaptiveDifficulty();
// 获取题目池的key
const poolKey = this.getPoolKey(type, targetDifficulty);
// 确保池子中有足够的题目
this.ensurePoolSize(poolKey, type, targetDiff... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getQuestion AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left type AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left QuestionType AST#identifier#Right AST#,#Left... | getQuestion(type: QuestionType, difficulty?: Difficulty): MathQuestion {
// 如果未指定难度,使用智能难度调节
const targetDifficulty = difficulty || this.getAdaptiveDifficulty();
// 获取题目池的key
const poolKey = this.getPoolKey(type, targetDifficulty);
// 确保池子中有足够的题目
this.ensurePoolSize(poolKey, type, targetDiff... | https://github.com/the-wwyang/kids-learning-app | 9e58720778a5f79067c5a0cbca81282d9b314559 | github |
terryma2024/happyword | harmonyos/entry/src/ohosTest/ets/test/ParentAdminFlow.ui.test.ets | arkts | typeIntoAdmin | Type text into a ParentAdminPage TextInput, then dismiss the soft
keyboard so the next interaction can locate its target. Mirrors the
pattern that CustomWishlistFlow's typeInto uses for AddCustomWishDialog. | async function typeIntoAdmin(driver: Driver, id: string, text: string): Promise<void> {
try {
await driver.assertComponentExist(ON.id(id));
const input = await driver.findComponent(ON.id(id));
await input.inputText(text);
await driver.delayMs(300);
await driver.pressBack();
await driver.delayM... | AST#program#Left AST#function_declaration#Left AST#async#Left async AST#async#Right AST#function#Left function AST#function#Right AST#identifier#Left typeIntoAdmin AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left driver AST#identifier#Right AST#typ... | async function typeIntoAdmin(driver: Driver, id: string, text: string): Promise<void> {
try {
await driver.assertComponentExist(ON.id(id));
const input = await driver.findComponent(ON.id(id));
await input.inputText(text);
await driver.delayMs(300);
await driver.pressBack();
await driver.delayM... | https://github.com/terryma2024/happyword | 98e752dae5706ab6656fe51d731d4edf2105f181 | github |
Mydstiny/RemoteDeskHarmonyOS | entry/src/main/ets/services/CloudStore.ets | arkts | upsertRelayLocal | ---- 本地 CRUD (不触发云同步, 供内部和 sync 方法使用) ---- | upsertRelayLocal(relay: RustDeskRelayConfig): boolean {
return this.upsertRelayLocalInternal(relay, true);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left upsertRelayLocal AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left relay AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left RustDeskRelayConfig AST#identifier#Rig... | upsertRelayLocal(relay: RustDeskRelayConfig): boolean {
return this.upsertRelayLocalInternal(relay, true);
} | https://github.com/Mydstiny/RemoteDeskHarmonyOS | 4dbd4fa5a7720a4f29dc501300fffb960f287480 | github |
arkui-x/samples | CodeLab/Cases/feature/bluetooth/src/main/ets/viewmodel/BluetoothClientModel.ets | arkts | offBLECharacteristicChange | 取消订阅服务端的特征值变化 | private offBLECharacteristicChange() {
Log.showInfo(TAG, `offBLECharacteristicChange`);
if (!this.mGattClientDevice) {
Log.showInfo(TAG, `offBLECharacteristicChange: mGattClientDevice is null`);
return;
}
this.mGattClientDevice.off('BLECharacteristicChange');
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left offBLECharacteristicChange 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#L... | private offBLECharacteristicChange() {
Log.showInfo(TAG, `offBLECharacteristicChange`);
if (!this.mGattClientDevice) {
Log.showInfo(TAG, `offBLECharacteristicChange: mGattClientDevice is null`);
return;
}
this.mGattClientDevice.off('BLECharacteristicChange');
} | https://gitcode.com/arkui-x/samples | 659731924a089199c6b93a0e4bc476d95021ce08 | gitcode |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/BarDataSet.ets | arkts | getGradients | This method is deprecated.
Use getFills() instead. | public getGradients(): JList<Fill> | null {
return this.mFills;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getGradients AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#binary_expression#Left AS... | public getGradients(): JList<Fill> | null {
return this.mFills;
} | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 131837cc764440870498cb667ef08e8070fa306c | gitee |
kumaleap/ArkLuban | library/src/main/ets/luban/LubanUtils.ets | arkts | getFileSizeInKB | 获取文件大小(KB)- 支持 URI 和普通路径
@param filePath 文件路径或 URI
@returns 文件大小(KB) | static async getFileSizeInKB(filePath: string): Promise<number> {
const sizeInBytes = await LubanUtils.getFileSizeInBytes(filePath);
return Math.round(sizeInBytes / 1024);
} | 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 getFileSizeInKB AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left filePath AST#identifier#Right AST#ERROR#Left AST#:#Left... | static async getFileSizeInKB(filePath: string): Promise<number> {
const sizeInBytes = await LubanUtils.getFileSizeInBytes(filePath);
return Math.round(sizeInBytes / 1024);
} | https://github.com/kumaleap/ArkLuban | e063da5a2ac78164226c3f5faf2e4beb9dd69859 | github |
heeh02/superconnect | harmony/entry/src/main/ets/services/WindowController.ets | arkts | exitFullscreen | Back to the windowed layout + clear the notification. | exitFullscreen(): void {
WindowMode.apply(this.ctx, DisplayMode.Windowed, this.onLog);
FullscreenNotification.cancel(this.onLog);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left exitFullscreen AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#void#Left void AST#void#Right AST#ERROR#Right AST#statement_blo... | exitFullscreen(): void {
WindowMode.apply(this.ctx, DisplayMode.Windowed, this.onLog);
FullscreenNotification.cancel(this.onLog);
} | https://github.com/heeh02/superconnect | 13256bc23d3dcb1121f5950590b295277c343157 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/utils/CryptoUtil.ets | arkts | skipAsn1Element | 跳过一个完整的 ASN.1 元素 (tag + length + value) | private static skipAsn1Element(data: Uint8Array, pos: number): number {
const result = CryptoUtil.readAsn1Element(data, pos);
if (!result) return -1;
return pos + result.totalLength;
} | 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 skipAsn1Element AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left... | private static skipAsn1Element(data: Uint8Array, pos: number): number {
const result = CryptoUtil.readAsn1Element(data, pos);
if (!result) return -1;
return pos + result.totalLength;
} | https://github.com/AlkaidLab/moonlight-harmony | 5c89014a08c5f5a3e9463931ae01823c7726de7a | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/LegadoRuleAnalyzer.ets | arkts | extractAttribute | 从元素中提取属性
支持Legado原版的所有属性提取方式 | private extractAttribute(element: string, attr: string): string {
switch (attr.toLowerCase()) {
case 'text':
case 'textcontent':
// 移除HTML标签,获取纯文本
return this.htmlToTextCached(element);
case 'textnodes':
// 获取所有文本节点,换行分隔
// 移除script和style标签内容
let textConte... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left extractAttribute AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left element AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#st... | private extractAttribute(element: string, attr: string): string {
switch (attr.toLowerCase()) {
case 'text':
case 'textcontent':
// 移除HTML标签,获取纯文本
return this.htmlToTextCached(element);
case 'textnodes':
// 获取所有文本节点,换行分隔
// 移除script和style标签内容
let textConte... | https://github.com/DaLongZhuaZi/manxia | 04213621735c23ed173398e9b5ed607f78123aab | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Download/UnifiedDownloadManager.ets | arkts | pauseTask | ==================== 任务管理 ====================
暂停下载任务 | public async pauseTask(taskId: string): Promise<boolean> {
const task = this.unifiedTasks.get(taskId);
if (!task) {
logger.warn(TAG, `任务不存在: ${taskId}`);
return false;
}
try {
if (task.type === UnifiedDownloadType.MANGA) {
const success = await this.mangaDownloadManager.... | 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 pauseTask AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left taskId AST#identifier#Right AST#:#Left : AST#:... | public async pauseTask(taskId: string): Promise<boolean> {
const task = this.unifiedTasks.get(taskId);
if (!task) {
logger.warn(TAG, `任务不存在: ${taskId}`);
return false;
}
try {
if (task.type === UnifiedDownloadType.MANGA) {
const success = await this.mangaDownloadManager.... | https://github.com/DaLongZhuaZi/manxia | 00c7529f237d3877b0b4a504520ec5ab0accc143 | github |
SMAT-Lab/Homecheck-Sec2026 | test/unittest/sample/PreferReadonlyParametertypes/ets/defaultError.ets | arkts | object3 | not all properties are readonly | function object3(arg: { readonly prop: { prop2: string } }) {} // nested property is not readonly | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left object3 AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left arg AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST... | function object3(arg: { readonly prop: { prop2: string } }) {} // nested property is not readonly | https://github.com/SMAT-Lab/Homecheck-Sec2026 | 9814356787a4da458825097411a103ccfc2d9204 | github |
erosTeam/NextE | shared/src/main/ets/constants/EhConstants.ets | arkts | baseHost | Resolve the request host for the current site mode. | static baseHost(isEx: boolean): string {
return isEx ? EhConstants.EX_BASE_HOST : EhConstants.EH_BASE_HOST
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left baseHost AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left isEx AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left boolean... | static baseHost(isEx: boolean): string {
return isEx ? EhConstants.EX_BASE_HOST : EhConstants.EH_BASE_HOST
} | https://github.com/erosTeam/NextE | 922430af6a22809146a7fb9278d6c3b9b82bd025 | github |
huaiminqin/TankWar-Master-with-Many-Tasks | game/src/main/ets/actors/actor/SupplyTruck.ets | arkts | generateDefaultPath | 生成默认路径(从上到下) | generateDefaultPath(battleField: BattleField): void {
const xTiles = battleField.getXTiles();
const yTiles = battleField.getYTiles();
const startX = Math.floor(xTiles / 2) * Resources.TILE_WIDTH;
this.waypoints = [];
// 从顶部开始
this.waypoints.push([startX, 0]);
// 中间点
this.waypoints... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left generateDefaultPath AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left battleField AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left BattleField AST#identifier#Ri... | generateDefaultPath(battleField: BattleField): void {
const xTiles = battleField.getXTiles();
const yTiles = battleField.getYTiles();
const startX = Math.floor(xTiles / 2) * Resources.TILE_WIDTH;
this.waypoints = [];
// 从顶部开始
this.waypoints.push([startX, 0]);
// 中间点
this.waypoints... | https://github.com/huaiminqin/TankWar-Master-with-Many-Tasks | 29b25ff21adbdf5e7ebb6867a02337d401483d2c | github |
HarmonyOS_Samples/MusicHome | features/player/src/main/ets/model/MediaService.ets | arkts | ensureBackgroundAudioTask | Starts or refreshes continuous background audio task (required after some track-switch paths). | private ensureBackgroundAudioTask(): void {
BackgroundUtil.startContinuousTask(this.abilityContext);
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left ensureBackgroundAudioTask 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#Rig... | private ensureBackgroundAudioTask(): void {
BackgroundUtil.startContinuousTask(this.abilityContext);
} | https://gitcode.com/HarmonyOS_Samples/MusicHome | 6eac7bccb433e884fa771d8361ba444ded994052 | gitcode |
miaochiahao/ark-ghidra | data/test_hap/arkts-decompile-test4_original_index.ets | arkts | testStringMethods2 | === String Methods === | function testStringMethods2(): string {
let s: string = ' Hello, World! ';
let trimmed: string = s.trim();
let lower: string = trimmed.toLowerCase();
let upper: string = trimmed.toUpperCase();
let hasHello: boolean = trimmed.includes('Hello');
let startsWith: boolean = trimmed.startsWith('Hello');
let e... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left testStringMethods2 AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#Right AST#predefin... | function testStringMethods2(): string {
let s: string = ' Hello, World! ';
let trimmed: string = s.trim();
let lower: string = trimmed.toLowerCase();
let upper: string = trimmed.toUpperCase();
let hasHello: boolean = trimmed.includes('Hello');
let startsWith: boolean = trimmed.startsWith('Hello');
let e... | https://github.com/miaochiahao/ark-ghidra | e4fbddc55c350458c4a95a26516b6b0dbb2ac12f | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/utils/PreferencesUtil.ets | arkts | getFilesDir | 获取应用沙箱文件目录路径 | static getFilesDir(): string {
return PreferencesUtil.contextRef?.filesDir ?? '';
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getFilesDir 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#str... | static getFilesDir(): string {
return PreferencesUtil.contextRef?.filesDir ?? '';
} | https://github.com/AlkaidLab/moonlight-harmony | 56609453c8ebef141144d57e7a784f4c6464f959 | github |
openharmony/codelabs | ETSUI/MediaReview/entry/src/main/ets/utils/RdbUtil.ets | arkts | upsertReview | 评分/评价:写入或更新 | static async upsertReview(context: Context, bookId: string, review: DbReview): Promise<boolean> {
RdbUtil.upsertMemory(bookId, review)
try {
const store = await RdbUtil.getStore(context)
if (!store) return false
const args: relationalStore.ValueType[] = [
review.id,
bookId,
... | 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 upsertReview AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left context AST#identifier#Right AST#:#Left : A... | static async upsertReview(context: Context, bookId: string, review: DbReview): Promise<boolean> {
RdbUtil.upsertMemory(bookId, review)
try {
const store = await RdbUtil.getStore(context)
if (!store) return false
const args: relationalStore.ValueType[] = [
review.id,
bookId,
... | https://gitcode.com/openharmony/codelabs | b23dc1c4ff197cb75a2e42fc2ebee9945824f44f | gitcode |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/streaming/StreamingSession.ets | arkts | sendKeyboardInput | ---------------------------------------------------------------------------
输入 — 键盘与文本
---------------------------------------------------------------------------
发送键盘输入
@param keyCode Windows 虚拟键码
@param keyAction 0x03=KEY_DOWN, 0x04=KEY_UP
@param modifiers SHIFT=0x01, CTRL=0x02, ALT=0x04, META=0x08 | sendKeyboardInput(keyCode: number, keyAction: number, modifiers: number = 0): void {
if (!this.isRunning) return;
this.nativeModule.sendKeyboardInput(keyCode, keyAction, modifiers, 0);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left sendKeyboardInput AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left keyCode AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#number#Right AST#ERROR#Right AST#,#Left , AS... | sendKeyboardInput(keyCode: number, keyAction: number, modifiers: number = 0): void {
if (!this.isRunning) return;
this.nativeModule.sendKeyboardInput(keyCode, keyAction, modifiers, 0);
} | https://github.com/AlkaidLab/moonlight-harmony | 00fe0f6bd4ec5f55a2ce73f20457c377ebdd518a | github |
popsiclelmlm/Hey | entry/src/main/ets/entryability/EntryAbility.ets | arkts | stashDeepLink | Stash a deep-link Want uri (hey://install-sub|install-config?url=...) or
declared shortcut parameters for the Index page to pick up on show. Set
before the window stage loads on cold start, and on every onNewWant for
warm starts. | private stashDeepLink(want: Want): void {
const uri = deepLinkUriFromWant({
uri: want.uri,
parameters: want.parameters
});
if (uri.length > 0) {
AppStorage.setOrCreate('pendingDeepLink', uri);
}
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left stashDeepLink AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left want AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | private stashDeepLink(want: Want): void {
const uri = deepLinkUriFromWant({
uri: want.uri,
parameters: want.parameters
});
if (uri.length > 0) {
AppStorage.setOrCreate('pendingDeepLink', uri);
}
} | https://github.com/popsiclelmlm/Hey | 3e262269d2cb9cbdc94cf9836de1627c5905d9c0 | github |
wgli-collab/qs-arkts | entry/src/main/ets/pages/Index.ets | arkts | t9_charsetIso8859 | T9: ISO-8859-1 charset | t9_charsetIso8859(): void {
const opts: ParseOptions = { charset: 'iso-8859-1' };
const r: Record<string, Object> = parse('q=%E9', opts);
const rec: Record<string, Object> = r as Record<string, Object>;
const val: Object = rec['q'];
const passed: boolean = typeof val === 'string';
this.record(... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left t9_charsetIso8859 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_... | t9_charsetIso8859(): void {
const opts: ParseOptions = { charset: 'iso-8859-1' };
const r: Record<string, Object> = parse('q=%E9', opts);
const rec: Record<string, Object> = r as Record<string, Object>;
const val: Object = rec['q'];
const passed: boolean = typeof val === 'string';
this.record(... | https://github.com/wgli-collab/qs-arkts | f523ecbb5037fd5addb36e0a374ed640fe00e89e | github |
OMGCA/sakipay | sakipay_hmos/main/src/main/ets/models/EarningsCalculator.ets | arkts | elapsedSinceStartSeconds | Converts a clock-second value to seconds elapsed since work start,
handling the cross-midnight wrap with second-level precision. | public elapsedSinceStartSeconds(clockSecond: number): number {
const wsSec: number = this.workStartMinutes * 60
if (!this.isCrossMidnight) {
return Math.max(0, clockSecond - wsSec)
}
if (clockSecond >= wsSec) {
return clockSecond - wsSec
}
return (1440 * 60 - wsSec) + clockSecond
... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left elapsedSinceStartSeconds AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left clockSecond AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left numb... | public elapsedSinceStartSeconds(clockSecond: number): number {
const wsSec: number = this.workStartMinutes * 60
if (!this.isCrossMidnight) {
return Math.max(0, clockSecond - wsSec)
}
if (clockSecond >= wsSec) {
return clockSecond - wsSec
}
return (1440 * 60 - wsSec) + clockSecond
... | https://github.com/OMGCA/sakipay | 7b400f5eb17a392fa542bba3280c80bb22f87393 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Utils/WidgetDataSync.ets | arkts | syncAllData | 从数据源加载并同步所有卡片数据 | public async syncAllData(): Promise<boolean> {
if (!this.context) {
logger.warn(TAG, 'syncAllData: context not initialized');
return false;
}
// 启动早期可能触发前后台切换,此时数据系统尚未就绪,直接跳过避免访问未初始化数据库
const initStatus = DataInitializer.getInstance().getInitializationStatus();
if (!initStatus.isIniti... | 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 syncAllData AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Le... | public async syncAllData(): Promise<boolean> {
if (!this.context) {
logger.warn(TAG, 'syncAllData: context not initialized');
return false;
}
// 启动早期可能触发前后台切换,此时数据系统尚未就绪,直接跳过避免访问未初始化数据库
const initStatus = DataInitializer.getInstance().getInitializationStatus();
if (!initStatus.isIniti... | https://github.com/DaLongZhuaZi/manxia | 36e918d042ee3f836fefc813809bcd0078e8edab | github |
openharmony/codelabs | Data/PersonalAssistantPro/entry/src/main/ets/model/EventModel.ets | arkts | queryRange | ========================================================
新增方法 2:查询时间段日程 (供日历视图筛选使用)
======================================================== | static async queryRange(start: number, end: number): Promise<Event[]> {
let predicates = new relationalStore.RdbPredicates(TABLE_EVENT);
// 数据库直接筛选:
// 1. 日程开始时间早于查询结束时间
// 2. 且 日程结束时间晚于查询开始时间
predicates.lessThanOrEqualTo('start_time', end)
.and()
.greaterThanOrEqualTo('end_time', sta... | 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 queryRange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left start AST#identifier#Right AST#:#Left : AST#:... | static async queryRange(start: number, end: number): Promise<Event[]> {
let predicates = new relationalStore.RdbPredicates(TABLE_EVENT);
// 数据库直接筛选:
// 1. 日程开始时间早于查询结束时间
// 2. 且 日程结束时间晚于查询开始时间
predicates.lessThanOrEqualTo('start_time', end)
.and()
.greaterThanOrEqualTo('end_time', sta... | https://gitcode.com/openharmony/codelabs | 08149648c54a601c7fd90b3abff5bba0c2839985 | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Animation/GlobalAnimationSystem.ets | arkts | interpolateVector3D | 3D向量插值 | public static interpolateVector3D(start: Vector3D, end: Vector3D, progress: number): Vector3D {
return {
x: AnimationUtils.interpolate(start.x, end.x, progress),
y: AnimationUtils.interpolate(start.y, end.y, progress),
z: AnimationUtils.interpolate(start.z, end.z, progress)
} as Vector3D;
... | 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 interpolateVector3D AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left start AST#identifier#Right AST#:#Le... | public static interpolateVector3D(start: Vector3D, end: Vector3D, progress: number): Vector3D {
return {
x: AnimationUtils.interpolate(start.x, end.x, progress),
y: AnimationUtils.interpolate(start.y, end.y, progress),
z: AnimationUtils.interpolate(start.z, end.z, progress)
} as Vector3D;
... | https://github.com/DaLongZhuaZi/manxia | 8cd4d94ce40e71200d66152d6b39b4896941a020 | github |
chenchl/GMLogger-HarmonyOS | gmlogger/src/main/ets/components/security/logger/LoggerFileUtil.ets | arkts | decryptLogFile | 解密日志文件
该函数用于解密指定的加密日志文件,并将解密后的内容写入到指定的解密日志文件中。
@param logPath - 加密日志文件的路径。如果为空字符串,则函数返回 false。
@param encryptKey - 用于解密的密钥,类型为 Uint8Array。如果密钥长度为 0,则函数返回 false。
@param decryptLogPath - 解密日志文件的存储路径。如果为空字符串,则函数返回 false。
@returns 返回一个布尔值,表示解密操作是否成功。如果成功返回 true,否则返回 false。 | async decryptLogFile(logPath: string, encryptKey: Uint8Array, decryptLogPath: string) {
try {
// 检查输入参数是否有效
if (logPath === '' || encryptKey.length === 0 || decryptLogPath === '') {
return false;
}
// 检查日志文件是否存在
if (!fs.accessSync(logPath)) {
return false;
}
... | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left decryptLogFile AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left logPath AST#identifier#Right AST#type_annotation#Left AST#:#Left... | async decryptLogFile(logPath: string, encryptKey: Uint8Array, decryptLogPath: string) {
try {
// 检查输入参数是否有效
if (logPath === '' || encryptKey.length === 0 || decryptLogPath === '') {
return false;
}
// 检查日志文件是否存在
if (!fs.accessSync(logPath)) {
return false;
}
... | https://github.com/chenchl/GMLogger-HarmonyOS | a17e9a9766816725aa787897f9a79522130b3f18 | github |
iHongRen/harmony-study-demo | entry/src/main/ets/pages/selectabletext/SelectableDemo.ets | arkts | copyText | 覆盖父类方法,消息可复制的文本
@returns | public copyText(): string {
return this.text
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left copyText 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... | public copyText(): string {
return this.text
} | https://github.com/iHongRen/harmony-study-demo | 92310cad5929d8eff25ad2138f0a87e9ee1762da | github |
RedRackham-R/WanAndroidHarmoney | entry/src/main/ets/net/wanAPI/WanHttpClient.ets | arkts | rankList | 积分排行榜接口
https://www.wanandroid.com/coin/rank/1/json
@param index 下标从1开始
@returns | public rankList(index: number): Promise<AxiosResponse<IWanCommonResponse<IWanCommonListData<IRankInfo>>>> {
return this.getRequest("/coin/rank/" + index + "/json")
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left rankList AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left index AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left number... | public rankList(index: number): Promise<AxiosResponse<IWanCommonResponse<IWanCommonListData<IRankInfo>>>> {
return this.getRequest("/coin/rank/" + index + "/json")
} | https://github.com/RedRackham-R/WanAndroidHarmoney | bbebe015bfe4360e2c73f23d204b29a7163edb14 | github |
openharmony-tpc/XmlGraphicsBatik | library/src/main/ets/batik/SVGXMLChecker.ets | arkts | _readDocTypeDeclaration | 读取文档类型:doctype声明一般被丢弃
@see https://www.w3.org/TR/xml/ 2.8节 [28] doctypedecl
@return 是否读取到了文档类型声明 | private _readDocTypeDeclaration(): boolean{
let _svgStringReader = this._svgStringReader!;
if (!_svgStringReader.readStringFast(XMLConstants.XML_DOCTYPE) || !this._readWhitespace()) {
return false;
}
// 读取第一组到达 [ 或 > 的字符
_svgStringReader.readMatchRegex(RegexConstants.REGEX_DOC_TYPE);
/... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left _readDocTypeDeclaration 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#Lef... | private _readDocTypeDeclaration(): boolean{
let _svgStringReader = this._svgStringReader!;
if (!_svgStringReader.readStringFast(XMLConstants.XML_DOCTYPE) || !this._readWhitespace()) {
return false;
}
// 读取第一组到达 [ 或 > 的字符
_svgStringReader.readMatchRegex(RegexConstants.REGEX_DOC_TYPE);
/... | https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git | 8171f7650825587ac7db3b31f21739fec94aa2a7 | gitee |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/EnhancedBackupManager.ets | arkts | exportPreferenceStores | 导出指定Preferences文件 | private async exportPreferenceStores(storeNames: string[]): Promise<PreferenceBackupSection> {
const section: PreferenceBackupSection = { stores: [] };
for (const storeName of storeNames) {
try {
const store = await this.exportPreferenceStore(storeName);
if (store.entries.length > 0) {
... | 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 exportPreferenceStores AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left storeNames AST#identifier#Right AST#ERROR#Lef... | private async exportPreferenceStores(storeNames: string[]): Promise<PreferenceBackupSection> {
const section: PreferenceBackupSection = { stores: [] };
for (const storeName of storeNames) {
try {
const store = await this.exportPreferenceStore(storeName);
if (store.entries.length > 0) {
... | https://github.com/DaLongZhuaZi/manxia | 1aae56c4220a8e9e670e3f292bc6fd4e3754d822 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Loading/LoadingStateManager.ets | arkts | transitionToPhase | 转换到新阶段 | public transitionToPhase(newPhase: LoadingPhase, data?: Record<string, PropertyValue>): void {
const previousPhase = this.currentPhase;
const previousState = this.phases.get(previousPhase)?.state || LoadingState.PENDING;
// 完成当前阶段
if (previousPhase !== LoadingPhase.UNINITIALIZED) {
this.com... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left transitionToPhase AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left newPhase AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier... | public transitionToPhase(newPhase: LoadingPhase, data?: Record<string, PropertyValue>): void {
const previousPhase = this.currentPhase;
const previousState = this.phases.get(previousPhase)?.state || LoadingState.PENDING;
// 完成当前阶段
if (previousPhase !== LoadingPhase.UNINITIALIZED) {
this.com... | https://github.com/DaLongZhuaZi/manxia | 490b04fc2ba5fc2dfb498627209e11cc43472f52 | github |
aimilin6688/KeePassHO | entry/src/main/ets/common/utils/Sm4Utils.ets | arkts | decrypt | 解密
@param data 16进制的字符串
@returns 明文字符串 | public static decrypt(data: string): string {
if (!data) {
return '';
}
return aegis.sm4DecTextHexSync(aegis.SM4Alg.SM4_CBC_PKCS5Padding, data, Sm4Utils.initKey());
} | 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 decrypt AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left data AST#identifier#Right AST#:#Left : AST#:#Ri... | public static decrypt(data: string): string {
if (!data) {
return '';
}
return aegis.sm4DecTextHexSync(aegis.SM4Alg.SM4_CBC_PKCS5Padding, data, Sm4Utils.initKey());
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/common/utils/Sm4Utils.ets#L77-L82 | 6ede765e9fd8026cea4c6c3ad033e4122b3e4f3e | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Atomics.ets | arkts | wait | If "typedArray[offset] != value" suspends the current thread until it is notified by Atomics.notify
or until the given timeout passes.
Note: An Atomics.notify call will wake up this thread even if "typedArray[offset] == value". | public static wait(typedArray: Int32Array, offset: int, value: int, timeout: long): string {
let indexedPosition = Atomics.validateAtomicAccess(typedArray.byteOffset, Int32Array.BYTES_PER_ELEMENT, typedArray.length, offset)
let mem = Atomics.requireSharedMemory(typedArray.buffer)
let 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#identifier#Left wait AST#identifier#Right AST#ERROR#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left typedArray ... | public static wait(typedArray: Int32Array, offset: int, value: int, timeout: long): string {
let indexedPosition = Atomics.validateAtomicAccess(typedArray.byteOffset, Int32Array.BYTES_PER_ELEMENT, typedArray.length, offset)
let mem = Atomics.requireSharedMemory(typedArray.buffer)
let result ... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 8c4143a349a210c40bb09788797f26d3f62895ec | gitee |
LJ666-ui/harmony-health-care | entry/src/main/ets/rag/HybridRetriever.ets | arkts | retrieve | 混合检索
@param query 查询文本
@returns 检索结果列表 | async retrieve(query: string): Promise<RetrievalResult[]> {
console.info('[HybridRetriever] 开始混合检索:', query);
try {
// 1. 向量检索
const vectorResults = await this.vectorRetriever.search(
query,
this.config.topK * 2
);
console.info('[HybridRetriever] 向量检索完成:', vectorResul... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left retrieve AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left query AST#identifier#Right AST#type_annotation#Left AST#:#Lef... | async retrieve(query: string): Promise<RetrievalResult[]> {
console.info('[HybridRetriever] 开始混合检索:', query);
try {
// 1. 向量检索
const vectorResults = await this.vectorRetriever.search(
query,
this.config.topK * 2
);
console.info('[HybridRetriever] 向量检索完成:', vectorResul... | https://github.com/LJ666-ui/harmony-health-care | a61178c1b1265b432c6fc0c25c7ef6dd29261536 | github |
LZZLHY/hlib | entry/src/main/ets/utils/DohResolver.ets | arkts | resolveA | 查询 IPv4(type=A)。失败时返回 ok=false,ips 为空。永不抛异常。 | static async resolveA(hostname: string): Promise<DnsResolveResult> {
const cleaned: string = hostname.replace(/^https?:\/\//, '').replace(/\/+$/, '').trim();
if (cleaned.length === 0) {
return DohResolver.buildResult(cleaned, [], 0, 'empty hostname');
}
// 先试主端点;失败再试 IP 直连端点
const start: num... | 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 resolveA AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left hostname AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#... | static async resolveA(hostname: string): Promise<DnsResolveResult> {
const cleaned: string = hostname.replace(/^https?:\/\//, '').replace(/\/+$/, '').trim();
if (cleaned.length === 0) {
return DohResolver.buildResult(cleaned, [], 0, 'empty hostname');
}
// 先试主端点;失败再试 IP 直连端点
const start: num... | https://github.com/LZZLHY/hlib | 97d018429a1ff9a016859b94e15feda5c392ad29 | github |
chendi126/harmonyOS-TCP | entry/src/main/ets/common/GlassStyles.ets | arkts | getStatusIndicatorBackgroundColor | 获取状态指示器背景色 | static getStatusIndicatorBackgroundColor(isActive: boolean = false): string {
return isActive ? 'rgba(76, 175, 80, 0.2)' : 'rgba(158, 158, 158, 0.2)';
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getStatusIndicatorBackgroundColor AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left isActive AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Righ... | static getStatusIndicatorBackgroundColor(isActive: boolean = false): string {
return isActive ? 'rgba(76, 175, 80, 0.2)' : 'rgba(158, 158, 158, 0.2)';
} | https://github.com/chendi126/harmonyOS-TCP | cbabe2b40d4f300b3bfb9a327e413467ec1b16a3 | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/std/core/String.ets | arkts | trimLeft | Trims all whitespaces from the beginning of this String.
@returns new left trimmed string | public trimLeft(): String {
let firstNotWhiteSpaceIdx: int = this.length();
for (let i: int = 0; i < this.length(); i++) {
if (!Char.isWhiteSpace(this.charAt(i))) {
firstNotWhiteSpaceIdx = i;
break;
}
}
return this.substring(fir... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left trimLeft 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 String AST#id... | public trimLeft(): String {
let firstNotWhiteSpaceIdx: int = this.length();
for (let i: int = 0; i < this.length(); i++) {
if (!Char.isWhiteSpace(this.charAt(i))) {
firstNotWhiteSpaceIdx = i;
break;
}
}
return this.substring(fir... | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 6733aa77db28a4da67e827a9c62c4b331ee1d6e9 | gitee |
openharmony-tpc/ohos_mpchart | library/src/main/ets/components/data/ChartData.ets | arkts | getEntryForHighlight | Get the Entry for a corresponding highlight object
@param highlight
@return the entry that is highlighted | public getEntryForHighlight(highlight: Highlight): EntryOhos | null {
if (!this.mDataSets) {
return null;
}
if (highlight.getDataSetIndex() >= this.mDataSets.size())
return null;
else {
return this.mDataSets.get(highlight.getDataSetIndex()).getEntryForXValue(highlight.getX(), highlig... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getEntryForHighlight AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left highlight AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identi... | public getEntryForHighlight(highlight: Highlight): EntryOhos | null {
if (!this.mDataSets) {
return null;
}
if (highlight.getDataSetIndex() >= this.mDataSets.size())
return null;
else {
return this.mDataSets.get(highlight.getDataSetIndex()).getEntryForXValue(highlight.getX(), highlig... | https://gitee.com/openharmony-tpc/ohos_mpchart.git | 63aec1c282aa14d5ba2a1acd5c5a8c13398e4871 | gitee |
codelably/tuniao-ui | packages/main/src/main/ets/viewmodel/TnCalendarViewModel.ets | arkts | setRange | 设置范围选择模式下的开始和结束日期
@param start 开始日期字符串
@param end 结束日期字符串 | setRange(start: string, end: string): void {
this.rangeStart = start;
this.rangeEnd = end;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left setRange AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left start AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#,#Left , AST#,... | setRange(start: string, end: string): void {
this.rangeStart = start;
this.rangeEnd = end;
} | https://github.com/codelably/tuniao-ui | c6cddb74827ee09eb67d7f29d2dd0404da34f605 | github |
chendi126/harmonyOS-TCP | entry/src/main/ets/common/GlassStyles.ets | arkts | getFloatingPanelBackgroundColor | 获取浮动面板背景色 | static getFloatingPanelBackgroundColor(): string {
return 'rgba(255, 255, 255, 0.9)';
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getFloatingPanelBackgroundColor 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... | static getFloatingPanelBackgroundColor(): string {
return 'rgba(255, 255, 255, 0.9)';
} | https://github.com/chendi126/harmonyOS-TCP | e71e82ec3b18a048b049b9fbcb35f47b6acba1f0 | github |
somnio-software/my-bot-pal | entry/src/main/ets/utils/PermissionUtils.ets | arkts | togglePermission | Toggles a permission state
@param permission The permission to toggle
@returns The new state of the permission | public togglePermission(permission: Permissions): boolean {
const currentValue = this.mockPermissions.get(permission) ?? this.defaultResponse;
const newValue = !currentValue;
this.mockPermissions.set(permission, newValue);
console.log(`[MOCK] Permission ${permission} toggled from ${currentValue} to ${... | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left togglePermission AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left permission AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifie... | public togglePermission(permission: Permissions): boolean {
const currentValue = this.mockPermissions.get(permission) ?? this.defaultResponse;
const newValue = !currentValue;
this.mockPermissions.set(permission, newValue);
console.log(`[MOCK] Permission ${permission} toggled from ${currentValue} to ${... | https://github.com/somnio-software/my-bot-pal | 6f80def8488de93ad434290422d9c484894c8265 | github |
apap6628114/nga_oh | entry/src/main/ets/common/managers/ThreadPaginationManager.ets | arkts | isPrefetchedPrevReady | 反向预取是否就绪。
@returns 是否有可提交的上一页缓存 | isPrefetchedPrevReady(): boolean {
return this.prefetchedPrevPosts.length > 0 && this.prefetchedPrevPage > 0
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left isPrefetchedPrevReady AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right A... | isPrefetchedPrevReady(): boolean {
return this.prefetchedPrevPosts.length > 0 && this.prefetchedPrevPage > 0
} | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/common/managers/ThreadPaginationManager.ets#L186-L188 | 5f2b4a7f9c386ee76bfee32ffd294134b64feb41 | github |
LongLiveY96/chatcube | entry/src/main/ets/viewmodels/ProviderViewModel.ets | arkts | getProviderByIdAsync | 缓存未命中时自动回源 DB | async getProviderByIdAsync(providerId: string): Promise<ModelProvider | null> {
return await this.store.getProviderByIdAsync(providerId)
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left getProviderByIdAsync AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left providerId AST#identifier#Right AST#type_annotation#Left A... | async getProviderByIdAsync(providerId: string): Promise<ModelProvider | null> {
return await this.store.getProviderByIdAsync(providerId)
} | https://github.com/LongLiveY96/chatcube | a4a5c98c9b493cb553b56aa861b7a6bbcef812cf | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Managers/NotificationManager.ets | arkts | sendDownloadProgressNotification | 发送下载进度通知 | public async sendDownloadProgressNotification(
taskId: string,
fileName: string,
current: number,
total: number
): Promise<boolean> {
const progress = this.calculateProgressPercent(current, total);
const progressInfo: ProgressInfo = { current: current, max: total };
const config: Notific... | 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 sendDownloadProgressNotification AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left taskId AST#identifier#R... | public async sendDownloadProgressNotification(
taskId: string,
fileName: string,
current: number,
total: number
): Promise<boolean> {
const progress = this.calculateProgressPercent(current, total);
const progressInfo: ProgressInfo = { current: current, max: total };
const config: Notific... | https://github.com/DaLongZhuaZi/manxia | 162e1bc855933dc0501e95cd7d4e2ebc2f450677 | github |
Harrisonls2004/WaterFlow | entry/src/main/ets/common/utils/MessageManager.ets | arkts | getConversationMessages | Get messages for a conversation (local only, for compatibility). | static async getConversationMessages(conversationId: string): Promise<IMessage[]> {
try {
const allMessages = await MessageManager.getAllMessages();
const conversationMessages = allMessages.filter(msg => msg.conversationId === conversationId);
// Sort by timestamp (oldest first)
con... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#identifier#Left async AST#identifier#Right AST#call_expression#Left AST#identifier#Left getConversationMessages AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left conversationId AST#identifier#Right AST#ERROR#L... | static async getConversationMessages(conversationId: string): Promise<IMessage[]> {
try {
const allMessages = await MessageManager.getAllMessages();
const conversationMessages = allMessages.filter(msg => msg.conversationId === conversationId);
// Sort by timestamp (oldest first)
con... | https://github.com/Harrisonls2004/WaterFlow | 8f388f8616f29b0eb00d1ffb85ff6d4bedfcd873 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/common/utils/DAOHelper.ets | arkts | hardDelete | 硬删除记录(物理删除)
@param tableName 表名
@param idColumn 主键列名
@param id 主键值
@param errorPrefix 错误消息前缀 | static async hardDelete(
tableName: string,
idColumn: string,
id: number,
errorPrefix: string = '[DAO]'
): Promise<void> {
const store = DatabaseManager.getDatabase();
const sql = `DELETE FROM ${tableName} WHERE ${idColumn} = ?`;
try {
await store.executeSql(sql, [id]);
conso... | 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 hardDelete AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left tableName AST#identifier#Right AST#ERROR#Left AST#:#Left : A... | static async hardDelete(
tableName: string,
idColumn: string,
id: number,
errorPrefix: string = '[DAO]'
): Promise<void> {
const store = DatabaseManager.getDatabase();
const sql = `DELETE FROM ${tableName} WHERE ${idColumn} = ?`;
try {
await store.executeSql(sql, [id]);
conso... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | f3e6078fc897c7ee48afd270149c455c4af91dda | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Debug/CrashRecorderService.ets | arkts | registerErrorObserver | 注册全局异常监听器
注册后应用崩溃时进程不会立即退出,可以执行日志保存操作 | private registerErrorObserver(): void {
if (this.isRegistered) {
console.log(`[NGF] ${TAG}: 异常监听器已注册,跳过`);
return;
}
try {
const observer: ErrorObserver = {
onUnhandledException: (errMsg: string): void => {
this.handleCrash(errMsg, '');
},
onException: ... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left registerErrorObserver 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 voi... | private registerErrorObserver(): void {
if (this.isRegistered) {
console.log(`[NGF] ${TAG}: 异常监听器已注册,跳过`);
return;
}
try {
const observer: ErrorObserver = {
onUnhandledException: (errMsg: string): void => {
this.handleCrash(errMsg, '');
},
onException: ... | https://github.com/DaLongZhuaZi/manxia | 8cb710e79c9d5e9eeccbedfc6baeab68b3c3707a | github |
apap6628114/nga_oh | entry/src/main/ets/pages/ProfilePanel.ets | arkts | buildStatItems | 构造个人主页统计项数组(数据驱动 Grid ForEach)。
格式化规则与原 7 个硬编码 GridItem 逐字一致:
posts/money/rvrc 走 fmtNum;regdate 走 formatTime 或兜底「未知」;
group 兜底「普通会员」;fame/followByNum 仅在 >0 时显示。 | private buildStatItems(): StatItem[] {
const items: StatItem[] = []
const p: ProfileData = this.profile!
const s1: StatItem = new StatItem()
s1.iconRes = $r('app.media.icon_chat_bubble')
s1.label = '发帖数'
s1.value = fmtNum(p.posts)
items.push(s1)
const s2: StatItem = new StatItem()
... | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left buildStatItems 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 Stat... | private buildStatItems(): StatItem[] {
const items: StatItem[] = []
const p: ProfileData = this.profile!
const s1: StatItem = new StatItem()
s1.iconRes = $r('app.media.icon_chat_bubble')
s1.label = '发帖数'
s1.value = fmtNum(p.posts)
items.push(s1)
const s2: StatItem = new StatItem()
... | https://github.com/apap6628114/nga_oh/blob/5db5f8174b9a994685dc00fce666367b68c13f78/entry/src/main/ets/pages/ProfilePanel.ets#L151-L202 | 89e373d8fbe8c2fdfafcfcab63d5c97724126f75 | github |
CPF-ApplicationTPC/openharmony_tpc_samples | SwipeMenuListView/library/src/main/ets/model/AnimationConfig.ets | arkts | copy | 复制配置并修改特定属性 | copy(overrides: Partial<AnimationConfig>): AnimationConfig {
let newConfig = new AnimationConfig();
newConfig.duration = overrides.duration ?? this.duration;
newConfig.delay = overrides.delay ?? this.delay;
newConfig.interpolator = overrides.interpolator ?? this.interpolator;
newConfig.customCurve... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left copy AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#instantiation_expression#Left AST#identifier#Left overrides AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#identifier#Left Partial AST#identifier#Right... | copy(overrides: Partial<AnimationConfig>): AnimationConfig {
let newConfig = new AnimationConfig();
newConfig.duration = overrides.duration ?? this.duration;
newConfig.delay = overrides.delay ?? this.delay;
newConfig.interpolator = overrides.interpolator ?? this.interpolator;
newConfig.customCurve... | https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples | 940c438164cd2845c3e71c2d16bbda34e7062d00 | gitcode |
aimilin6688/KeePassHO | entry/src/main/ets/services/store/SyncSettingsService.ets | arkts | pushLocalDataToRemote | 推送本地数据到远端 | private static async pushLocalDataToRemote(): Promise<void> {
try {
hilog.debug(DOMAIN, TAG, 'Pushing local data to remote');
// 推送设置数据
const settingsService = SettingsService.getInstance();
// 获取所有本地设置键,自动发现需要同步的设置
const allSettings = SettingsService.getAll();
const localSet... | 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 pushLocalDataToRemote AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST... | private static async pushLocalDataToRemote(): Promise<void> {
try {
hilog.debug(DOMAIN, TAG, 'Pushing local data to remote');
// 推送设置数据
const settingsService = SettingsService.getInstance();
// 获取所有本地设置键,自动发现需要同步的设置
const allSettings = SettingsService.getAll();
const localSet... | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/store/SyncSettingsService.ets#L588-L623 | ea045e0bc02276c84e83ead4322a4427d6fc0774 | github |
offlinecat-dev/OCNetORM | src/main/ets/decorators/ColumnDecorator.ets | arkts | applyColumnOptions | 应用列选项(仅覆盖已定义字段) | function applyColumnOptions(target: ColumnOptions, options?: DecoratorColumnOptions): ColumnOptions {
if (!options) {
return target
}
if (options.name !== undefined) {
target.name = options.name
}
if (options.type !== undefined) {
target.type = options.type
}
if (options.nullable !== undefined... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left applyColumnOptions AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left target AST#identifier#Right AST#type_annotation#Left AST#:#Left : A... | function applyColumnOptions(target: ColumnOptions, options?: DecoratorColumnOptions): ColumnOptions {
if (!options) {
return target
}
if (options.name !== undefined) {
target.name = options.name
}
if (options.type !== undefined) {
target.type = options.type
}
if (options.nullable !== undefined... | https://github.com/offlinecat-dev/OCNetORM | cae2321da03bb46ef3b74fbc311463dca6de333f | github |
DaLongZhuaZi/manxia | entry/src/main/ets/pages/SourceDetailPage.ets | arkts | prependItems | 在列表顶部插入新项目(用于优雅刷新) | prependItems(newItems: ComicInfo[]): void {
if (newItems.length === 0) return;
this.items = [...newItems, ...this.items];
// 通知数据变化,触发UI更新
const listenersSnapshot: DataChangeListener[] = this.listeners.slice();
listenersSnapshot.forEach(listener => {
listener.onDataAdd(0);
});
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left prependItems AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left newItems AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#subscript_expression#Left AST#identifier#Left ComicInfo... | prependItems(newItems: ComicInfo[]): void {
if (newItems.length === 0) return;
this.items = [...newItems, ...this.items];
// 通知数据变化,触发UI更新
const listenersSnapshot: DataChangeListener[] = this.listeners.slice();
listenersSnapshot.forEach(listener => {
listener.onDataAdd(0);
});
} | https://github.com/DaLongZhuaZi/manxia | 945b58c94858a5916bb89bd87f6f246fb81b1c32 | github |
yongoe1024/RdbPlus | rdbplus/src/main/ets/core/MyWrapper.ets | arkts | getSelect | 获取select | getSelect(): string {
return this.selectSql
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left getSelect AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#ERROR#Right AST#statement_bl... | getSelect(): string {
return this.selectSql
} | https://github.com/yongoe1024/RdbPlus/blob/83f7347b7ac692941729d3464923155948e876bb/rdbplus/src/main/ets/core/MyWrapper.ets#L26-L28 | ce11271513d84aca6dcfd23e399e22b29ded2fc6 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Cache/ImageCacheManager.ets | arkts | loadLocalFile | [新增] 加载本地文件
直接从本地文件系统加载图片,不经过网络 | private async loadLocalFile(
url: string,
cacheKey: string,
options?: LoadOptions
): Promise<image.PixelMap | null> {
try {
// 第一级:内存缓存
if (!options?.skipMemoryCache && !options?.forceRefresh) {
const memoryResult = this.getFromMemoryCache(cacheKey);
if (memoryResult) {
... | 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 loadLocalFile AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left url AST#identifier#Right AST#:#Left : A... | private async loadLocalFile(
url: string,
cacheKey: string,
options?: LoadOptions
): Promise<image.PixelMap | null> {
try {
// 第一级:内存缓存
if (!options?.skipMemoryCache && !options?.forceRefresh) {
const memoryResult = this.getFromMemoryCache(cacheKey);
if (memoryResult) {
... | https://github.com/DaLongZhuaZi/manxia | 0a27244c138fa259e4e0c350d9fbecb920b24955 | github |
richshaw2015/nds | ohos/entry/src/test/InputMappingProperty.test.ets | arkts | generateGamepadMappings | Generate a random GamepadMappingEntry[] with unique buttonCodes.
Returns 1-15 entries with buttonCodes in range [2000, 3999]. | function generateGamepadMappings(rng: PRNG): GamepadMappingEntry[] {
const count = rng.nextInt(1, 15);
const usedCodes = new Set<number>();
const mappings: GamepadMappingEntry[] = [];
for (let i = 0; i < count; i++) {
let buttonCode: number;
do {
buttonCode = rng.nextInt(2000, 3999);
} while ... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left generateGamepadMappings AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left rng AST#identifier#Right AST#type_annotation#Left AST#:#Left :... | function generateGamepadMappings(rng: PRNG): GamepadMappingEntry[] {
const count = rng.nextInt(1, 15);
const usedCodes = new Set<number>();
const mappings: GamepadMappingEntry[] = [];
for (let i = 0; i < count; i++) {
let buttonCode: number;
do {
buttonCode = rng.nextInt(2000, 3999);
} while ... | https://github.com/richshaw2015/nds | d240d79096751c78a78cf5365a76dec70a28700b | github |
LongLiveY96/chatcube | entry/src/main/ets/viewmodels/ChatViewModel.ets | arkts | createPendingSession | 创建待持久化的会话(仅内存中,不保存到数据库) | createPendingSession(
title: string = '',
assistantId: string = 'default',
modelIdSeed: string = '',
providerIdSeed: string = ''
): ChatSession {
const session = this.sessionStore.createPendingSession(title, assistantId, modelIdSeed, providerIdSeed)
this.currentSession = this.session... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left createPendingSession AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left title AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#assignment_expression#Left AST#identifier#Left str... | createPendingSession(
title: string = '',
assistantId: string = 'default',
modelIdSeed: string = '',
providerIdSeed: string = ''
): ChatSession {
const session = this.sessionStore.createPendingSession(title, assistantId, modelIdSeed, providerIdSeed)
this.currentSession = this.session... | https://github.com/LongLiveY96/chatcube | 03e25b646f1db42757efa4d505f918431043b75b | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/TypedUArrays.ets | arkts | findLastIndex | Finds an index of the last element in the Uint8Array 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: Uint8Array) => 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: Uint8Array) => 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 | fcbbaf654366e56d649c080b4c184a6978202cfb | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/database/PerformanceMonitor.ets | arkts | getStats | 获取性能统计报告
@returns 性能统计数据 | static getStats(): Map<string, PerformanceStats> {
return new Map(PerformanceMonitor.stats);
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getStats 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_st... | static getStats(): Map<string, PerformanceStats> {
return new Map(PerformanceMonitor.stats);
} | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 919185c78a15e7fb1ecaebd1f0cca4147571e703 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/usbdriver/UsbDriverService.ets | arkts | shouldClaimDevice | 检查是否应该驱动该设备 | private shouldClaimDevice(device: usbManager.USBDevice): boolean {
return UsbDriverService.identifyKnownGamepad(device) !== null;
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left shouldClaimDevice AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left device AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#member_ex... | private shouldClaimDevice(device: usbManager.USBDevice): boolean {
return UsbDriverService.identifyKnownGamepad(device) !== null;
} | https://github.com/AlkaidLab/moonlight-harmony | 93c1d9aab91023e3a7710e987b79040e0e05a49e | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/JSONPathParser.ets | arkts | parsePathSegments | 解析路径段 | private static parsePathSegments(path: string): string[] {
const segments: string[] = [];
let current = '';
let inBracket = false;
for (let i = 0; i < path.length; i++) {
const char = path[i];
if (char === '[') {
if (current) {
segments.push(current);
current ... | 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 parsePathSegments AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left path AST#identifier#Right AST#:#Le... | private static parsePathSegments(path: string): string[] {
const segments: string[] = [];
let current = '';
let inBracket = false;
for (let i = 0; i < path.length; i++) {
const char = path[i];
if (char === '[') {
if (current) {
segments.push(current);
current ... | https://github.com/DaLongZhuaZi/manxia | 5ac986f1c775bbd9287a0237ab2e2253094e4c31 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/OCRRecognitionDAO.ets | arkts | getHighConfidenceUnused | 获取高置信度未使用记录 | static async getHighConfidenceUnused(
userId: number,
confidenceThreshold: number = 0.85,
limit: number = 10
): Promise<OCRRecognitionRecord[]> {
try {
const store = DatabaseManager.getDatabase();
const sql = `
SELECT *
FROM ${OCRRecognitionRecord.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 getHighConfidenceUnused AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#... | static async getHighConfidenceUnused(
userId: number,
confidenceThreshold: number = 0.85,
limit: number = 10
): Promise<OCRRecognitionRecord[]> {
try {
const store = DatabaseManager.getDatabase();
const sql = `
SELECT *
FROM ${OCRRecognitionRecord.tableName}
WHERE... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 5f2fcb1e0bc29455bdc2f16d061708ff4a815353 | github |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/dao/EventSourcingDAO.ets | arkts | getAllByUser | 获取用户的所有读模型 | static async getAllByUser(userId: number): Promise<ReadModel[]> {
let resultSet: relationalStore.ResultSet | null = null;
try {
const store = DatabaseManager.getDatabase();
const predicates = new relationalStore.RdbPredicates(ReadModel.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 getAllByUser AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left userId AST#identifier#Right AST#:#Left : AS... | static async getAllByUser(userId: number): Promise<ReadModel[]> {
let resultSet: relationalStore.ResultSet | null = null;
try {
const store = DatabaseManager.getDatabase();
const predicates = new relationalStore.RdbPredicates(ReadModel.tableName);
predicates.equalTo('user_id', userId);
... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 65765ab5a3c703996e696506b796477def8da45c | github |
webabcd/HarmonyDemo | entry/src/main/ets/pages/component/progress/GaugeDemo.ets | arkts | buildGauge | 自定义 Gauge | @Builder function buildGauge(config: GaugeConfiguration) {
/*
* GaugeConfiguration - 自定义 Gauge 的相关信息
* enabled - 是否可用
* contentModifier - 绑定的 ContentModifier 对象
* value - 当前值
* min - 最小值
* max - 最大值
*/
Column() {
Gauge({
value: config.value,
min: config.min,
max:... | AST#program#Left AST#function_declaration#Left AST#decorator#Left AST#@#Left @ AST#@#Right AST#identifier#Left Builder AST#identifier#Right AST#decorator#Right AST#function#Left function AST#function#Right AST#identifier#Left buildGauge AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#requir... | @Builder function buildGauge(config: GaugeConfiguration) {
/*
* GaugeConfiguration - 自定义 Gauge 的相关信息
* enabled - 是否可用
* contentModifier - 绑定的 ContentModifier 对象
* value - 当前值
* min - 最小值
* max - 最大值
*/
Column() {
Gauge({
value: config.value,
min: config.min,
max:... | https://github.com/webabcd/HarmonyDemo | f2eaec9923d2e6656fcc34eb0570ba0afcb01709 | github |
David8Idira/AI-OA | packages/harmonyos/commons/src/main/ets/services/ApprovalService.ets | arkts | addCC | 添加审批抄送人
@param approvalId 审批ID
@param userIds 抄送人ID列表 | async addCC(approvalId: string, userIds: string[]): Promise<ApiResponse<any>> {
return this.client.post<any>(`/api/v1/approval/approvals/${approvalId}/cc`, { userIds })
} | AST#program#Left AST#ERROR#Left AST#async#Left async AST#async#Right AST#ERROR#Left AST#identifier#Left addCC AST#identifier#Right AST#ERROR#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left approvalId AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST... | async addCC(approvalId: string, userIds: string[]): Promise<ApiResponse<any>> {
return this.client.post<any>(`/api/v1/approval/approvals/${approvalId}/cc`, { userIds })
} | https://github.com/David8Idira/AI-OA | bb2853e3cdcfd34bd91fb9a70f5fe940fefbc627 | github |
iJcher/openharmony-app-znjj | entry/src/main/ets/tools/preferencesUtil.ets | arkts | getPreference | 获取数据信息 | getPreference(key:string){
return this.Preferences?.getSync(key,'')
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getPreference 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 string AST#identifier#Right ... | getPreference(key:string){
return this.Preferences?.getSync(key,'')
} | https://github.com/iJcher/openharmony-app-znjj | 21d88d87407b9a2e49f5179ab3cdff25e46f0650 | github |
openharmony/codelabs | ETSUI/MemoTime/entry/src/main/ets/service/AudioService.ets | arkts | startDurationTimer | 启动时长计时器 | private startDurationTimer(): void {
this.durationTimer = setInterval(() => {
this.recordingDuration = (Date.now() - this.recordingStartTime) / 1000
if (this.recordingCallback?.onDurationUpdate) {
this.recordingCallback.onDurationUpdate(this.recordingDuration)
}
}, 100)
} | AST#program#Left AST#ERROR#Left AST#private#Left private AST#private#Right AST#call_expression#Left AST#identifier#Left startDurationTimer 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#... | private startDurationTimer(): void {
this.durationTimer = setInterval(() => {
this.recordingDuration = (Date.now() - this.recordingStartTime) / 1000
if (this.recordingCallback?.onDurationUpdate) {
this.recordingCallback.onDurationUpdate(this.recordingDuration)
}
}, 100)
} | https://gitcode.com/openharmony/codelabs | d9ef41acf5eeb2f550a328b3d6a0efaa25d2ac1d | gitcode |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Novel/NovelSourceValidator.ets | arkts | sendProgressNotification | 发送进度通知(限制更新频率) | private async sendProgressNotification(
current: number,
total: number,
validCount: number,
invalidCount: number
): Promise<void> {
const now = Date.now();
// 限制通知更新频率,避免过于频繁
if (now - this.lastNotificationTime < this.notificationInterval && current !== 0 && current !== total) {
re... | 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 sendProgressNotification AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left current AST#identifier#Right AST#ERROR#Left... | private async sendProgressNotification(
current: number,
total: number,
validCount: number,
invalidCount: number
): Promise<void> {
const now = Date.now();
// 限制通知更新频率,避免过于频繁
if (now - this.lastNotificationTime < this.notificationInterval && current !== 0 && current !== total) {
re... | https://github.com/DaLongZhuaZi/manxia | ba48f029ad46ca522953c55dbdb59f786ef70d73 | github |
DaLongZhuaZi/NGF | ngf_framework/src/main/ets/utils/PerformanceMonitor.ets | arkts | mark | 记录性能打点 | mark(name: string): void {
const normalizedName = name.trim();
if (normalizedName.length <= 0) {
return;
}
const now = Date.now();
this.marks.set(normalizedName, new NGFPerformanceMark(normalizedName, now));
logger.debug(TAG, '打点: ' + normalizedName + ', 时间=' + now);
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left mark AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left name AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Right AST#)#Left ) AST#)#Righ... | mark(name: string): void {
const normalizedName = name.trim();
if (normalizedName.length <= 0) {
return;
}
const now = Date.now();
this.marks.set(normalizedName, new NGFPerformanceMark(normalizedName, now));
logger.debug(TAG, '打点: ' + normalizedName + ', 时间=' + now);
} | https://github.com/DaLongZhuaZi/NGF | a654566946ecb718c67eef60740539d4b5a32e22 | github |
openharmony-tpc/XmlGraphicsBatik | library/src/main/ets/batik/svggen/SVGSpecifiedFormat.ets | arkts | getElementName | 获取节点名称 | public getElementName(): string{
return this._formatResultObj[SVGAttrConstants.ATTR_KEY_NAME]as string;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left getElementName 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#... | public getElementName(): string{
return this._formatResultObj[SVGAttrConstants.ATTR_KEY_NAME]as string;
} | https://gitee.com/openharmony-tpc/XmlGraphicsBatik.git | cbe0e3473a1ec827b92b82ced5a1cfc1e1a0fa35 | gitee |
CLMC2025/Vignette | entry/src/main/ets/vocabulary/SnowballSystem.ets | arkts | getAssociations | 获取词汇关联 | getAssociations(word: string): WordAssociation[] {
const associations: WordAssociation[] = [];
this.associations.forEach((assocList: WordAssociation[], key: string) => {
if (key.startsWith(word.toLowerCase())) {
associations.push(...assocList);
}
});
return associations;
} | AST#program#Left AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left getAssociations AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left word AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left string AST#identifier#Rig... | getAssociations(word: string): WordAssociation[] {
const associations: WordAssociation[] = [];
this.associations.forEach((assocList: WordAssociation[], key: string) => {
if (key.startsWith(word.toLowerCase())) {
associations.push(...assocList);
}
});
return associations;
} | https://github.com/CLMC2025/Vignette | 431433b02615df2dafc48b6279191cb54d45f189 | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Storage/StorageAnalyzer.ets | arkts | analyzeTempFiles | 分析临时文件 | private async analyzeTempFiles(): Promise<StorageItem> {
try {
const tempPath = this.sandboxManager.getDirectory('temp');
const dirInfo = await this.getDirectoryInfo(tempPath);
const size = dirInfo.size;
const count = dirInfo.count;
return {
type: StorageType.TEMP_FILE... | 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 analyzeTempFiles AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right ... | private async analyzeTempFiles(): Promise<StorageItem> {
try {
const tempPath = this.sandboxManager.getDirectory('temp');
const dirInfo = await this.getDirectoryInfo(tempPath);
const size = dirInfo.size;
const count = dirInfo.count;
return {
type: StorageType.TEMP_FILE... | https://github.com/DaLongZhuaZi/manxia | 9b8d5d40c621573ca6a9ef630f3f4f30ab23f01e | github |
aimilin6688/KeePassHO | entry/src/main/ets/services/template/TemplateBuilder.ets | arkts | withNoExpiry | 设置不过期 | withNoExpiry(): TemplateBuilder {
this.entry.times.expires = false;
return this;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left withNoExpiry 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 TemplateBuilder AST#identifier#Right AST#ERROR#Ri... | withNoExpiry(): TemplateBuilder {
this.entry.times.expires = false;
return this;
} | https://github.com/aimilin6688/KeePassHO/blob/6ac299504782abfed903b23a13c736b0841388d9/entry/src/main/ets/services/template/TemplateBuilder.ets#L185-L188 | 86a94ed1202c4595d0439b0c86bf65954dc6e381 | github |
SMAT-Lab/PhantomRendering | example/entry/src/main/ets/common/DeviceUtils.ets | arkts | getHeightPercent | 获取相对屏幕高度的百分比 | static getHeightPercent(percent: number): number {
return Math.round(DeviceUtils.getScreenHeight() * percent / 100)
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left getHeightPercent AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left percent AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#numbe... | static getHeightPercent(percent: number): number {
return Math.round(DeviceUtils.getScreenHeight() * percent / 100)
} | https://github.com/SMAT-Lab/PhantomRendering | c5b66eb39ceec79512e536dd752701507fad4b0c | github |
openharmony-sig/arkcompiler_runtime_core | plugins/ets/stdlib/escompat/Date.ets | arkts | setMilliseconds | Sets the milliseconds for a specified date according to local time.
@param value new ms | public setMilliseconds(value: short): void {
let ms = ecmaMsFromTime(this.ms - this.TZOffset * 60 * msPerSecond);
this.ms -= ms;
this.ms += value;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#call_expression#Left AST#identifier#Left setMilliseconds AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left value AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left... | public setMilliseconds(value: short): void {
let ms = ecmaMsFromTime(this.ms - this.TZOffset * 60 * msPerSecond);
this.ms -= ms;
this.ms += value;
} | https://gitee.com/openharmony-sig/arkcompiler_runtime_core.git | 8e9a9998c39af49bfd21c841458839c3b01e6bd1 | gitee |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/clipboard/ClipboardSyncConfig.ets | arkts | buildRefPayload | Build a small JSON payload for KIND_REF. | static buildRefPayload(ref: ClipboardBlobRef): Uint8Array {
const normalized: ClipboardBlobRef = {
type: 'ref',
id: ref.id,
mime: ref.mime,
size: Math.max(0, Math.floor(ref.size))
}
return StringUtil.stringToUint8Array(JSON.stringify(normalized))
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left buildRefPayload AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ref AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#identifier#Left C... | static buildRefPayload(ref: ClipboardBlobRef): Uint8Array {
const normalized: ClipboardBlobRef = {
type: 'ref',
id: ref.id,
mime: ref.mime,
size: Math.max(0, Math.floor(ref.size))
}
return StringUtil.stringToUint8Array(JSON.stringify(normalized))
} | https://github.com/AlkaidLab/moonlight-harmony | f04f93c0555249c5fbe3d241dfea06318a795201 | github |
popsiclelmlm/Hey | entry/src/main/ets/features/nodes/NodeDetailFields.ets | arkts | buildSecurity | ---- 安全:security=tls/reality 时展示 SNI/指纹/ALPN/REALITY 公钥等 ---- | function buildSecurity(stream: Record<string, Object>): Array<NodeDetailField> {
const fields: Array<NodeDetailField> = [];
const security: string = stringValue(stream['security']).toLowerCase();
if (security !== 'tls' && security !== 'reality') {
return fields;
}
pushField(fields, 'node.field.security', ... | AST#program#Left AST#function_declaration#Left AST#function#Left function AST#function#Right AST#identifier#Left buildSecurity AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#required_parameter#Left AST#identifier#Left stream AST#identifier#Right AST#type_annotation#Left AST#:#Left : AST#:#... | function buildSecurity(stream: Record<string, Object>): Array<NodeDetailField> {
const fields: Array<NodeDetailField> = [];
const security: string = stringValue(stream['security']).toLowerCase();
if (security !== 'tls' && security !== 'reality') {
return fields;
}
pushField(fields, 'node.field.security', ... | https://github.com/popsiclelmlm/Hey | ddb1448a9bce6ab308c0b5c81c23f70041955baf | github |
CPF-ApplicationTPC/openharmony_tpc_samples | amqplib/entry/src/main/ets/pages/001_ConnectClosePage.ets | arkts | build | ─── UI 构建 ────────────────────────────────────────────────────────────── | build() {
Scroll() {
Column({ space: 16 }) {
// 页面标题
Text($r('app.string.demo_001_title'))
.fontSize(20)
.fontWeight(FontWeight.Bold)
.width('100%')
.textAlign(TextAlign.Center)
.padding({ top: 16 })
// 服务器地址输入
TextInput({ te... | 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() {
Scroll() {
Column({ space: 16 }) {
// 页面标题
Text($r('app.string.demo_001_title'))
.fontSize(20)
.fontWeight(FontWeight.Bold)
.width('100%')
.textAlign(TextAlign.Center)
.padding({ top: 16 })
// 服务器地址输入
TextInput({ te... | https://gitcode.com/CPF-ApplicationTPC/openharmony_tpc_samples | f9eaa1331e56e210b654c09a550c9157e9e5fbeb | gitcode |
AGenUI/AGenUI | playground/harmony/entry/src/main/ets/stability/StabilityScenarioEngine.ets | arkts | pickRandom | Pick a random stress scenario | pickRandom(available: string[]): string {
return available[Math.floor(Math.random() * available.length)];
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left pickRandom AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left available AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#string#Left string AST#string#Right AST#[#Left [ AST#[#Right AST#]#Left ... | pickRandom(available: string[]): string {
return available[Math.floor(Math.random() * available.length)];
} | https://github.com/AGenUI/AGenUI | 182eadc3d5096b35b042d9b9d880fbbf36b710ab | github |
DaLongZhuaZi/manxia | entry/src/main/ets/Framework/Utils/TimeUtils.ets | arkts | isValidTimestamp | 验证时间戳是否有效
@param timestamp - 时间戳
@returns 是否有效 | static isValidTimestamp(timestamp: number): boolean {
return !isNaN(timestamp) && timestamp > 0 && timestamp <= Date.now() + 86400000; // 允许未来24小时内的时间
} | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left isValidTimestamp AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#identifier#Left timestamp AST#identifier#Right AST#ERROR#Left AST#:#Left : AST#:#Right AST#number#Left number AST#num... | static isValidTimestamp(timestamp: number): boolean {
return !isNaN(timestamp) && timestamp > 0 && timestamp <= Date.now() + 86400000; // 允许未来24小时内的时间
} | https://github.com/DaLongZhuaZi/manxia | b28cbafb3a0c448c18cf4b9416b4a00d5bd5e3ad | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/SettingsService.ets | arkts | getAdvancedSettings | 获取高级设置 | async getAdvancedSettings(): Promise<AdvancedSettings> {
return {
decoderBufferCount: await this.getNumber(SettingsKeys.DECODER_BUFFER_COUNT, 0),
enableSyncDecode: await this.getBoolean(SettingsKeys.ENABLE_SYNC_DECODE, false), // 默认禁用
enableVrr: await this.getBoolean(SettingsKeys.ENABLE_VRR, fa... | AST#program#Left AST#expression_statement#Left AST#identifier#Left async AST#identifier#Right AST#ERROR#Left AST#identifier#Left getAdvancedSettings AST#identifier#Right AST#formal_parameters#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#formal_parameters#Right AST#type_annotation#Left AST#:#Left : AST#:#R... | async getAdvancedSettings(): Promise<AdvancedSettings> {
return {
decoderBufferCount: await this.getNumber(SettingsKeys.DECODER_BUFFER_COUNT, 0),
enableSyncDecode: await this.getBoolean(SettingsKeys.ENABLE_SYNC_DECODE, false), // 默认禁用
enableVrr: await this.getBoolean(SettingsKeys.ENABLE_VRR, fa... | https://github.com/AlkaidLab/moonlight-harmony | c6b08f472fa39b2b773ac404a3e1746960859676 | github |
openharmony-sig/applications_clock | feature/timer/src/main/ets/controller/TimerController.ets | arkts | setTimeListUpdateListener | Set the record time list change listening
@param listener | public setTimeListUpdateListener(listener: (timeList: Array<number>, lastTimeMs: number) => void) {
LogUtil.info(`${TAG} setTimeListUpdateListener`);
this.timeListUpdateListener = listener;
} | AST#program#Left AST#ERROR#Left AST#public#Left public AST#public#Right AST#ERROR#Right AST#expression_statement#Left AST#call_expression#Left AST#identifier#Left setTimeListUpdateListener AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#call_expression#Left AST#member_expression#Left AST#call_expre... | public setTimeListUpdateListener(listener: (timeList: Array<number>, lastTimeMs: number) => void) {
LogUtil.info(`${TAG} setTimeListUpdateListener`);
this.timeListUpdateListener = listener;
} | https://gitee.com/openharmony-sig/applications_clock.git | 09887cdc2be4819f641b2a63e104fb2bf6cff367 | gitee |
openharmony-tpc/VCard | library/src/main/ets/components/VCardParserImpl_V21.ets | arkts | maybeUnescapeCharacter | Returns unescaped String if the character should be unescaped. Return
null otherwise. e.g. In vCard 2.1, "\;" should be unescaped into ";"
while "\x" should not be. | protected maybeUnescapeCharacter(ch: number): string | null {
return VCardParserImpl_V21.unescapeCharacter(ch);
} | AST#program#Left AST#ERROR#Left AST#protected#Left protected AST#protected#Right AST#call_expression#Left AST#identifier#Left maybeUnescapeCharacter AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#ERROR#Left AST#identifier#Left ch AST#identifier#Right AST#:#Left : AST#:#Right AST#ERROR#Right AST#id... | protected maybeUnescapeCharacter(ch: number): string | null {
return VCardParserImpl_V21.unescapeCharacter(ch);
} | https://gitee.com/openharmony-tpc/VCard.git | 3868b069a771c8bfe725beb0cc2b7c9b91c3532c | gitee |
wblxr408/SEU-SE-HarmonyExpense-App- | entry/src/main/ets/model/FinancialHealth.ets | arkts | createDefaultDimensions | 创建默认维度评分 | static createDefaultDimensions(): HealthDimensions {
const defaultDimension: DimensionScore = {
name: '',
score: 0,
weight: 0.125,
weightedScore: 0,
grade: GRADE_FAIR,
actualValue: 0,
targetValue: 0,
benchmarkValue: 0,
description: '',
improvement: ''
... | AST#program#Left AST#ERROR#Left AST#static#Left static AST#static#Right AST#call_expression#Left AST#identifier#Left createDefaultDimensions 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#Lef... | static createDefaultDimensions(): HealthDimensions {
const defaultDimension: DimensionScore = {
name: '',
score: 0,
weight: 0.125,
weightedScore: 0,
grade: GRADE_FAIR,
actualValue: 0,
targetValue: 0,
benchmarkValue: 0,
description: '',
improvement: ''
... | https://github.com/wblxr408/SEU-SE-HarmonyExpense-App- | 41fee59ffbfd6f4409bf4e632301c3060083a789 | github |
AlkaidLab/moonlight-harmony | entry/src/main/ets/service/input/DeviceSensorService.ets | arkts | hasAccelerometer | 检测设备是否有加速度计传感器 | hasAccelerometer(): boolean {
this.checkAvailability();
return this.accelAvailable;
} | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left hasAccelerometer AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right AST#st... | hasAccelerometer(): boolean {
this.checkAvailability();
return this.accelAvailable;
} | https://github.com/AlkaidLab/moonlight-harmony | fc7367817ebfbea23e670ac3dd4de60598443aa7 | github |
openharmony-sig/fluttertpc_flutter_qr_reader | ohos/src/main/ets/me/hetian/flutter_qr_reader/components/viewmodel/CustomScanViewModel.ets | arkts | updateFlashLightStatus | 更新相机闪光灯状态
@returns {void} | updateFlashLightStatus(): boolean {
// 根据当前闪光灯状态,选择打开或关闭闪关灯
try {
let isCameraLightOpen: boolean = false;
if (customScan.getFlashLightStatus()) {
customScan.closeFlashLight();
isCameraLightOpen = false;
} else {
customScan.openFlashLight();
isCameraLightOpen =... | AST#program#Left AST#ERROR#Left AST#call_expression#Left AST#identifier#Left updateFlashLightStatus AST#identifier#Right AST#arguments#Left AST#(#Left ( AST#(#Right AST#)#Left ) AST#)#Right AST#arguments#Right AST#call_expression#Right AST#:#Left : AST#:#Right AST#boolean#Left boolean AST#boolean#Right AST#ERROR#Right ... | updateFlashLightStatus(): boolean {
// 根据当前闪光灯状态,选择打开或关闭闪关灯
try {
let isCameraLightOpen: boolean = false;
if (customScan.getFlashLightStatus()) {
customScan.closeFlashLight();
isCameraLightOpen = false;
} else {
customScan.openFlashLight();
isCameraLightOpen =... | https://gitee.com/openharmony-sig/fluttertpc_flutter_qr_reader.git | a97e69e801d2b87f28449c8fc0008026bb4bc13a | gitee |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.