@byloth/vuert
Version:
The headless alerts, modals, notifications & popups library for Vue.js craftsmen. ℹ
28 lines (27 loc) • 1.35 kB
TypeScript
import { 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> = (alert: AlertOptions<R>) => Context<R> | void;
export default class Vuert {
static readonly VERSION: string;
static get DEFAULT_OPTS(): VuertOptions;
protected _subscribers: VuertSubscriber<any>[];
protected _throttlers: Map<symbol, number>;
protected _options: VuertOptions;
get options(): VuertOptions;
protected _throttle: <R>(alert: AlertOptions<R>) => boolean;
constructor(options?: Partial<VuertOptions>);
emit<R = void>(alert: BlockingAlert<R>): Context<R>;
emit<R = void>(alert: DismissibleAlert<R>): Context<R | void>;
emit<R = void>(alert: BlockingCustomAlert<R>): Context<R>;
emit<R = void>(alert: DismissibleCustomAlert<R>): Context<R | void>;
emit<R = void>(alert: AlertOptions<R>): Context<R | void>;
subscribe<R>(subscriber: VuertSubscriber<R>): () => VuertSubscriber<R>;
}