Skip to content
This repository was archived by the owner on Oct 4, 2020. It is now read-only.

Commit c8ac2a3

Browse files
committed
Add common event types, export EventType ctor
1 parent 845eff8 commit c8ac2a3

File tree

3 files changed

+278
-1
lines changed

3 files changed

+278
-1
lines changed

src/DOM/Event/EventTypes.purs

Lines changed: 267 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,267 @@
1+
module DOM.Event.EventTypes where
2+
3+
import DOM.Event.Types (EventType(..))
4+
5+
abort :: EventType
6+
abort = EventType "abort"
7+
8+
animationend :: EventType
9+
animationend = EventType "animationend"
10+
11+
animationiteration :: EventType
12+
animationiteration = EventType "animationiteration"
13+
14+
animationstart :: EventType
15+
animationstart = EventType "animationstart"
16+
17+
audioprocess :: EventType
18+
audioprocess = EventType "audioprocess"
19+
20+
beforeprint :: EventType
21+
beforeprint = EventType "beforeprint"
22+
23+
beforeunload :: EventType
24+
beforeunload = EventType "beforeunload"
25+
26+
blur :: EventType
27+
blur = EventType "blur"
28+
29+
canplay :: EventType
30+
canplay = EventType "canplay"
31+
32+
canplaythrough :: EventType
33+
canplaythrough = EventType "canplaythrough"
34+
35+
change :: EventType
36+
change = EventType "change"
37+
38+
click :: EventType
39+
click = EventType "click"
40+
41+
complete :: EventType
42+
complete = EventType "complete"
43+
44+
compositionend :: EventType
45+
compositionend = EventType "compositionend"
46+
47+
compositionstart :: EventType
48+
compositionstart = EventType "compositionstart"
49+
50+
compositionupdate :: EventType
51+
compositionupdate = EventType "compositionupdate"
52+
53+
contextmenu :: EventType
54+
contextmenu = EventType "contextmenu"
55+
56+
copy :: EventType
57+
copy = EventType "copy"
58+
59+
cut :: EventType
60+
cut = EventType "cut"
61+
62+
dblclick :: EventType
63+
dblclick = EventType "dblclick"
64+
65+
drag :: EventType
66+
drag = EventType "drag"
67+
68+
dragend :: EventType
69+
dragend = EventType "dragend"
70+
71+
dragenter :: EventType
72+
dragenter = EventType "dragenter"
73+
74+
dragleave :: EventType
75+
dragleave = EventType "dragleave"
76+
77+
dragover :: EventType
78+
dragover = EventType "dragover"
79+
80+
dragstart :: EventType
81+
dragstart = EventType "dragstart"
82+
83+
drop :: EventType
84+
drop = EventType "drop"
85+
86+
durationchange :: EventType
87+
durationchange = EventType "durationchange"
88+
89+
emptied :: EventType
90+
emptied = EventType "emptied"
91+
92+
ended :: EventType
93+
ended = EventType "ended"
94+
95+
error :: EventType
96+
error = EventType "error"
97+
98+
focus :: EventType
99+
focus = EventType "focus"
100+
101+
fullscreenchange :: EventType
102+
fullscreenchange = EventType "fullscreenchange"
103+
104+
fullscreenerror :: EventType
105+
fullscreenerror = EventType "fullscreenerror"
106+
107+
hashchange :: EventType
108+
hashchange = EventType "hashchange"
109+
110+
input :: EventType
111+
input = EventType "input"
112+
113+
invalid :: EventType
114+
invalid = EventType "invalid"
115+
116+
keydown :: EventType
117+
keydown = EventType "keydown"
118+
119+
keypress :: EventType
120+
keypress = EventType "keypress"
121+
122+
keyup :: EventType
123+
keyup = EventType "keyup"
124+
125+
load :: EventType
126+
load = EventType "load"
127+
128+
loadeddata :: EventType
129+
loadeddata = EventType "loadeddata"
130+
131+
loadedmetadata :: EventType
132+
loadedmetadata = EventType "loadedmetadata"
133+
134+
loadend :: EventType
135+
loadend = EventType "loadend"
136+
137+
loadstart :: EventType
138+
loadstart = EventType "loadstart"
139+
140+
message :: EventType
141+
message = EventType "message"
142+
143+
mousedown :: EventType
144+
mousedown = EventType "mousedown"
145+
146+
mouseenter :: EventType
147+
mouseenter = EventType "mouseenter"
148+
149+
mouseleave :: EventType
150+
mouseleave = EventType "mouseleave"
151+
152+
mousemove :: EventType
153+
mousemove = EventType "mousemove"
154+
155+
mouseout :: EventType
156+
mouseout = EventType "mouseout"
157+
158+
mouseover :: EventType
159+
mouseover = EventType "mouseover"
160+
161+
mouseup :: EventType
162+
mouseup = EventType "mouseup"
163+
164+
open :: EventType
165+
open = EventType "open"
166+
167+
pagehide :: EventType
168+
pagehide = EventType "pagehide"
169+
170+
pageshow :: EventType
171+
pageshow = EventType "pageshow"
172+
173+
paste :: EventType
174+
paste = EventType "paste"
175+
176+
pause :: EventType
177+
pause = EventType "pause"
178+
179+
play :: EventType
180+
play = EventType "play"
181+
182+
playing :: EventType
183+
playing = EventType "playing"
184+
185+
popstate :: EventType
186+
popstate = EventType "popstate"
187+
188+
progress :: EventType
189+
progress = EventType "progress"
190+
191+
ratechange :: EventType
192+
ratechange = EventType "ratechange"
193+
194+
readystatechange :: EventType
195+
readystatechange = EventType "readystatechange"
196+
197+
reset :: EventType
198+
reset = EventType "reset"
199+
200+
resize :: EventType
201+
resize = EventType "resize"
202+
203+
scroll :: EventType
204+
scroll = EventType "scroll"
205+
206+
seeked :: EventType
207+
seeked = EventType "seeked"
208+
209+
seeking :: EventType
210+
seeking = EventType "seeking"
211+
212+
select :: EventType
213+
select = EventType "select"
214+
215+
show :: EventType
216+
show = EventType "show"
217+
218+
stalled :: EventType
219+
stalled = EventType "stalled"
220+
221+
submit :: EventType
222+
submit = EventType "submit"
223+
224+
suspend :: EventType
225+
suspend = EventType "suspend"
226+
227+
timeout :: EventType
228+
timeout = EventType "timeout"
229+
230+
timeupdate :: EventType
231+
timeupdate = EventType "timeupdate"
232+
233+
touchcancel :: EventType
234+
touchcancel = EventType "touchcancel"
235+
236+
touchend :: EventType
237+
touchend = EventType "touchend"
238+
239+
touchenter :: EventType
240+
touchenter = EventType "touchenter"
241+
242+
touchleave :: EventType
243+
touchleave = EventType "touchleave"
244+
245+
touchmove :: EventType
246+
touchmove = EventType "touchmove"
247+
248+
touchstart :: EventType
249+
touchstart = EventType "touchstart"
250+
251+
transitionend :: EventType
252+
transitionend = EventType "transitionend"
253+
254+
unload :: EventType
255+
unload = EventType "unload"
256+
257+
visibilitychange :: EventType
258+
visibilitychange = EventType "visibilitychange"
259+
260+
volumechange :: EventType
261+
volumechange = EventType "volumechange"
262+
263+
waiting :: EventType
264+
waiting = EventType "waiting"
265+
266+
wheel :: EventType
267+
wheel = EventType "wheel"

