-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(createEventHook): allow trigger to optionally have no parameters
Previously, `createEventHook()` would always require at least one parameter: ```ts const { trigger } = createEventHook(); trigger(); // ^ // Expected 1 arguments, but got 0 ``` Now, parameters are optional. This allows a use case where there is no other information to send when triggering an event, and simply knowing that an event was triggered is all that is needed: ```ts const { on, trigger } = createEventHook(); // This is now possible: trigger(/* having no arguments is now allowed */); // Elsewhere, we can listen for the event: on((/* no arguments */) => {}) ```
- Loading branch information
1 parent
bacf402
commit 8402ab4
Showing
2 changed files
with
21 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters