Class EventPoller

The EventPoller class provides a convenient way to poll events from the Massa network.

Hierarchy

  • EventEmitter
    • EventPoller

Constructors

Methods

Constructors

  • Constructor of the EventPoller object.

    Parameters

    • provider: PublicProvider

      The provider to use for polling.

    • eventsFilter: EventFilter

      The filter to use for the events.

    • pollIntervalMs: number

      The interval in milliseconds to poll for events.

    Returns EventPoller

Methods

  • Starts polling for events and returns the stopPolling function.

    Parameters

    • provider: PublicProvider

      The provider to use for polling.

    • eventsFilter: EventFilter

      The filter to use for the events.

    • Optional onData: ((data) => void)

      The callback function to call when new events are found.

        • (data): void
        • Parameters

          • data: OutputEvents

          Returns void

    • Optional onError: ((err) => void)

      The callback function to call when an error occurs.

        • (err): void
        • Parameters

          • err: Error

          Returns void

    • pollIntervalMs: number = DEFAULT_POLL_INTERVAL_MS

      The interval in milliseconds to poll for events. Default is 1000Ms.

    Returns {
        stopPolling: (() => void);
    }

    An object containing the stopPolling function.

    • stopPolling: (() => void)
        • (): void
        • Returns void