var MyPlugin = Plugin.extend({
- // Constructor
+ /** XXX to check
+ * @brief Plugin constructor
+ * @param options : an associative array of setting values
+ * @param element :
+ * @return : a jQuery collection of objects on which the plugin is
+ * applied, which allows to maintain chainability of calls
+ */
init: function(options, element) {
// Call the parent constructor, see FAQ when forgotten
this._super(options, element);
+ /* Member variables */
+
+ /* Plugin events */
+
+ /* Setup query and record handlers */
+
// Explain this will allow query events to be handled
// What happens when we don't define some events ?
// Some can be less efficient
this.listen_query(options.query_uuid);
this.listen_query(options.query_uuid, 'all');
- // GUI Event binding
+ /* GUI setup and event binding */
// call function
},
+ /* PLUGIN EVENTS */
+ // on_show like in querytable
+
+
/* GUI EVENTS */
- // a function to bind events here
+ // a function to bind events here: click change
// how to raise manifold events
+
/* GUI MANIPULATION */
// We advise you to write function to change behaviour of the GUI
show_hide_button: function()
{
- // this.id, this.el, this.cl, this.els
+ // this.id, this.el, this.cl, this.elts
// same output as a jquery selector with some guarantees
},
// ... be sure to list all events here
/* RECORD HANDLERS */
-
- on_record_received: function(record)
+ on_all_new_record: function(record)
{
//
},
+ /* INTERNAL FUNCTIONS */
+ _dummy: function() {
+ // only convention, not strictly enforced at the moment
+ },
+
});
+ /* Plugin registration */
+ $.plugin('MyPlugin', MyPlugin);
+
// TODO Here use cases for instanciating plugins in different ways like in the pastie.
})(jQuery);