obsidian-dev-utils
Version:
This is the collection of useful functions that you can use for your Obsidian plugin development
32 lines (31 loc) • 1.28 kB
text/typescript
/**
* @packageDocumentation
*
* Contains utility functions for enqueuing and processing functions in Obsidian.
*/
import type { App } from 'obsidian';
import type { Promisable } from 'type-fest';
/**
* Adds an asynchronous function to be executed after the previous function completes.
*
* @param app - The Obsidian application instance.
* @param fn - The function to add.
* @param timeoutInMilliseconds - The timeout in milliseconds.
* @param stackTrace - Optional stack trace.
*/
export declare function addToQueue(app: App, fn: () => Promisable<void>, timeoutInMilliseconds?: number, stackTrace?: string): void;
/**
* Adds an asynchronous function to be executed after the previous function completes and returns a {@link Promise} that resolves when the function completes.
*
* @param app - The Obsidian application instance.
* @param fn - The function to add.
* @param timeoutInMilliseconds - The timeout in milliseconds.
* @param stackTrace - Optional stack trace.
*/
export declare function addToQueueAndWait(app: App, fn: () => Promisable<void>, timeoutInMilliseconds?: number, stackTrace?: string): Promise<void>;
/**
* Flushes the queue;
*
* @param app - The Obsidian application instance.
*/
export declare function flushQueue(app: App): Promise<void>;