mirror of
https://github.com/motion-canvas/motion-canvas.git
synced 2026-01-11 06:48:12 -05:00
fix: previous scenes not getting disposed
This commit is contained in:
@@ -83,10 +83,7 @@ export class Project extends Stage {
|
||||
public async next(speed: number = 1): Promise<boolean> {
|
||||
if (this.previousScene) {
|
||||
await this.previousScene.next();
|
||||
if (
|
||||
this.previousScene.isFinished() &&
|
||||
(!this.currentScene || this.currentScene.isAfterTransitionIn())
|
||||
) {
|
||||
if (!this.currentScene || this.currentScene.isAfterTransitionIn()) {
|
||||
this.previousScene.remove();
|
||||
this.previousScene.lastFrame = this.frame;
|
||||
this.previousScene = null;
|
||||
|
||||
20
src/hot.ts
20
src/hot.ts
@@ -1,11 +1,23 @@
|
||||
import {Player} from './player/Player';
|
||||
|
||||
export function hot(player: Player, root: typeof module) {
|
||||
const update = (modules: string[]) => {
|
||||
player.project.reload(
|
||||
const update = async (modules: string[]) => {
|
||||
const runners = [];
|
||||
for (const module of modules) {
|
||||
// @ts-ignore
|
||||
modules.map(id => __webpack_require__(id).default),
|
||||
);
|
||||
const runner = __webpack_require__(module).default;
|
||||
if (
|
||||
// FIXME Find out a better way to detect runner factories.
|
||||
runner.name === '__WEBPACK_DEFAULT_EXPORT__' &&
|
||||
typeof runner === 'function'
|
||||
) {
|
||||
runners.push(await runner());
|
||||
} else {
|
||||
runners.push(runner);
|
||||
}
|
||||
}
|
||||
|
||||
player.project.reload(runners);
|
||||
player.requestSeek(player.project.frame);
|
||||
};
|
||||
|
||||
|
||||
@@ -74,6 +74,9 @@ const compiler = webpack({
|
||||
compress: true,
|
||||
port: 9000,
|
||||
},
|
||||
experiments: {
|
||||
topLevelAwait: true,
|
||||
}
|
||||
});
|
||||
const server = new WebpackDevServer(
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"sourceMap": true,
|
||||
"noImplicitAny": true,
|
||||
"module": "esnext",
|
||||
"target": "es6",
|
||||
"target": "es2017",
|
||||
"moduleResolution": "node",
|
||||
"resolveJsonModule": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
|
||||
Reference in New Issue
Block a user