资源说明:Smooth, throttle, queue async function parallel execution with a limitation.
Smooth.js ==== module(limitation, max_queue, timeout) ---- * limitation - default 10 * max_queue if the queue size big than max_queue, will show an warn message. * timeout in ms - default 5000ms ```js var limit = 5; var smooth = require('smooth')(limit); ``` smooth(fn, [limit, [max_queue, [timeout]]]) ---- smooth a function ```js foo = smooth(foo); ``` smooth a method of class. ```js RedisClient.prototype.get = smooth(RedisClient.prototype.get); ``` smooth a method of object. ```js redisClient.get = smooth(redisClient.get) ``` work with async.js ---- Without smooth ```js async.map(keys, function(key, callback) { memcacheClient.get('ITEM_' + key, callback); }, callback); ``` With smooth ```js async.map(keys, smooth(function(key, callback){ memcacheClient.get('ITEM_' + key, callback); }), callback); ```
本源码包内暂不包含可直接显示的源代码文件,请下载源码包。