X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=plugins%2Fmyplugin%2Fstatic%2Fjs%2Fmyplugin.js;h=da65c43034fb52ea87c317e280113ede45bc06e9;hb=22dba9d34674e0cc1b285e678bbb7bc6482c58ca;hp=fee1e4bdce3e93040e3d822b1ac932d7bb270402;hpb=c84873b7b55121705ca5ec4d897194faadcb8408;p=myslice.git diff --git a/plugins/myplugin/static/js/myplugin.js b/plugins/myplugin/static/js/myplugin.js index fee1e4bd..da65c430 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 hazelnut + + /* 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 }, @@ -75,8 +92,16 @@ // }, + /* 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);