Skip to content

Commit 1db81ff

Browse files
author
exoego
committed
Add searchParams
1 parent 32d32d6 commit 1db81ff

File tree

1 file changed

+50
-0
lines changed
  • src/main/scala/org/scalajs/dom/experimental

1 file changed

+50
-0
lines changed

src/main/scala/org/scalajs/dom/experimental/URL.scala

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,54 @@ class URL(url: String, base: String = js.native) extends js.Object {
9292
* MDN
9393
*/
9494
var hash: String = js.native
95+
96+
var searchParams: URLSearchParams = js.native
97+
}
98+
99+
/**
100+
* The URLSearchParams defines utility methods to work with the query string of a URL.
101+
*
102+
* An object implementing URLSearchParams can directly be used in a for...of structure, for example the following two lines are equivalent:
103+
*
104+
* MDN
105+
*/
106+
@js.native
107+
@JSGlobal
108+
class URLSearchParams
109+
extends js.Iterable[js.Tuple2[String, String]] {
110+
111+
/**
112+
* Leading '?' characters are ignored.
113+
*
114+
* MDN
115+
*/
116+
def this(init: String) = this()
117+
def this(init: js.Array[String]) = this()
118+
def this(init: js.Dictionary[String]) = this()
119+
120+
def append(name: String, value: String): Unit = js.native
121+
122+
def delete(name: String): Unit = js.native
123+
124+
def get(name: String): js.UndefOr[String] = js.native
125+
126+
def getAll(name: String): Sequence[String] = js.native
127+
128+
def has(name: String): Boolean = js.native
129+
130+
def set(name: String, value: String): Unit = js.native
131+
132+
def sort(): Unit = js.native
133+
134+
@JSName(js.Symbol.iterator)
135+
override def jsIterator(): js.Iterator[js.Tuple2[String, String]] = js.native
136+
137+
def entries(): js.Iterator[js.Tuple2[String, String]] = js.native
138+
139+
def keys(): js.Iterator[String] = js.native
140+
141+
def values(): js.Iterator[String] = js.native
142+
143+
def forEach(callback: js.Function2[String, String, Unit]): Unit = js.native
144+
95145
}

0 commit comments

Comments
 (0)