Skip to content

Commit

Permalink
fix: crypto.randomUUID
Browse files Browse the repository at this point in the history
  • Loading branch information
rei1024 committed Oct 13, 2024
1 parent 0d66a55 commit c45ffc5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { BitGrid, BitWorld } from "@ca-ts/algo/bit";
import { $autoRandom } from "./bind";
import { createTemplateCell } from "./lib/cell";
import { setRLE } from "./lib/setRLE";
import { randomId } from "./lib/randomId";

const stackHeight = 1;

Expand Down Expand Up @@ -80,7 +81,7 @@ export class App {
// セルのインスタンスを作成
const instance =
this.meshPool.pop() ??
this.templateMesh.createInstance(`cell_${crypto.randomUUID()}`);
this.templateMesh.createInstance(`cell_${randomId()}`);
instance.isVisible = true;
instance.position = new BABYLON.Vector3(
x,
Expand Down
4 changes: 4 additions & 0 deletions src/lib/randomId.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export function randomId() {
// httpで使用できない場合
return crypto.randomUUID ? crypto.randomUUID() : Math.random().toString(16);
}

0 comments on commit c45ffc5

Please sign in to comment.