davebalmer / jo

Jo (0.5.0) is a thin (~16K) candy shell for making HTML5 apps. Jo works with: PhoneGap, Chrome, Safari, Opera, FireFox, iOS, Android, BlackBerry 10, Tizen, & Windows Phone 8+. Features include skinnable UI widgets, a clean event model and a light data layer.
MIT License
1.2k stars 180 forks source link

Not everything is chainable #32

Closed thiloplanz closed 13 years ago

thiloplanz commented 13 years ago

Not everything is chainable and it is not obvious what is and what is not.

For example, the following does not work (returns undefined):

    var navbar = new joNavbar().setStack(stack);
    var stack = new joStackScroller().push( card );
davebalmer commented 13 years ago

In this case, you're using stack before you've defined it (which should explode). I think reversing those two lines would fix it...? That said, I should put a section in the docs on chaining. What it is, and what sorts of methods support it (usually everything but getter methods).

thiloplanz commented 13 years ago

Sorry for the bad example, those two lines were supposed to be unrelated to each other. Reversing them does not fix the problem, I think. The problem being that neither push nor setStack (and probably others as well) return their respective this.

davebalmer commented 13 years ago

Ah! Got it. I'll do another chaining pass as part of 0.5.0. Thanks!