Coder Social home page Coder Social logo

backbone-null-store's Introduction

Backbone-Null-Store

A backbone.js store that doesn't store.

Purpose

If you have a collection/model that you want to be able to treat like any other collection/model (calling .fetch()/.save()/etc) but you don't want it to be stored (e.g. it may be transient data, or you may be using localStorage and not want to use up your valuable 5MB storing stuff you can easily re-fetch) then you can use backbone-null-store.

Installing: Browser

In a browser, simply include this script via a <script> tag.

<script src='/js/backbone-null-store.js'></script>

Installing: Node.JS

In Node.JS, simply require() this script, and then infect Backbone:

var backbone = require('backbone');
require('./backbone-null-store').infect(backbone);

Usage

Once the module has "infected" Backbone, you can simply tell your model or collection that it's a null store by adding nullStore:true to it's prototype:

var MyCollection = Backbone.Collection.extend({
  nullStore: true
});

CoffeeScript

Backbone-null-store was written in CoffeeScript; here's the equivalent usage:

class MyCollection extends Backbone.Collection
  nullStore: true

License

WTFPL v2 or later. (If you want a different license then just tweet me @benjiegillam)

backbone-null-store's People

Contributors

benjie avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.