mpetroff / pannellum

Pannellum is a lightweight, free, and open source panorama viewer for the web.
https://pannellum.org/
MIT License
4.16k stars 712 forks source link

Completely dispose Pannellum Viewer #1095

Closed TillCity closed 2 years ago

TillCity commented 2 years ago

If this has been explained somewhere in the documentation I have been unable to find it. I am using Pannellum in a hybrid mobile app - to great success. The thing that concerns me is this - in the app the panorama gets loaded and is displayed on one page of the app. What happens when the user navigates away to another page. The panorama will no longer display since its container control has been destroyed. However, what about the previously configured Pannellum.Viewer? Isn't there something that needs to be done to tell it to stop and dispose of all resources prior to unloading its hosting page?

mpetroff commented 2 years ago

There's a .destroy() method you can call on the viewer instance, which should dispose of most of its resources.

TillCity commented 2 years ago

Thanks!