Skip to content

Commit 97906d4

Browse files
committed
Deprecate the last def apply()s of config objects in lib.scala.
Instead, make the corresponding traits non-native JS traits, so that they can be created with the `new Foo { ... }` syntax.
1 parent afe9351 commit 97906d4

File tree

3 files changed

+21
-19
lines changed

3 files changed

+21
-19
lines changed

api-reports/2_12.txt

+4-4
Original file line numberDiff line numberDiff line change
@@ -317,9 +317,9 @@ Blob[JC] def stream(): ReadableStream[Uint8Array]
317317
Blob[JC] def text(): js.Promise[String]
318318
Blob[JC] def `type`: String
319319
Blob[JO]
320-
BlobPropertyBag[JT] def endings: String
321-
BlobPropertyBag[JT] def `type`: String
322-
BlobPropertyBag[SO] def apply(`type`: js.UndefOr[String]?): BlobPropertyBag
320+
BlobPropertyBag[JT] var endings: js.UndefOr[String]
321+
BlobPropertyBag[JT] var `type`: js.UndefOr[String]
322+
BlobPropertyBag[SO] def apply(`type`: js.UndefOr[String]?): BlobPropertyBag (@deprecated in 2.0.0)
323323
Body[JT] def arrayBuffer(): js.Promise[ArrayBuffer]
324324
Body[JT] def blob(): js.Promise[Blob]
325325
Body[JT] def bodyUsed: Boolean
@@ -14427,7 +14427,7 @@ MutationObserverInit[JT] var characterData: js.UndefOr[Boolean]
1442714427
MutationObserverInit[JT] var characterDataOldValue: js.UndefOr[Boolean]
1442814428
MutationObserverInit[JT] var childList: js.UndefOr[Boolean]
1442914429
MutationObserverInit[JT] var subtree: js.UndefOr[Boolean]
14430-
MutationObserverInit[SO] def apply(childList: Boolean = false, attributes: Boolean = false, characterData: Boolean = false, subtree: Boolean = false, attributeOldValue: Boolean = false, characterDataOldValue: Boolean = false, attributeFilter: js.UndefOr[js.Array[String]]?): MutationObserverInit
14430+
MutationObserverInit[SO] def apply(childList: Boolean = false, attributes: Boolean = false, characterData: Boolean = false, subtree: Boolean = false, attributeOldValue: Boolean = false, characterDataOldValue: Boolean = false, attributeFilter: js.UndefOr[js.Array[String]]?): MutationObserverInit (@deprecated in 2.0.0)
1443114431
MutationRecord[JT] def addedNodes: NodeList[Node]
1443214432
MutationRecord[JT] def attributeName: String
1443314433
MutationRecord[JT] def attributeNamespace: String

api-reports/2_13.txt

+4-4
Original file line numberDiff line numberDiff line change
@@ -317,9 +317,9 @@ Blob[JC] def stream(): ReadableStream[Uint8Array]
317317
Blob[JC] def text(): js.Promise[String]
318318
Blob[JC] def `type`: String
319319
Blob[JO]
320-
BlobPropertyBag[JT] def endings: String
321-
BlobPropertyBag[JT] def `type`: String
322-
BlobPropertyBag[SO] def apply(`type`: js.UndefOr[String]?): BlobPropertyBag
320+
BlobPropertyBag[JT] var endings: js.UndefOr[String]
321+
BlobPropertyBag[JT] var `type`: js.UndefOr[String]
322+
BlobPropertyBag[SO] def apply(`type`: js.UndefOr[String]?): BlobPropertyBag (@deprecated in 2.0.0)
323323
Body[JT] def arrayBuffer(): js.Promise[ArrayBuffer]
324324
Body[JT] def blob(): js.Promise[Blob]
325325
Body[JT] def bodyUsed: Boolean
@@ -14427,7 +14427,7 @@ MutationObserverInit[JT] var characterData: js.UndefOr[Boolean]
1442714427
MutationObserverInit[JT] var characterDataOldValue: js.UndefOr[Boolean]
1442814428
MutationObserverInit[JT] var childList: js.UndefOr[Boolean]
1442914429
MutationObserverInit[JT] var subtree: js.UndefOr[Boolean]
14430-
MutationObserverInit[SO] def apply(childList: Boolean = false, attributes: Boolean = false, characterData: Boolean = false, subtree: Boolean = false, attributeOldValue: Boolean = false, characterDataOldValue: Boolean = false, attributeFilter: js.UndefOr[js.Array[String]]?): MutationObserverInit
14430+
MutationObserverInit[SO] def apply(childList: Boolean = false, attributes: Boolean = false, characterData: Boolean = false, subtree: Boolean = false, attributeOldValue: Boolean = false, characterDataOldValue: Boolean = false, attributeFilter: js.UndefOr[js.Array[String]]?): MutationObserverInit (@deprecated in 2.0.0)
1443114431
MutationRecord[JT] def addedNodes: NodeList[Node]
1443214432
MutationRecord[JT] def attributeName: String
1443314433
MutationRecord[JT] def attributeNamespace: String

