Use EventEmitter in addition to Payload Hooks to allow plugins subscribe on events #13203
MurzNN
started this conversation in
Feature Requests & Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Now, Payload CMS provides many hooks for many needs, that's great!
But each hook needs to be explicitly configured in the file
payload.config.ts
- that is convenient for local project hooks, but not convenient for plugins!So, each plugin, if it wants to alter some behavior, should manually extend the
payload.config.ts
, which is pretty dangerous!But Node.js provides the event system
EventEmitter
that will give much more flexibility for plugin developers to subscribe on the Payload CMS events for specific actions (create, update, etc) without needing to insert them into the Payload config manually! What do you think about this idea?Beta Was this translation helpful? Give feedback.
All reactions