-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Event dispatcher #18316
Event dispatcher #18316
Conversation
Looks nice. We have a few other places in core where we'd need that. By the way: in what way would this affect the assets pipeline ? Would there be two JS bundles one with the extra scripts and one without ? |
We could actually dispatch a similar event after "app.php" of any app has run. Not sure about the performance though if we do it for each app in every request... |
Not at all from my understanding - all scripts/styles will be summed up during rendering of the template. And the version hash of the assembled files will change based on the files included. |
Death to the hooks! I like this 😄 |
|
||
\OC::$server->getEventDispatcher()->dispatch('OCA\Files::loadAdditionalScripts'); | ||
|
||
\OC::$server->getEventDispatcher()->addListener('OCA\Files::loadAdditionalScripts', function() { |
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 guessing this is example code and isn't actually supposed to be run? Otherwise it seems odd the dispatch call is above
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 don't get it. In this case the dispatch happens before the registration of the listeners. So the listener isn't called. Or am I totally wrong and missunderstood the EventDispatcher?
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.
@MorrisJobke this block is supposed to be in the activity app's appinfo/app.php.
@DeepDiver1975 has added it only to show an example. That must be removed before merging.
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 guess this will completely mess up once the apps are not loaded in the correct order.
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.
sure - this will go into the activity app
We have to do this slightly different
Otherwise an app being loaded later cannot react on a loaded event of a previous app |
Anyway, I'm fine with the current approach for now. |
👍 |
2 similar comments
👍 |
👍 |
Let me squash the last two commits later before merge ... |
@DeepDiver1975 time to squash |
8e9ff1a
to
b0f7eab
Compare
Please fix the commit text |
b0f7eab
to
dfba425
Compare
A new inspection was created. |
👍 |
@owncloud-bot 👽 |
@owncloud-bot retest this please |
@PVince81 @MorrisJobke @Raydiation @PVince81 @Raydiation