-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[expo] introduce api for devtools plugin #24667
Conversation
c1d5448
to
7de36b2
Compare
7de36b2
to
bf66a79
Compare
ENG-10329 Handle multiple devices workflow
Currently the devtool plugin clients broadcast messages on the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
introduce useDevToolsPluginClient(pluginName) hook from the expo package
nice :) that simplifies the api.
as discussed last week, let's follow up at some point with some concept of a device id that is built into the client, so there is a first class concept built into this api for plugins to be able to handle multiple devices
*/ | ||
public abstract isConnected(): boolean; | ||
|
||
protected handleMessage = (event: WebSocketMessageEvent): void => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One nitpick: prefer using functions over arrow functions when the arrow function is not necessary 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is required because we want to bind "this" to the DevToolsPluginClient class. since the function would be called inside an event callback.
# Why support devtools plugins for autolinking close ENG-9981 having series prs to add devtools plugins support: - #24649 - #24650 - #24667 # How - add `devtools` as a platform - passing `projectRoot` rather than default implicit `process.cwd()` - exposing autolinking interfaces for cli integration - introduce `onlyProjectDeps` for not filtering out project dependencies from monorepo # Test Plan - ci passed - manual test from devtools plugins --------- Co-authored-by: Tomasz Sapeta <tomasz.sapeta@swmansion.com>
# Why add devtools plugins support to cli close ENG-9981 having series prs to add devtools plugins support: - #24649 - #24650 - #24667 # How - [prebuild-config] update expo-modules-autolinking integrate because now it exports public apis from #24649 - [cli] add `DevToolsPluginManager` and `DevToolsPluginMiddleware` for devtools plugins support # Test Plan add unit tests and ci passed
will follow up this in a separate pr and going to merge this. |
# Why support devtools plugins for autolinking close ENG-9981 having series prs to add devtools plugins support: - #24649 - #24650 - #24667 # How - add `devtools` as a platform - passing `projectRoot` rather than default implicit `process.cwd()` - exposing autolinking interfaces for cli integration - introduce `onlyProjectDeps` for not filtering out project dependencies from monorepo # Test Plan - ci passed - manual test from devtools plugins --------- Co-authored-by: Tomasz Sapeta <tomasz.sapeta@swmansion.com>
# Why add devtools plugins support to cli close ENG-9981 having series prs to add devtools plugins support: - #24649 - #24650 - #24667 # How - [prebuild-config] update expo-modules-autolinking integrate because now it exports public apis from #24649 - [cli] add `DevToolsPluginManager` and `DevToolsPluginMiddleware` for devtools plugins support # Test Plan add unit tests and ci passed
# Why for devtools plugins integration close ENG-9981 close ENG-10329 having series prs to add devtools plugins support: - #24649 - #24650 - #24667 # How introduce `useDevToolsPluginClient(pluginName)` hook from the expo package. this api has some designs in mind: - pluginName as message namespace. so that method `hello` from different plugins will not conflict. - the websocket client in the app supports multiplexing. multiple plugins would have just one websocket client and will terminate the connection once reference count reaches zero. - if multiple webpages with the same pluginName connect to the app, we will terminate previous connection and let the latest plugin webpage win. # Test Plan add some unit test and ci passed
Why
for devtools plugins integration
close ENG-9981
close ENG-10329
having series prs to add devtools plugins support:
How
introduce
useDevToolsPluginClient(pluginName)
hook from the expo package. this api has some designs in mind:hello
from different plugins will not conflict.Test Plan
add some unit test and ci passed
Checklist
npx expo prebuild
& EAS Build (eg: updated a module plugin).