Skip to content

Commit

Permalink
Added scene.destroy callback
Browse files Browse the repository at this point in the history
  • Loading branch information
ydaniv committed Dec 25, 2023
1 parent 6dc88b5 commit 2ee69bd
Show file tree
Hide file tree
Showing 7 changed files with 552 additions and 4 deletions.
3 changes: 3 additions & 0 deletions dist/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ function getController (config) {
* Removes all side effects and deletes all objects.
*/
function destroy () {
config.scenes.forEach(scene => scene.destroy?.());

document.removeEventListener('scrollend', scrollendHandler);

if (resizeObserver) {
Expand Down Expand Up @@ -374,6 +376,7 @@ class Pointer {
* @property {boolean} [centeredToTarget] whether this scene's progress is centered on the target's center.
* @property {HTMLElement} [target] target element for the effect.
* @property {boolean} [disabled] whether this scene is disabled.
* @property {function} [destroy] a function clean up the scene when it's controller is destroyed.
*/

/**
Expand Down
Loading

0 comments on commit 2ee69bd

Please sign in to comment.