diff options
author | MetaMuffin <metamuffin@yandex.com> | 2021-08-06 13:20:35 +0200 |
---|---|---|
committer | MetaMuffin <metamuffin@yandex.com> | 2021-08-06 13:20:35 +0200 |
commit | a8f89036b5788a3f6ddb053824650b913a0c98a3 (patch) | |
tree | 7bdd48b3d95b7e33fc59da046bedfe68129ad559 /source/client/helper.ts | |
parent | 2387d8910d80b86a95e8c3242bdb6809dddda1aa (diff) | |
download | keks-meet-a8f89036b5788a3f6ddb053824650b913a0c98a3.tar keks-meet-a8f89036b5788a3f6ddb053824650b913a0c98a3.tar.bz2 keks-meet-a8f89036b5788a3f6ddb053824650b913a0c98a3.tar.zst |
idk
Diffstat (limited to 'source/client/helper.ts')
-rw-r--r-- | source/client/helper.ts | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/source/client/helper.ts b/source/client/helper.ts new file mode 100644 index 0000000..19c4f46 --- /dev/null +++ b/source/client/helper.ts @@ -0,0 +1,14 @@ +export function get_query_params(): { [key: string]: string } { + const q: { [key: string]: string } = {} + for (const kv of window.location.search.substr(1).split("&")) { + const [key, value] = kv.split("=") + q[decodeURIComponent(key)] = decodeURIComponent(value) + } + return q +} + +export function hex_id(len: number = 8): string { + if (len > 8) return hex_id() + hex_id(len - 8) + return Math.floor(Math.random() * 16 ** len).toString(16).padStart(len, "0") +} + |