Comparing version 7.1.0 to 7.2.0
24
index.js
@@ -159,3 +159,11 @@ /*! drag-drop. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */ | ||
if (listeners.onDrop && event.dataTransfer.items) { | ||
processItems(event.dataTransfer.items, (files, directories) => { | ||
processItems(event.dataTransfer.items, (err, files, directories) => { | ||
if (err) { | ||
// TODO: A future version of this library might expose this somehow | ||
console.error(err) | ||
return | ||
} | ||
if (files.length === 0) return | ||
const fileList = event.dataTransfer.files | ||
@@ -187,3 +195,5 @@ | ||
if (items.length === 0) return | ||
if (items.length === 0) { | ||
cb(null, [], []) | ||
} | ||
@@ -195,5 +205,7 @@ parallel(items.map(item => { | ||
}), (err, results) => { | ||
// This catches permission errors with file:// in Chrome. This should never | ||
// throw in production code, so the user does not need to use try-catch. | ||
if (err) throw err | ||
// This catches permission errors with file:// in Chrome | ||
if (err) { | ||
cb(err) | ||
return | ||
} | ||
@@ -210,3 +222,3 @@ const entries = results.flat(Infinity) | ||
cb(files, directories) | ||
cb(null, files, directories) | ||
}) | ||
@@ -213,0 +225,0 @@ } |
{ | ||
"name": "drag-drop", | ||
"description": "HTML5 drag & drop for humans", | ||
"version": "7.1.0", | ||
"version": "7.2.0", | ||
"author": { | ||
@@ -22,3 +22,3 @@ "name": "Feross Aboukhadijeh", | ||
"standard": "*", | ||
"tape": "^5.2.0" | ||
"tape": "^5.2.2" | ||
}, | ||
@@ -25,0 +25,0 @@ "homepage": "https://github.com/feross/drag-drop", |
@@ -193,3 +193,3 @@ # drag-drop [![ci][ci-image]][ci-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url] | ||
document.addEventListener('paste', event => { | ||
dragDrop.processItems(event.clipboardData.items, files => { | ||
dragDrop.processItems(event.clipboardData.items, (err, files) => { | ||
// ... | ||
@@ -196,0 +196,0 @@ }) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16768
241