src/DOM/Event/Types.purs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module DOM.Event.Types
22
( Event()
3-
, EventType()
3+
, EventType(..)
44
, EventTarget()
55
, readEventTarget
66
, AnimationEvent()

src/DOM/HTML/Types.purs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,24 @@ module DOM.HTML.Types where
33

44
import Prelude
55

6+
import DOM.Event.Types
67
import DOM.Node.Types
78

89
import qualified Unsafe.Coerce as U
910

1011
foreign import data Window :: *
1112

13+
windowToEventTarget :: Window -> EventTarget
14+
windowToEventTarget = U.unsafeCoerce
15+
1216
foreign import data HTMLDocument :: *
1317

1418
htmlDocumentToDocument :: HTMLDocument -> Document
1519
htmlDocumentToDocument = U.unsafeCoerce
1620

21+
htmlDocumentToEventTarget :: HTMLDocument -> EventTarget
22+
htmlDocumentToEventTarget = U.unsafeCoerce
23+
1724
foreign import data HTMLElement :: *
1825

1926
htmlElementToElement :: HTMLElement -> Element
@@ -27,3 +34,6 @@ htmlElementToNonDocumentTypeChildNode = U.unsafeCoerce
2734

2835
htmlElementToNode :: HTMLElement -> Node
2936
htmlElementToNode = U.unsafeCoerce
37+
38+
htmlElementToEventTarget :: HTMLElement -> EventTarget
39+
htmlElementToEventTarget = U.unsafeCoerce

0 commit comments

Comments
 (0)