123456789101112131415 |
- /**
- * Save a <canvas> element's content to a Blob object.
- *
- * @param {HTMLCanvasElement} canvas
- * @returns {Promise}
- */
- export default function canvasToBlob(
- canvas: HTMLCanvasElement,
- type: string,
- quality?: number,
- ): Promise<Blob | null> {
- return new Promise((resolve) => {
- canvas.toBlob(resolve, type, quality)
- })
- }
|