var next; function handle(req, res) { res.setContentType("text/html"); res.writer.write("counter using continuation"); res.writer.write(""); if (next) { var n = next; next = null; n(); } else { res.writer.write("hoge"); next = new Continuation(); if (next) return; res.writer.write("hage"); next = new Continuation(); if (next) return; res.writer.write("hige"); } res.writer.write(""); }