Skip to content

Commit e9ae7ad

Browse files
TATSUNO Yasuhirosjrd
TATSUNO Yasuhiro
authored andcommitted
Add URL.searchParams (URLSearch​Params) (#361)
1 parent df7033c commit e9ae7ad

File tree

1 file changed

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

1 file changed

+48
-0
lines changed

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

+48
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,52 @@ 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+
* MDN
103+
*/
104+
@js.native
105+
@JSGlobal
106+
class URLSearchParams
107+
extends js.Iterable[js.Tuple2[String, String]] {
108+
109+
/**
110+
* Leading '?' characters are ignored.
111+
*
112+
* MDN
113+
*/
114+
def this(init: String) = this()
115+
def this(init: Sequence[String]) = this()
116+
def this(init: js.Dictionary[String]) = this()
117+
118+
def append(name: String, value: String): Unit = js.native
119+
120+
def delete(name: String): Unit = js.native
121+
122+
def get(name: String): js.UndefOr[String] = js.native
123+
124+
def getAll(name: String): Sequence[String] = js.native
125+
126+
def has(name: String): Boolean = js.native
127+
128+
def set(name: String, value: String): Unit = js.native
129+
130+
def sort(): Unit = js.native
131+
132+
@JSName(js.Symbol.iterator)
133+
override def jsIterator(): js.Iterator[js.Tuple2[String, String]] = js.native
134+
135+
def entries(): js.Iterator[js.Tuple2[String, String]] = js.native
136+
137+
def keys(): js.Iterator[String] = js.native
138+
139+
def values(): js.Iterator[String] = js.native
140+
141+
def forEach(callback: js.Function2[String, String, Unit]): Unit = js.native
142+
95143
}

0 commit comments

Comments
 (0)