You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
397 B
TypeScript
15 lines
397 B
TypeScript
import { saveURLAsFile } from './saveURLAsFile';
|
|
|
|
export function saveQRCode(id: string): void {
|
|
const qrCanvas = document.querySelector(`#${id}`) as HTMLCanvasElement;
|
|
if (qrCanvas) {
|
|
saveURLAsFile({
|
|
filename: `${id}-${new Date().toISOString()}.png`,
|
|
url: qrCanvas.toDataURL(),
|
|
document,
|
|
});
|
|
} else {
|
|
window.log.error('[saveQRCode] QR code not found!');
|
|
}
|
|
}
|