# backbone-localstorage-sync

> Backbone sync function adapter for persisting Models and Collections to browser localStorage

Latest version **1.0.1** (published 2014-11-30) · 0 weekly downloads

## Install

```sh
npm install backbone-localstorage-sync
pnpm add backbone-localstorage-sync
yarn add backbone-localstorage-sync
bun add backbone-localstorage-sync
```

## 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.1 |
| Published | 2014-11-30 |
| First published | 2014-11-30 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Stuart Rackham |
| Maintainers | srackham |
| Keywords | backbone, sync, localstorage |

## Links

- npm: https://www.npmjs.com/package/backbone-localstorage-sync
- Repository: https://github.com/srackham/backbone-localstorage-sync
- Issues: https://github.com/srackham/backbone-localstorage-sync/issues
- npm.io page: https://npm.io/package/backbone-localstorage-sync

## Alternatives

- [localforage](https://npm.io/package/localforage.md) — 6.2M weekly downloads
- [localforage-observable](https://npm.io/package/localforage-observable.md) — 30.8K weekly downloads
- [@y/y](https://npm.io/package/@y/y.md) — 30.1K weekly downloads
- [@metaobjectsdev/render](https://npm.io/package/@metaobjectsdev/render.md) — 3.5K weekly downloads
- [@ledgerhq/coin-algorand](https://npm.io/package/@ledgerhq/coin-algorand.md) — 1.1K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2014-11-30
- 1.0.0 — 2014-11-30

## README

# Backbone LocalStorage sync adaptor

A Backbone sync function adapter for persisting Models and Collections to
browser LocalStorage.

Based on [example in Backbone Fundamentals
book](https://github.com/addyosmani/backbone-fundamentals/blob/gh-pages/practicals/modular-todo-app/js/libs/backbone/localstorage.js).

Modifications:

- Converted to a Node compatible module for use by Browserify/Webpack.
- No dependencies (Backbone or Underscore).
- The adapter sync to be used on a per Model and per Collection basis.


## Installing
Install module with `npm install backbone-localstorage-sync`


## Using
Globally, for example:

    var BackboneLocalStorageSync = require('backbone-localstorage-sync.js');
    Backbone.sync = BackboneLocalStorageSync('flux-backbone-todo');

On a per Model/Collection class basis, for example:

    var BackboneLocalStorageSync = require('backbone-localstorage-sync.js');

    var TodoItem = Backbone.Model.extend({
      sync: BackboneLocalStorageSync('flux-backbone-todo'),
    });

    var TodoStore = Backbone.Collection.extend({
      model: TodoItem,
      sync: BackboneLocalStorageSync('flux-backbone-todo'),
    });

These examples assume you are bundling your app with a CommonJS comaptible tool such as Webpack or Browserify.

**NOTE:** Because LocalStorage requests execute synchronously the fetch, save
and destroy APIs are also synchronous (differs from the usual async behavior of
client-server adapters).

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