Are there any best practices concerning multiple instances of new window.SDVApp.ParametricViewer on a single page? Any reason this should be avoided?
I’m using React.js and want to create/destroy ParametricViewer instances within a reusable object.
Any insight here is greatly appreciated as I’ve set this up in React.js and it works very well (noticeably faster loads).
At this point, the issue I’ve found is ensuring you address your ShapeDiver viewports (performance degradation, webGL context limits) on component unmounts. This is relatively straightforward and doable relying on ShapeDiver Api functions.
I’d like to know if there are any limitations (on ShapeDiver’s end) in having many window.SDVApp.ParametricViewer in existence (i.e. more than 20 viewer objects is problematic) within a page so that I may build accordingly.
Thanks
My apologies for the late reply. There are no specific limitations in terms of parallel viewer instances on the ShapeDiver side. Such limitations will likely come from general browser limitations and the hardware of client devices (CPU and GPU).
As a side note, we will release later this year a new version of the API that takes into account the feedback we received from our users using various framewords (React, Vue…). Managing viewer instances and various communication plugins will become much more convenient in the new version. We expect to publish sample code for framework integrations after the release.
Thanks Mathieu. Looking forward to the new API.