# backbone.conduit

> Moving data through backbone

Latest version **1.1.0** (published 2016-08-18) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install backbone.conduit
pnpm add backbone.conduit
yarn add backbone.conduit
bun add backbone.conduit
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2016-08-18 |
| First published | 2015-01-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4.4.4 |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Maintainers | pwagener |
| Keywords | backbone, performance, reset, data |

## Links

- npm: https://www.npmjs.com/package/backbone.conduit
- Repository: https://github.com/pwagener/backbone.conduit
- Homepage: http://conduit.wagener.org
- Issues: https://github.com/pwagener/backbone.conduit/issues
- npm.io page: https://npm.io/package/backbone.conduit

## Dependencies (3)

- [backbone](https://npm.io/package/backbone.md) ^1.0.0
- [underscore](https://npm.io/package/underscore.md) ^1.8.3
- [es6-promise](https://npm.io/package/es6-promise.md) ^3.2.1

## Alternatives

- [@libsql/sqlite3](https://npm.io/package/@libsql/sqlite3.md) — 39.8K weekly downloads
- [@fortemi/core](https://npm.io/package/@fortemi/core.md) — 461 weekly downloads
- [cdb-converter](https://npm.io/package/cdb-converter.md) — 341 weekly downloads
- [@uplo/adapter-prisma](https://npm.io/package/@uplo/adapter-prisma.md) — 75 weekly downloads
- [typeorm-aios](https://npm.io/package/typeorm-aios.md) — 30 weekly downloads

## Recent versions

- 1.1.0 (latest) — 2016-08-18
- 1.0.0 — 2016-05-18
- 0.6.19 — 2015-12-05
- 0.6.18 — 2015-10-21
- 0.6.17 — 2015-10-19
- 0.6.16 — 2015-10-03
- 0.6.15 — 2015-10-01
- 0.6.14 — 2015-09-30
- 0.6.13 — 2015-09-29
- 0.6.12 — 2015-09-25
- 0.6.11 — 2015-09-25
- 0.6.10 — 2015-09-16
- 0.6.9 — 2015-09-15
- 0.6.8 — 2015-09-14
- 0.6.7 — 2015-08-16
- … 21 more at https://npm.io/package/backbone.conduit/versions

## README

# Backbone.Conduit
## Moving Data Through Backbone

Conduit is a Backbone plugin that improves the ability of Backbone to handle large scale data sets.  

[![Build Status](https://travis-ci.org/pwagener/backbone.conduit.svg?branch=master)](https://travis-ci.org/pwagener/backbone.conduit)
[![Join the chat at https://gitter.im/pwagener/backbone.conduit](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/pwagener/backbone.conduit?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

Install it with `npm` or `bower`:

```bash
$ bower install backbone.conduit
... or ...
$ npm install backbone.conduit
```

### Option #1: Faster Model Creation
`Conduit.QuickCollection` is optimized to create Backbone.Model instances faster:

```javascript
var collection = new Backbone.Conduit.QuickCollection();

// If you have a large amount of data injected onto the page, instead of 'reset(...)' do ...
var aBigArray = [ {}, {}, {} ]; // let's assume this was 100K objects
collection.refill(aBigArray);

// Or, if you need to get it asynchronously, instead of 'fetch()' do ...
collection.haul();
```

Performance varies, but typically loading data into a `Conduit.QuickCollection` is ~ 40% faster than a `Backbone.Collection`.

### Option #2:  Async Data Management + Deferred Model Creation

`Conduit.SparseCollection` drastically changes how data is managed in a Collection.  Raw data is managed in a web worker,
and model creation only happens when data is *prepared* for use in a View.  Sort, Filter, Map and Reduce, and other 
methods are asynchronous, using Promises to manage the flow:

```javascript
var MyCollection = Backbone.Conduit.SparseCollection.extend({

    // Assume this endpoint returns 100K items:
    url: '/some/enormous/data',
    
    // ...
});

Backbone.Conduit.enableWorker({
    paths: '/your/path/to/backbone.conduit'
}).then(function() {
    var collection = new MyCollection();
    return collection.haul();
}).then(function() {
   console.log('Length: ' + collection.length); // <== "Length: 100000"

   // Prepare the first 10 models for use
   return collection.prepare({
       indexes: { min: 0, max: 9}
   });
}).then(function(models) {
  console.log('Prepared: ' + models.length); // <== "Prepared: 10"
  // Note the prepared models are also available via
  // 'collection.get(...)' or 'collection.at(...)';
});

```

Since model creation happens at the last possible moment, and the worker thread handles the data management, 
a `SparseCollection` can handle hundreds of thousands of items easily.


### Interesting.  Can you tell me more?
- Sure!  Here's [The Documentation](http://conduit.wagener.org/docs).

### Reading bores me.  Can you show me instead?
- Yes!  Check out [the Demo](http://conduit.wagener.org).

### I Think It's Broken.
- Oh No!  Please [File An Issue](https://github.com/pwagener/backbone.conduit/issues).

### I Have A Question
Great!  Either ...
- Send a note [via Gitter](https://gitter.im/pwagener/backbone.conduit)
- Send a note [via Twitter](https://twitter.com/peterwagener)

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