@arieh:
I like this idea, but - even though I know(!) this a proof of concept
- if plugins would share a same method name like 'show' and it would
call execute('show') on each of the plugins in the doAction loop..
things could get messy no? You would still need some sort of
controller that should dictate what to do if plugins X Y and/or Z are
added and method X is executed.
For example if Ryan's SlideShow has a navigation plugin, touch events
plugin and a carousel plugin added, the carousel is playing/running in
auto mode and the user would "touch" the slideshow, maybe the
navigation plugin should .show() and the carousel should .pause().
Then if the user clicks (in the navigation) on a load-next-gallery-
button the navigation should .showBusy() and the touchevents
should .disable()..
.. or are you thinking of something else.. more generic stuff maybe?@aaron: I'd say Ryan has already checked FormValidator, if you look at SlideShow it has a similar pattern and structure for adding fx-styles. I like that! :) As for extend vs refactor I understand what you're saying. I guess Spinner is just such a thing you could easily add to an existing class with refactor, since it's like a "tool". You could still extend a base class in one or two ways and thanks to the addition of Spinner using refactor it can be used (useSpinner: true) in all subclasses without adding Spinner to every extende class (if you know what I'm saying). If there's some plugin-style pattern you could "add" the plugin Spinner to the class which would have the same effect. On Sep 1, 9:21 am, אריה גלזר <[email protected]> wrote: > How I would do it:http://jsfiddle.net/6T9p5/ > the base concept is to supply a plugin interface for you class. > I made the execute method receive an action so that it can route it (maybe > the plugin needs to work only on specific actions). > The implementation can obviously be made better, it's just a proof of > concept > > On Wed, Sep 1, 2010 at 1:13 AM, Ryan Florence <[email protected]> wrote: > > On Aug 31, 2010, at 4:02 PM, Aaron Newton wrote: > > > > If I went back and rewrote the HtmlTable stuff, I'd probably use a > > plugin-style pattern, but using Refactor works fine, too. > > > Can you expand on this a bit? > > > I'm about to dig in to SlideShow to add some "plugins" like a navigation > > piece, or a carousel, or touch events, etc. and haven't settled on how to do > > it. > > -- > Arieh Glazer > אריה גלזר > 052-5348-561 > 5561
