@@ -8,17 +8,48 @@ package org.scalajs.dom
8
8
9
9
import scala .scalajs .js
10
10
import scala .scalajs .js .annotation ._
11
+ import scala .scalajs .js .|
11
12
12
13
/** XMLHttpRequest Level 2 adds support for the new FormData interface. FormData objects provide a way to easily
13
14
* construct a set of key/value pairs representing form fields and their values, which can then be easily sent using
14
15
* the XMLHttpRequest send() method.
15
16
*/
16
17
@ js.native
17
18
@ JSGlobal
18
- class FormData (form : HTMLFormElement = js.native) extends js.Object {
19
+ class FormData (form : HTMLFormElement = js.native) extends js.Iterable [js. Tuple2 [ String , String ]] {
19
20
20
21
/** Appends a key/value pair to the FormData object. */
21
22
def append (name : js.Any , value : js.Any , blobName : String = js.native): Unit = js.native
23
+
24
+ /** Deletes a key/value pair from the FormData object. */
25
+ def delete (name : String ): Unit = js.native
26
+
27
+ /** Returns the first value associated with a given key from within a FormData object. */
28
+ def get (name : String ): String | Blob = js.native
29
+
30
+ /** Returns whether a FormData object contains a certain key. */
31
+ def has (name : String ): Boolean = js.native
32
+
33
+ /** Sets a new value for an existing key inside a FormData object, or adds the key/value if it does not already exist.
34
+ */
35
+ def set (
36
+ name : String , value : String | Blob , blobName : String = js.native
37
+ ): Unit = js.native
38
+
39
+ @ JSName (js.Symbol .iterator)
40
+ override def jsIterator (): js.Iterator [js.Tuple2 [String , String ]] = js.native
41
+
42
+ /** Returns an iterator that iterates through all key/value pairs contained in the FormData. */
43
+ def entries (): js.Iterator [js.Tuple2 [String , String | Blob ]] = js.native
44
+
45
+ /** Returns an array of all the values associated with a given key from within a FormData. */
46
+ def getAll (name : String ): js.Array [String | Blob ] = js.native
47
+
48
+ /** Returns an iterator iterates through all keys of the key/value pairs contained in the FormData. */
49
+ def keys (): js.Iterator [String ] = js.native
50
+
51
+ /** Returns an iterator that iterates through all values contained in the FormData. */
52
+ def values (): js.Iterator [String | Blob ] = js.native
22
53
}
23
54
24
55
@ js.native
0 commit comments