Re:Amplify: a jQuery component library for solving common we...
by mgh on Friday February 18, 2011 @12:29AM
(#2234357)
PubSub is useful for implementing interfaces between data and UI layers. Js.io has one that has almost the same interface: https://github.com/mcarter/js.io/blob/master/packages/lib/Pu...
Re:Amplify: a jQuery component library for solving common we...
by geekfactor on Thursday February 17, 2011 @10:54PM
(#2234157)
Great response!
-- The 'request' module --
is mixing concerns (network protocol, caching, serialization, model) that you probably don't want to mix that way in a real app.
It's pretty trivial to roll the polling part yourself (setTimeout), if you really need a plugin then PeriodicalUpdater[1] might be a candidate (although there are many others, and the cool kids use comet/websocket now anyways).
I didn't quite understand the purpose of the caching part; the browser already caches for us after all. It seems like a misnomer for some sort of bridge to the localstorage, but I didn't quite get in what situation storing the verbatim server response would be useful - as opposed to storing the deserialized result (or part thereof).
Anyways for the serialization part JSON2.js[2] is your friend. And for models there are various choices, backbone.js[3] being the most popular recently.
-- The 'store' module --
doesn't seem to provide anything interesting over jq-store[4]. And if you really want your data to stick around then there's evercookie[5]
-- The 'pubsub' module --
was a little hard for me to understand the purpose of. Since it isn't actually about server messaging(?) but rather only a way of passing events inside the browser it seems like what you'd really want is either JavascriptMVC[6], Backbone[3], perhaps knockout[7], or the older chain.js[8], or maybe one of the other two dozen data binding plugins.
Admittedly on this last one I may very well just be missing the point entirely. PubSub inside the browser? Huh?