Skip to content

TypeScript

The library provides a built-in support of Typescript that should work out of the box

It adds the <idlive-face-capture> tag and the type HTMLIdLiveFaceCaptureElement to the global scope

In addition, it provides types for all events emitted by the component

import type { CaptureEvent } from 'idlive-face-capture-web';

const idliveFaceCapture: HTMLIdLiveFaceCaptureElement = document.querySelector('idlive-face-capture');

idliveFaceCapture.addEventListener('capture', (event) => {
    // event has type CaptureEvent
    handleCapture(event);
});

const handleCapture = (event: CaptureEvent) => {};