Developing Extensions

Creating a minimal extension

Each extension has its own folder in which it can store any required resources and the required "extension.js" file. The folder should be named like the identifier used to access the extension programmatically.

At the global scope of extension.js, the extension should perform any basic setup that it needs. This includes a call to registerExtension, and registering any actions or events that it supports. A simple example could look like this:

// This call must be done before any other calls. The first argument must be a
// unique identifier of the add-on and should include the creator's name in some
// form. It must be a valid JavaScript identifier.
registerExtension("com.superplugins.example", {
	version: "1.0.0",
	title: "Example Extension",
	vendor: "Superplugins Inc.",
	description: "Adds a menu entry for displaying a message box."
})

registerAction("showMessageBox", function() {
	print("Now showing the message box...");
	alert("This is the message!", "Message Addon");
});

addMenuEntry("showMessageBox", "Show message box", "control+alt+M")

Have a look at the Extensions and Snippets Forum Category for examples. The API reference lists the APIs that are available on top of the standard ECMA script v3 functionality.