excalibur-router
Advanced tools
Comparing version
{ | ||
"name": "excalibur-router", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -86,2 +86,27 @@ # excalibur-router | ||
## Dynamic Scene Loading | ||
Scenes can be imported dynamically as routes, which will then trigger a loading scene when navigated to. If these scenes contain any `router.addResource()` calls or import files that do, they will get loaded in the same loading screen. | ||
```js | ||
import * as ex from 'excalibur' | ||
import { Router } from 'excalibur-router' | ||
const engine = new ex.Engine({ | ||
width: 800, | ||
height: 600, | ||
}) | ||
const router = new Router({ | ||
routes: { | ||
level1: () => import('./level1'), // contains default export of scene | ||
level2: () => import('./level2'), | ||
}, | ||
}) | ||
router.start(engine).then(() => { | ||
router.goto('level1') | ||
}) | ||
``` | ||
## Transitions | ||
@@ -88,0 +113,0 @@ |
59425
1.08%202
14.12%