summaryrefslogtreecommitdiff
path: root/packages/frontend/src/utility
diff options
context:
space:
mode:
authorsyuilo <4439005+syuilo@users.noreply.github.com>2025-03-20 18:55:32 +0900
committersyuilo <4439005+syuilo@users.noreply.github.com>2025-03-20 18:55:32 +0900
commitabddd40c09c7c48d9c741db9cc322517085d8f67 (patch)
tree7e4a595408fb44b1a01da3a60ed4a00d8da01045 /packages/frontend/src/utility
parentfix(frontend): MkRoleSelectDialogでのpopupの使い方が誤っているの... (diff)
downloadsharkey-abddd40c09c7c48d9c741db9cc322517085d8f67.tar.gz
sharkey-abddd40c09c7c48d9c741db9cc322517085d8f67.tar.bz2
sharkey-abddd40c09c7c48d9c741db9cc322517085d8f67.zip
enhance(frontend): 通常のRouterViewにTransitionを追加
Diffstat (limited to 'packages/frontend/src/utility')
-rw-r--r--packages/frontend/src/utility/random-id.ts15
1 files changed, 15 insertions, 0 deletions
diff --git a/packages/frontend/src/utility/random-id.ts b/packages/frontend/src/utility/random-id.ts
new file mode 100644
index 0000000000..4e5943a97f
--- /dev/null
+++ b/packages/frontend/src/utility/random-id.ts
@@ -0,0 +1,15 @@
+/*
+ * SPDX-FileCopyrightText: syuilo and misskey-project
+ * SPDX-License-Identifier: AGPL-3.0-only
+ */
+
+const CHARS = 'abcdefghijklmnopqrstuvwxyz'; // CSSの<custom-ident>などで使われることもあるのでa-z以外使うな
+
+export function randomId(length = 32, characters = CHARS) {
+ let result = '';
+ const charactersLength = characters.length;
+ for ( let i = 0; i < length; i++ ) {
+ result += characters.charAt(Math.floor(Math.random() * charactersLength));
+ }
+ return result;
+}