(event: MessageEvent<tts.InferenceConfg & { type: 'init' }>)
| 1 | import * as tts from '../src/index'; |
| 2 | |
| 3 | async function main(event: MessageEvent<tts.InferenceConfg & { type: 'init' }>) { |
| 4 | if (event.data?.type != 'init') return; |
| 5 | |
| 6 | const start = performance.now(); |
| 7 | const blob = await tts.predict({ |
| 8 | text: event.data.text, |
| 9 | voiceId: event.data.voiceId, |
| 10 | }); |
| 11 | console.log('Time taken:', performance.now() - start + ' ms'); |
| 12 | |
| 13 | self.postMessage({ type: 'result', audio: blob }) |
| 14 | } |
| 15 | |
| 16 | self.addEventListener('message', main); |
nothing calls this directly
no outgoing calls
no test coverage detected