@@ -2692,6 +2692,38 @@ class Window
2692
2692
var lostpointercapture : js.Function1 [PointerEvent , _] = js.native
2693
2693
}
2694
2694
2695
+ /**
2696
+ * An options object that specifies characteristics about the event listener.
2697
+ *
2698
+ * MDN
2699
+ */
2700
+ @ js.native
2701
+ trait EventListenerOptions extends js.Object {
2702
+ /**
2703
+ * A Boolean indicating that events of this type will be dispatched to the registered listener
2704
+ * before being dispatched to any EventTarget beneath it in the DOM tree.
2705
+ *
2706
+ * MDN
2707
+ */
2708
+ var capture : js.UndefOr [Boolean ] = js.undefined
2709
+
2710
+ /**
2711
+ * A Boolean indicating that the listener should be invoked at most once after being added.
2712
+ * If true, the listener would be automatically removed when invoked.
2713
+ */
2714
+ var once : js.UndefOr [Boolean ] = js.undefined
2715
+
2716
+ /**
2717
+ * A Boolean which, if true, indicates that the function specified by listener will never call preventDefault().
2718
+ * If a passive listener does call preventDefault(),
2719
+ * the user agent will do nothing other than generate a console warning.
2720
+ * See Improving scrolling performance with passive listeners to learn more.
2721
+ *
2722
+ * MDN
2723
+ */
2724
+ var passive : js.UndefOr [Boolean ] = js.undefined
2725
+ }
2726
+
2695
2727
/**
2696
2728
* EventTarget is a DOM interface implemented by objects that can receive DOM events
2697
2729
* and have listeners for them.
@@ -2731,6 +2763,20 @@ class EventTarget extends js.Object {
2731
2763
listener : js.Function1 [T , _],
2732
2764
useCapture : Boolean = js.native): Unit = js.native
2733
2765
2766
+ /**
2767
+ * The EventTarget.addEventListener() method registers the specified listener on
2768
+ * the EventTarget it's called on. The event target may be an Element in a document, the
2769
+ * Document itself, a Window, or any other object that supports events (such as
2770
+ * XMLHttpRequest).
2771
+ *
2772
+ * This implementation accepts a settings object of type EventListenerOptions.
2773
+ *
2774
+ * MDN
2775
+ */
2776
+ def addEventListener [T <: Event ](`type` : String ,
2777
+ listener : js.Function1 [T , _],
2778
+ options : EventListenerOptions ): Unit = js.native
2779
+
2734
2780
/**
2735
2781
* Dispatches an Event at the specified EventTarget, invoking the affected
2736
2782
* EventListeners in the appropriate order. The normal event processing rules
0 commit comments