-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: support nested event methods #5
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
couple minor comments. can you add a section to the README about this as well?
src/event-mixin.spec.ts
Outdated
{ | ||
eventOne: TypedEvent<(value: number) => void>; | ||
eventTwo: TypedEvent<(value: boolean) => void>; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: for consistency, can you extract these out into an interface like the test above does? with them matching it makes it easier to see that what's different here is the path argument.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure thing. Done.
src/event-mixin.ts
Outdated
// Even though we bypass type safety in the call (casting this as any), we've enforced it in the | ||
// method signature above, so it's still safe. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment looks like it isn't really relevant here anymore...maybe better as a note on getEvent
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. Done.
@bbaldino Thanks for the feedback. I fixed the tests to be more consistent, moved the stale comment into the comment |
This PR adds an optional path parameter to the
AddEvents
utility, enabling the specification of nested event locations within objects. The addition of thegetEvent
closure function allows for retrieving events based on this optional path, and an error is thrown if the event is not found.A successful example:
An error example: