4 ms·
What does Q do? Apart from providing a "library for modern web apps" (whatever that means).
by j_baker 13y ago
What does Q do? Apart from providing a "library for modern web apps" (whatever that means).
- camus 13y agodoesnt mean anything and the readme file fails to explain what does that lib do. EDIT : looks like a prototype/dojo utility library , not a framework.
- EGreg 13y agoIt has some minor overlap with jQuery but literally it is built to provide a unified solution to all the "other" challenges that an WEB/MOBILE WEB APP developer faces. Such as: Reusable tools - Q comes with a lot of reusable tools you can just drop onto a page, many with their own back end and they "just work" when you Q.activate the page Not refreshing the whole page - Q has virtual pages loaded with AJAX and slots (content areas) to fill on the page. Q.handle(url) simply loads the url for example and activates all the tools for you. Event system - you nee to be able to remove event handlers when the page is unloaded or a tool is removed Integration with PhoneGap, jQuery, touch vs non touch environments, etc. But the coolest stuff is the middleware. You can literally write apps that get objects like this: Users.byId(uid, function(err, user) { ... } ); and not care how it gets the user object. If it already cached it then it uses the cached version. If it already requested it, it puts your callback on a waitlist instead of sending again. When response comes back it calls all callbacks on the list. It also can do throttling, and batching of requests. And all the while you just have to use the construction above to get objects. Oh and Q supports socket.io so if you have node running you can update caches via a push so they are almost NEVER out of date! Furthermore a lot of the time your JS code has a functional programming character, such as "wait until these objects are fetched, then do this". So just use this: var p = new Q.Pipe(["user", "stream"], callback); Users.byId(uid, p.fill("user")); Streams.get(publisherId, streamName, p.fill("stream")) You can even use it with any unsuspecting library since it produces callbacks you pass to this library. So basically: Virtual pages and tools you drop on them, set and forget Model done via caching and realtime updates, query and no worries. Use Q.pipe to wait for some objects then do what you wanted to do Connect everything together with event handlers Boom your app coming together quickly. Other libraries (like jQuery) are for manipulating DOM and other stuff. This library helps you build rich web APPS.
- ndnichols 13y agoIs there a cohesive idea or approach here? This just feels like a bunch of unrelated utility functions. And there's basically no documentation, right? The readme description of Q.getter is just "Q.getter - wrapper which makes any getter function smarter, using caching, waiting, throttling, without worrying about ", while the docstring for the method is 30 lines long and I still have no idea what it does or how to use it. It seems like you're doing some really heavy, serious work in this library with a ton of library-specific options, etc. If that's the route you're taking, I think you're going to need real documentation, tutorials, etc. if you expect this to get any uptake.
- EGreg 13y agoI completely agree. I just wanted to put out one file from our framework and get some early feedback. But Q.getter for example is just that easy. Try this: 1) Include Q.js 2) Take any function that gets stuff from any web server and calls one or more callbacks, let's say function X 3) Do this: X = Q.getter(X) Now use your function :)))) See how it improves efficiency? It caches the result, it prevents multiple requests to the same thing, etc. Next you can tell it what to use for the cache, by another parameter to Q.getter. And finally you can hook up socket.io to update the cache on a push!