Implement plugin

Your JavaScript files are automatically wrapped in an anonymous function, which makes your plugin object available as the P variable. This makes your code easier to read, and creates a scope which encapsulates your implementation and makes sure it doesn’t pollute the global namespace.

// Implement your plugin here.
// Refer to the plugin object using the P variable.

P.hook('hPostObjectChange', function(response /*, .../*) {
    // Respond to hook

P.respond("GET", "/do/example/hello", [
], function(E) {
    // Respond to request

A plugin may need to implement one or more Hooks to integrate into the Haplo application user interface. Use the function template in each hooks documentation to start your implementation.

To add to the home page or the object pages, use Elements.

A plugin is likely to implement request handlers for any extra user interface it requires. These respond to HTTP requests from the user. Extra UI added by the hooks or Elements will link to these plugin URLs.

Once the plugin has been created, you are free to add more methods to the plugin object in other JavaScript source files in any way you choose.

You may wish to implement onInstall() and onLoad() methods in your plugin. See the plugin lifecycle interface documentation for more details.