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

backbone-partial-render

v1.0.7

Published

React-style View rendering for Backbone

Readme

backbone-partial-render

This package allows you to render your Backbone Views by updating the View's DOM rather than completely replacing it every time you render. This is similar to how React renders HTML. You can also have Backbone leave custom rendering that happens outside render in place.

Install

npm install backbone-partial-render on npm

Usage

You have a template that renders Backbone Model data as it updates (with the help of your Backbone View).

Because we're in the real world you also have to update something in your markup outside the normal render workflow. Now you start doubting yourself. "Did I do this right?" "Why doesn't Backbone take this into consideration?" "Is my whole life a lie?"

Not anymore!

With backbone-partial-render you can keep using render like normal and do all the custom UI work you want and never the twain shall meet.

Your page:

<div class="js-book">
</div>

Your JS:

var PartialViewUpdateMixin = require('backbone-partial-render');
var $ = require('jquery');
var Backbone = require('backbone');
var _ = require('lodash');

var Book = Backbone.Model.extend({
  defaults: {
    title: "The Muted Heart",
    rating: "2.5",
    author: "Glenn Close, Sally Field"
  }
});

var BookView = Backbone.View.extend({
  template: _.template(
    '<h1><%= title %></h1><input class="js-title-text" type="text"/><button class="js-button">refresh</button><button class="js-image-button">image</button><img class="js-image"/>'
  ),
  events: {
    'click .js-button': '_setTitle',
    'click .js-image-button': '_setImage'
  },
  initialize: function() {
    this.initializePartialViewUpdateMixin();
    this.model.on('change', this.render.bind(this));
    this.render();
  },
  _setTitle: function() {
    this.model.set('title', this.$('.js-title-text').val());
  },
  _setImage: function() {
    this.$('.js-image').attr('src', 'http://assets.inhabitat.com/wp-content/blogs.dir/1/files/2014/07/true-cost-of-cheeseburger.jpg');
  },
  render: function() {
    // --------------------------------------
    // NOTE: This is where the magic happens
    // --------------------------------------
    this.renderByPatching({ignore: ['.js-image']});
    
    // or: this.renderByPatching({data: {a: '1', b: '2'}}). See "options" below.
  }
});
_.extend(BookView.prototype, PartialViewUpdateMixin);

$(function() {
  var bookView = new BookView({model: new Book(),
                               el: document.querySelector('.js-book')});
});

Now you can render all the books you want and look at delectable cheeseburgers at the same time.

Additionally, your form inputs won't be ruined and input focus will be unaffected.

options

  • renderByPatching by default passes this.model.attributes to the template when rendering. You can override this by passing a data parameter. For example: renderByPatching({data: this.serialize()}).

pull requests

You submit em, I'll merge em.

dedication

I dedicate this package to my family, my other family (BuzzFeed), and of course Cthulhu.