Vinyl
    Preparing search index...

    An object that may dispatch events and have handlers for those events. Similar to the DOM's EventTarget, this is a basic event system based on event naming.

    Some of the advantages of EventHost over EventTarget:

    • Not all supported platforms support EventTarget construction or extension.
    • EventTarget is designed for the DOM, with bubble and capture phases not necessary in Vinyl.
    • Event types are strict.
    • Events can be plain objects, no need to extend CustomEvent.
    • Easier unsubscription and disposal; reduces the risk of memory leaks.

    EventHost supports concurrent modification, that is, handlers may be added or removed during the execution of another handler.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    logPrefix: string = ...

    A string prefix for all log statements made by this target.

    Accessors

    • get "[toStringTag]"(): string

      Returns string

    Methods

    • Dispatches an event.

      Type Parameters

      • K extends "error"

      Parameters

      • type: K

        The key of the event within EventMap

      • event: ErrorReporterEventMap[K]

        If the passed event is read-only, then it may be re-used/cached. Otherwise, it should be a new event object every dispatch. If no target property is set on the event, the target will be set to this host.

      Returns void

    • Returns true if the event host has any listeners.

      Returns boolean

    • Returns true if the event host has any listeners for the given type.

      Parameters

      • type: "error"

      Returns boolean

    • Dispatches an error event.

      Parameters

      Returns void