ts: Convert loading module to TypeScript.

This commit is contained in:
Priyank Patel 2021-06-17 17:39:35 +00:00 committed by Tim Abbott
parent a8cdc968cc
commit 4fa4309338
3 changed files with 8 additions and 5 deletions

View File

@ -2,7 +2,10 @@ import $ from "jquery";
import render_loader from "../templates/loader.hbs"; import render_loader from "../templates/loader.hbs";
export function make_indicator(outer_container, {abs_positioned = false, text} = {}) { export function make_indicator(
outer_container: JQuery,
{abs_positioned = false, text}: {abs_positioned?: boolean; text?: string} = {},
): void {
let container = outer_container; let container = outer_container;
// TODO: We set white-space to 'nowrap' because under some // TODO: We set white-space to 'nowrap' because under some
@ -37,7 +40,7 @@ export function make_indicator(outer_container, {abs_positioned = false, text} =
container.append(text_elem); container.append(text_elem);
// See note, below // See note, below
if (!abs_positioned) { if (!abs_positioned) {
text_width = 20 + text_elem.width(); text_width = 20 + (text_elem.width() ?? 0);
} }
} }
@ -48,7 +51,7 @@ export function make_indicator(outer_container, {abs_positioned = false, text} =
outer_container.data("destroying", false); outer_container.data("destroying", false);
} }
export function destroy_indicator(container) { export function destroy_indicator(container: JQuery): void {
if (container.data("destroying")) { if (container.data("destroying")) {
return; return;
} }

View File

@ -446,7 +446,7 @@ div.overlay {
top: 9px; top: 9px;
} }
/* Standard loading indicators generated by the loading.js API */ /* Standard loading indicators generated by the loading.ts API */
.loading_indicator_spinner { .loading_indicator_spinner {
/* If you change these, make sure to adjust the constants in /* If you change these, make sure to adjust the constants in
loading.make_indicator as well */ loading.make_indicator as well */

View File

@ -78,7 +78,7 @@ EXEMPT_FILES = {
"static/js/lightbox_canvas.js", "static/js/lightbox_canvas.js",
"static/js/lightbox.js", "static/js/lightbox.js",
"static/js/list_util.ts", "static/js/list_util.ts",
"static/js/loading.js", "static/js/loading.ts",
"static/js/local_message.js", "static/js/local_message.js",
"static/js/localstorage.js", "static/js/localstorage.js",
"static/js/message_edit.js", "static/js/message_edit.js",