Header menu 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

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.