4 ms·
Currently the body of the response can be any object that has a "forEach" method. For example: return [200, {}, { forEach : function(block) { block
by tlrobinson 17y ago
Currently the body of the response can be any object that has a "forEach" method. For example:
return [200, {}, { forEach : function(block) {
block("a");
sleep(1000);
block("b");
sleep(1000);
block("c");
}];
Would output "a", wait 1000ms, output "b", etc.
The Response helper object (part of the "Jack" implementation not "JSGI" specification) makes it even easier:
return response.finish(function(block) {
// etc
}
Still working on an async API though.
The Jack/JSGI site is currently at http://jackjs.org http://jackjs.org