@@ -18,43 +18,101 @@ import scala.scalajs.js.|
18
18
@ JSGlobal
19
19
class FormData (form : HTMLFormElement = js.native) extends js.Iterable [js.Tuple2 [String , String ]] {
20
20
21
- /** Appends a key/value pair to the FormData object. */
21
+ /** The `append()` method of the `FormData` interface appends a new value onto an existing key inside a `FormData`
22
+ * object, or adds the key if it does not already exist.
23
+ *
24
+ * @param name
25
+ * The name of the field whose data is contained in value.
26
+ * @param value
27
+ * The field's value. This can be a string or `Blob` (including subclasses such as File). If none of these are
28
+ * specified the value is converted to a string.
29
+ */
22
30
def append (name : js.Any , value : String ): Unit = js.native
23
31
32
+ /** The `append()` method of the `FormData` interface appends a new value onto an existing key inside a `FormData`
33
+ * object, or adds the key if it does not already exist.
34
+ *
35
+ * @param name
36
+ * The name of the field whose data is contained in value.
37
+ * @param value
38
+ * The field's value. This can be a string or `Blob` (including subclasses such as File). If none of these are
39
+ * specified the value is converted to a string.
40
+ * @param blobName
41
+ * The filename reported to the server (a string), when a `Blob` or `File` is passed as the second parameter. The
42
+ * default filename for `Blob` objects is "blob". The default filename for `File` objects is the file's filename.
43
+ */
24
44
def append (name : js.Any , value : Blob , blobName : String ): Unit = js.native
25
45
26
- /** Deletes a key/value pair from the FormData object. */
46
+ /** The `delete()` method of the `FormData` interface deletes a key and its value(s) from a `FormData` object.
47
+ * @param name
48
+ * The name of the key you want to delete.
49
+ */
27
50
def delete (name : String ): Unit = js.native
28
51
29
- /** Returns the first value associated with a given key from within a FormData object. */
52
+ /** The `get()` method of the `FormData` interface returns the first value associated with a given key from within a
53
+ * `FormData` object. If you expect multiple values and want all of them, use the `getAll()` method instead.
54
+ *
55
+ * @param name
56
+ * A string representing the name of the key you want to retrieve.
57
+ * @return
58
+ * A value whose key matches the specified name. Otherwise, `null`.
59
+ */
30
60
def get (name : String ): String | Blob = js.native
31
61
32
- /** Returns whether a FormData object contains a certain key. */
62
+ /** The `has()` method of the `FormData` interface returns whether a `FormData` object contains a certain key.
63
+ *
64
+ * @param name
65
+ * A string representing the name of the key you want to test for.
66
+ * @return
67
+ * `true` if a key of `FormData` matches the specified name. Otherwise, `false`.
68
+ */
33
69
def has (name : String ): Boolean = js.native
34
70
35
- /** Sets a new value for an existing key inside a FormData object, or adds the key/value if it does not already exist.
71
+ /** The `set()` method of the `FormData` interface sets a new value for an existing key inside a `FormData` object, or
72
+ * adds the key/value if it does not already exist.
73
+ *
74
+ * @param name
75
+ * The name of the field whose data is contained in value.
76
+ * @param value
77
+ * The field's value.
36
78
*/
37
79
def set (
38
80
name : String , value : String
39
81
): Unit = js.native
40
82
83
+ /** The `set()` method of the `FormData` interface sets a new value for an existing key inside a `FormData` object, or
84
+ * adds the key/value if it does not already exist.
85
+ *
86
+ * @param name
87
+ * The name of the field whose data is contained in value.
88
+ * @param value
89
+ * The field's value.
90
+ */
41
91
def set (
42
92
name : String , value : Blob , blobName : String
43
93
): Unit = js.native
44
94
45
95
@ JSName (js.Symbol .iterator)
46
96
override def jsIterator (): js.Iterator [js.Tuple2 [String , String ]] = js.native
47
97
48
- /** Returns an iterator that iterates through all key/value pairs contained in the FormData. */
98
+ /** The `FormData.entries()` method returns an iterator which iterates through all key/value pairs contained in the
99
+ * `FormData`. The key of each pair is a string object, and the value is either a string or a `Blob`.
100
+ */
49
101
def entries (): js.Iterator [js.Tuple2 [String , String | Blob ]] = js.native
50
102
51
- /** Returns an array of all the values associated with a given key from within a FormData. */
103
+ /** The `getAll()` method of the `FormData` interface returns all the values associated with a given key from within a
104
+ * `FormData` object.
105
+ */
52
106
def getAll (name : String ): js.Array [String | Blob ] = js.native
53
107
54
- /** Returns an iterator iterates through all keys of the key/value pairs contained in the FormData. */
108
+ /** The `FormData.keys()` method returns an iterator which iterates through all keys contained in the `FormData`. The
109
+ * keys are strings.
110
+ */
55
111
def keys (): js.Iterator [String ] = js.native
56
112
57
- /** Returns an iterator that iterates through all values contained in the FormData. */
113
+ /** The `FormData.values()` method returns an iterator which iterates through all values contained in the `FormData`.
114
+ * The values are strings or `Blob` objects.
115
+ */
58
116
def values (): js.Iterator [String | Blob ] = js.native
59
117
}
60
118
0 commit comments