import { CropperObj, IImageCropperResult } from '@eduswiper/types'; import { expose } from 'threads/worker'; expose(function onExportCanvas( cropperObj: CropperObj ): Promise<IImageCropperResult> { return new Promise((resolve) => { const imageData = cropperObj.cropper.getImageData(); const canvasData = cropperObj.cropper.getCanvasData(); const canvas = cropperObj.cropper.getCroppedCanvas(); const editedURL = canvas.toDataURL(); resolve({ canvasData, imageData, editedURL }); }); });