1.0.0-alpha.2 • Published 6 years ago

@transclusion/runtime-worker v1.0.0-alpha.2

Weekly downloads
-
License
MIT
Repository
-
Last release
6 years ago

@transclusion/runtime-worker

Usage

/** @jsx createVElement */

import {run} from '@transclusion/runtime-worker'
import {createVElement} from '@transclusion/vdom'

const counter = {
  init() {
    return [0, null]
  },
  update(model, msg) {
    switch (msg) {
      case 'DECR':
        return [model - 1, null]
      case 'INCR':
        return [model - 1, null]
      default:
        return [model, null]
    }
  },
  view(model) {
    return (
      <div class="counter">
        <button innerHTML="-" on={{click: 'DECR'}} />
        {model}
        <button innerHTML="+" on={{click: 'INCR'}} />
      </div>
    )
  }
}

run({
  program: counter,
  scope: self
})
1.0.0-alpha.2

6 years ago

1.0.0-alpha.1

6 years ago