Skip to content
This repository has been archived by the owner on Aug 25, 2018. It is now read-only.

Commit

Permalink
Merge pull request #143 from firebase/readme_updates
Browse files Browse the repository at this point in the history
updated readme
  • Loading branch information
davideast committed May 26, 2015
2 parents 142e279 + f61e8bb commit c143bbc
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![Coverage Status](https://img.shields.io/coveralls/firebase/backbonefire.svg?branch=master&style=flat)](https://coveralls.io/r/firebase/backbonefire?branch=master)
[![Version](https://badge.fury.io/gh/firebase%2Fbackbonefire.svg?branch=master)](http://badge.fury.io/gh/firebase%2Fbackbonefire)

BackboneFire is the officially supported [Backbone](http://backbonejs.org) binding for Firebase. The bindings let you use special model and collection types that allow for synchronizing data with [Firebase](http://www.firebase.com/?utm_medium=web&utm_source=backbonefire).
BackboneFire is the officially supported [Backbone](http://backbonejs.org) binding for Firebasem data. The bindings let you use special model and collection types that allow for synchronizing data with [Firebase](http://www.firebase.com/?utm_medium=web&utm_source=backbonefire).

## Live Demo

Expand Down Expand Up @@ -70,7 +70,7 @@ Once you've included BackboneFire and its dependencies into your project, you wi

## Getting Started with Firebase

BackboneFire requires Firebase in order to sync data. You can
BackboneFire requires the Firebase database in order to sync data. You can
[sign up here](https://www.firebase.com/signup/?utm_medium=web&utm_source=backbonefire) for a free
account.

Expand Down Expand Up @@ -113,8 +113,8 @@ onetimeList.fetch();

## Backbone.Firebase.Collection

This is a special collection object that will automatically synchronize its contents with Firebase.
You may extend this object, and must provide a Firebase URL or a Firebase reference as the
This is a special collection object that will automatically synchronize its contents with your Firebase database.
You may extend this object, and must provide a Firebase database URL or a Firebase database reference as the
`url` property.

Each model in the collection will have its own `firebase` property that is its reference in Firebase.
Expand Down Expand Up @@ -142,7 +142,7 @@ var TodoList = Backbone.Firebase.Collection.extend({

### url as a function

The `url` property can be set with a function. This function must return a Firebase ref or a url.
The `url` property can be set with a function. This function must return a Firebase database ref or a url.

```javascript
var TodoList = Backbone.Firebase.Collection.extend({
Expand All @@ -155,7 +155,7 @@ var TodoList = Backbone.Firebase.Collection.extend({

### initialize function

Any models added to the collection will be synchronized to the provided Firebase. Any other clients
Any models added to the collection will be synchronized to the provided Firebase database. Any other clients
using the Backbone binding will also receive `add`, `remove` and `changed` events on the collection
as appropriate.

Expand All @@ -165,7 +165,7 @@ all your other clients immediately.

### add(model)

Adds a new model to the collection. If autoSync set to true, the newly added model will be synchronized to Firebase, triggering an
Adds a new model to the collection. If autoSync set to true, the newly added model will be synchronized to your Firebase database, triggering an
`add` and `sync` event both locally and on all other clients. If autoSync is set to false, the `add` event will only be raised locally.

```javascript
Expand All @@ -183,7 +183,7 @@ todoList.on('all', function(event) {

### remove(model)

Removes a model from the collection. If autoSync is set to true this model will also be removed from Firebase, triggering a `remove` event both locally and on all other clients. If autoSync is set to false, this model will only trigger a local `remove` event.
Removes a model from the collection. If autoSync is set to true this model will also be removed from your Firebase database, triggering a `remove` event both locally and on all other clients. If autoSync is set to false, this model will only trigger a local `remove` event.

```javascript
todoList.remove(someModel);
Expand All @@ -198,7 +198,7 @@ todoList.on('all', function(event) {
### create(value)

Creates and adds a new model to the collection. The newly created model is returned, along with an
`id` property (uniquely generated by Firebase).
`id` property (uniquely generated by the Firebase client library).

```javascript
var model = todoList.create({bar: "foo"});
Expand All @@ -212,8 +212,8 @@ todoList.on('all', function(event) {

## Backbone.Firebase.Model

This is a special model object that will automatically synchronize its contents with Firebase. You
may extend this object, and must provide a Firebase URL or a Firebase reference as the `url`
This is a special model object that will automatically synchronize its contents with your Firebase database. You
may extend this object, and must provide a Firebase database URL or reference as the `url`
property.

```javascript
Expand All @@ -224,7 +224,7 @@ var Todo = Backbone.Firebase.Model.extend({
You may apply query methods as with `Backbone.Firebase.Collection`.

### urlRoot
The `urlRoot` property can be used to dynamically set the Firebase reference from the model's id.
The `urlRoot` property can be used to dynamically set the Firebase database reference from the model's id.

```javascript
var Todo = Backbone.Firebase.Model.extend({
Expand Down Expand Up @@ -256,7 +256,7 @@ realtimeModel.on('sync', function(model) {
console.log('model loaded', model);
});

// calling .set() will sync the changes to firebase
// calling .set() will sync the changes to your database
// this will fire the sync, change, and change:name events
realtimeModel.set('name', 'Bob');
```
Expand All @@ -278,26 +278,26 @@ realtimeModel.on('sync', function(model) {
// this will fire off the sync event
realtimeModel.fetch();

// calling .save() will sync the changes to firebase
// calling .save() will sync the changes to your database
// this will fire the sync, change, and change:name events
realtimeModel.save('name', 'Bob');

```

### set(value)

Sets the contents of the model and updates it in Firebase.
Sets the contents of the model and updates it in your database.

```javascript
MyTodo.set({foo: "bar"}); // Model is instantly updated in Firebase (and other clients)
MyTodo.set({foo: "bar"}); // Model is instantly updated in your database (and other clients)
```

### destroy()

Removes the model locally, and from Firebase.

```javascript
MyTodo.destroy(); // Model is instantly removed from Firebase (and other clients)
MyTodo.destroy(); // Model is instantly removed from your database (and other clients)
```

## Contributing
Expand Down

0 comments on commit c143bbc

Please sign in to comment.