X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=plugins%2Fmyplugin%2Fstatic%2Fjs%2Fmyplugin.js;h=26a29922ea59bb5eebde3f1e8b64f2f702add166;hb=c025814eadebf386f556f9af571d3f04e2124a80;hp=fee1e4bdce3e93040e3d822b1ac932d7bb270402;hpb=47fd4e2abb3c63765efec28fc9ea8b73264aa5af;p=myslice.git diff --git a/plugins/myplugin/static/js/myplugin.js b/plugins/myplugin/static/js/myplugin.js index fee1e4bd..26a29922 100644 --- a/plugins/myplugin/static/js/myplugin.js +++ b/plugins/myplugin/static/js/myplugin.js @@ -15,27 +15,44 @@ 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 @@ -44,7 +61,7 @@ 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 }, @@ -69,14 +86,21 @@ // ... 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);