Plugins.d.ts 684 B

12345678910111213141516
  1. import { CreateOptionsType, LooseOptionsType } from './Options';
  2. import { EmblaCarouselType } from './EmblaCarousel';
  3. import { OptionsHandlerType } from './OptionsHandler';
  4. export type LoosePluginType = {
  5. [key: string]: unknown;
  6. };
  7. export type CreatePluginType<TypeA extends LoosePluginType, TypeB extends LooseOptionsType> = TypeA & {
  8. name: string;
  9. options: Partial<CreateOptionsType<TypeB>>;
  10. init: (embla: EmblaCarouselType, OptionsHandler: OptionsHandlerType) => void;
  11. destroy: () => void;
  12. };
  13. export interface EmblaPluginsType {
  14. [key: string]: CreatePluginType<LoosePluginType, {}>;
  15. }
  16. export type EmblaPluginType = EmblaPluginsType[keyof EmblaPluginsType];