()
| 76 | }) |
| 77 | |
| 78 | const stop = async (): Promise<unknown> => { |
| 79 | const rawRecording = await recorder.stop() |
| 80 | const transformed = await options.onComplete?.(rawRecording) |
| 81 | // Only `undefined` (returning nothing) keeps the raw recording; a returned |
| 82 | // null is a real value, matching the inferred output type. |
| 83 | const output = transformed === undefined ? rawRecording : transformed |
| 84 | recording.set(output) |
| 85 | return output |
| 86 | } |
| 87 | |
| 88 | return { |
| 89 | recording: recording.asReadonly(), |