mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-25 19:13:54 +00:00
Update packages/webamp-modern-2/src/utils.ts
okay, one line is better. less code less bug Co-authored-by: Jordan Eldredge <jordan@jordaneldredge.com>
This commit is contained in:
parent
316c130bc6
commit
e0724c338c
1 changed files with 1 additions and 10 deletions
|
|
@ -82,16 +82,7 @@ export function findLast<T>(
|
|||
|
||||
|
||||
export function getUrlQuery(location:Location, variable:string):string {
|
||||
var query = location.search.substring(1);
|
||||
var vars = query.split('&');
|
||||
for (var i = 0; i < vars.length; i++) {
|
||||
var pair = vars[i].split('=');
|
||||
if (decodeURIComponent(pair[0]) == variable) {
|
||||
return decodeURIComponent(pair[1]);
|
||||
}
|
||||
}
|
||||
console.log('Query variable %s not found', variable);
|
||||
return null;
|
||||
return new URL(location.href).searchParams.get(variable)
|
||||
}
|
||||
|
||||
export class Emitter {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue