Hacker News new | ask | show | jobs
by ndnichols 4718 days ago
Is 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.
1 comments

I 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!