2

PHOTO EMBED

Thu Nov 03 2022 08:39:03 GMT+0000 (Coordinated Universal Time)

Saved by @strojekmikolaj #typescript

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 });
	});
});
content_copyCOPY