Created
July 17, 2017 14:37
-
-
Save masnagam/15a7e112566a9d825baca7d06dfe8d22 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const $ = require('jquery'); | |
const html2canvas = require('html2canvas'); | |
if (ARGS.length < 2) { | |
throw new Error('Selector is required'); | |
} | |
const selector = ARGS[0]; | |
const callback = ARGS[ARGS.length - 1]; | |
Promise.all($(selector).map(function() { | |
return html2canvas(this) | |
.then((canvas) => canvas.toDataURL('image/png')); | |
})) | |
.then(callback); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment