()
| 15 | _read() {} |
| 16 | |
| 17 | *render() { |
| 18 | // push the <head> immediately |
| 19 | this.push('<!DOCTYPE html><html><head><title>Hello World</title></head>'); |
| 20 | |
| 21 | // render the <body> on the next tick |
| 22 | const body = yield done => { |
| 23 | setImmediate(() => done(null, '<p>Hello World</p>')); |
| 24 | }; |
| 25 | |
| 26 | this.push('<body>' + body + '</body>'); |
| 27 | |
| 28 | // close the document |
| 29 | this.push('</html>'); |
| 30 | |
| 31 | // end the stream |
| 32 | this.push(null); |
| 33 | }; |
| 34 | }; |