mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 22:13:26 +00:00
This commit prepares the frontend code to be consumed by webpack. It is a hack: In theory, modules should be declaring and importing the modules they depend on and the globals they expose directly. However, that requires significant per-module work, which we don't really want to block moving our toolchain to webpack on. So we expose the modules by setting window.varName = varName; as needed in the js files.
59 lines
1.3 KiB
JavaScript
59 lines
1.3 KiB
JavaScript
var FetchStatus = function () {
|
|
|
|
var self = {};
|
|
|
|
var loading_older = false;
|
|
var loading_newer = false;
|
|
var found_oldest = false;
|
|
var found_newest = false;
|
|
|
|
self.start_initial_narrow = function () {
|
|
loading_newer = true;
|
|
loading_older = true;
|
|
};
|
|
|
|
self.finish_initial_narrow = function (opts) {
|
|
loading_newer = false;
|
|
loading_older = false;
|
|
found_oldest = opts.found_oldest;
|
|
found_newest = opts.found_newest;
|
|
};
|
|
|
|
self.start_older_batch = function () {
|
|
loading_older = true;
|
|
};
|
|
|
|
self.finish_older_batch = function (opts) {
|
|
loading_older = false;
|
|
found_oldest = opts.found_oldest;
|
|
};
|
|
|
|
self.can_load_older_messages = function () {
|
|
return !loading_older && !found_oldest;
|
|
};
|
|
|
|
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;
|
|
|
|
};
|
|
if (typeof module !== 'undefined') {
|
|
module.exports = FetchStatus;
|
|
}
|
|
window.FetchStatus = FetchStatus;
|