Skip to content

An adapter for writing development tooling that runs as a Chrome extension or an electron app.

Notifications You must be signed in to change notification settings

fulcrologic/fulcro-devtools-remote

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

INCOMPLETE. WORK IN PROGRESS. Do not use.

Devtools Remote supplies a Fulcro Remote abstraction that can be used for developing development tooling using Fulcro for the UI of the tool, such that the communication to the target of the tooling acts simply as a Fulcro remote where mutations, loads, and "server push" is supported without you having to write that plumbing.

The use cases are:

  • A Chrome Extension that creates one or more panels (using Fulcro) and the target is any web-page based application (doesn’t have to be Fulcro).

  • An Electron app whose UI is written in Fulcro, and talks over websockets to "whatever" using the Sente websockets library.

The target app can be anything that can run Sente as a Server (CLJC). Pathom is the suggested library for implementing the code on the target that your Devtool will talk to.

IF The target of your tool is a Fulcro application (as it is for Fulcro Inspect), then there is a little additional tooling where you can install an extra dev-time remote on your target application so that the Target can initiate communications with the Tool. Thus you’d have:

Target 1 (Fulcro) <-> Dev Tool (Fulcro)
Target 2 (Fulcro) <-> Dev Tool (Fulcro)
Target 3 (Fulcro) <-> Dev Tool (Fulcro)

The goal is that your mental model is this:

Fulcro UI (Chrome Extension) <-> CLJS running in Web Page: Fulcro remote

even though a Chrome extensions require transferring the message through multiple hops for security. The devtool has to run a background worker, which can communicate to/from either the extension or the page, but this communication is done via ports and on-page events of the target web page.

So, in reality, the comms look more like this:

Chrome Extension 1 <-> Background Worker: port
Chrome Extension 2 <-> Background Worker: port
Chrome Extension 3 <-> Background Worker: port
Background Worker <-> Content Script 1: port
Background Worker <-> Content Script 2: port
Background Worker <-> Content Script 3: port
Content Script 1 <-> Target CLJS 1: events
Content Script 1 <-> Target CLJS 2: events
Content Script 2 <-> Target CLJS 3: events
Content Script 3 <-> Target CLJS 4: events

The same as chrome, but different communication bits. We want you to see:

Fulcro UI (Electron UI) <-> CLJ(s) Program: Fulcro remote

when in reality the chain of communication is:

Electron UI <-> Background: IPC
Background <-> This Library: websockets
This Library <-> Target Code

Copyright (c) 2017-2022, Fulcrologic, LLC The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

An adapter for writing development tooling that runs as a Chrome extension or an electron app.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published