# h-spa

> Typescript Helpers

Latest version **0.0.9** (published 2019-10-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install h-spa
pnpm add h-spa
yarn add h-spa
bun add h-spa
```

## Health

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

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

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.9 |
| Published | 2019-10-09 |
| First published | 2018-07-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | benjaminjackman |
| Maintainers | benjaminjackman |
| Keywords | ash9g, typescript |

## Links

- npm: https://www.npmjs.com/package/h-spa
- npm.io page: https://npm.io/package/h-spa

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 0.0.9 (latest) — 2019-10-09
- 0.0.8 — 2019-10-09
- 0.0.7 — 2019-10-09
- 0.0.6 — 2019-10-09
- 0.0.5 — 2018-07-05
- 0.0.4 — 2018-07-05
- 0.0.3 — 2018-07-05
- 0.0.2 — 2018-07-05

## README

# Incredibly simple single pager router application

will generate a very simple home page

expects an element named content

# Usage

```html
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title>Page Title</title>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" type="text/css" media="screen" href="https://static.jackman.biz/cdn/reset.css" />
</head>
<body>
  <div id="menubar" style="position: fixed;top: 0"><a href="#">[🏠home]</a></div>
  <div id="content"></div>
  <script src="dist/index.js"></script>
  <script src="/rldr"></script>
</body>
</html>
```

```typescript
import {router} from "h-spa"

function demo1 (el: HTMLDivElement) => {
  var alive = true
  i = 0
  function loop() {
    el.innerText = `Counter: ${i++}`
    if (alive) requestAnimationFrom(loop)
  }

  requestAnimationFrame(loop)

  function stop() {alive = false}

  return stop
}

function demo2 (el: HTMLDivElement) => {
  el.innerText = "HELLO DEMO 2"
}



router({
  demo1,
  demo2,
})

http://localhost:1234/#demo1
http://localhost:1234/#demo2
http://localhost:1234/#demo3
```

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