"Fossies" - the Fresh Open Source Software Archive

Member "jitsi-meet-7309/react/features/face-landmarks/faceLandmarksWorker.ts" (31 May 2023, 612 Bytes) of package /linux/misc/jitsi-meet-7309.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) TypeScript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 import { HumanHelper, IFaceLandmarksHelper } from './FaceLandmarksHelper';
    2 import { DETECT_FACE, INIT_WORKER } from './constants';
    3 
    4 let helper: IFaceLandmarksHelper;
    5 
    6 onmessage = async function({ data }: MessageEvent<any>) {
    7     switch (data.type) {
    8     case DETECT_FACE: {
    9         if (!helper || helper.getDetectionInProgress()) {
   10             return;
   11         }
   12 
   13         const detections = await helper.detect(data);
   14 
   15         if (detections) {
   16             self.postMessage(detections);
   17         }
   18         break;
   19     }
   20 
   21     case INIT_WORKER: {
   22         helper = new HumanHelper(data);
   23         break;
   24     }
   25     }
   26 };