-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(events): introduce
EventType
enum in separate module (#8530)
* refactor(events): Use "export ... from" where applicable * refactor(events): Introduce EventType enum Introduce an enum for the event .type values. We can't actually use it as the type of the .type property on Abstract events, because we want to allow developers to add their own custom event types inheriting from this type, but at least this way we can be reasonably sure that all of our own event subclasses have distinct .type values—plus consistent use of enum syntax (EventType.TYPE_NAME) is probably good for readability overall. Put it in a separate module from the rest of events/utils.ts because it would be helpful if event utils could use event instanceof SomeEventType for type narrowing but but at the moment most events are in modules that depend on events/utils.ts for their .type constant, and although circular ESM dependencies should work in principle there are various restrictions and this particular circularity causes issues at the moment. A few of the event classes also depend on utils.ts for fire() or other functions, which will be harder to deal with, but at least this commit is win in terms of reducing the complexity of our dependencies, making most of the Abstract event subclass module dependent on type.ts, which has no imports, rather than on utils.ts which has multiple imports.
- Loading branch information
Showing
67 changed files
with
419 additions
and
530 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
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
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
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
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
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
Oops, something went wrong.