Add developer tools extension.#1094
Add developer tools extension.#1094teymour-aldridge wants to merge 35 commits intoyewstack:masterfrom
Conversation
|
@teymour-aldridge could you please rebase off latest master. CI times have been reduced and repo structure has been updated |
eae9256 to
536707c
Compare
jstarry
left a comment
There was a problem hiding this comment.
@teymour-aldridge could you please rebase your changes off of master? There are a lot of changes in this PR that are unrelated to dev tools (I think from a bad merge?)
|
Yes. My git skills are not the best. I’ll try to rebase again.
… On 3 May 2020, at 05:44, Justin Starry ***@***.***> wrote:
@jstarry commented on this pull request.
@teymour-aldridge <https://github.com/teymour-aldridge> could you please rebase your changes off of master? There are a lot of changes in this PR that are unrelated to dev tools (I think from a bad merge?)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#1094 (review)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AKFSTPI7UTUXRTIELMR5KDTRPTZEPANCNFSM4MMNSGXQ>.
|
|
@teymour-aldridge good luck! If you can't get it working lmk and I can fix it for you |
|
@jstarry I think I've now done this successfully. If I haven't, would you mind letting me know? |
| pub mod dev; | ||
|
|
||
| #[cfg(feature = "dev")] | ||
| thread_local! { |
There was a problem hiding this comment.
nit: can you please move this inside the dev module? I don't think it needs to be here
There was a problem hiding this comment.
I agree, I'll move it into the dev module.
| Chunk(Option<FileChunk>), | ||
| Files(Vec<File>, Chunks), | ||
| ToggleByChunks, | ||
| InvalidString, |
There was a problem hiding this comment.
The changes in this file can be removed. In a separate change, I changed the type of Chunk to use Option<FileChunk>
| "examples/two_apps", | ||
| "examples/webgl", | ||
| ] | ||
| ] No newline at end of file |
There was a problem hiding this comment.
nit: please add a newline to remove this change
| serde = "1" | ||
| serde_derive = "1" | ||
| yew = { path = "../../yew" } | ||
| yew = { path = "../../yew", features = ["std_web"] } |
| </head> | ||
| <body> | ||
| <script src="/todomvc.js"></script> | ||
| <script src="/todomvc_std_web.js"></script> |
| pub fn mount(self, element: Element) -> ComponentLink<COMP> { | ||
| #[cfg(feature = "dev")] | ||
| let _ = wasm_bindgen_futures::spawn_local(async move { | ||
| let new_debugger = crate::dev::DebuggerConnection::new().await; |
There was a problem hiding this comment.
I don't think this is necessary if you have a message queue. The debugger connection message queue should be immediately available
There was a problem hiding this comment.
No – it's here from before I added the message queue.
|
|
||
| /// Describes the state of a WebSocket connection. | ||
| #[derive(Debug)] | ||
| pub enum ConnectionState { |
There was a problem hiding this comment.
No (and the future isn't being used either). It's some code I had here when I was trying to work out how to handle the WebSocket connection.
I'm now using an event listener to send messages when the connection opens (I'll also add one to raise an error if it can't connect).
| /// The event which has happened | ||
| event: ComponentEvent, | ||
| /// Optional additional data about the event. | ||
| data: Option<DebugComponent>, |
| /// A message sent to describe a change in a component's state. | ||
| #[derive(Serialize, Debug)] | ||
| pub struct ComponentMessage { | ||
| /// Time in seconds since the page was loaded. |
| #[derive(Serialize, Debug)] | ||
| pub struct ComponentMessage { | ||
| /// Time in seconds since the page was loaded. | ||
| time: f64, |
There was a problem hiding this comment.
What is the purpose of sending this?
There was a problem hiding this comment.
I thought it could be used to build a timeline of events on the page.
There was a problem hiding this comment.
The extension will receive messages in order so I think it can handle timestamping on its end
There was a problem hiding this comment.
That makes sense, I'll remove the field.
|
This is a good first step, let me know if you need any clarification on my comments! |
|
I love this PR. Did you start working on the browser extension? |
|
This PR (I love it too!) is a mess right now. I'm trying to fix it, but once that's done I intend to start working on the browser extension. My thoughts on the browser extension are that hopefully I'll be able to get the extension to open a WebSocket server, but I suspect that a server running locally coordinating the extension and the code may be necessary which would in turn require a command line script. I'm not sure when this will be releasable. |
This function generates strings which can be used to identify DOM nodes.
This function generates strings which can be used to identify DOM nodes.
2f22368 to
a78032d
Compare
They are now two different traits.
Co-authored-by: Justin Starry <justin.m.starry@gmail.com>
This (draft) pull request implements feature #1090. It opens a WebSocket connection using a
thread_local!and sends information about components to a (not yet developed) browser extension to make it easier to debug Yew applications.