Closed G-yhlee closed 1 year ago
Here's the variant generated by AI (untested):
@js.native
@JSGlobal
class FormData(form: HTMLFormElement = js.native) extends js.Object {
/** Appends a key/value pair to the FormData object. */
def append(name: String, value: String | Blob, blobName: String = js.native): Unit = js.native
/** Deletes a key/value pair from the FormData object. */
def delete(name: String): Unit = js.native
/** Returns an iterator that iterates through all key/value pairs contained in the FormData. */
def entries(): Iterator[js.Tuple2[String, String | Blob]] = js.native
/** Returns the first value associated with a given key from within a FormData object. */
def get(name: String): String | Blob = js.native
/** Returns an array of all the values associated with a given key from within a FormData. */
def getAll(name: String): js.Array[String | Blob] = js.native
/** Returns whether a FormData object contains a certain key. */
def has(name: String): Boolean = js.native
/** Returns an iterator iterates through all keys of the key/value pairs contained in the FormData. */
def keys(): Iterator[String] = js.native
/** Sets a new value for an existing key inside a FormData object, or adds the key/value if it does not already exist. */
def set(name: String, value: String | Blob, blobName: String = js.native): Unit = js.native
/** Returns an iterator that iterates through all values contained in the FormData. */
def values(): Iterator[String | Blob] = js.native
}
This is updated and merged at https://github.com/scala-js/scala-js-dom/pull/800
Thanks all !
In js world ,
FormData Object have
append
andget
method,but scalajs FormData class has only
append
method, we need to addget
method like this...ref. https://github.com/scala-js/scala-js-dom/blob/d157768ac7def180e0ba00fd5e9bdb20920e159a/dom/src/main/scala/org/scalajs/dom/FormData.scala#L18