1
0
mirror of https://github.com/troisjs/trois.git synced 2024-11-24 04:12:02 +08:00

clear callbacks onUnmounted

This commit is contained in:
Kevin Levron 2021-04-06 19:17:32 +02:00
parent 7e0c4d5737
commit 41dfd4465a
3 changed files with 5 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{
"name": "troisjs",
"version": "0.2.1",
"version": "0.2.2",
"scripts": {
"dev": "vite",
"build": "vite build",
@ -11,6 +11,7 @@
"@rollup/plugin-replace": "^2.3.3",
"@vitejs/plugin-vue": "^1.2.1",
"@vue/compiler-sfc": "^3.0.11",
"cannon": "^0.6.2",
"eslint": "^7.7.0",
"eslint-config-airbnb-base": "^14.2.0",
"eslint-config-standard": "^14.1.1",

View File

@ -28,6 +28,7 @@ export default function useCannon(options) {
removeMesh,
step,
};
return obj;
function addMesh(mesh) {
const shape = getShape(mesh.geometry);
@ -189,6 +190,4 @@ export default function useCannon(options) {
iMatrix[index + 14] = position.z;
iMatrix[index + 15] = 1;
}
return obj;
}

View File

@ -61,6 +61,8 @@ export default defineComponent({
this.onMountedCallbacks.forEach(c => c());
},
beforeUnmount() {
this.beforeRenderCallbacks = [];
this.afterRenderCallbacks = [];
this.raf = false;
this.three.dispose();
},