Created
October 9, 2014 21:36
-
-
Save claudiopro/636b21bdb00082a103bb to your computer and use it in GitHub Desktop.
Poll Activity Stream notifications and print the total count (action required + unread mentions + unread notifications)
This file contains 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
(function poll_notifications() { | |
var dfd = dojo.xhrGet({ | |
url : '/connections/opensocial/basic/rest/activitystreams/@me/@actions', | |
handleAs : 'json' | |
}); | |
dfd.addCallback(function(response, ioargs) { | |
var count = response.totalResults + response.connections.unreadMentions + response.connections.unreadNotifications; | |
console.log(count); | |
setTimeout(poll_notifications, 30000); | |
}); | |
dfd.addErrback(function(response, ioargs) { | |
console.error(response); | |
}); | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment