* @param {(renderer: Renderer) => void} fn
(fn)
| 399 | * @param {(renderer: Renderer) => void} fn |
| 400 | */ |
| 401 | title(fn) { |
| 402 | const path = this.get_path(); |
| 403 | |
| 404 | /** @param {string} head */ |
| 405 | const close = (head) => { |
| 406 | this.global.set_title(head, path); |
| 407 | }; |
| 408 | |
| 409 | this.child((renderer) => { |
| 410 | const r = new Renderer(renderer.global, renderer); |
| 411 | fn(r); |
| 412 | |
| 413 | if (renderer.global.mode === 'async') { |
| 414 | return r.#collect_content_async().then((content) => { |
| 415 | close(content.head); |
| 416 | }); |
| 417 | } else { |
| 418 | const content = r.#collect_content(); |
| 419 | close(content.head); |
| 420 | } |
| 421 | }); |
| 422 | } |
| 423 | |
| 424 | /** |
| 425 | * @param {string | (() => Promise<string>)} content |
nothing calls this directly
no test coverage detected