chore: Type examplePlugin

This commit is contained in:
Marc Rousavy 2023-09-30 13:35:04 +02:00
parent b92960a837
commit 68776f683b

View File

@ -2,7 +2,14 @@ import { VisionCameraProxy, Frame } from 'react-native-vision-camera'
const plugin = VisionCameraProxy.getFrameProcessorPlugin('example_plugin')
export function examplePlugin(frame: Frame): string[] {
interface Result {
example_array: (string | number | boolean)[]
example_str: string
example_bool: boolean
example_double: number
}
export function examplePlugin(frame: Frame): Result {
'worklet'
if (plugin == null) throw new Error('Failed to load Frame Processor Plugin "example_plugin"!')
@ -13,5 +20,5 @@ export function examplePlugin(frame: Frame): string[] {
someNumber: 42,
someObject: { test: 0, second: 'test' },
someArray: ['another test', 5],
}) as string[]
}) as unknown as Result
}