Skip to content

Instantly share code, notes, and snippets.

@mlynch
Created June 12, 2012 18:42
Show Gist options
  • Save mlynch/2919313 to your computer and use it in GitHub Desktop.
Save mlynch/2919313 to your computer and use it in GitHub Desktop.
Resource Events
// Bind Firebase data events
_bindDataEvents: function() {
var self = this;
this._resources.on('child_added', function(resourceSnapshot) {
$(document).trigger('resource.oneAdded', resourceSnapshot.val());
});
this._resources.on('child_changed', function(resourceSnapshot) {
var resource = resourceSnapshot.val();
var el = $('#resources a[data-resourcetag="' + resource.tag + '"]');
if(el.length) {
self._updateResourceElement(resource, el);
}
});
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment