You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
334 B
16 lines
334 B
5 years ago
|
'use strict'
|
||
|
|
||
|
module.exports = function (src, clip) {
|
||
|
return new Promise(function (ok, nok) {
|
||
|
var img = new Image()
|
||
|
img.crossOrigin = 'Anonymous'
|
||
|
img.onload = function() {
|
||
|
ok(img)
|
||
|
}
|
||
|
img.onerror = function(err) {
|
||
|
nok(new Error('Bad image URL/path', err))
|
||
|
}
|
||
|
img.src = src
|
||
|
})
|
||
|
}
|