Skip to content

feat(plugins): Plugins Event Bus (MIN-225)

mateusz-winiarczyk requested to merge MIN-225-events-bus into development

It introduces plugins event bus for Minerva plugins, empowering them to seamlessly react to user interactions and application state alterations.

To listen for specific events, plugins can use the addListener method in events object returned by window.minerva.plugins.registerPlugin. This method takes two arguments: the name of the event and a callback function to handle the event. The types of possible events are described in the file docs/plugins.md

To remove event listener, plugins can use the removeListener method in events object returned by window.minerva.plugins.registerPlugin. This method takes two arguments: the name of the event and the reference to the callback function previously used to add the listener.

To remove all event listeners attached by a plugin, plugins can use the removeAllListeners method in events object returned by window.minerva.plugins.registerPlugin.

If you would like to learn how to implement a plugin with event listeners, you can find examples in docs/plugins.md to create your own plugin.

You can also use a plugin I created that has all the event listeners added. In the interface, you can remove the sample listener or all listeners by clicking the appropriate button: plugin link

events-bus

Merge request reports