Files
zulip/web/src/setup.ts
Anders Kaseorg ec3177c834 web: Add explicit extensions to imports.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-11-13 09:18:56 -08:00

30 lines
781 B
TypeScript

import $ from "jquery";
import * as blueslip from "./blueslip.ts";
import * as loading from "./loading.ts";
import * as util from "./util.ts";
export let page_load_time: number | undefined;
// Miscellaneous early setup.
$(() => {
page_load_time = Date.now();
// Display loading indicator. This disappears after the first
// get_events completes.
loading.make_indicator($("#page_loading_indicator"), {
abs_positioned: true,
});
$.fn.get_offset_to_window = function () {
return util.the(this).getBoundingClientRect();
};
$.fn.expectOne = function () {
if (blueslip && this.length !== 1) {
blueslip.error("Expected one element in jQuery set", {length: this.length});
}
return this;
};
});