Files
cocos4/templates/web-mobile/index.js.ejs
T
Santy-Wang 7bc135e1c7 adjust initialization process (#11143)
* adjust init process

* fix bugs

* restructure

* tweak

* delete useless code

* fix ci

* support more platform and fix some bugs

* mark internal

* tweak

* add docs

* add docs and little adjustment

* fix bugs

* adjust decorator execute order

fix mesh error

* fix bugs

* revert some change

* revert auto-generated code

* revert auto-generated code
2022-07-03 21:16:09 +08:00

23 lines
515 B
Plaintext

import { Application } from '<%= applicationJS %>';
const canvas = document.getElementById('GameCanvas');
const $p = canvas.parentElement;
const bcr = $p.getBoundingClientRect();
canvas.width = bcr.width;
canvas.height = bcr.height;
function topLevelImport (url) {
return System.import(url);
}
const application = new Application();
topLevelImport('cc')
.then((engine) => {
return application.init(engine);
}).then(() => {
return application.start();
}).catch((err) => {
console.error(err);
});