This repository was archived by the owner on Oct 4, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
src/DOM/HTML/Event/DragEvent Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 1
1
"use strict" ;
2
2
3
- exports . files = function ( dataTransfer ) {
3
+ exports . filesNullable = function ( dataTransfer ) {
4
4
return dataTransfer . files ;
5
5
} ;
6
6
Original file line number Diff line number Diff line change 1
1
module DOM.HTML.Event.DragEvent.DataTransfer
2
2
( DataTransfer
3
3
, files
4
+ , filesNullable
4
5
, types
5
6
) where
6
7
8
+ import Prelude
7
9
import DOM.File.Types (FileList )
10
+ import Data.Maybe (Maybe )
11
+ import Data.Nullable (Nullable , toMaybe )
8
12
9
13
foreign import data DataTransfer :: *
10
14
11
15
-- | Contains a list of all the local files available on the data transfer.
12
16
-- | Empty if the drag operation doesn't involve dragging files.
13
- foreign import files :: DataTransfer -> FileList
17
+ -- |
18
+ -- | It's possible that a drag operation may have null files, instead of an
19
+ -- | empty file list. In these cases Nothing is returned.
20
+ files :: DataTransfer -> Maybe FileList
21
+ files = toMaybe <$> filesNullable
22
+
23
+ foreign import filesNullable :: DataTransfer -> Nullable FileList
14
24
15
25
-- | Returns an array of data formats used in the drag operation.
16
26
-- | If the drag operation included no data, then the array is empty.
You can’t perform that action at this time.
0 commit comments