Development/Tutorials/Plasma4/JavaScript/API-Addons

From KDE TechBase
Revision as of 12:14, 24 June 2011 by Aseigo (talk | contribs) (Created page with '== 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...')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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