-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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: Add 'beforepluginsetup' event and named plugin setup events (e.g. 'pluginsetup:foo') #4255
Conversation
…g. 'pluginsetup:foo')
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.
Do we also want events for after setup, and dispose?
src/js/plugin.js
Outdated
* A plugin event hash. | ||
* | ||
* @param {Boolean} [before] | ||
* If true, modifies the events to be "before" events. |
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.
I think it would be good to have an example, as this confused me at first. Maybe: 'I.E pluginsetup
-> beforepluginsetup
'
// | ||
// The only potentially counter-intuitive thing here is the `instance` in | ||
// the "pluginsetup" event is the value returned by the `plugin` function. | ||
triggerSetupEvent(this, {name, plugin, instance: null}, true); |
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.
I'm up in the air about wether we should pass data along with the event. I understand why we would need to but, it still goes against most of the practices that we have for other events. Anyone else want to chime in here?
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.
Well, it's already the case for pluginsetup
.
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.
true, I guess this is just what we have to do
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.
Also, I do know some plugins do return something from the method, so, providing it is nice.
We could potentially add |
Also, I plan to add tests for this at some point this week. |
This adds a
beforepluginsetup
event as well asbeforepluginsetup:$name
andpluginsetup:$name
events.The drive behind this is improving the ability for people to make cross-plugin dependencies in a more robust manner.
Requirements Checklist