GithubHelp home page GithubHelp logo

ladrl / elm-electron Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dillonkearns/elm-electron

0.0 2.0 0.0 5.25 MB

Type-safe interprocess communication for Electron apps built with Elm.

JavaScript 0.23% Elm 71.21% TypeScript 28.55%

elm-electron's Introduction

Elm-Electron

Communicate between your Elm pages and your main NodeJS Electron process with the type-safety your accustomed to in Elm.

Type-Safe IPC Messages

Usage

See github.com/dillonkearns/elm-electron-starter for reference or to setup a brand new project.

See 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:
"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).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.