# bind-store

> A simple elegant data-binding library for JavaScript

Latest version **0.0.1** (published 2018-07-16) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install bind-store
pnpm add bind-store
yarn add bind-store
bun add bind-store
```

## 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 | 2018-07-16 |
| First published | 2018-07-16 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Jane Zeng |
| Maintainers | janeskywalker |

## Links

- npm: https://www.npmjs.com/package/bind-store
- Repository: https://github.com/janeskywalker/data-binding
- Homepage: https://github.com/janeskywalker/data-binding#readme
- Issues: https://github.com/janeskywalker/data-binding/issues
- npm.io page: https://npm.io/package/bind-store

## Recent versions

- 0.0.1 (latest) — 2018-07-16
- 0.0.0 — 2018-07-16

## README

# Data Binding

A minimal data-binding library.

## Install

```sh
$ npm install --save bind-store
```

## Usage

Say we are developing a stock ticker. We would want to update stock price values in real time.

In our markup we could call out the need to bind view elements to data with a data attribute.

```html
<li data-bind='stocks.google'></li>
<li data-bind='stocks.microsoft'></li>
<li data-bind='stocks.amazon'></li>
<li data-bind='stocks.facebook'></li>
```

Values are namespaced, the portion before the `.`. The name space is the store name.

For example:

```js
import { createStore } from 'bind-store'

const stocks = createStore('stocks')
```

The key name is then the portion after the `.`.

```js
stocks.set('google', 1000)
stocks.set('microsoft', 101)
stocks.set('amazon', 1700)
stocks.set('facebook', 178)
```

The values would then appear as the inner text of the corresponding HTML elements. There can be multiple elements on the page bound to the same key.

The store object also allows us to retrieve values once they are set.

```js
const value = stocks.get('google')
```

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