diff client/digitallibrary/jquery/jquery-digilib-plugins.txt @ 786:912519475259 jquery

documentation for new plugin api in jquery-digilib-plugin.txt. more steps towards plugification of birdseye view.
author robcast
date Fri, 18 Feb 2011 15:16:30 +0100
parents
children 32d1d6601968
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/digitallibrary/jquery/jquery-digilib-plugins.txt	Fri Feb 18 15:16:30 2011 +0100
@@ -0,0 +1,38 @@
+
+The plugin API of jquery.digilib
+--------------------------------
+
+* The plugin Javascript file has to be loaded after jquery.digilib.js.
+
+* The plugin should be written as a closure on jQuery (like a jquery plugin) exporting a plugin object as its interface:
+
+  var plugin = {
+            name : 'mydigilibplugin',
+            install : install,
+            init : init,
+            buttons : {},
+            actions : {},
+            fn : {},
+            plugins : {},
+            defaults : {}
+  };
+
+  The "name" string, "install" function and "init" function are provided by the plugin and called by digilib. 
+  "buttons", "actions", "fn" and "plugins" are shared objects provided by digilib.
+  "buttons" is the array of button objects. The plugin can add its own buttons to this array.
+  "actions" is the array of action objects. The plugin can add its own actions to this array.
+  "fn" is an object with functions from digilib.
+  "plugins" is an object with all digilib plugin objects.
+  "defaults" is an object with all digilib defaults.
+
+* the plugin object is passed to digilib in the "plugin" action on loading the plugin javascript file:
+
+  $.fn.digilib('plugin', plugin);
+
+  digilib then calls the "install" function on the populated plugin object (i.e. this = plugin) with the plugin object as parameter.
+  
+* digilib calls the "init" function from the plugin object with the data object instance as a parameter in digilibs init phase.
+
+* further actions should be implemented as custom events on the data object.
+
+* events should be documented here...