()
| 17 | let cachedBinding: NativeAudioBinding | null | undefined |
| 18 | |
| 19 | function loadNativeBinding(): NativeAudioBinding | null { |
| 20 | if (cachedBinding !== undefined) { |
| 21 | return cachedBinding |
| 22 | } |
| 23 | |
| 24 | const embeddedPath = getEmbeddedAudioCapturePath() |
| 25 | if (!embeddedPath) { |
| 26 | cachedBinding = null |
| 27 | return cachedBinding |
| 28 | } |
| 29 | |
| 30 | try { |
| 31 | cachedBinding = requireFn(embeddedPath) as NativeAudioBinding |
| 32 | } catch { |
| 33 | cachedBinding = null |
| 34 | } |
| 35 | |
| 36 | return cachedBinding |
| 37 | } |
| 38 | |
| 39 | export function isNativeAudioAvailable(): boolean { |
| 40 | return loadNativeBinding() !== null |
no test coverage detected