Created
November 26, 2012 22:15
-
-
Save jonnii/4151023 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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