Skip to content
Discussion options

You must be logged in to vote

You don't need to call await on a promise as soon as you have it. You can create a promise, store it in a variable, then await it later.

This would skip the need for a replay subject:

  private async isBatchPickupSupportedByMediator(mediator: MediationRecord) {
    const { protocolUri } = parseMessageType(BatchPickupMessage.type)

    // Listen for response to our feature query
    const response = firstValueFrom(
      this.eventEmitter
        .observable<AgentMessageProcessedEvent>(AgentEventTypes.AgentMessageProcessed)
        .pipe(
          ...
        )
     )

    // This is the method that may trigger an event
    await this.discoverFeaturesModule.queryFeatures(mediator.connecti…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by TimoGlastra
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants