Module Js.FormData
Bindings to FormData
type ttype t;type entryValuetype entryValue;The values returned by the `get,All` and iteration functions is either a string or a Blob. Melange uses an abstract type and defers to users of the API to handle it according to their application needs.
val make : unit -> tlet make: unit => t;make () creates a new FormData object, initially empty.
val append :
name:string ->
value:[ `String of string | `Object of < .. > Js.t | `Dict of _ Js.dict ] ->
t ->
unitlet append:
name:string =>
value:[ `String(string) | `Object(Js.t({.. })) | `Dict(Js.dict(_)) ] =>
t =>
unit;append t ~name ~value appends a new value onto an existing key inside a FormData object, or adds the key if it does not already exist.
val appendBlob :
name:string ->
value:[ `Blob of Js.blob | `File of Js.file ] ->
?filename:string ->
t ->
unitlet appendBlob:
name:string =>
value:[ `Blob(Js.blob) | `File(Js.file) ] =>
?filename:string =>
t =>
unit;appendBlob t ~name ~value appends a new value onto an existing key inside a FormData object, or adds the key if it does not already exist. This method differs from append in that instances in the Blob hierarchy can pass a third filename argument.
val delete : name:string -> t -> unitlet delete: name:string => t => unit;delete t ~name deletes a key and its value(s) from a FormData object.
val get : name:string -> t -> entryValue optionlet get: name:string => t => option(entryValue);get t ~name returns the first value associated with a given key from within a FormData object. If you expect multiple values and want all of them, use getAll instead.
val getAll : name:string -> t -> entryValue arraylet getAll: name:string => t => array(entryValue);getAll t ~name returns all the values associated with a given key from within a FormData object.
val set :
name:string ->
[ `String of string | `Object of < .. > Js.t | `Dict of _ Js.dict ] ->
t ->
unitlet set:
name:string =>
[ `String(string) | `Object(Js.t({.. })) | `Dict(Js.dict(_)) ] =>
t =>
unit;set t ~name ~value sets a new value for an existing key inside a FormData object, or adds the key/value if it does not already exist.
val setBlob :
name:string ->
[ `Blob of Js.blob | `File of Js.file ] ->
?filename:string ->
t ->
unitlet setBlob:
name:string =>
[ `Blob(Js.blob) | `File(Js.file) ] =>
?filename:string =>
t =>
unit;setBlob t ~name ~value ?filename sets a new value for an existing key inside a FormData object, or adds the key/value if it does not already exist. This method differs from set in that instances in the Blob hierarchy can pass a third filename argument.
val has : name:string -> t -> boollet has: name:string => t => bool;has ~name t returns whether a FormData object contains a certain key.
val keys : t -> string Js.iteratorlet keys: t => Js.iterator(string);keys t returns an iterator which iterates through all keys contained in the FormData. The keys are strings.
val values : t -> entryValue Js.iteratorlet values: t => Js.iterator(entryValue);values t returns an iterator which iterates through all values contained in the FormData. The values are strings or Blob objects.
val entries : t -> (string * entryValue) Js.iteratorlet entries: t => Js.iterator((string, entryValue));entries t returns an iterator which iterates through all key/value pairs contained in the FormData.