fermata
fermata copied to clipboard
Composable plugins
Couple things have felt awkward to me, especially in more casual use of Fermata:
- for one-off requests, it's a little bummer that e.g.
fermata.json("http://localhost:5984/db/_changes", {limit:5})
doesn't work. Perhaps it is good that URL initialization is different from normal URL extension, but it feels inconsistent. - related, it seems like something like connect's "use" chaining might be cooler than having this weird "low-level" (e.g. autoConvert/statusCheck) vs. "high-level" (e.g. json/raw/twitter/couchdb) plugin distinction.
Another use case: a "timeout" mixin.
I'd be happy to look into JSONP support for a plugin :)
To expand on the OP, I still think that part of the issue here is we really have two types of plugins:
- mixins that add a specific bit of behavior (e.g. statusCheck, autoConvert, oauth, a timeout provider, redirect follower…)
- wrappers — for lack of better term, as Fermata never really "wraps" — that combine a certain set of mixins and add perhaps a bit of sugar to polish up dealing with a particular API (Twitter, Flickr, CouchDB, Chargify
One typical distinction being that the latter modify the transport
they are given, while the former tend to just use it as-is.