# reactive-var-std

> A Standalone version of ReactiveVar package from Meteor. Lets you write reactive code with ease outside of Meteor

Latest version **1.1.6** (published 2016-12-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install reactive-var-std
pnpm add reactive-var-std
yarn add reactive-var-std
bun add reactive-var-std
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.6 |
| Published | 2016-12-23 |
| First published | 2016-12-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Maintainers | khangnlh |

## Links

- npm: https://www.npmjs.com/package/reactive-var-std
- Repository: https://github.com/nlhuykhang/reactive-var-std
- Homepage: https://github.com/nlhuykhang/reactive-var-std#readme
- Issues: https://github.com/nlhuykhang/reactive-var-std/issues
- npm.io page: https://npm.io/package/reactive-var-std

## Dependencies (2)

- [trackr](https://npm.io/package/trackr.md) ^2.0.2
- [babel-runtime](https://npm.io/package/babel-runtime.md) ^6.20.0

## Recent versions

- 1.1.6 (latest) — 2016-12-23
- 1.1.5 — 2016-12-13
- 1.1.4 — 2016-12-10
- 1.1.3 — 2016-12-10
- 1.1.2 — 2016-12-10
- 1.1.1 — 2016-12-09
- 1.1.0 — 2016-12-09
- 1.0.0 — 2016-12-07

## README

# Standalone Reactive Var

[![CircleCI](https://circleci.com/gh/nlhuykhang/reactive-var-std/tree/master.svg?style=shield)](https://circleci.com/gh/nlhuykhang/reactive-var-std/tree/master) [![Coverage Status](https://coveralls.io/repos/github/nlhuykhang/reactive-var-std/badge.svg?branch=master)](https://coveralls.io/github/nlhuykhang/reactive-var-std?branch=master) [![npm version](https://badge.fury.io/js/reactive-var-std.svg)](https://badge.fury.io/js/reactive-var-std) [![dependencies](https://david-dm.org/nlhuykhang/reactive-var-std/status.svg)](https://david-dm.org/nlhuykhang/reactive-var-std?view=list) [![Known Vulnerabilities](https://snyk.io/test/github/nlhuykhang/reactive-var-std/badge.svg)](https://snyk.io/test/github/nlhuykhang/reactive-var-std)

A Standalone version of ReactiveVar package from Meteor. Lets you write reactive code with ease outside of Meteor

[Check out the demo here](https://nlhuykhang.github.io/reactive-var-std/)

## Install

##### NPM
```bash
npm install --save reactive-var-std
```

##### CDN
```html
<script src="//cdn.jsdelivr.net/reactive-var-std/1.1.4/reactive-var-std.min.js"></script>
<!-- OR  -->
<script src="//cdn.jsdelivr.net/reactive-var-std/latest/reactive-var-std.min.js"></script>
```

## Usage

##### ES6

```javascript
import StdReactiveVar, { Tracker } from 'reactive-var-std';

// or if you do not use ES6
// var StdReactiveVar = require('reactive-var-std');
// var Tracker = StdReactiveVar.Tracker;
// var StdReactiveVar = StdReactiveVar.default;

// create a creative var instance
const reactive = new StdReactiveVar(0);

// wrap the reactive instance inside a computation block created by Tracker.autorun
Tracker.autorun(() => {
  // log the value whenever it changes
  console.log(reactive.get());
});

// change the value 1st time
reactive.set(1);
// ---> the console will show: 1

// change the value 1st time
reactive.set(10);
// ---> the console will show: 10
```

##### ES5

```javascript
var StdReactiveVar = require('reactive-var-std');
var Tracker = StdReactiveVar.Tracker;
var StdReactiveVar = StdReactiveVar.default;

// create a creative var instance
var reactive = new StdReactiveVar(0);

// wrap the reactive instance inside a computation block created by Tracker.autorun
Tracker.autorun(function() {
  // log the value whenever it changes
  console.log(reactive.get());
});

// change the value 1st time
reactive.set(1);
// ---> the console will show: 1

// change the value 1st time
reactive.set(10);
// ---> the console will show: 10
```

## API

### StdReactiveVar(v:Any)

### .get()

### .set(v:Any)

### .getOld()

### .getNonReactive()


## License

[MIT](LICENSE)

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