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

[v5] Add support for partial wildcards (prefix matching) #1811

Merged
merged 20 commits into from
Jan 6, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add changeset
davidkpiano committed Jan 6, 2021
commit 5d16a73651e97dd0228c5215cb2452a4d9951118
28 changes: 28 additions & 0 deletions .changeset/thin-ads-obey.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
'xstate': major
---

Prefix wildcard event descriptors are now supported. These are event descriptors ending with `".*"` which will match all events that start with the prefix (the partial event type before `".*"`):

```js
// ...
on: {
'mouse.click': {/* ... */},
// Matches events such as:
// "pointer.move"
// "pointer.move.out"
// "pointer"
'pointer.*': {/* ... */}
}
// ...
```

Note: wildcards are only valid as the entire event type (`"*"`) or at the end of an event type, preceded by a period (`".*"`):

-`"*"`
-`"event.*"`
-`"event.something.*"`
-~`"event.*.something"`~
-~`"event*"`~
-~`"event*.some*thing"`~
-~`"*.something"`~