NativeScript / mlkit

Apache License 2.0
24 stars 9 forks source link

Can't find the variable "data" of the readme #24

Closed kriefsacha closed 2 years ago

kriefsacha commented 2 years ago

Hi, the detection event problem seems to be fixed with the alpha 4.

I just have an issue, the readme says:

onDetection(event: DetectionEvent){
    if(event.type === DetectionType.Barcode){
        const barcode: BarcodeResult = data;
    }

But where data comes from ?

If i try to do = event.data it tells me that i cant because event.data is type [key:string].

Thank you

triniwiz commented 2 years ago

Please install the firebase and mlkit plugins with the @alpha tag w/o the tag it will pull the latest which is unfortunately the first published alpha

kriefsacha commented 2 years ago

@triniwiz I still have the problem with the last one (which i had to install manually btw, i tried alpha tag didnt work and when i tried without any tag or with @latest it was giving me the alpha0 , so i manually wrote alpha5), when i puted as in the readme

const barcode: BarcodeResult[] = event.data;

i got this error:

Type '{ [key: string]: any; } | { [key: string]: any; }[]' is not assignable to type 'BarcodeResult[]'. Type '{ [key: string]: any; }' is missing the following properties from type 'BarcodeResult[]': length, pop, push, concat