No description
Find a file
2012-10-09 00:13:45 +01:00
available_plugins/ep_fintest Integrated hooks into templates and provided a blokc/hook for the left and right editbar menu 2012-03-13 20:32:56 +01:00
bin Update bin/installOnWindows.bat 2012-09-11 22:15:48 +02:00
doc Merge branch 'develop' into express-v3 2012-10-03 10:09:00 +02:00
src major restructering of the front end test framework 2012-10-08 00:34:29 +02:00
tests/frontend started button_indention test 2012-10-08 21:04:09 +01:00
tools/doc Check in tools/doc/node_modules 2012-08-11 13:18:17 +02:00
var Minify and compress JS & CSS before sending it 2011-05-28 18:09:17 +01:00
.gitignore Ignoring .ep_initialized in git 2012-04-05 20:04:54 +02:00
CHANGELOG.md Update CHANGELOG.md 2012-05-30 00:20:03 +02:00
CONTRIBUTING.md Let Github know our Dev Guidelines 2012-09-22 12:55:49 +02:00
LICENSE change copyright holder in license 2012-02-25 09:44:57 +00:00
Makefile Fix doc format, add in makefile for docs 2012-08-13 21:11:39 -07:00
README.plugins Added a plugin-readme 2012-03-13 17:08:57 +01:00
settings.json.template mention postgres in the default settings 2012-06-20 17:36:05 +02:00
start.bat Update start.bat 2012-08-01 15:52:12 +02:00

So, a plugin is an npm package whose name starts with ep_ and that contains a file ep.json
require("ep_etherpad-lite/static/js/plugingfw/plugins").update() will use npm to list all installed modules and read their ep.json files. These will contain registrations for hooks which are loaded
A hook registration is a pairs of a hook name and a function reference (filename for require() plus function name)
require("ep_etherpad-lite/static/js/plugingfw/hooks").callAll("hook_name", {argname:value}) will call all hook functions registered for hook_name
That is the basis.
Ok, so that was a slight simplification: inside ep.json, hook registrations are grouped into groups called "parts". Parts from all plugins are ordered using a topological sort according to "pre" and "post" pointers to other plugins/parts (just like dependencies, but non-installed plugins are silently ignored).
This ordering is honored when you do callAll(hook_name) - hook functions for that hook_name are called in that order
Ordering between plugins is undefined, only parts are ordered.

A plugin usually has one part, but it van have multiple.
This is so that it can insert some hook registration before that of another plugin, and another one after.
This is important for e.g. registering URL-handlers for the express webserver, if you have some very generic and some very specific url-regexps
So, that's basically it... apart from client-side hooks
which works the same way, but uses a separate member of the part (part.client_hooks vs part.hooks), and where the hook function must obviously reside in a file require():able from the client...
One thing more: The main etherpad tree is actually a plugin itself, called ep_etherpad-lite, and it has it's own ep.json...
was that clear?