Skip to content

Commit a42cb00

Browse files
nukismanspicydonuts
authored andcommitted
targetFiles (#72)
Ability to get selected files from input
1 parent 0c459eb commit a42cb00

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/React/Basic/DOM/Events.purs

+4
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ import Effect.Unsafe (unsafePerformEffect)
4848
import React.Basic.Events (EventFn, SyntheticEvent, unsafeEventFn)
4949
import Unsafe.Coerce (unsafeCoerce)
5050
import Web.Event.Internal.Types (Event, EventTarget)
51+
import Web.File.FileList (FileList)
5152

5253
-- | General event fields
5354

@@ -111,6 +112,9 @@ targetChecked = unsafeEventFn \e -> toMaybe (unsafeCoerce e).target.checked
111112
targetValue :: EventFn SyntheticEvent (Maybe String)
112113
targetValue = unsafeEventFn \e -> toMaybe (unsafeCoerce e).target.value
113114

115+
targetFiles :: EventFn SyntheticEvent (Maybe FileList)
116+
targetFiles = unsafeEventFn \e -> toMaybe (unsafeCoerce e).target.files
117+
114118
timeStamp :: EventFn SyntheticEvent Number
115119
timeStamp = unsafeEventFn \e -> (unsafeCoerce e).timeStamp
116120

0 commit comments

Comments
 (0)