(obj, key)
| 314 | container.removeChild(canvas); |
| 315 | } |
| 316 | const callIfFn = (obj, key) => { |
| 317 | if (obj && typeof obj[key] === 'function') { |
| 318 | obj[key].call(obj); |
| 319 | } |
| 320 | }; |
| 321 | callIfFn(programRef.current, 'remove'); |
| 322 | callIfFn(geometryRef.current, 'remove'); |
| 323 | callIfFn(meshRef.current, 'remove'); |