Skip to content

Commit 0dfaa13

Browse files
committed
Support html2canvas v1.0.0 with promise-based call
1 parent 32447ef commit 0dfaa13

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,13 @@ var html2pdf = function(source, opt) {
5050

5151
// Render the canvas and pass the result to makePDF.
5252
var onRendered = opt.html2canvas.onrendered || function() {};
53-
opt.html2canvas.onrendered = function(canvas) {
53+
delete opt.html2canvas.onrendered;
54+
var done = function(canvas) {
5455
onRendered(canvas);
5556
document.body.removeChild(overlay);
5657
html2pdf.makePDF(canvas, pageSize, opt);
57-
}
58-
html2canvas(container, opt.html2canvas);
58+
};
59+
html2canvas(container, opt.html2canvas).then(done);
5960
};
6061

6162
html2pdf.parseInput = function(source, opt) {

0 commit comments

Comments
 (0)