1.0.5 • Published 8 years ago

backbone.datastore v1.0.5

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

Backbone DataStore

npm install backbone.datastore

Introduction

Once required, collection and model data will be cached in memory for { this.expires }'s seconds after the initial fetch. All models and collections will be cached unless the object's store property is set to false like so...

var realtimeCollection = Backbone.Collection.extend({
	store: false,

	// ...other options here
})

Once the cached data has expired, the subsequent fetch request will fetch from REST endpoint and recache repeating the cycle.

CommonJS

// This is the top of my Backbone application!

var Backbone = require('backbone'); // Must be required prior to data store

var DataStore = require('backbone.datastore');
DataStore.extend({
	expires: 20 // Content expiry in seconds
	debug: true // Output debugging log
});

Disable data storage

At class level...

var realtimeCollection = Backbone.Collection.extend({
	store: false,

	// ...other options here
})

At instance level...

var realtimeInstance = new realtimeCollection({ store: false })

At fetch level...

realtimeInstance.fetch({ 
	invalidate: true,
	// ... other opts
})

Options

...

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago