Replicate BrowserSync syncing using Webview, IPC, events
BrowserSync is great, but it may be overkill for the needs of Reflex. Running into difficulties using the proxy function—especially on http sites—and the performance of the server it runs seems to be super slow.
Instead of running BrowserSync's server and having to load that URL, we could instead just handle the events between the Webviews that are already rendered! The performance should be far superior.
We can use IPC to communicate between a Webview—which has access to the underlying document data—and the Electron process. From there, we can emit with an event bus to keep track of events being fired, which element they're on, etc.
Try it out on the webview-event-sync branch.
Reflex should synchronize all these events between Webviews:
- [x] Scroll
- [ ] Hover
- [x] Click
- (Ideally all possible pointer, mouse, and gesture events)
Checklist
- [ ] Don't perform event on origin Webview
- [ ] For clicks, send the
DOMElementand be able to find that element on the other Webviews - [ ] Works on simple and complex sites (i.e. NYTimes)
- Who sent the event? (don't duplicate the event for them)
- What was the event?
- Did the event have a target that we should apply to? (i.e. apply a hover/click)
- Apply event to all Webviews (except the origin)