https://github.com/dillonkearns/elm-electron
Type-safe interprocess communication for Electron apps built with Elm.
https://github.com/dillonkearns/elm-electron
electron elm ipc
Last synced: about 1 year ago
JSON representation
Type-safe interprocess communication for Electron apps built with Elm.
- Host: GitHub
- URL: https://github.com/dillonkearns/elm-electron
- Owner: dillonkearns
- Created: 2017-07-27T03:09:00.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-08-06T21:54:48.000Z (almost 9 years ago)
- Last Synced: 2025-05-17T21:37:33.071Z (about 1 year ago)
- Topics: electron, elm, ipc
- Language: Elm
- Size: 5.13 MB
- Stars: 19
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Elm-Electron
Communicate between your Elm pages and your main NodeJS Electron process
with the type-safety your accustomed to in Elm.

## Usage
See [github.com/dillonkearns/elm-electron-starter](https://github.com/dillonkearns/elm-electron-starter) for reference or to setup a brand new project.
See [github.com/dillonkearns/mobster](https://github.com/dillonkearns/mobster)
for a real-world example of this library in action.
* `cd` into your electron project.
* `npm install --save-dev elm-electron`.
* Add a script in your `package.json` `scripts` section similar to:
```javascript
"scripts": {
...
"generate-ipc": "elm-electron src/Ipc.elm --ts src/ipc.ts --elm src/IpcSerializer.elm"
}
```
Where `src/Ipc.elm` is the location of your `Ipc.Msg` union type and `src/ipc.ts` is the location where you would like to save the generated typescript discriminated union.
Import the generated code in your Electron nodejs typescript code with `import { Ipc } from 'src/ipc.ts'` (or whatever the relative path to your generated file is).