Player devtools RFC #227
rafbcampos
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Player devtools RFC
Developer tool extensions are fundamental to ergonomics. Therefore, we must ensure that Player has a companion browser extension that allows it to be inspected and debugged while running in the user's application.
Current architecture
We leverage the Player plugins API, where the Player exposes tappable hooks, devtools plugins tap a subset of those and message the extension using window.postMessage.
When the extension starts, it injects a script tag containing the code to register the devtools-plugin.
The devtools-plugin taps on some of the Player hooks, starts messaging the devtools extension background page, and answers requests for more data or expression evaluation.
The extension leverages the devtools-common package, that exposes the redux store/reducer, types and messaging helper functions.
Finally, the devtools render the panel using the devtools-ds.
New requirements
Although the current implementation allows inspecting running Player instances, we want to expand its capabilities and fulfill those requirements:
Architecture changes proposal
With those requirements in mind, these are the changes we want to make to the devtools implementation:
Example flow:
With those changes, we add support to Player inspection, allow the user to register any number of plugins, and let them define their UI.
Dependencies
Performance
Every data processing / business logic runs into the plugins running into the inspected Player.
The devtools and its service worker, only handle messaging, subscription, data changes, and rendering the Player content sent by the plugins.
So having those processes running in the Player could potentially tank its performance.
We need to prevent that running while the extension is not active, so all devtools plugins need to have a runtime check for an environment variable, for example, and, if possible, adopt dynamic imports.
Inspiration
Vue devtools
Beta Was this translation helpful? Give feedback.
All reactions