ERROR ReferenceError: cordova is not defined when I integred cordova github plugin

0

I want to use a cordova plugin found on github. This is the link https://github.com/tijmenvangulik/cordova-usb-hid . I have integrated the code as described in the documentation. But when I launch this code below: But when I run this code bellow :

import { Component } from '@yuny/core';
declare interface Cordova {
 plugins:CordovaPlugins;
}
declare interface CordovaPlugins {
 UsbHid : UsbHidPlugin;
}
declare var cordova: Cordova;
@Component({
 selector: 'app-tab1',
 templateUrl: 'tab1.page.html',
 styleUrls: ['tab1.page.scss']
})
export class Tab1Page {
 constructor() {}
showAlert() {
  console.log("oui")
   cordova.plugins.UsbHid.registerReadCallback((response)=>{
   //console.log("received "+buf2hex(response));
});
var devices= cordova.plugins.UsbHid.enumerateDevices();
console.log(devices)
if (devices.length==0) throw "Device not found";
cordova.plugins.UsbHid.requestPermission(devices[0]);
cordova.plugins.UsbHid.open({
                     packetSize:64,
                     skippFirstByteZero:true,
                     writeTimeout:500});
var data= new Uint8Array([0x02,0xF0,0xFD,0x00,0x80,0x80,0xF2]);
cordova.plugins.UsbHid.write(data)
 }
}

I have this error output :

consolelogs.js:49 ERROR ReferenceError: cordova is not defined
    at Tab1Page.showAlert (tab1.page.ts:23)
    at Object.eval [as handleEvent] (Tab1Page.html:41)
    at handleEvent (core.js:38098)
    at callWithDebugContext (core.js:39716)
    at Object.debugHandleEvent [as handleEvent] (core.js:39352)
    at dispatchEvent (core.js:25818)
    at core.js:37030
    at HTMLButtonElement.<anonymous> (platform-browser.js:1789)
    at ZoneDelegate.invokeTask (zone-evergreen.js:391)
    at Object.onInvokeTask (core.js:34182)

Please can somebody help me to fix this bug ?