About 7,370 results: "Backbone.Collection.extend"
Page 15 of 50
Filter Results
Sources
Languages
Filter Results
Try Search On













  1. layout: post
  2. title: Real-Time Backbone With PubNub
  3. type: intermediate
  4. posturl: http://backbonetutorials.com/real-time-backbone-with-pubnub
  5. 
                        
  6. # Real-Time Backbone With PubNub
  7. 
                        
  8. 
                        
  9. Our integration allows developers to create a Backbone model or collection and have them synchronize with every other client instance of those models or collections in real-time. This will give any Backbone application a better user experience when working with collaborative, social, or any type of multi-user interface. It works by taking all of the create, update, and delete methods that are spawned by Backbone and propagating them across the PubNub real-time network.
  10. 
                        
  11. 
                        
  12. Now that we have a connection to PubNub, we can feed that connection into our custom Backbone collection:
  13. {% highlight javascript %}
  14. var MyCollection = Backbone.PubNub.Collection.extend({
  15.   name: 'MyCollection',
  16. 
                        
  17. This will look and act just like a normal Backbone collection with two extra keys. The “name” key allows PubNub to distinguish this collection, so it connects this collections to only collections of the same type. Think of this as a namespace so you can have multiple types of collections all updating in real-time. It uses this to generate a PubNub channel that is unique to the collection in the form of "backbone-collection-{name}". The "pubnub" property is the globally referenced connection to the PubNub network. This is the object that comes back after calling PUBNUB.init.






  1. layout: post
  2. title: Real-Time Backbone With PubNub
  3. type: intermediate
  4. posturl: http://backbonetutorials.com/real-time-backbone-with-pubnub
  5. 
                        
  6. # Real-Time Backbone With PubNub
  7. 
                        
  8. 
                        
  9. Our integration allows developers to create a Backbone model or collection and have them synchronize with every other client instance of those models or collections in real-time. This will give any Backbone application a better user experience when working with collaborative, social, or any type of multi-user interface. It works by taking all of the create, update, and delete methods that are spawned by Backbone and propagating them across the PubNub real-time network.
  10. 
                        
  11. 
                        
  12. Now that we have a connection to PubNub, we can feed that connection into our custom Backbone collection:
  13. {% highlight javascript %}
  14. var MyCollection = Backbone.PubNub.Collection.extend({
  15.   name: 'MyCollection',
  16. 
                        
  17. This will look and act just like a normal Backbone collection with two extra keys. The “name” key allows PubNub to distinguish this collection, so it connects this collections to only collections of the same type. Think of this as a namespace so you can have multiple types of collections all updating in real-time. It uses this to generate a PubNub channel that is unique to the collection in the form of "backbone-collection-{name}". The "pubnub" property is the globally referenced connection to the PubNub network. This is the object that comes back after calling PUBNUB.init.

Back to Top