Closed lyzadanger closed 10 years ago
I agree. What I will say is that it's super important that we be able to retrieve or otherwise manipulate the SimpleSlideView
object because it's important to advanced use-cases to be able to call methods like changeView
directly.
The issue I ran into last time was that Zepto does not ship with the data
method by default. Now that we won't be limited by that, how I might approach this would be to create the SimpleSlideView
object, with $.fn.simpleSlideView
instantiating the object and attaching it as a data value to the element(s) ($(el).data('simpleSlideView', slideView)
).
What I might also do is create a $.simpleSlideView
method that accepted an element as the first object and returned the SimpleSlideView
object. This would give the user two ways of grabbing that object...
// Method 1
var slideView = $.simpleSlideView(el);
// Method 2
var slideView = $(el).simpleSlideView().data('simpleSlideView');
Just some ideas! :)
Right now, we are doing this:
This breaks the metaphor of jQuery plugins, which is to return
this
, i.e. the jQuery object. The way the plugin is currently architected, instantiation of aSimpleSlideView
is necessary. I don't want to re-design the object, but may look at returningthis
instead of theSimpleSlideView
object. This would help with encapsulation, also, as presently one could use the object returned to mess around with a bunch of internals.