BabylonJS/Spector.js

Suggestion: Expose requestAnimationFrameFunctions and spiedWindow in main script

De-Panther opened this issue · 3 comments

There are some cases where the window.rAF is packed by other scopes to add functionalities to it. (e.g. some XR emulators or for cases of rendering frames selectively)

Following the WebXR PR #257
I think that similar to how the requestAnimationFrameFunctions and spiedWindow were exposed for xrSpy, it would be nice to add an option to set them from the main Spector.js script as well.

spector = new SPECTOR.Spector();
spector.addRequestAnimationFrameFunctionName("customRafName");
spector.setSpiedWindow(referenceToScope); // or spector.setSpiedScope
spector.displayUI();

Do you want to make a PR for it ?

Do you want to make a PR for it ?

Sure.
Is renaming 'spiedWindow' to 'spiedScope' and adding 'setSpiedScope' is ok?

Sure, but can you comment for this on the other PR #257 ? lets avoid changing it after release ?