File tree Expand file tree Collapse file tree 3 files changed +29
-0
lines changed Expand file tree Collapse file tree 3 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ Breaking changes:
8
8
- Migrate FFI to ES modules (#24 by @JordanMartinez )
9
9
10
10
New features:
11
+ - Add ` addEventListenerWithOptions ` to expose more options (#25 by @JordanMartinez )
11
12
12
13
Bugfixes:
13
14
Original file line number Diff line number Diff line change @@ -6,6 +6,18 @@ export function eventListener(fn) {
6
6
} ;
7
7
}
8
8
9
+ export function addEventListenerWithOptions ( type ) {
10
+ return function ( listener ) {
11
+ return function ( options ) {
12
+ return function ( target ) {
13
+ return function ( ) {
14
+ return target . addEventListener ( type , listener , options ) ;
15
+ } ;
16
+ } ;
17
+ } ;
18
+ } ;
19
+ }
20
+
9
21
export function addEventListener ( type ) {
10
22
return function ( listener ) {
11
23
return function ( useCapture ) {
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ module Web.Event.EventTarget
3
3
, EventListener
4
4
, eventListener
5
5
, addEventListener
6
+ , addEventListenerWithOptions
6
7
, removeEventListener
7
8
, dispatchEvent
8
9
) where
@@ -29,6 +30,21 @@ foreign import eventListener
29
30
. (Event -> Effect a )
30
31
-> Effect EventListener
31
32
33
+ -- | Adds a listener to an event target.
34
+ -- | - `capture` - whether the listener is added to the "capture" phase
35
+ -- | - `once` - if true, indicates listener should be invokved at most once
36
+ -- | before being automatically removed.
37
+ -- | - `passive` - indicates the callback function will never call `preventDefault`
38
+ foreign import addEventListenerWithOptions
39
+ :: EventType
40
+ -> EventListener
41
+ -> { capture :: Boolean
42
+ , once :: Boolean
43
+ , passive :: Boolean
44
+ }
45
+ -> EventTarget
46
+ -> Effect Unit
47
+
32
48
-- | Adds a listener to an event target. The boolean argument indicates whether
33
49
-- | the listener should be added for the "capture" phase.
34
50
foreign import addEventListener
You can’t perform that action at this time.
0 commit comments