Skip to content

Commit e74ceb3

Browse files
committed
remove old oops
1 parent ea30505 commit e74ceb3

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

module/source/hooks/use-unity-loader.ts

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,6 @@ import { isBrowserEnvironment } from "../constants/is-browser-environment";
33
import { UnityLoaderStatus } from "../enums/unity-loader-status";
44
import { UnityConfig } from "../exports";
55

6-
interface ScriptData {
7-
count: number;
8-
status: UnityLoaderStatus;
9-
handleLoad?: () => void;
10-
handleError?: () => void;
11-
}
12-
13-
// Map to track script references, status, and event handlers.
14-
const scriptReferenceMap = new Map<string, ScriptData>();
15-
166
/**
177
* Hook to embed a Unity Loader script.
188
* @param source The source of the unity loader.
@@ -28,12 +18,12 @@ const useUnityLoader = (unityConfig: UnityConfig): UnityLoaderStatus => {
2818
// this scenario, the window is not available. We can't create a Unity
2919
// Loader in this case.
3020
if (isBrowserEnvironment === false) {
31-
return undefined;
21+
return;
3222
}
3323
// If the script's source is null, we'll reset the status to idle.
3424
if (unityConfig.loaderUrl === null) {
3525
setStatus(UnityLoaderStatus.Idle);
36-
return undefined;
26+
return;
3727
}
3828
/**
3929
* Find existing script element by source. It may have been added by
@@ -88,7 +78,7 @@ const useUnityLoader = (unityConfig: UnityConfig): UnityLoaderStatus => {
8878
if (script !== null) {
8979
script.removeEventListener("load", setStateFromEvent);
9080
script.removeEventListener("error", setStateFromEvent);
91-
script.remove();
81+
window.document.body.removeChild(script);
9282
}
9383
};
9484
}, [unityConfig.loaderUrl]);

0 commit comments

Comments
 (0)