Issie logo Issie

Bridge Module

The main-process half of Issie's renderer bridge. Every operation the renderer is allowed to ask the operating system for is registered here, as a named channel with a fixed shape. The renderer half is src/Preload/preload.js, and the two are meant to be read together: nothing should be exposed there that is not answered here, and nothing answered here should take a request general enough to stand in for `require`. Handlers use event.returnValue, the synchronous form, because the renderer's file wrappers return values from inside Elmish update and cannot await. get-user-data in Main.fs already worked this way before any of this existed.

Functions and values

Function or value Description

allowProjectRoot dir

Full Usage: allowProjectRoot dir

Parameters:
    dir : string

dir : string

preloadPath ()

Full Usage: preloadPath ()

Parameters:
    () : unit

Returns: string

Where the preload bundle is, for webPreferences.preload. webpack.config.preload.js writes it beside the main bundle in both development and production, so no branch is needed here.

() : unit
Returns: string

register ()

Full Usage: register ()

Parameters:
    () : unit

Register every bridge channel. Called once, before any window exists.

() : unit

startSidecar ()

Full Usage: startSidecar ()

Parameters:
    () : unit

Start the sidecar, and start it again if it dies. In development that is `dotnet run`, which builds first when it must - the port channel below answers null until the handshake lands, so a slow first build costs nothing but waiting. In production it is the self-contained binary electron-builder placed under resources/sidecar (scripts/publish-sidecar.js). **What a restart does and does not recover.** The transport comes back on its own: the port channel answers the new port, and the renderer's `request` connects when it has no socket, so the next thing asked of the simulator reaches the new process. What does NOT come back is the simulation - the new process holds no design and no session, so every command naming the old session's epoch is refused by name, which is exactly what that number is for. The user's next Start or Refresh builds again and works. It is deliberately left there. Rebuilding from here would mean this side deciding to simulate, and "nothing but a start path builds" is the rule that deleted the build-retry storm (docs/dev/sidecarInvariants.md, section J). A restart that silently rebuilt would also be a simulation the user did not ask for, of whatever design happened to be open.

() : unit

staticDirectory ()

Full Usage: staticDirectory ()

Parameters:
    () : unit

Returns: string

Absolute path to the static asset directory. The renderer used to work this out three different ways - a bare "./resources/static" relative to the working directory on Windows and Linux, and __dirname/../../static on macOS. Both land on the same place as process.resourcesPath, which is what Main.fs already uses for the splash page, so this collapses them into the one reliable form.

() : unit
Returns: string

Type something to start searching.