import type { Plugin } from './interfaces'; export declare type Arguments = [T] extends [(...args: infer U) => any] ? U : [T] extends [void] ? [] : [T]; export default class PluginManager { constructor(plugins?: Plugin[]); private plugins; /** * Call `event` on plugins */ emit(eventName: K, data: Arguments[0]): void; /** * Emit an event and get the first non-undefined return value. * Returning a value from the handler will cancel the rest of the plugin chain. */ getFirst(eventName: K, data: Arguments[0]): R | undefined; /** * Add a plugin to the beginning of the list of plugins */ addFirst(plugin: Plugin): void; /** * Add a plugin to the end of the list of plugins */ add(plugin: Plugin): void; has(plugin: Plugin): boolean; remove(plugin: Plugin): void; }