I like the idea of having custom detectors that can be constructed with different options. However, we might not need the Detector base class, if we make is a mixin (one less thing to throw on the Window object):
[NoInterfaceObject, exposed=Window,Worker]
interface Detector {
Promise <sequence<DetectedObject>> detect(ImageBitmapsource image);
// readonly attribute boolean isAccelerated;
}
// FaceDetectorOptions to control the features and performance
[Constructor(optional FaceDetectorOptions faceDetectorOptions)]
interface FaceDetector {
// face detector specific attributes and methods
attribute FaceDetectorOperationMode mode;
attribute boolean detectLandmarks;
};
FaceDetector implements Detector;
Might be able to do the same with DetectedObject, as it canāt be constructed. We should put a constructor on the different types to allow developers to build them themselves if they want from various libraries.