signal-desktop/js/views/last_seen_indicator_view.js

36 lines
768 B
JavaScript
Raw Normal View History

2018-04-27 21:25:04 +00:00
(function() {
'use strict';
window.Whisper = window.Whisper || {};
2018-04-27 21:25:04 +00:00
var FIVE_SECONDS = 5 * 1000;
2018-04-27 21:25:04 +00:00
Whisper.LastSeenIndicatorView = Whisper.View.extend({
className: 'last-seen-indicator-view',
templateName: 'last-seen-indicator-view',
initialize: function(options) {
options = options || {};
this.count = options.count || 0;
},
2018-04-27 21:25:04 +00:00
increment: function(count) {
this.count += count;
this.render();
},
2018-04-27 21:25:04 +00:00
getCount: function() {
return this.count;
},
2018-04-27 21:25:04 +00:00
render_attributes: function() {
var unreadMessages =
this.count === 1
? i18n('unreadMessage')
: i18n('unreadMessages', [this.count]);
2018-04-27 21:25:04 +00:00
return {
unreadMessages: unreadMessages,
};
},
});
})();