Files
zulip/static/js/fetch_status.js
Anders Kaseorg d17b577d0c js: Purge useless IIFEs.
With webpack, variables declared in each file are already file-local
(Global variables need to be explicitly exported), so these IIFEs are
no longer needed.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2019-10-25 13:51:21 -07:00

51 lines
1.1 KiB
JavaScript

var FetchStatus = function () {
var self = {};
var loading_older = false;
var loading_newer = false;
var found_oldest = false;
var found_newest = false;
var history_limited = false;
self.start_older_batch = function () {
loading_older = true;
};
self.finish_older_batch = function (opts) {
loading_older = false;
found_oldest = opts.found_oldest;
history_limited = opts.history_limited;
};
self.can_load_older_messages = function () {
return !loading_older && !found_oldest;
};
self.history_limited = function () {
return history_limited;
};
self.start_newer_batch = function () {
loading_newer = true;
};
self.finish_newer_batch = function (opts) {
loading_newer = false;
found_newest = opts.found_newest;
};
self.can_load_newer_messages = function () {
return !loading_newer && !found_newest;
};
self.has_found_newest = function () {
return found_newest;
};
return self;
};
module.exports = FetchStatus;
window.FetchStatus = FetchStatus;