Skip to content

Commit 0d88533

Browse files
authored
Add all media element events (#37)
1 parent 44f46f0 commit 0d88533

File tree

1 file changed

+40
-19
lines changed

1 file changed

+40
-19
lines changed

src/DOM/HTML/Indexed.purs

Lines changed: 40 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,49 @@ type ClipboardEvents r =
129129
| r
130130
)
131131

132+
type MediaEvents r =
133+
( onLoadStart :: Event
134+
, onProgress :: Event
135+
, onSuspend :: Event
136+
, onAbort :: Event
137+
, onError :: Event
138+
, onEmptied :: Event
139+
, onStalled :: Event
140+
, onLoadedMetadata :: Event
141+
, onLoadedData :: Event
142+
, onCanPlay :: Event
143+
, onCanPlayThrough :: Event
144+
, onPlaying :: Event
145+
, onWaiting :: Event
146+
, onSeeking :: Event
147+
, onSeeked :: Event
148+
, onEnded :: Event
149+
, onDurationChange :: Event
150+
, onTimeUpdate :: Event
151+
, onPlay :: Event
152+
, onPause :: Event
153+
, onRateChange :: Event
154+
, onResize :: Event
155+
, onVolumeChange :: Event
156+
| r
157+
)
158+
132159
type InteractiveEvents r = ClipboardEvents (FocusEvents (TransitionEvents (KeyEvents (PointerEvents (TouchEvents (DragEvents (MouseEvents (onWheel :: WheelEvent | r))))))))
133160

134161
type GlobalProperties r = GlobalAttributes (GlobalEvents r)
135162

136163
type Interactive r = InteractiveEvents (GlobalProperties r)
137164

165+
type Media r = Interactive (MediaEvents
166+
( autoplay :: Boolean
167+
, controls :: Boolean
168+
, loop :: Boolean
169+
, muted :: Boolean
170+
, preload :: PreloadValue
171+
, src :: String
172+
| r
173+
))
174+
138175
type Noninteractive r = GlobalProperties r
139176

140177
type HTMLa = Interactive
@@ -166,15 +203,7 @@ type HTMLarticle = Interactive ()
166203

167204
type HTMLaside = Interactive ()
168205

169-
type HTMLaudio = Interactive
170-
( autoplay :: Boolean
171-
, controls :: Boolean
172-
, loop :: Boolean
173-
, muted :: Boolean
174-
, preload :: PreloadValue
175-
, src :: String
176-
, onError :: Event
177-
)
206+
type HTMLaudio = Media ()
178207

179208
type HTMLb = Interactive ()
180209

@@ -630,19 +659,11 @@ type HTMLul = Interactive (onScroll :: Event)
630659

631660
type HTMLvar = Interactive ()
632661

633-
type HTMLvideo = Interactive
634-
( autoplay :: Boolean
635-
, controls :: Boolean
636-
, height :: CSSPixel
637-
, loop :: Boolean
638-
, muted :: Boolean
662+
type HTMLvideo = Media
663+
( height :: CSSPixel
639664
, poster :: String
640-
, preload :: PreloadValue
641-
, src :: String
642665
, width :: CSSPixel
643666
, type :: MediaType
644-
, onError :: Event
645-
, onTimeUpdate :: Event
646667
)
647668

648669
type HTMLwbr = Interactive ()

0 commit comments

Comments
 (0)