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:
88- Migrate FFI to ES modules (#24 by @JordanMartinez )
99
1010New features:
11+ - Add ` addEventListenerWithOptions ` to expose more options (#25 by @JordanMartinez )
1112
1213Bugfixes:
1314
Original file line number Diff line number Diff line change @@ -6,6 +6,18 @@ export function eventListener(fn) {
66 } ;
77}
88
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+
921export function addEventListener ( type ) {
1022 return function ( listener ) {
1123 return function ( useCapture ) {
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ module Web.Event.EventTarget
33 , EventListener
44 , eventListener
55 , addEventListener
6+ , addEventListenerWithOptions
67 , removeEventListener
78 , dispatchEvent
89 ) where
@@ -29,6 +30,21 @@ foreign import eventListener
2930 . (Event -> Effect a )
3031 -> Effect EventListener
3132
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+
3248-- | Adds a listener to an event target. The boolean argument indicates whether
3349-- | the listener should be added for the "capture" phase.
3450foreign import addEventListener
You can’t perform that action at this time.
0 commit comments