# @transclusion/runtime-browser

> ## Usage

Latest version **1.0.0-alpha.2** (published 2017-11-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install @transclusion/runtime-browser
pnpm add @transclusion/runtime-browser
yarn add @transclusion/runtime-browser
bun add @transclusion/runtime-browser
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0-alpha.2 |
| Published | 2017-11-30 |
| First published | 2017-11-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Marius Lundgård |
| Maintainers | mariuslundgard |

## Links

- npm: https://www.npmjs.com/package/@transclusion/runtime-browser
- npm.io page: https://npm.io/package/@transclusion/runtime-browser

## Recent versions

- 1.0.0-alpha.2 (latest) — 2017-11-30
- 1.0.0-alpha.1 — 2017-11-21

## README

# @transclusion/runtime-browser

## Usage

```js
import {run} from '@transclusion/runtime-browser'

run(
  {
    element: document.getElementById('root'),
    props: {},
    worker: new Worker('worker.js')
  },
  context => {
    context.ports.history.subscribe(msg => {
      switch (msg.type) {
        case 'PUSH_STATE':
          history.pushState(msg.state, msg.title, msg.path)
          break

        case 'REPLACE_STATE':
          history.replaceState(msg.state, msg.title, msg.path)
          break
      }
    })

    window.addEventListener('popstate', event => {
      context.ports.history.send({
        type: 'POP_STATE',
        state: event.state,
        path: location.pathname
      })
    })
  }
)
```

---
_Source: https://npm.io/package/@transclusion/runtime-browser · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
