# emitting-primitive

> A primitive value store that makes it easy to keep dependencies in sync

Latest version **0.0.1** (published 2015-08-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install emitting-primitive
pnpm add emitting-primitive
yarn add emitting-primitive
bun add emitting-primitive
```

## 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.0.1 |
| Published | 2015-08-17 |
| First published | 2015-08-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Erin Dachtler |
| Maintainers | download |
| Keywords | emitter, variable, boolean, number, string |

## Links

- npm: https://www.npmjs.com/package/emitting-primitive
- Repository: https://github.com/download13/emitting-primitive
- Homepage: https://github.com/download13/emitting-primitive#readme
- Issues: https://github.com/download13/emitting-primitive/issues
- npm.io page: https://npm.io/package/emitting-primitive

## Alternatives

- [async-exit-hook](https://npm.io/package/async-exit-hook.md) — 3.7M weekly downloads
- [evnty](https://npm.io/package/evnty.md) — 7.2K weekly downloads
- [eleventy-plugin-asciidoc](https://npm.io/package/eleventy-plugin-asciidoc.md) — 3.5K weekly downloads
- [@jswork/next-get2get](https://npm.io/package/@jswork/next-get2get.md) — 945 weekly downloads
- [@dashersw/axon](https://npm.io/package/@dashersw/axon.md) — 934 weekly downloads

## Recent versions

- 0.0.1 (latest) — 2015-08-17
- 0.0.0 — 2015-08-17

## README

# emitting-primitive

A store that holds a single primitive value (string, number, boolean). It emits events to registered listeners when the value changes.


## Example

```javascript
var EmittingPrimitive = require('emitting-primitive');

// Initial state can be passed during construction, or it will be null
var counter = new EmittingPrimitive(0);

// The handler will be called once with the value 0 when it is registered
// and again with the value 1 when the value is set down below
counter.onChange(function(value) {
	// Update view
	view.render({count: value});
});

counter.set(counter.get() + 1);
```


## Methods

* `.get()` - Gets the current value
* `.set(value)` - Sets the current value
* `.onChange(fn)` - Registers `fn` as a handler that will be called once when it is registered, and again whenever the stored value changes.

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