Skip to content

Latest commit

 

History

History
41 lines (29 loc) · 1.2 KB

README.md

File metadata and controls

41 lines (29 loc) · 1.2 KB

Backbone.jFeed

A drop-in plugin that allows you to turn Backbone.js's Collection object into an RSS/ATOM feed. Much thanks to Jean-François Hovinne for the jFeed library.

Dependencies

Installation

Add these dependencies to your <head>, in order:

<script src="jquery.js"></script>
<script src="underscore.js"></script>
<script src="backbone.js"></script>
<script src="jquery.jfeed.js"></script>
<script src="backbone.jfeed.js"></script>

Usage

Simply extend the Backbone.JFeed.Collection instead of Backbone.Collection.

var PostsCollection = Backbone.JFeed.Collection.extend({
  model: Post,
  feedUrl: 'http://yourdomain/feed.xml'
});

var posts = new PostsCollection();
posts.fetch();

posts.first().get('title')
=> 'Title of My Blog Post'

NOTE: As we're talking about feeds, the add and create methods of Backbone.JFeed.Collection will obviously not work.