Skip to content

Commit 001c22a

Browse files
committed
Improve doc comments, fix function signature getAsString, api reports
1 parent ff85260 commit 001c22a

File tree

5 files changed

+73
-13
lines changed

5 files changed

+73
-13
lines changed

api-reports/2_12.txt

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1297,13 +1297,24 @@ DOMTokenList[JC] def remove(token: String): Unit
12971297
DOMTokenList[JC] def toggle(token: String): Boolean
12981298
DOMTokenList[JC] def toggle(token: String, force: Boolean): Boolean
12991299
DataTransfer[JT] def clearData(format: String?): Unit
1300-
DataTransfer[JT] var dropEffect: String
1301-
DataTransfer[JT] var effectAllowed: String
1300+
DataTransfer[JT] var dropEffect: DropEffectValue
1301+
DataTransfer[JT] var effectAllowed: EffectAllowedValue
13021302
DataTransfer[JT] def files: FileList
13031303
DataTransfer[JT] def getData(format: String): String
1304+
DataTransfer[JT] def items: DataTransferItemList
13041305
DataTransfer[JT] def setData(format: String, data: String): Unit
13051306
DataTransfer[JT] def setDragImage(image: Element, x: Double, y: Double): Unit
1306-
DataTransfer[JT] def types: js.Array[String]
1307+
DataTransfer[JT] def types: FrozenArray[String]
1308+
DataTransferItem[JT] def getAsFile(): js.UndefOr[File]
1309+
DataTransferItem[JT] def getAsString(callback: Function1[String, Unit]): Unit
1310+
DataTransferItem[JT] def kind: DragDataItemKind
1311+
DataTransferItem[JT] def `type`: String
1312+
DataTransferItemList[JC] def add(data: File): Unit
1313+
DataTransferItemList[JC] def add(data: String, `type`: String): Unit
1314+
DataTransferItemList[JC] @js.annotation.JSBracketAccess def apply(index: Int): DataTransferItem
1315+
DataTransferItemList[JC] def clear(): Unit
1316+
DataTransferItemList[JC] def length: Int
1317+
DataTransferItemList[JC] def remove(index: Int): Unit
13071318
DedicatedWorkerGlobalScope[JO] def self: DedicatedWorkerGlobalScope
13081319
DedicatedWorkerGlobalScope[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit
13091320
DedicatedWorkerGlobalScope[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit
@@ -1625,6 +1636,9 @@ DocumentType[JC] def removeEventListener[T <: Event](`type`: String, listener: j
16251636
DocumentType[JC] def replaceChild(newChild: Node, oldChild: Node): Node
16261637
DocumentType[JC] def systemId: String
16271638
DocumentType[JC] var textContent: String
1639+
DragDataItemKind[JT]
1640+
DragDataItemKind[SO] val file: DragDataItemKind
1641+
DragDataItemKind[SO] val string: DragDataItemKind
16281642
DragEffect[SO] final val All = "all"
16291643
DragEffect[SO] final val Copy = "copy"
16301644
DragEffect[SO] final val CopyLink = "copyLink"
@@ -1666,6 +1680,11 @@ DragEvent[JT] def target: EventTarget
16661680
DragEvent[JT] def timeStamp: Double
16671681
DragEvent[JT] def `type`: String
16681682
DragEvent[JT] def view: Window
1683+
DropEffectValue[JT]
1684+
DropEffectValue[SO] val copy: DropEffectValue
1685+
DropEffectValue[SO] val link: DropEffectValue
1686+
DropEffectValue[SO] val move: DropEffectValue
1687+
DropEffectValue[SO] val none: DropEffectValue
16691688
DynamicsCompressorNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit
16701689
DynamicsCompressorNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit
16711690
DynamicsCompressorNode[JT] val attack: AudioParam
@@ -1711,6 +1730,16 @@ EcdsaParams[JT] val name: String
17111730
EcdsaParams[SO] def apply(name: String, hash: HashAlgorithmIdentifier): EcdsaParams (@deprecated in 2.0.0)
17121731
EcdsaParams[SO] val hash = hash0
17131732
EcdsaParams[SO] val name = name0
1733+
EffectAllowedValue[JT]
1734+
EffectAllowedValue[SO] val all: EffectAllowedValue
1735+
EffectAllowedValue[SO] val copy: EffectAllowedValue
1736+
EffectAllowedValue[SO] val copyLink: EffectAllowedValue
1737+
EffectAllowedValue[SO] val copyMove: EffectAllowedValue
1738+
EffectAllowedValue[SO] val link: EffectAllowedValue
1739+
EffectAllowedValue[SO] val linkMove: EffectAllowedValue
1740+
EffectAllowedValue[SO] val move: EffectAllowedValue
1741+
EffectAllowedValue[SO] val none: EffectAllowedValue
1742+
EffectAllowedValue[SO] val uninitialized: EffectAllowedValue
17141743
Element[JC] var accessKey: String
17151744
Element[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit
17161745
Element[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit

api-reports/2_13.txt

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1297,13 +1297,24 @@ DOMTokenList[JC] def remove(token: String): Unit
12971297
DOMTokenList[JC] def toggle(token: String): Boolean
12981298
DOMTokenList[JC] def toggle(token: String, force: Boolean): Boolean
12991299
DataTransfer[JT] def clearData(format: String?): Unit
1300-
DataTransfer[JT] var dropEffect: String
1301-
DataTransfer[JT] var effectAllowed: String
1300+
DataTransfer[JT] var dropEffect: DropEffectValue
1301+
DataTransfer[JT] var effectAllowed: EffectAllowedValue
13021302
DataTransfer[JT] def files: FileList
13031303
DataTransfer[JT] def getData(format: String): String
1304+
DataTransfer[JT] def items: DataTransferItemList
13041305
DataTransfer[JT] def setData(format: String, data: String): Unit
13051306
DataTransfer[JT] def setDragImage(image: Element, x: Double, y: Double): Unit
1306-
DataTransfer[JT] def types: js.Array[String]
1307+
DataTransfer[JT] def types: FrozenArray[String]
1308+
DataTransferItem[JT] def getAsFile(): js.UndefOr[File]
1309+
DataTransferItem[JT] def getAsString(callback: Function1[String, Unit]): Unit
1310+
DataTransferItem[JT] def kind: DragDataItemKind
1311+
DataTransferItem[JT] def `type`: String
1312+
DataTransferItemList[JC] def add(data: File): Unit
1313+
DataTransferItemList[JC] def add(data: String, `type`: String): Unit
1314+
DataTransferItemList[JC] @js.annotation.JSBracketAccess def apply(index: Int): DataTransferItem
1315+
DataTransferItemList[JC] def clear(): Unit
1316+
DataTransferItemList[JC] def length: Int
1317+
DataTransferItemList[JC] def remove(index: Int): Unit
13071318
DedicatedWorkerGlobalScope[JO] def self: DedicatedWorkerGlobalScope
13081319
DedicatedWorkerGlobalScope[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit
13091320
DedicatedWorkerGlobalScope[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit
@@ -1625,6 +1636,9 @@ DocumentType[JC] def removeEventListener[T <: Event](`type`: String, listener: j
16251636
DocumentType[JC] def replaceChild(newChild: Node, oldChild: Node): Node
16261637
DocumentType[JC] def systemId: String
16271638
DocumentType[JC] var textContent: String
1639+
DragDataItemKind[JT]
1640+
DragDataItemKind[SO] val file: DragDataItemKind
1641+
DragDataItemKind[SO] val string: DragDataItemKind
16281642
DragEffect[SO] final val All = "all"
16291643
DragEffect[SO] final val Copy = "copy"
16301644
DragEffect[SO] final val CopyLink = "copyLink"
@@ -1666,6 +1680,11 @@ DragEvent[JT] def target: EventTarget
16661680
DragEvent[JT] def timeStamp: Double
16671681
DragEvent[JT] def `type`: String
16681682
DragEvent[JT] def view: Window
1683+
DropEffectValue[JT]
1684+
DropEffectValue[SO] val copy: DropEffectValue
1685+
DropEffectValue[SO] val link: DropEffectValue
1686+
DropEffectValue[SO] val move: DropEffectValue
1687+
DropEffectValue[SO] val none: DropEffectValue
16691688
DynamicsCompressorNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit
16701689
DynamicsCompressorNode[JT] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit
16711690
DynamicsCompressorNode[JT] val attack: AudioParam
@@ -1711,6 +1730,16 @@ EcdsaParams[JT] val name: String
17111730
EcdsaParams[SO] def apply(name: String, hash: HashAlgorithmIdentifier): EcdsaParams (@deprecated in 2.0.0)
17121731
EcdsaParams[SO] val hash = hash0
17131732
EcdsaParams[SO] val name = name0
1733+
EffectAllowedValue[JT]
1734+
EffectAllowedValue[SO] val all: EffectAllowedValue
1735+
EffectAllowedValue[SO] val copy: EffectAllowedValue
1736+
EffectAllowedValue[SO] val copyLink: EffectAllowedValue
1737+
EffectAllowedValue[SO] val copyMove: EffectAllowedValue
1738+
EffectAllowedValue[SO] val link: EffectAllowedValue
1739+
EffectAllowedValue[SO] val linkMove: EffectAllowedValue
1740+
EffectAllowedValue[SO] val move: EffectAllowedValue
1741+
EffectAllowedValue[SO] val none: EffectAllowedValue
1742+
EffectAllowedValue[SO] val uninitialized: EffectAllowedValue
17141743
Element[JC] var accessKey: String
17151744
Element[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit
17161745
Element[JC] def addEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ trait DataTransfer extends js.Object {
2222
*/
2323
var effectAllowed: EffectAllowedValue = js.native
2424

25-
/** The actual effect that will be used, and should always be one of the possible values of effectAllowed. */
25+
/** The actual effect that will be used. */
2626
var dropEffect: DropEffectValue = js.native
2727

2828
/** Remove the data associated with a given type. The type argument is optional. If the type is empty or not

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ trait DataTransferItem extends js.Object {
1919
def `type`: String = js.native
2020

2121
/** Invokes the callback with the string data as the argument, if the drag data item kind is text. */
22-
def getAsString(callback: () => String) = js.native
22+
def getAsString(callback: Function1[String, Unit]): Unit = js.native
2323

2424
/** Returns a File object, if the drag data item kind is File. */
2525
def getAsFile(): js.UndefOr[File] = js.native

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,14 @@
77
package org.scalajs.dom
88

99
import scala.scalajs.js
10+
import scala.scalajs.js.annotation.JSGlobal
1011

12+
/** A list of [[DataTransferItem]] objects representing items being dragged. During a drag operation, each DragEvent has
13+
* a dataTransfer property and that property is a DataTransferItemList.
14+
*/
1115
@js.native
12-
trait DataTransferItemList extends js.Object {
16+
@JSGlobal
17+
class DataTransferItemList extends js.Object {
1318

1419
/** Returns the number of items in the drag data store. */
1520
def length: Int = js.native
@@ -30,10 +35,7 @@ trait DataTransferItemList extends js.Object {
3035
/** Removes all the entries in the drag data store. */
3136
def clear(): Unit = js.native
3237

33-
}
34-
35-
@js.native
36-
object DataTransferItemList extends DataTransferItemList {
38+
@js.annotation.JSBracketAccess
3739
/** Returns the DataTransferItem object representing the indexth entry in the drag data store. */
3840
def apply(index: Int): DataTransferItem = js.native
3941
}

0 commit comments

Comments
 (0)