UNPKG

450 BJavaScriptView Raw
1/**
2 * Checks if the browser supports Drag & Drop (not supported on mobile devices, for example).
3 *
4 * @returns {boolean}
5 */
6module.exports = function isDragDropSupported () {
7 const div = document.createElement('div')
8
9 if (!('draggable' in div) || !('ondragstart' in div && 'ondrop' in div)) {
10 return false
11 }
12
13 if (!('FormData' in window)) {
14 return false
15 }
16
17 if (!('FileReader' in window)) {
18 return false
19 }
20
21 return true
22}