First jQuery Plugin
Michael Geary contacted me today to let me know that he’s finished the first third-party jQuery plugin. His particular plugin loads in a remote JSON file, which can then be manipulated further. The chaining of this particular request doesn’t serve many benefits, but this is still something that I’m exploring further (maybe jQuery can support JSON-traversing, along with DOM?).
His code reminds me of a templating/JSON plugin that Jordan and I started developing at BarCampNYC, which allows you to import external templating code. I’ll have more details on this plugin soon (and more details on an AJAX plugin that I’m developing, per the requests of a lot of people).
I’m planning on opening up a plugin repository soon, so that plugin authors can submit their code, have an area for documentation and comments, and allow for patches. More details on this, soon.
Thanks for the mention, John. I wouldn’t call the plugin *finished*, exactly, but what is there so far works well for what I need at the moment. I will probably add a timeout option, and who knows what else.
Regarding the method chaining, keep in mind that any chaining happens immediately, not after the JSON data is loaded. Use the callback function for that.
The plugin repository sounds great; it will make it easier for people to build on each other’s work. Thanks!
Michael: Concerning the method chaining: I realize that, but that doesn’t mean that it has to be that way. I’ve been toying with the option of a having a flag which can be toggled to apply chaining, or not. For example, every call after your json() function gets added to a queue and is executed whenever the JSON is finished loaded. It’s be really cool (and make for much shorter code), but also really weird and confusing. It’s just an idea right now, but I’ll probably play with it more soon.