Skip to content

Updates MediaQueryList to extend EventTarget #724

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Sep 5, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 27 additions & 22 deletions api-reports/2_12.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
scala-js-dom API
================

This is generated automatically on compile via custom Scalafix rule 'GenerateApiReport'.

Flags:
[J-] = JavaScript type
[S-] = Scala type
[-C] = Class
[-T] = Trait
[-O] = Object


scala-js-dom API
================
This is generated automatically on compile via custom Scalafix rule 'GenerateApiReport'.
Flags:
[J-] = JavaScript type
[S-] = Scala type
[-C] = Class
[-T] = Trait
[-O] = Object
AbortController[JC] def abort(): Unit
AbortController[JC] val signal: AbortSignal
AbortSignal[JT] def aborted: Boolean
Expand Down Expand Up @@ -15401,7 +15401,7 @@ Location[JT] def reload(flag: Boolean?): Unit
Location[JT] def replace(url: String): Unit
Location[JT] var search: String
MIMEType[JT]
MIMEType[SO] val `application/xhtml+xml` = "application/xhtml+xml".asInstanceOf[MIMEType]
MIMEType[SO] val `application/xhtml+xml` = "application/xhtml+xml".asInstanceOf[MIMEType]
MIMEType[SO] val `application/xml` = "application/xml".asInstanceOf[MIMEType]
MIMEType[SO] val `image/svg+xml` = "image/svg+xml".asInstanceOf[MIMEType]
MIMEType[SO] val `text/html` = "text/html".asInstanceOf[MIMEType]
Expand Down Expand Up @@ -15450,10 +15450,15 @@ MediaList[JC] def item(index: Int): String
MediaList[JC] def length: Int
MediaList[JC] def mediaText: String
MediaList[JC] @scala.scalajs.js.annotation.JSBracketAccess def update(index: Int, v: String): Unit
MediaQueryList[JT] def addListener(listener: MediaQueryListListener): Unit
MediaQueryList[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit
MediaQueryList[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit
MediaQueryList[JT] def addListener(listener: MediaQueryListListener): Unit (@deprecated in 2.3.0)
MediaQueryList[JT] def dispatchEvent(evt: Event): Boolean
MediaQueryList[JT] def matches: Boolean
MediaQueryList[JT] var media: String
MediaQueryList[JT] def removeListener(listener: MediaQueryListListener): Unit
MediaQueryList[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit
MediaQueryList[JT] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit
MediaQueryList[JT] def removeListener(listener: MediaQueryListListener): Unit (@deprecated in 2.3.0)
MediaQueryListListener[JT] def apply(mql: MediaQueryList): Unit
MediaSource[JC] def activeSourceBuffers: SourceBufferList
MediaSource[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit
Expand Down Expand Up @@ -16111,7 +16116,7 @@ PermissionName[JT]
PermissionName[SO] val geolocation: PermissionName
PermissionName[SO] val midi: PermissionName
PermissionName[SO] val notifications: PermissionName
PermissionName[SO] val `persistent-storage` = "persistent-storage".asInstanceOf[PermissionName]
PermissionName[SO] val `persistent-storage` = "persistent-storage".asInstanceOf[PermissionName]
PermissionName[SO] val push: PermissionName
PermissionState[JT]
PermissionState[SO] val denied: PermissionState
Expand Down Expand Up @@ -16497,9 +16502,9 @@ RTCSessionDescriptionInit[SO] def apply(`type`: js.UndefOr[RTCSdpType]?, sdp: js
RTCSignalingState[JT]
RTCSignalingState[SO] val closed: RTCSignalingState
RTCSignalingState[SO] val `have-local-offer` = "have-local-offer".asInstanceOf[RTCSignalingState]
RTCSignalingState[SO] val `have-local-pranswer` = "have-local-pranswer".asInstanceOf[RTCSignalingState]
RTCSignalingState[SO] val `have-local-pranswer` = "have-local-pranswer".asInstanceOf[RTCSignalingState]
RTCSignalingState[SO] val `have-remote-offer` = "have-remote-offer".asInstanceOf[RTCSignalingState]
RTCSignalingState[SO] val `have-remote-pranswer` = "have-remote-pranswer".asInstanceOf[RTCSignalingState]
RTCSignalingState[SO] val `have-remote-pranswer` = "have-remote-pranswer".asInstanceOf[RTCSignalingState]
RTCSignalingState[SO] val stable: RTCSignalingState
RTCStats[JT] val id: String
RTCStats[JT] val timestamp: Double
Expand Down Expand Up @@ -16569,9 +16574,9 @@ ReadableStreamUnderlyingSource[JT] var `type`: js.UndefOr[ReadableStreamType]
ReferrerPolicy[JT]
ReferrerPolicy[SO] val empty: ReferrerPolicy
ReferrerPolicy[SO] val `no-referrer` = "no-referrer".asInstanceOf[ReferrerPolicy]
ReferrerPolicy[SO] val `no-referrer-when-downgrade` = "no-referrer-when-downgrade".asInstanceOf[ReferrerPolicy]
ReferrerPolicy[SO] val `no-referrer-when-downgrade` = "no-referrer-when-downgrade".asInstanceOf[ReferrerPolicy]
ReferrerPolicy[SO] val `origin-only` = "origin-only".asInstanceOf[ReferrerPolicy]
ReferrerPolicy[SO] val `origin-when-cross-origin` = "origin-when-cross-origin".asInstanceOf[ReferrerPolicy]
ReferrerPolicy[SO] val `origin-when-cross-origin` = "origin-when-cross-origin".asInstanceOf[ReferrerPolicy]
ReferrerPolicy[SO] val `unsafe-url` = "unsafe-url".asInstanceOf[ReferrerPolicy]
Request[JC] def arrayBuffer(): js.Promise[ArrayBuffer]
Request[JC] def blob(): js.Promise[Blob]
Expand Down Expand Up @@ -27550,4 +27555,4 @@ webworkers[SO] type WorkerGlobalScope = dom.WorkerGlobalScope (@deprecated in 2
webworkers[SO] type WorkerLocation = dom.WorkerLocation (@deprecated in 2.0.0)
webworkers[SO] type WorkerNavigator = dom.WorkerNavigator (@deprecated in 2.0.0)
webworkers[SO] def self: DedicatedWorkerGlobalScope (@deprecated in 2.0.0)
webworkers.DedicatedWorkerGlobalScope[JO] def self: DedicatedWorkerGlobalScope (@deprecated in 2.0.0)
webworkers.DedicatedWorkerGlobalScope[JO] def self: DedicatedWorkerGlobalScope (@deprecated in 2.0.0)
Expand Down
29 changes: 21 additions & 8 deletions dom/src/main/scala/org/scalajs/dom/MediaQueryList.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,36 @@ package org.scalajs.dom

import scala.scalajs.js

/** A MediaQueryList object maintains a list of media queries on a document, and handles sending notifications to
* listeners when the media queries on the document change.
/** A MediaQueryList object stores information on a media query applied to a document, with support for both immediate
* and event-driven matching against the state of the document.
*/
@js.native
trait MediaQueryList extends js.Object {
trait MediaQueryList extends EventTarget {

/** true if the document currently matches the media query list; otherwise false. Read only. */
/** A boolean value that returns true if the document currently matches the media query list, or false if not. */
def matches: Boolean = js.native

/** The serialized media query list */
/** A string representing a serialized media query. */
var media: String = js.native

/** Adds a new listener to the media query list. If the specified listener is already in the list, this method has no
* effect.
/** Adds to the MediaQueryList a callback which is invoked whenever the media query status—whether or not the document
* matches the media queries in the list—changes.
*
* This method exists primarily for backward compatibility; if possible, you should instead use addEventListener() to
* watch for the change event.
* @deprecated
*/
@deprecated("Use addEventListener() instead", "2.3.0")
def addListener(listener: MediaQueryListListener): Unit = js.native

/** Removes a listener from the media query list. Does nothing if the specified listener isn't already in the list. */
/** Removes the specified listener callback from the callbacks to be invoked when the MediaQueryList changes media
* query status, which happens any time the document switches between matching and not matching the media queries
* listed in the MediaQueryList.
*
* This method has been kept for backward compatibility; if possible, you should generally use removeEventListener()
* to remove change notification callbacks (which should have previously been added using addEventListener()).
* @deprecated
*/
@deprecated("Use removeEventListener() instead", "2.3.0")
def removeListener(listener: MediaQueryListListener): Unit = js.native
}