Development/Tutorials/Plasma4/JavaScript/API-Addons: Difference between revisions
m (D ed moved page Development/Tutorials/Plasma/JavaScript/API-Addons to Development/Tutorials/Plasma4/JavaScript/API-Addons) |
|
(No difference)
|
Latest revision as of 23:27, 11 September 2014
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