Skip to content

A lightweight general purpose elm-like runtime for typescript, based off of raj.

License

Notifications You must be signed in to change notification settings

RonaldDijks/ts-elmish

Repository files navigation

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.

About

A lightweight general purpose elm-like runtime for typescript, based off of raj.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published