js: Convert static/js/fetch_status.js to ES6 module.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2021-02-23 19:59:56 -08:00 committed by Tim Abbott
parent 0663b23d54
commit 8add2ffc4e
13 changed files with 3 additions and 16 deletions

View File

@ -126,7 +126,6 @@
"files": ["static/js/**"],
"globals": {
"$": false,
"FetchStatus": false,
"Filter": false,
"ListCursor": false,
"MessageListData": false,

View File

@ -5,7 +5,7 @@ const {strict: assert} = require("assert");
const {set_global, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const FetchStatus = zrequire("fetch_status");
const {FetchStatus} = zrequire("fetch_status");
set_global("message_scroll", {
hide_loading_older: () => {},
show_loading_older: () => {},

View File

@ -19,7 +19,6 @@ function MessageListView() {
}
set_global("MessageListView", MessageListView);
zrequire("FetchStatus", "js/fetch_status");
const Filter = zrequire("Filter", "js/filter");
zrequire("MessageListData", "js/message_list_data");
const message_list = zrequire("message_list");

View File

@ -25,7 +25,6 @@ set_global("document", {
const narrow_state = set_global("narrow_state", {});
const stream_data = set_global("stream_data", {});
zrequire("FetchStatus", "js/fetch_status");
const muting = zrequire("muting");
zrequire("MessageListData", "js/message_list_data");
zrequire("MessageListView", "js/message_list_view");

View File

@ -9,7 +9,6 @@ const muting = zrequire("muting");
zrequire("unread");
zrequire("Filter", "js/filter");
zrequire("FetchStatus", "js/fetch_status");
const MessageListData = zrequire("MessageListData", "js/message_list_data");
set_global("page_params", {});

View File

@ -10,7 +10,6 @@ const {run_test} = require("../zjsunit/test");
set_global("document", "document-stub");
const Filter = zrequire("Filter", "js/filter");
zrequire("FetchStatus", "js/fetch_status");
zrequire("MessageListData", "js/message_list_data");
const MessageListView = zrequire("MessageListView", "js/message_list_view");
const message_list = zrequire("message_list");

View File

@ -13,7 +13,6 @@ set_global("resize", {
});
const stream_data = zrequire("stream_data");
zrequire("Filter", "js/filter");
zrequire("FetchStatus", "js/fetch_status");
zrequire("MessageListData", "js/message_list_data");
zrequire("unread");
const narrow = zrequire("narrow");

View File

@ -6,7 +6,6 @@ const {set_global, zrequire} = require("../zjsunit/namespace");
const {run_test} = require("../zjsunit/test");
const Filter = zrequire("Filter", "js/filter");
zrequire("FetchStatus", "js/fetch_status");
const MessageListData = zrequire("MessageListData", "js/message_list_data");
const narrow_state = zrequire("narrow_state");
const narrow = zrequire("narrow");

View File

@ -19,7 +19,6 @@ const stream_topic_history = zrequire("stream_topic_history");
const people = zrequire("people");
const stream_color = zrequire("stream_color");
const stream_data = zrequire("stream_data");
zrequire("FetchStatus", "js/fetch_status");
zrequire("Filter", "js/filter");
zrequire("MessageListData", "js/message_list_data");
zrequire("MessageListView", "js/message_list_view");

View File

@ -45,7 +45,6 @@ import "../filter";
import "../poll_widget";
import "../widgetize";
import "../submessage";
import "../fetch_status";
import "../message_list_data";
import "../message_list_view";
import "../message_list";

View File

@ -1,5 +1,3 @@
"use strict";
function max_id_for_messages(messages) {
let max_id = 0;
for (const msg of messages) {
@ -8,7 +6,7 @@ function max_id_for_messages(messages) {
return max_id;
}
class FetchStatus {
export class FetchStatus {
// The FetchStatus object tracks tracks the state of a
// message_list_data object, whether rendered in the DOM or not,
// and is the source of truth for whether the message_list_data
@ -134,5 +132,3 @@ class FetchStatus {
);
}
}
module.exports = FetchStatus;
window.FetchStatus = FetchStatus;

View File

@ -3,7 +3,6 @@
// remove each declaration when the corresponding module is migrated
// to TS.
declare let FetchStatus: any;
declare let Filter: any;
declare let ListCursor: any;
declare let MessageListData: any;

View File

@ -2,6 +2,7 @@
const _ = require("lodash");
const {FetchStatus} = require("./fetch_status");
const util = require("./util");
class MessageListData {