@byloth/vuert
Version:
The headless alerts, modals, notifications & popups library for Vue.js craftsmen. ℹ
28 lines (27 loc) • 1.75 kB
TypeScript
import type { Context } from "./models/index.js";
import type { Duration } from "./types/index.js";
import type { AlertOptions } from "./types/alert/index.js";
import type { BlockingAlert, DismissibleAlert } from "./types/alert/simple.js";
import type { BlockingCustomAlert, DismissibleCustomAlert } from "./types/alert/custom.js";
export interface VuertOptions {
useThrottling: boolean;
throttlingDuration: number;
transitionDuration: number | Duration;
}
export type VuertSubscriber<R = void, P extends Record<string, unknown> = never> = (alert: AlertOptions<R, P>) => Context<R, P> | void;
export default class Vuert {
static readonly VERSION: string;
static get DEFAULT_OPTS(): VuertOptions;
protected _subscribers: VuertSubscriber<any, any>[];
protected _throttlers: Map<symbol, number>;
protected _options: VuertOptions;
get options(): VuertOptions;
protected _throttle: <R, P extends Record<string, unknown>>(alert: AlertOptions<R, P>) => boolean;
constructor(options?: Partial<VuertOptions>);
emit<R = void, P extends Record<string, unknown> = never>(alert: BlockingAlert<R, P>): Context<R, P>;
emit<R = void, P extends Record<string, unknown> = never>(alert: DismissibleAlert<R, P>): Context<R | void, P>;
emit<R = void, P extends Record<string, unknown> = never>(alert: BlockingCustomAlert<R, P>): Context<R, P>;
emit<R = void, P extends Record<string, unknown> = never>(alert: DismissibleCustomAlert<R, P>): Context<R | void, P>;
emit<R = void, P extends Record<string, unknown> = never>(alert: AlertOptions<R, P>): Context<R | void, P>;
subscribe<R = void, P extends Record<string, unknown> = never>(subscriber: VuertSubscriber<R, P>): () => VuertSubscriber<R, P>;
}