# watchdog

> An Timer used to Detect and Recover from Malfunctions

Latest version **0.8.17** (published 2018-11-27) · Apache-2.0 license · 0 weekly downloads

## Install

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

## 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.8.17 |
| Published | 2018-11-27 |
| First published | 2012-03-06 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 72.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Author | Huan LI |
| Maintainers | zixia |
| Keywords | watchdog, timer |

## Links

- npm: https://www.npmjs.com/package/watchdog
- Repository: https://github.com/huan/watchdog
- Homepage: https://github.com/huan/watchdog#readme
- Issues: https://github.com/huan/watchdog/issues
- npm.io page: https://npm.io/package/watchdog

## Dependencies (1)

- [brolog](https://npm.io/package/brolog.md) ^1.3.3

## Recent versions

- 0.8.17 (latest) — 2018-11-27
- 0.9.2 (next) — 2021-10-10
- 0.8.15 — 2018-07-12
- 0.8.12 — 2018-07-12
- 0.8.10 — 2018-06-10
- 0.8.9 — 2018-06-10
- 0.8.8 — 2018-06-08
- 0.8.1 — 2018-04-29
- 0.7.7 — 2018-04-29
- 0.7.6 — 2018-04-29
- 0.7.5 — 2018-04-23
- 0.7.4 — 2018-04-23
- 0.7.3 — 2018-04-23
- 0.6.3 — 2018-04-23
- 0.7.2 — 2018-04-23
- … 25 more at https://npm.io/package/watchdog/versions

## README

# WATCHDOG

[![NPM Version](https://badge.fury.io/js/watchdog.svg)](https://badge.fury.io/js/watchdog)
[![Build Status](https://travis-ci.com/huan/watchdog.svg?branch=master)](https://travis-ci.com/huan/watchdog)
[![Downloads](http://img.shields.io/npm/dm/watchdog.svg?style=flat-square)](https://npmjs.org/package/watchdog)
[![Powered by TypeScript](https://img.shields.io/badge/Powered%20By-TypeScript-blue.svg)](https://www.typescriptlang.org/)
[![Greenkeeper badge](https://badges.greenkeeper.io/huan/watchdog.svg)](https://greenkeeper.io/)

A Timer used to Detect and Recover from Malfunctions.

![watchdog](https://huan.github.io/watchdog/images/watchdog.png)
> Picture Credit: [Using Watchdog Timer](https://www.logicsupply.com/explore/io-hub/tutorial-using-beaglebone-black-watchdog-timer/)

## USAGE

```shell
$ npm install watchdog
...
```

```ts
import { Watchdog } from 'watchdog'

const TIMEOUT = 1 * 1000  // 1 second
const dog = new watchdog(TIMEOUT)

const food = { data: 'delicious' }

dog.on('reset', () => console.log('reset-ed'))
dog.on('feed',  () => console.log('feed-ed'))

dog.feed(food)
// Output: feed-ed

setTimeout(function() {
  dog.sleep()
  console.log('dog sleep-ed. Demo over.')
}, TIMEOUT + 1)
// Output: reset-ed.
// Output: dog sleep-ed. Demo over.
```

## DOCUMENT

See [auto generated docs](https://huan.github.io/watchdog)

## SEE ALSO

* [Wikipedia: Watchdog timer](https://en.wikipedia.org/wiki/Watchdog_timer)
* [Yet Another watchdog timer for node.js (and browserify)](https://github.com/andrew-filonenko/ya-watchdog)

## THANKS

Thanks to Damon Oehlman (https://github.com/DamonOehlman) who owned the `watchdog` name of NPM module. He is so kind and nice that passed this name over to me after my request.

## AUTHOR

Huan LI \<zixia@zixia.net\> (http://linkedin.com/in/zixia)

<a href="http://stackoverflow.com/users/1123955/zixia">
  <img src="http://stackoverflow.com/users/flair/1123955.png" width="208" height="58" alt="profile for zixia at Stack Overflow, Q&amp;A for professional and enthusiast programmers" title="profile for zixia at Stack Overflow, Q&amp;A for professional and enthusiast programmers">
</a>

## COPYRIGHT & LICENSE

* Code & Docs © 2017 Huan LI \<zixia@zixia.net\>
* Code released under the Apache-2.0 License
* Docs released under Creative Commons

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