PluginStore
Methods:
- install
- getInstalledPluginNameWithVersion
- addFunction
- executeFunction
- removeFunction
- uninstall
- addEventListener
- removeEventListener
- dispatchEvent
install
It is used to register the plugin with the PluginStore.
Arguments
(IPlugin
) : It contains the instance of plugin class which is implemented by IPlugin interface.
Returns
(void
)
getInstalledPluginNameWithVersion
It returns the name of the plugin if it exists or null otherwise.
Arguments
(string
) : name of the plugin
Returns
(string | null
): It returns the plugin name if exists or null
addFunction
It is used to add a function in the PluginStore.
Arguments
key
(string): name of the function.function
: Function definition which is to be added against the key.
Returns
(void
)
executeFunction
It is used to execute the function stored in the PluginStore.
Arguments
key
(string): It represents the name of the function that we want to execute....args
: arguments to be passed in the function parameters.
Returns
(void
)
removeFunction
It is used to remove a function from the PluginStore.
Arguments
key
(string): It represents the name of the function which is to be removed.
Returns
(void
)
uninstall
It is used to uninstall the plugin from the PluginStore of the app.
Arguments
key
(string): It represents the name of the plugin which needs to be uninstalled.
Returns
(void
)
addEventListener
It is used to add a callback function against an event in the PluginStore.
Arguments
name
(string): It represents the name of the event.callback
(function): It is the function which is to be added against the event.
Returns
(void
)
Note: It works the same as events in javascript i.e. we can store as many callbacks for a particular event. event.stopPropagation() and event.preventDefault() also work the same way in javascript.
removeEventListener
It is used to remove a callback function against an event from the PluginStore.
Arguments
name
(string): It represents the name of the event.callback
(function): It is the function which is to be removed.
Returns
(void
)
Note: The callback which we provide will be removed from the event registry. All other callbacks present in the event will still execute on dispatching the event.
dispatchEvent
It is used to dispatch a particular event.
Arguments
event
(Event): It represents the event object which is to be dispatched.
Returns
(void
)