class URLSearchParams extends Object
The URLSearchParams API provides read and write access to the query of a URL. The URLSearchParams class can also be used standalone with one of the four following constructors.
The WHATWG URLSearchParams interface and the querystring module have similar purpose, but the purpose of the querystring module is more general, as it allows the customization of delimiter characters (& and =). On the other hand, this API is designed purely for URL query strings.
- Annotations
- @RawJSType() @native() @JSImport( "url" , "URLSearchParams" )
- Alphabetic
- By Inheritance
- URLSearchParams
- Object
- Any
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
URLSearchParams(it: Iterable[Tuple2[String, String]])
Instantiate a new URLSearchParams object with an iterable map in a way that is similar to Map's constructor.
Instantiate a new URLSearchParams object with an iterable map in a way that is similar to Map's constructor. iterable can be an Array or any iterable object. That means iterable can be another URLSearchParams, in which case the constructor will simply create a clone of the provided URLSearchParams. Elements of iterable are key-value pairs, and can themselves be any iterable object.
- it
An iterable object whose elements are key-value pairs
-
new
URLSearchParams(obj: Object)
Instantiate a new URLSearchParams object with a query hash map.
Instantiate a new URLSearchParams object with a query hash map. The key and value of each property of obj are always coerced to strings.
- obj
An object representing a collection of key-value pairs
-
new
URLSearchParams(obj: Dictionary[_])
Instantiate a new URLSearchParams object with a query hash map.
Instantiate a new URLSearchParams object with a query hash map. The key and value of each property of obj are always coerced to strings.
- obj
An object representing a collection of key-value pairs
-
new
URLSearchParams(queryString: String)
Parse the string as a query string, and use it to instantiate a new URLSearchParams object.
Parse the string as a query string, and use it to instantiate a new URLSearchParams object. A leading '?', if present, is ignored.
- queryString
A query string
- new URLSearchParams()
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
append(name: String, value: String): Unit
Append a new name-value pair to the query string.
Append a new name-value pair to the query string.
- name
the name of the property
- value
the value of the property
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native() @HotSpotIntrinsicCandidate()
-
def
delete(name: String): Unit
Remove all name-value pairs whose name is name.
Remove all name-value pairs whose name is name.
- name
the name of the property
-
def
entries(): Iterator[Tuple2[String, String]]
Returns an ES6 Iterator over each of the name-value pairs in the query.
Returns an ES6 Iterator over each of the name-value pairs in the query. Each item of the iterator is a JavaScript Array. The first item of the Array is the name, the second item of the Array is the value.
- returns
an iterable of an array of results
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
forEach(fn: Function3[String, String, URLSearchParams, Any]): Unit
Iterates over each name-value pair in the query and invokes the given function.
Iterates over each name-value pair in the query and invokes the given function.
- fn
the function invoked for each name-value pair in the query.
-
def
get(name: String): String
Returns the value of the first name-value pair whose name is name.
Returns the value of the first name-value pair whose name is name. If there are no such pairs, null is returned.
- name
the name of the property
- returns
the value or null if there is no name-value pair with the given name.
-
def
getAll(name: String): Array[String]
Returns the values of all name-value pairs whose name is name.
Returns the values of all name-value pairs whose name is name. If there are no such pairs, an empty array is returned.
- name
the name of the property
- returns
the array of values or null if there is no name-value pair with the given name.
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
def
has(name: String): Boolean
Returns true if there is at least one name-value pair whose name is name.
Returns true if there is at least one name-value pair whose name is name.
- name
the name of the property
- returns
true if there is at least one name-value pair whose name is name.
-
def
hasOwnProperty(v: String): Boolean
- Definition Classes
- Object
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
isPrototypeOf(v: Object): Boolean
- Definition Classes
- Object
- def keys(): Iterator[String]
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
def
propertyIsEnumerable(v: String): Boolean
- Definition Classes
- Object
-
def
set(name: String, value: String): Unit
Sets the value in the URLSearchParams object associated with name to value.
Sets the value in the URLSearchParams object associated with name to value. If there are any pre-existing name-value pairs whose names are name, set the first such pair's value to value and remove all others. If not, append the name-value pair to the query string.
- name
the name of the property
- value
the value of the property
-
def
sort(): Unit
Sort all existing name-value pairs in-place by their names.
Sort all existing name-value pairs in-place by their names. Sorting is done with a stable sorting algorithm, so relative order between name-value pairs with the same name is preserved.
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toLocaleString(): String
- Definition Classes
- Object
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
valueOf(): Any
- Definition Classes
- Object
-
def
values(): Iterator[String]
Returns an ES6 Iterator over the values of each name-value pair.
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )