Skip to content

Commit

Permalink
fix: add teardown function
Browse files Browse the repository at this point in the history
  • Loading branch information
Onxi95 committed May 17, 2024
1 parent ac6d2a9 commit 0750f2b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/components/GyroscopeExperience.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ export const GyroscopeExperience = () => {
} else {
console.log("Device Orientation API not supported.");
}

return () =>
window.removeEventListener(
"deviceorientation",
handleDeviceOrientationChange
);
});

const instances = useMemo(() => {
Expand Down

0 comments on commit 0750f2b

Please sign in to comment.