Skip to content

Commit

Permalink
Document beginning of no side effect
Browse files Browse the repository at this point in the history
  • Loading branch information
deltakosh committed Oct 2, 2024
1 parent c9fae1d commit 0cd1e55
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
40 changes: 40 additions & 0 deletions content/setup/frameworkPackages/es6Support.md
Original file line number Diff line number Diff line change
Expand Up @@ -733,3 +733,43 @@ initializeWebWorker(worker, wasm);

SetBasisTranscoderWorker(worker);
```
## Avoiding side-effects
Starting with Babylon.js v7.23, we are introducing a new way for ES6 users to import optional features without side effects.
Depending on how the internal engine works, we have aimed to reduce the number of functions that need to be added at the prototype level. Instead, when possible, we are offering more 'pick and choose' public functions.
### Animations
- File to import: "core/Animations/animatable.core" (instead of "core/Animations/animatable" which has side-effects)
- Function to import and execute to initialize the module: `AddAnimationExtensions(sceneClass, boneClass)`
- Calling `AddAnimationExtensions` will populate the following prootype functions:
- Bone.prototype.copyAnimationRange
- Scene.prototype.beginAnimation
- Scene.prototype.beginDirectAnimation
- Scene.prototype.beginDirectHierarchyAnimation
- Scene.prototype.beginWeightedAnimation
- Scene.prototype.beginHierarchyAnimation
- Scene.prototype.getAllAnimatablesByTarget
- Scene.prototype.getAnimatableByTarget
- Scene.prototype.sortActiveAnimatables
- Scene.prototype.stopAllAnimations
### Ray
- File to import: "core/Culling/ray.core" (instead of "core/Culling/ray" which has side-effects)
- Function to import and execute to initialize the module: `AddRayExtensions(sceneClass, cameraClass)`
- Calling `AddRayExtensions` will populate the following prootype functions:
- Camera.prototype.getForwardRay
- Camera.prototype.getForwardRayToRef
- Scene.prototype.createPickingRay
- The following functions will be available:
- CreatePickingRay
- CreatePickingRayToRef
- CreatePickingRayInCameraSpace
- CreatePickingRayInCameraSpaceToRef
- Pick
- PickWithRay
- PickWithBoundingInfo
- MultiPick
- MultiPickWithRay
2 changes: 1 addition & 1 deletion next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information.

0 comments on commit 0cd1e55

Please sign in to comment.