# domgame

> simple dom games

Latest version **0.1.2** (published 2018-03-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install domgame
pnpm add domgame
yarn add domgame
bun add domgame
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2018-03-19 |
| First published | 2018-03-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 6.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Luke Burns |
| Maintainers | lukeburns |

## Links

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

## Dependencies (1)

- [xoo](https://npm.io/package/xoo.md) ^1.2.0

## Recent versions

- 0.1.2 (latest) — 2018-03-19
- 0.1.1 — 2018-03-17
- 0.1.0 — 2018-03-17

## README

# domgame

```js
npm install domgame
```

## example

```js
const domgame = require('domgame')
const html = require('bel')

// create 10 targets with random values
const targets = Array(10).fill(1)
const targetValues = targets.reduce((map, target, id) => {
  map[id] = Math.floor(Math.random()*60000)
  return map
}, {})

const game = domgame(function () {
  return html`<body id="game">
    <div id="time">Time remaining: ${this.time_remaining()}</div>
    <div id="score">Score: ${this.score()}</div>
    ${targets.map((target, id) => html`<div class="target" onclick=${() => this.click(id)}>target ${id}: ${targetValues[id]} points</div>`)}
  </body>`
}, { timeLimit: 60000, targetValues })

game.on('ready', function (state) {
  state.start()
  game.once('end', gameHistory => {
    console.log('game over', gameHistory)
  })
})

document.body = game()
```

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