npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-backbone-app-store

v1.1.0

Published

Lightweight data store for React applications using Backbone models/collections

Downloads

35

Readme

react-backbone-app-store

NPM version

Lightweight data store for React applications using Backbone models/collections

Installation

npm install react-backbone-app-store --save
bower install react-backbone-app-store --save

Usage

First, initialize an AppStore and register models.

var AppStore = require('react-backbone-app-store');

var app = new AppStore();

app.registerModel('Users', UsersCollection, '/api/users');
app.registerModel('Items', ItemsCollection, '/api/items');
// ...
var rootProps = {
  // default props for root node
};
var rootNode = RootReactComponentType; 
var rootParentNode = document.getElementById('root-element');

// Render the application
app.resetData(rootProps, rootNode, rootParentNode);

AppStore API

registerModel(name, collection, endpoint)

Register a Backbone model for the app store

@param {String} name       The name to use for the model (plural)
@param {Object} collection The Backbone collection for the model
@param {String} endpoint   The base URL for CRUD operations on this model

resetData(data, rootNodeType, rootParentNode)

Reset the application data and re-render the top-level of the app

@param  {Object} data            The root props of the toplevel element
                                 (including app store models, such that
                                 data[modelName] = array of model objects
@param  {React}  rootNodeType    The toplevel React component type
@param  {DOM}    rootParentNode  The DOM element where the app lives

resetModelHash(modelHash)

Take in a mapping of model-type to array-of-model objects and reset this.modelHash as a mapping of model-type to Backbone Collection of that model type (this is useful when we want to update/delete/etc. models later)

@param  {Object} modelHash Map of model names to arrays of model objects

renderRoot()

Re-render the root with (presumably) new model data

fetch(ids, modelName, callback)

Fetch a set of ids from the server and store their models in model hash

@param  {String[]} ids       Ids of models to fetch
@param  {String}   modelName The name of the type of model to fetch
@param  {Function} cb        Optional callback

get(id, modelName)

getModel(id, modelName)

Get cached model with particular id and type

@param  {String} id        The id of the desired model
@param  {String} modelName The name of the desired model type
@return {Object}           The model object or undefined if not yet fetched

getAll(modelName)

Get all the models in a particular collection

@param  {String} modelName The name of the desired model type
@return {Object[]}         An array of all the model objects

add(modelData, modelName)

Add a model to the model hash without fetching from server

@param {Object} modelData The model object (must include _id)
@param {String} modelName The name of the model type

set(updateObject, id, modelName, callback)

Update fields on model of particular type with particular id

@param {Object}   updateObject Key-value-pairs specifying fields to update
@param {String}   id           Id of the model to be updated
@param {String}   modelName    Name of the type of model being updated
@param {Function} callback     Callback once model has been synced with db

refresh(id, modelName, callback)

Sync a particular model with data in the database

@param  {String}   id        Id of the model to be synced
@param  {String}   modelName Name of the type of model getting synced
@param  {Function} callback  Optional callback

hasModel(modelName)

Determine whether app store has registered a model with given name

@param  {String}  modelName The name of the model in question
@return {Boolean}           Whether the model has been registered