@@ -8,23 +8,36 @@ package org.scalajs.dom
8
8
9
9
import scala .scalajs .js
10
10
11
- /** A MediaQueryList object maintains a list of media queries on a document, and handles sending notifications to
12
- * listeners when the media queries on the document change .
11
+ /** A MediaQueryList object stores information on a media query applied to a document, with support for both immediate
12
+ * and event-driven matching against the state of the document.
13
13
*/
14
14
@ js.native
15
- trait MediaQueryList extends js. Object {
15
+ trait MediaQueryList extends EventTarget {
16
16
17
- /** true if the document currently matches the media query list; otherwise false. Read only . */
17
+ /** A boolean value that returns true if the document currently matches the media query list, or false if not . */
18
18
def matches : Boolean = js.native
19
19
20
- /** The serialized media query list */
21
- var media : String = js.native
20
+ /** A string representing a serialized media query. */
21
+ def media : String = js.native
22
22
23
- /** Adds a new listener to the media query list. If the specified listener is already in the list, this method has no
24
- * effect.
23
+ /** Adds to the MediaQueryList a callback which is invoked whenever the media query status—whether or not the document
24
+ * matches the media queries in the list—changes.
25
+ *
26
+ * This method exists primarily for backward compatibility; if possible, you should instead use addEventListener() to
27
+ * watch for the change event.
28
+ * @deprecated
25
29
*/
30
+ @ deprecated(" Use addEventListener() instead" , " 2.4.0" )
26
31
def addListener (listener : MediaQueryListListener ): Unit = js.native
27
32
28
- /** Removes a listener from the media query list. Does nothing if the specified listener isn't already in the list. */
33
+ /** Removes the specified listener callback from the callbacks to be invoked when the MediaQueryList changes media
34
+ * query status, which happens any time the document switches between matching and not matching the media queries
35
+ * listed in the MediaQueryList.
36
+ *
37
+ * This method has been kept for backward compatibility; if possible, you should generally use removeEventListener()
38
+ * to remove change notification callbacks (which should have previously been added using addEventListener()).
39
+ * @deprecated
40
+ */
41
+ @ deprecated(" Use removeEventListener() instead" , " 2.4.0" )
29
42
def removeListener (listener : MediaQueryListListener ): Unit = js.native
30
43
}
0 commit comments