Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(events): Fuller example with pub/sub #3232

Merged
merged 5 commits into from
Oct 2, 2024

Conversation

kamranayub
Copy link
Member

@kamranayub kamranayub commented Oct 2, 2024

===:clipboard: PR Checklist :clipboard:===

  • 📌 issue exists in github for these changes
  • 🔬 existing tests still pass
  • 🙈 code conforms to the style guide
  • 📐 new tests written and passing / old tests updated with new scenario(s)
  • 📄 changelog entry added (or not needed)

==================

Preview

https://kamranayub-docs-events-pubsu.excaliburjs.pages.dev/docs/events#pubsub-or-signal-based-event-bus

Changes

  • Add a Shiki Twoslash example implementing custom event handling
  • Show how to achieve a pub/sub emitter
  • Show how to achieve higher strictness on event name handling
  • Clean up existing verbiage and add some more context

Notes

  • Inspired by @jyoung4242's post about Signals and Pub/Sub, I noticed our docs lacked info about this use case. When I dug into it, the existing example was not enough to help me create a custom event so I had to look at the engine source.

## Changes

- Add a Shiki Twoslash example walkthrough of implementing custom event handling
- Clean up existing verbiage and add some more context
@kamranayub kamranayub added the docs Relating to documentation in any way label Oct 2, 2024
Copy link

cloudflare-workers-and-pages bot commented Oct 2, 2024

Deploying excaliburjs with  Cloudflare Pages  Cloudflare Pages

Latest commit: ba33add
Status: ✅  Deploy successful!
Preview URL: https://b4c9d6f5.excaliburjs.pages.dev
Branch Preview URL: https://kamranayub-docs-events-pubsu.excaliburjs.pages.dev

View logs

@kamranayub kamranayub requested a review from eonarheim October 2, 2024 03:33
@kamranayub
Copy link
Member Author

OK, so if I create my own strict emitter, and override the overloads, it will work:

image

I could include this example, although it feels like Ex could provide this or support this somehow in an easier way...

@kamranayub
Copy link
Member Author

I'm giving myself credit for Hacktoberfest 🎃

@kamranayub kamranayub marked this pull request as ready for review October 2, 2024 04:30
@eonarheim eonarheim merged commit 7f2ae36 into main Oct 2, 2024
8 checks passed
@eonarheim eonarheim deleted the kamranayub/docs/events-pubsub branch October 2, 2024 13:49
@eonarheim
Copy link
Member

@kamranayub Thanks for the add this helps clear it up a ton!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Relating to documentation in any way hacktoberfest-accepted
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants