Skip to content

Instantly share code, notes, and snippets.

@taras
Created September 26, 2013 09:07
Show Gist options
  • Save taras/6711708 to your computer and use it in GitHub Desktop.
Save taras/6711708 to your computer and use it in GitHub Desktop.
var pusher = new Pusher('APP_KEY');
var eventName = 'new-comment';
var callback = function(data) {
var applicationRoute = App.__container__.lookup('route:application');
Em.A(data).map(function(comment){
applicationRoute.findModel( "post", comment.post_id );
post.comments.push(App.Comment.create(comment));
});
};
pusher.bind(eventName, callback);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment