Spaces:
Running
Running
web share API
Browse files
components/SketchRenderer.js
CHANGED
|
@@ -94,7 +94,14 @@ export default function SketchRenderer({
|
|
| 94 |
window.addEventListener('message', function(event) {
|
| 95 |
if (event.data.type === 'startGifCapture') {
|
| 96 |
saveGif('word-to-code-animation', 5, { silent: true })
|
| 97 |
-
.then(() => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
window.parent.postMessage({ type: 'gifCaptureComplete' }, '*');
|
| 99 |
});
|
| 100 |
}
|
|
|
|
| 94 |
window.addEventListener('message', function(event) {
|
| 95 |
if (event.data.type === 'startGifCapture') {
|
| 96 |
saveGif('word-to-code-animation', 5, { silent: true })
|
| 97 |
+
.then((blob) => {
|
| 98 |
+
// Create a downloadable link
|
| 99 |
+
const url = URL.createObjectURL(blob);
|
| 100 |
+
const link = document.createElement('a');
|
| 101 |
+
link.href = url;
|
| 102 |
+
link.download = 'word-to-code-animation.gif';
|
| 103 |
+
document.body.appendChild(link);
|
| 104 |
+
// Don't click the link - let the share API handle it
|
| 105 |
window.parent.postMessage({ type: 'gifCaptureComplete' }, '*');
|
| 106 |
});
|
| 107 |
}
|