Hotfix: Replace calls to crypto.randomUUID (#82)

`crypto.randomUUID` is only available in secure contexts (HTTPS), which
throws an error when trying to run in certain situations/browsers.
This commit is contained in:
Danny McGee
2024-03-08 19:56:19 -05:00
committed by GitHub
parent 33250e4627
commit 9dfbcae134
2 changed files with 4 additions and 2 deletions
+2 -1
View File
@@ -1,5 +1,6 @@
import { type AbstractCtor, type Ctor, type Fn } from "@storyteller/utility";
import { type PropertyValues } from "lit";
import { v4 as uuid } from "uuid";
export class UniqueToken {
get id() { return this.#id; }
@@ -10,7 +11,7 @@ export class UniqueToken {
}
static create<T>(name?: string): Token<T> {
return new UniqueToken(name ?? crypto.randomUUID());
return new UniqueToken(name ?? uuid());
}
toString(): string {