Fail with a Promise.reject when no canvas support

This commit is contained in:
Niklas von Hertzen 2014-03-10 18:46:25 +02:00
parent 3101f2007a
commit 12d85e3c04
4 changed files with 40 additions and 26 deletions

View File

@ -21,7 +21,7 @@ module.exports = function(grunt) {
concat: {
dist: {
src: [
'src/**/*.js'
'src/promise.js', 'src/**/*.js'
],
dest: 'build/<%= pkg.name %>.js'
},

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,12 @@
var html2canvasNodeAttribute = "data-html2canvas-node";
if (typeof(Object.create) !== "function" || typeof(document.createElement("canvas").getContext) !== "function") {
window.html2canvas = function() {
return Promise.reject("No canvas support");
};
return;
}
window.html2canvas = function(nodeList, options) {
options = options || {};
if (options.logging) {