Skip to content

Instantly share code, notes, and snippets.

@jonnii
Created November 26, 2012 22:15
Show Gist options
  • Save jonnii/4151023 to your computer and use it in GitHub Desktop.
Save jonnii/4151023 to your computer and use it in GitHub Desktop.
subscribe: function (connection) {
console.log(" -> subscribing to application updates");
var subscriber = connection.applicationHub;
var store = App.store;
subscriber.client.applicationUpdated = function (data) {
data.forEach(function (d) {
var persisted = store.find(App.Application, d.id);
persisted.set('last_message', d.last_message);
persisted.set('total_messages', d.total_messages);
persisted.markUnread();
// hack because we don't want this to get commited when
// we change views, consider it clean.
persisted.get('stateManager').send('becameClean');
});
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment