Essentially, I need to extract the dataURL from the canvas and return it.
function getImage() {
var p = new Promise(function (resolve, reject) {
html2canvas(document.body).then(function (canvas) {
var image = canvas.toDataURL("image/png");
resolve(image);
});
});
p.then(function (image) {
return image;
})
.catch(function (err) {
console.log(err)
});
}
Please help to correct my code.