Hi guys,

I have written a couple of plugins that I'd to share. The first is an
MVC style mini-framework with the M and V (or C, depends on how you
look at it) stripped out of it. Anything more, IMHO, is overdoing it
no matter how large the project. It is called jFrame. It works on top
jQuery and provides a way to enforce convention and javascript code
separation. The other benefit from it is that it allows 'registry'
variables (accessible application-wide) and dispatch parameters which
get sent to the script that is being dispatched to and cleared
afterwards. Current plans are to remove prototyped methods, convert to
private functions and keep only the ones that are necessary. I put
those in for fun at first.

The second is a plugin for plugins. It takes John's idea with his
widget plugin (dare I say) a step farther and instead of just creating
another method in the jQuery namespace it allows you to create a new
plugin namespace with multiple methods. 'this', when inside of a given
plugin namespace is used in the same manner as when inside the jQuery
namespace, thus is interchangeable. Plugin methods are available on
'this', but jQuery methods aren't unless wrapped ($(this)). It also
includes a method in the jQuery scope for setting and auto-extending
options. It saves it as data to each object, so options for each
object on a given plugin can be changed independently. There's a
couple of more functions, but they're not worth mentioning at this
stage.

The original reason I wrote this is because I have a form validation
plugin that I wanted to namespace due to it containing a lot of
methods and was built more as a library than a widget. Currently
namespacing seems to consist of passing a string argument to a
function of the method you want to call and I didn't like that. So
instead of:

jQuery('ul').somePlugin('someMethod').somePlugin('anotherMethod',
'arg');

it would allow for:

jQuery('ul').plugin('somePlugin').someMethod().anotherMethod('arg');

If you want to chain the jQuery namespace back in:

jQuery('ul').options('somePlugin', {
    opt1 : 'val1',
    opt2 : 'val2'
}).plugin('somePlugin').aMethod().jQuery.find('> li').show();


Currently, argument handling hasn't been built in (hey, I started it
today on 3 hours of sleep!). No excuses, right?!

Now, these are just ideas and it is a work in progress as is jFrame. I
would love any input from you guys, especially John, as I feel they
both relate heavily to this thread. Let me know if you have any
questions or comments. Links below:

Plugin plugin (no pun): 
http://code.google.com/p/jquery-plugin-dev/source/browse/trunk/jquery.plugin.js
jFrame plugin: 
http://code.google.com/p/jquery-plugin-dev/source/browse/trunk/jquery.jFrame.js

Thanks,
Trey
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-dev@googlegroups.com
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to