ARnft icon indicating copy to clipboard operation
ARnft copied to clipboard

ARnft.dispose() removes #app even if it did not create it

Open andreyrd opened this issue 3 years ago • 2 comments

Calling ARnft.dispose() will remove the #app element even if it was not created by ARnft:

CameraViewRenderer.ts:230

                let currentAR = document.getElementById("app");
                if (currentAR !== null && currentAR !== undefined) {
                    currentAR.remove();
                }

This is a problem for a Vue app, since it ends up destroying the entire app.

What if you add a special data-arnft attribute to app when creating it in Container.ts, and if that does not exist, you don't remove the element.

I can open a PR if that makes sense.

andreyrd avatar Mar 03 '22 17:03 andreyrd

Good catch @andreyrd ! Yes please open a PR, start from the dev branch creating a new one for example feature -data-arnft or name it as you prefer. Also the terminate worker function need to be improved, actually i think can't terminate a single worker.

kalwalt avatar Mar 03 '22 19:03 kalwalt

I'll try to get it soon. I think this method needs to be aware of the global config, and use that to determine if the container was created. Because the user may have also specified an id other than app for the container.

andreyrd avatar Mar 03 '22 20:03 andreyrd