@@ -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,34 @@ class EventTarget extends js.Object {
2731
2769
listener : js.Function1 [T , _],
2732
2770
useCapture : Boolean = js.native): Unit = js.native
2733
2771
2772
+ /**
2773
+ * Removes the event listener previously registered with
2774
+ * EventTarget.addEventListener.
2775
+ *
2776
+ * This implementation accepts a settings object of type EventListenerOptions.
2777
+ *
2778
+ * MDN
2779
+ */
2780
+ def removeEventListener [T <: Event ](`type` : String ,
2781
+ listener : js.Function1 [T , _],
2782
+ options : EventListenerOptions ): Unit = js.native
2783
+
2784
+ /**
2785
+ * The EventTarget.addEventListener() method
2786
+ * registers the specified listener
2787
+ * on the EventTarget it's called on.
2788
+ * The event target may be an Element in a document,
2789
+ * the Document itself, a Window, or any other object that supports events
2790
+ * (such as XMLHttpRequest).
2791
+ *
2792
+ * This implementation accepts a settings object of type EventListenerOptions.
2793
+ *
2794
+ * MDN
2795
+ */
2796
+ def addEventListener [T <: Event ](`type` : String ,
2797
+ listener : js.Function1 [T , _],
2798
+ options : EventListenerOptions ): Unit = js.native
2799
+
2734
2800
/**
2735
2801
* Dispatches an Event at the specified EventTarget, invoking the affected
2736
2802
* EventListeners in the appropriate order. The normal event processing rules
0 commit comments