Summary Files Commits Branches @commit @diff @stats
path: root / public / simple-image.js
diff options
context:
space:
mode:
1 files changed, 10 insertions, 0 deletions
-rw-r--r--public/simple-image.js10
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);
+ });