@@ -8,17 +8,48 @@ package org.scalajs.dom
88
99import scala .scalajs .js
1010import scala .scalajs .js .annotation ._
11+ import scala .scalajs .js .|
1112
1213/** XMLHttpRequest Level 2 adds support for the new FormData interface. FormData objects provide a way to easily
1314 * construct a set of key/value pairs representing form fields and their values, which can then be easily sent using
1415 * the XMLHttpRequest send() method.
1516 */
1617@ js.native
1718@ 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 ]] {
1920
2021 /** Appends a key/value pair to the FormData object. */
2122 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
2253}
2354
2455@ js.native
0 commit comments