Skip to content

Commit b2181ec

Browse files
committed
add URLSearchPArams forEach
1 parent 51d8988 commit b2181ec

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Runtime/Scripting/DomProxies/URLSearchParams.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,14 @@ public void sort()
111111
public string[] keys() => _values.Select(p => p.Key).Distinct().ToArray();
112112
public string[] values() => _values.Select(p => p.Value).ToArray();
113113
public string[][] entries() => _values.Select(p => new[] { p.Key, p.Value }).ToArray();
114+
115+
public void forEach(object callback, object thisArg = null)
116+
{
117+
var cb = Callback.From(callback, null, thisArg);
118+
119+
foreach (var pair in _values) cb.Call(pair.Value, pair.Key, this);
120+
}
121+
114122
public IEnumerator<string[]> GetEnumerator() => ((IEnumerable<string[]>) entries()).GetEnumerator();
115123
IEnumerator IEnumerable.GetEnumerator() => entries().GetEnumerator();
116124

0 commit comments

Comments
 (0)