improve plugin docu

This commit is contained in:
Rene Haas
2022-10-13 14:03:59 +02:00
parent 5971493cc1
commit 1599409e79
2 changed files with 11 additions and 1 deletions
@@ -86,7 +86,7 @@ export type Initialization = {
};
/** The initialization target element. */
export type InitializationTargetElement = HTMLElement | HTMLTextAreaElement;
export type InitializationTargetElement = HTMLElement; // | HTMLTextAreaElement;
/**
* The initialization target object.
@@ -1,9 +1,19 @@
import { each, isArray, keys, push } from '~/support';
import type { OverlayScrollbars, OverlayScrollbarsStatic } from '~/overlayscrollbars';
/** Describes the instance of a OverlayScrollbars plugin. */
export type PluginInstance =
/** A `static` plugin. Its neither bound to a instance nor to the static object. */
| Record<string, unknown>
/**
* A plugin which is bound to either a instance or to the static object.
* The function will be called multiple times. Once with the static object and each time a new instance is created.
* The plugin then can add new methods or fields to thow objects.
* These plugins should be side-effect free and deterministic. (same input produces same output)
*/
| ((staticObj?: OverlayScrollbarsStatic, instanceObj?: OverlayScrollbars) => void);
/** Describes a OverlayScrollbars plugin. */
export type Plugin<T extends PluginInstance = PluginInstance> = {
[pluginName: string]: T;
};