h5p-types
    Preparing search index...

    Interface IH5PContentType<TParams>

    interface IH5PContentType<TParams = unknown> {
        off: <TData = unknown>(
            type: string,
            listener?: (event: TData) => void,
        ) => void;
        on: <TData = unknown, TType extends string = string>(
            type: TType,
            listener: EventListener<TData, TType>,
            thisArg?: ThisType<unknown>,
        ) => void;
        once: <TData = unknown, TType extends string = string>(
            type: TType,
            listener: EventListener<TData, TType>,
            thisArg?: ThisType<unknown>,
        ) => void;
        params?: TParams;
        trigger: <TData = unknown>(
            event: unknown,
            eventData?: TData,
            extras?: { bubbles?: boolean; external?: boolean },
        ) => void;
        triggerXAPI: (verb: XAPIVerb, extra: unknown) => void;
        attach($wrapper: JQuery<HTMLElement>): void;
        createXAPIEventTemplate<TVerb extends XAPIVerb>(
            verb: TVerb,
            extra: unknown,
        ): XAPIEvent;
    }

    Type Parameters

    • TParams = unknown

    Hierarchy (View Summary)

    Index

    Properties

    off: <TData = unknown>(type: string, listener?: (event: TData) => void) => void

    Remove event listener If no listener is specified, all listeners will be removed

    Type declaration

      • <TData = unknown>(type: string, listener?: (event: TData) => void): void
      • Type Parameters

        • TData = unknown

        Parameters

        • type: string

          Event type

        • Optionallistener: (event: TData) => void

          Event listener

        Returns void

    listener must be a function

    on: <TData = unknown, TType extends string = string>(
        type: TType,
        listener: EventListener<TData, TType>,
        thisArg?: ThisType<unknown>,
    ) => void

    Add new event listener

    Type declaration

      • <TData = unknown, TType extends string = string>(
            type: TType,
            listener: EventListener<TData, TType>,
            thisArg?: ThisType<unknown>,
        ): void
      • Type Parameters

        • TData = unknown
        • TType extends string = string

        Parameters

        • type: TType

          Event type. If the event type is xAPI, the listener's event parameter will be of type XAPIEvent. Any dispatched XAPIEvent will trigger the xAPI event.

        • listener: EventListener<TData, TType>

          Event listener

        • OptionalthisArg: ThisType<unknown>

          Optionally specify the listener's this value

        Returns void

    listener must be a function

    once: <TData = unknown, TType extends string = string>(
        type: TType,
        listener: EventListener<TData, TType>,
        thisArg?: ThisType<unknown>,
    ) => void

    Add new event listener that will be fired only once

    Type declaration

      • <TData = unknown, TType extends string = string>(
            type: TType,
            listener: EventListener<TData, TType>,
            thisArg?: ThisType<unknown>,
        ): void
      • Type Parameters

        • TData = unknown
        • TType extends string = string

        Parameters

        • type: TType

          Event type. If the event type is xAPI, the listener's event parameter will be of type XAPIEvent. Any dispatched XAPIEvent will trigger the xAPI event.

        • listener: EventListener<TData, TType>

          Event listener

        • OptionalthisArg: ThisType<unknown>

          Optionally specify the listener's this value

        Returns void

    listener must be a function

    params?: TParams
    trigger: <TData = unknown>(
        event: unknown,
        eventData?: TData,
        extras?: { bubbles?: boolean; external?: boolean },
    ) => void

    Dispatch event

    Type declaration

      • <TData = unknown>(
            event: unknown,
            eventData?: TData,
            extras?: { bubbles?: boolean; external?: boolean },
        ): void
      • Type Parameters

        • TData = unknown

        Parameters

        • event: unknown

          Event object or event type as string

        • OptionaleventData: TData

          Custom event data (used when event type as string is used as first argument)

        • Optionalextras: { bubbles?: boolean; external?: boolean }

        Returns void

    triggerXAPI: (verb: XAPIVerb, extra: unknown) => void

    Methods

    • Parameters

      Returns void