Sv443 7 месяцев назад
Родитель
Сommit
018b53c04c
3 измененных файлов с 6 добавлено и 6 удалено
  1. 2 2
      src/components/longButton.ts
  2. 1 1
      src/utils/input.ts
  3. 3 3
      src/utils/misc.ts

+ 2 - 2
src/components/longButton.ts

@@ -26,7 +26,7 @@ type LongBtnOptions = {
     href: string;
   }
   | {
-    /** Callback function to execute when the button is clicked */
+    /** Callback function to execute when the button is interacted with */
     onClick: (evt: MouseEvent | KeyboardEvent) => void;
   }
   | {
@@ -36,7 +36,7 @@ type LongBtnOptions = {
     toggleInitialState?: boolean;
     /** Callback function to execute when the button is toggled */
     onToggle: (enabled: boolean, evt: MouseEvent | KeyboardEvent) => void;
-    /** Predicate function to determine if the button should be toggled on click */
+    /** Predicate function to determine if the button should be toggled on interaction */
     togglePredicate?: (evt: MouseEvent | KeyboardEvent) => boolean;
   }
 );

+ 1 - 1
src/utils/input.ts

@@ -7,7 +7,7 @@ type ListenerOpts = AddEventListenerOptions & {
 
 /**
  * Adds generic, accessible interaction listeners to the passed element.  
- * All listeners have the default behavior prevented and stop propagation (for keyboard events only as long as the captured key is valid).
+ * All listeners have the default behavior prevented and stop propagation (for keyboard events this only applies as long as the captured key is included in {@linkcode interactionKeys}).
  * @param listenerOptions Provide a {@linkcode listenerOptions} object to configure the listeners
  */
 export function onInteraction<TElem extends HTMLElement>(elem: TElem, listener: (evt: MouseEvent | KeyboardEvent) => void, listenerOptions?: ListenerOpts) {

+ 3 - 3
src/utils/misc.ts

@@ -1,4 +1,4 @@
-import { compress, decompress, fetchAdvanced, openInNewTab, pauseFor, randomId } from "@sv443-network/userutils";
+import { compress, decompress, fetchAdvanced, openInNewTab, pauseFor, randomId, randRange } from "@sv443-network/userutils";
 import { marked } from "marked";
 import { branch, compressionFormat, repo, sessionStorageAvailable } from "../constants.js";
 import { type Domain, type NumberLength, type ResourceKey, type StringGen } from "../types.js";
@@ -34,7 +34,7 @@ export function getSessionId(): string | null {
     let sesId = window.sessionStorage.getItem("_bytm-session-id");
 
     if(!sesId)
-      window.sessionStorage.setItem("_bytm-session-id", sesId = randomId(8, 36));
+      window.sessionStorage.setItem("_bytm-session-id", sesId = randomId(10, 36));
 
     return sesId;
   }
@@ -180,7 +180,7 @@ export async function tryToDecompressAndParse<TData = Record<string, unknown>>(i
   }
 
   // artificial timeout to allow animations to finish and because dumb monkey brains *expect* a delay
-  await pauseFor(250);
+  await pauseFor(randRange(250, 500));
 
   return parsed;
 }