ts-elmish
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

ts-elmish

The Elm architecture for TypeScript.

A lightweight general purpose Elm-like runtime for TypeScript, based off of raj.

yarn add ts-elmish

Example

A counter that increments by one every thimne the user confirms.

import { Runtime } from '../src/ts-elmish'

new Runtime({
  init: [0],
  update: (message, state) => {
    return [state + 1]
  },
  view: (state, dispatch) => {
    const keepCounting = window.confirm(`Count is ${state}. Increment?`)
    if (keepCounting) {
      dispatch({})
    }
  }
})

Note: ts-elmish is view layer agnostic. Here we use the browser's built-in view to play the part.

/ts-elmish/

    Package Sidebar

    Install

    npm i ts-elmish

    Weekly Downloads

    2

    Version

    0.0.2

    License

    MIT

    Unpacked Size

    15.9 kB

    Total Files

    8

    Last publish

    Collaborators

    • ronalddijks