Skip to content

Conversation

@k-wasniowski
Copy link

@k-wasniowski k-wasniowski commented Dec 10, 2025

Add emitAsync method to TypedEvent

Summary

This PR adds a new emitAsync method to the TypedEvent class that allows emitting events and waiting for all handlers (including async handlers) to complete before resolving.

Motivation

The existing emit method is fire-and-forget, which doesn't provide a way to:

  • Wait for async event handlers to complete
  • Ensure all handlers have finished executing before proceeding
  • Handle async workflows that depend on event handler completion

This is particularly useful in scenarios where:

  • Event handlers perform async operations (API calls, database queries, etc.)
  • The caller needs to know when all event processing is complete
  • Sequential processing is required after event emission

This change implements...

  • A new feature
  • A bug fix
  • Other (please specify):

Is this a breaking change?

  • Yes
  • No

I certify that...

  • All relevant unit and integration tests have passed and/or have been updated according to this change.

Generative AI (GAI) Usage Disclosure

Reference: Cisco GAI Coding Guidelines

  • Cisco approved GAI tool/IDE was used for coding - eg: VSCode, Cursor, Windsurf, Codex, Claude code
  • No GAI - Code was written entirely manually without GAI assistance

If a GAI tool/IDE was used then select the category that best describes GAI usage in this PR:

  • Manual Draft with GAI Refinement - I/we created a draft manually that was non-substantively modified by GAI (e.g., refactoring was performed by GAI on manually written code) (Default)
  • GAI Draft with Manual Customization - GAI tool was used to create a draft that I/we subsequently customized or modified.
  • GAI Generated Code - Code was generated entirely by GAI

Additional GAI Usage Details (Optional):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants