Development/Tutorials/Plasma4/JavaScript/API-Addons
Addons (API V3)
Plasmoids may also have plugins of their own, also written in Javascript, and which are shipped separately to the Plasmoid. These are referred to as "Addons" and are packaged similarly to a Plasmoid. For more information on creating Javascript Addons, visit the Javascript Addons tutorial.
It is possible to list, load and be notified of new Addons having been installed for your Plasmoid.
- Array[AddonInformation] listAddons(string type): an array of available addons of the provided type. The type name maps to the X-KDE-PluginInfo-Category entry in the Addon's metadata.desktop file.
- boolean loadAddon(String type, String id): load the addon with the given id and type, return true on success. In order to be notified when the addon is successfully created, add an event listener to the "addCreated" event.
The following are the Addon events which are recognized by the Plasmoid along with the type of event objects (if any) that are passed to registered event listeners that are registered with addEventListener:
- addonCreated: Object addOn
- newAddonsAvaiable
AddonInformation (API V3)
The AddonInformation object contains the following read-only properties:
- String id: the id of the Addon. Can be used with loadAddon
- String name: a string suitable for showing the user, such as in a configuration dialog