Nice one. I think that would be good functionality to have. Feel free to mess with the source. If I get time I'll implement something and let you know.
Feel free to contact me via email. -Trey On Mar 28, 1:45 pm, Daniel Friesen <[email protected]> wrote: > Bleh, I never noticed this one. > > The __load is actually there pretty much for completeness just to make > coding of plugins complete when we have __unload. Quite frankly __load > would probably be run right after you run addPlugin in your plugin's js. > The __unload would be run if someone decided to run > .removePlugin('yourName'); > > If really wanted we could actually set things up so you could unload a > plugin and reload it without running the actual plugin code. > > ~Daniel Friesen (Dantman, Nadir-Seen-Fire) > > tres wrote: > > I like where you are going with that. Please elaborate a bit on your > > idea of what would constitute loading and unloading. > > > Mike, where you been? > > > -Trey > > > On Mar 12, 9:11 am, Daniel Friesen <[email protected]> wrote: > > >> After a bit of thought I just thought about one. > >> A __load and __unload for when the plugin is loaded and unloaded. This > >> will allow for the plugin to do extension type stuff and be able to unload. > > >> Assuming jQuery.css.addHook and jQuery.css.removeHook for adding and > >> removing css hooks (an extensibility feature that ideally will get into > >> jQuery after John does his $.attr and $.curCSS refactor) > > >> (function(jQuery) { > > >> function cssCallback(elem, name, value, force) { > >> ... > > >> } > > >> jQuery.addPlugin('obscureCompat', { > >> __load: function() { > >> jQuery.css.addHook(cssCallback); > >> }, > >> __unload: function() { > >> jQuery.css.removeHook(cssCallback); > >> } > > >> }); > >> })(jQuery); > > >> ~Daniel Friesen (Dantman, Nadir-Seen-Fire) > > >> tres wrote: > > >>> Thanks for the feedback, Daniel. > > >>> I see what you mean about jQuery.options instead of jQuery.fn.options. > >>> My reasoning for this, though, is by putting it on .fn you can assign > >>> different options to different elements instead of setting it globally > >>> for the plugin. This way options are persistent and can be changed on > >>> the fly. > > >>> I did think about giving the ability to assign a plugin to jQuery and > >>> not just jQuery.fn, but couldn't find a very graceful way to implement > >>> it as I just wanted to get the .fn working first. Could add a third, > >>> boolean, argument called addToFn and default it to true since it is > >>> the most likely case. > > >>> "Magic" methods can also be supported. Say you want to execute a > >>> function when the object is constructed, or when the options are > >>> changed. This isn't currently documented, but '__construct' works,and > >>> others would be fairly easy to implement. > > >>> Another idea would be to have an argument in jQuery.addPlugin to pass > >>> in an object of default options which would automatically apply > >>> options to the passed objects using jQuery.fn.options. > > >>> That said, I'm trying to keep a good balance of simplicity and > >>> extensibility, so more features isn't necessarily the right answer. > > >>> Anybody have anymore ideas or want to collaborate? > > >>> Thanks, > >>> -Trey > > >>> On Mar 5, 1:34 pm, Daniel Friesen <[email protected]> wrote: > > >>>> I think it could do with the ability to handle methods on jQuery itself > >>>> instead of being limited to just jQuery.fn, perhaps a second > >>>> object/function to addPlugin; > > >>>> Likewise I'd prefer jQuery.options over jQuery.fn.options; > > >>>> ~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://nadir-seen-fire.com] > >>>> -Nadir-Point & Wiki-Tools (http://nadir-point.com) > >>>> (http://wiki-tools.com) > >>>> -MonkeyScript (http://monkeyscript.org) > >>>> -Animepedia (http://anime.wikia.com) > >>>> -Narutopedia (http://naruto.wikia.com) > >>>> -Soul Eater Wiki (http://souleater.wikia.com) > > >>>> [email protected] wrote: > > >>>>> There has been a lot of activity about plugin authoring and how it can > >>>>> be more structured and extensible. I've posted a couple of comments on > >>>>> some threads and sent an email to John, but I thought I'd create a new > >>>>> thread since I haven't had any feedback yet. John, I understand you > >>>>> probably get a lot of email and are very busy. > > >>>>> I've written a plugin that I'd like to get feedback on from you guys. > >>>>> It's still evolving, but should be stable in what it currently is > >>>>> designed to do and I have found it invaluable when authoring larger, > >>>>> more advanced plugins. It would be nice to see similar functionality > >>>>> built into jQuery as I think others would also find it useful. > > >>>>> Link:http://plugins.jquery.com/project/plugin-authoring > > >>>>> Cheers, > >>>>> Trey --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---