src/main/scala/org/scalajs/dom/lib.scala

+13-11
Original file line numberDiff line numberDiff line change
@@ -3013,41 +3013,42 @@ class MutationObserver(callback: js.Function2[js.Array[MutationRecord], Mutation
30133013
* attributes, or characterDatamust be set to true. Otherwise, "An invalid or illegal string was specified" error is
30143014
* thrown.
30153015
*/
3016-
@js.native
30173016
trait MutationObserverInit extends js.Object {
30183017

30193018
/** Set to true if additions and removals of the target node's child elements (including text nodes) are to be
30203019
* observed.
30213020
*/
3022-
var childList: js.UndefOr[Boolean] = js.native
3021+
var childList: js.UndefOr[Boolean] = js.undefined
30233022

30243023
/** Set to true if mutations to target's attributes are to be observed. */
3025-
var attributes: js.UndefOr[Boolean] = js.native
3024+
var attributes: js.UndefOr[Boolean] = js.undefined
30263025

30273026
/** Set to true if mutations to target's data are to be observed. */
3028-
var characterData: js.UndefOr[Boolean] = js.native
3027+
var characterData: js.UndefOr[Boolean] = js.undefined
30293028

30303029
/** Set to true if mutations to not just target, but also target's descendants are to be observed. */
3031-
var subtree: js.UndefOr[Boolean] = js.native
3030+
var subtree: js.UndefOr[Boolean] = js.undefined
30323031

30333032
/** Set to true if attributes is set to true and target's attribute value before the mutation needs to be recorded. */
3034-
var attributeOldValue: js.UndefOr[Boolean] = js.native
3033+
var attributeOldValue: js.UndefOr[Boolean] = js.undefined
30353034

30363035
/** Set to true if characterData is set to true and target's data before the mutation needs to be recorded. */
3037-
var characterDataOldValue: js.UndefOr[Boolean] = js.native
3036+
var characterDataOldValue: js.UndefOr[Boolean] = js.undefined
30383037

30393038
/** Set to an array of attribute local names (without namespace) if not all attribute mutations need to be observed.
30403039
*/
3041-
var attributeFilter: js.UndefOr[js.Array[String]] = js.native
3040+
var attributeFilter: js.UndefOr[js.Array[String]] = js.undefined
30423041
}
30433042

30443043
/** Factory for [[MutationObserverInit]] objects. */
3044+
@deprecated("all members of MutationObserverInit are deprecated", "2.0.0")
30453045
object MutationObserverInit {
30463046

30473047
/** Creates a new [[MutationObserverInit]] object with the given values. Default values for the `Boolean` parameters
30483048
* are `false`. If the value of `attributeFilter` is `js.undefined`, created object won't have `attributeFilter`
30493049
* property.
30503050
*/
3051+
@deprecated("use `new MutationObserverInit { ... }` instead", "2.0.0")
30513052
def apply(
30523053
childList: Boolean = false, attributes: Boolean = false, characterData: Boolean = false, subtree: Boolean = false,
30533054
attributeOldValue: Boolean = false, characterDataOldValue: Boolean = false,
@@ -4877,15 +4878,16 @@ object FileReader extends js.Object {
48774878
val DONE: Short = js.native
48784879
}
48794880

4880-
@js.native
48814881
trait BlobPropertyBag extends js.Object {
4882-
def `type`: String = js.native
4882+
var `type`: js.UndefOr[String] = js.undefined
48834883

4884-
def endings: String = js.native
4884+
var endings: js.UndefOr[String] = js.undefined
48854885
}
48864886

4887+
@deprecated("all members of BlobPropertyBag are deprecated", "2.0.0")
48874888
object BlobPropertyBag {
48884889

4890+
@deprecated("use `new BlobPropertyBag { ... }` instead", "2.0.0")
48894891
@inline
48904892
def apply(`type`: js.UndefOr[String] = js.undefined): BlobPropertyBag = {
48914893
val result = js.Dynamic.literal()

0 commit comments

Comments
 (0)