# vatom

> Shared, independent state manager for Vue

Latest version **1.0.2** (published 2018-05-06) · ISC license · 0 weekly downloads

## Install

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

## 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.0.2 |
| Published | 2018-05-06 |
| First published | 2018-05-04 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 4.2 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Paul Adams |
| Maintainers | p-adams |

## Links

- npm: https://www.npmjs.com/package/vatom
- Repository: https://github.com/p-adams/Vatom
- Homepage: https://github.com/p-adams/Vatom#readme
- Issues: https://github.com/p-adams/Vatom/issues
- npm.io page: https://npm.io/package/vatom

## Dependencies (1)

- [vue](https://npm.io/package/vue.md) ^2.5.16

## Recent versions

- 1.0.2 (latest) — 2018-05-06
- 1.0.1 — 2018-05-04
- 1.0.0 — 2018-05-04

## README

# Vatom

### a shared, independent state manager for Vue

## Installation

`npm install vatom`

## Usage

`import Vatom from 'vatom'`

#### Create a Vatom to store the state you want to share in your app:

`const todos = Vatom([{id: 1, text: "Learn Vue", completed: false}])`

#### Update the shared state by passing in a function (free of side-effects) to the `$swap`<br/>

#### method along with any optional arguments:

`const setCompletedToTrue = function(todos, id) { return todos.map( todo => (todo.id === id ? { ...todo, completed: true } : todo) ); };`

`todos.$swap(setCompletedToTrue, 0)` 0 is the id of the todo you want to set to complete

#### Get a snapshot of your state by calling `$deref`:

`todos.$deref()`

#### Set old state to entirely new state using `$reset`:

`todos.$reset(["Learn Vue", "Master Vuex"])` todos is now an array of text strings

###### Vatom is inspired by Clojure's Atom mechanism for managing state

(https://clojure.org/reference/atoms)

```

```

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