Skip to content

Add 'once' support #61

@ivanpochta

Description

@ivanpochta

Hello, guys).

Just discovered that Stream extends EventEmitter, and EventEmitter has once() method, which really helpful in some cases.

Can you add, please, once(event: "report", listener: (report: Report) => void): this; to IStream?)

Current workaround is:

return new Promise<IPullPriceFeedResponse>(async (resolve, reject) => {
      (this.stream as unknown as EventEmitter).once('report', (report) => {
        try {
          const decoded = decodeReport(report.fullReport, report.feedID) as DecodedV3Report;

          resolve(decoded);
        } catch (error) {
          reject(error);
        }
      })
    })

Best regards.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions