-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex-web.js
More file actions
30 lines (27 loc) · 1 KB
/
index-web.js
File metadata and controls
30 lines (27 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { name as productName, author as companyName, version as productVersion } from '../../../package.json';
const { Module } = await createUnityInstance(document.querySelector("#unity-canvas"), {
arguments: [],
dataUrl: "Build/Main.data",
frameworkUrl: "Build/Main.framework.js",
codeUrl: "Build/Main.wasm",
streamingAssetsUrl: "StreamingAssets",
productName,
companyName,
productVersion,
});
Module.errorHandler = () => true;
window.onerror = (message, file, line, column, error) => {
const stack = error?.stack;
const ErrorOverlay = customElements?.get('vite-error-overlay');
if (ErrorOverlay) {
const loc = line && column ? { file, line, column } : undefined;
document.body.appendChild(new ErrorOverlay({ message, stack, loc }))
} else {
window.alert(message + '\n' + stack);
}
};
import { getDefaultContext } from './Runtime/include/emnapi.mjs';
const context = getDefaultContext();
const exports = Module.emnapiInit({ context });
export default exports;
context.openScope();