diff options
| Commit | 70e5b712b5267cfe008a9cecc2d4aae44f90ac6d (patch) | |
|---|---|---|
| Author | 2023-01-17 17:26:46 +0200 | |
| Committer | 2023-01-17 17:26:46 +0200 | |
| Files | 13228b2ab02c6349a45181e76a2269a73e8cc9f5 /public/simple-image.js | |
| web-buttons-70e5b712b5267cfe008a9cecc2d4aae44f90ac6d.tar web-buttons-70e5b712b5267cfe008a9cecc2d4aae44f90ac6d.tar.gz web-buttons-70e5b712b5267cfe008a9cecc2d4aae44f90ac6d.zip | ||
| Parent | 148979cc976a58fcf8e45784c765e432ace36974 (diff) | |
[general] Separated image generation to it's own javascript file
1 files changed, 10 insertions, 0 deletions
| -rw-r--r-- | public/simple-image.js | 10 |
diff --git a/public/simple-image.js b/public/simple-image.js new file mode 100644 index 0000000..2150802 --- /dev/null +++ b/public/simple-image.js @@ -0,0 +1,10 @@ +var node = document.getElementById('button'); +domtoimage.toPng(node) + .then (function (dataUrl) { + var img = new Image(); + img.src = dataUrl; + document.body.appendChild(img); + }) + .catch(function (error) { + console.error('oops, something went wrong!', error); + }); |
