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