3 var unreadItemService = require('gitter-web-unread-items');
5 function AllUnreadItemCountStrategy(options) {
6 this.userId = options.userId || options.currentUserId;
7 this.unreadCounts = null;
10 AllUnreadItemCountStrategy.prototype = {
11 preload: function(troupeIds) {
12 return unreadItemService
13 .getUserUnreadCountsForTroupeIds(this.userId, troupeIds.toArray())
15 .then(function(result) {
16 this.unreadCounts = result;
21 var count = this.unreadCounts[id];
25 name: 'AllUnreadItemCountStrategy'
28 module.exports = AllUnreadItemCountStrategy;