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

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2021-02-10 07:51:34 -08:00 committed by Tim Abbott
parent a1dc8e37a2
commit 4513ef8861
6 changed files with 7 additions and 14 deletions

View File

@ -279,7 +279,6 @@
"message_view_header": false,
"templates": false,
"timerender": false,
"todo_widget": false,
"top_left_corner": false,
"topic_list": false,
"transmit": false,

View File

@ -8,7 +8,6 @@ const {make_zjquery} = require("../zjsunit/zjquery");
set_global("$", make_zjquery());
const poll_widget = set_global("poll_widget", {});
set_global("todo_widget", {});
set_global("zform", {});
set_global("document", "document-stub");

View File

@ -43,7 +43,6 @@ import "../top_left_corner";
import "../stream_list";
import "../filter";
import "../poll_widget";
import "../todo_widget";
import "../zform";
import "../widgetize";
import "../submessage";

View File

@ -144,7 +144,6 @@ declare let subs: any;
declare let message_view_header: any;
declare let templates: any;
declare let timerender: any;
declare let todo_widget: any;
declare let stream_topic_history: any;
declare let topic_list: any;
declare let top_left_corner: any;

View File

@ -1,9 +1,7 @@
"use strict";
import render_widgets_todo_widget from "../templates/widgets/todo_widget.hbs";
import render_widgets_todo_widget_tasks from "../templates/widgets/todo_widget_tasks.hbs";
const render_widgets_todo_widget = require("../templates/widgets/todo_widget.hbs");
const render_widgets_todo_widget_tasks = require("../templates/widgets/todo_widget_tasks.hbs");
class TaskData {
export class TaskData {
task_map = new Map();
get_new_index() {
@ -120,9 +118,8 @@ class TaskData {
}
}
}
exports.TaskData = TaskData;
exports.activate = function (opts) {
export function activate(opts) {
const elem = opts.elem;
const callback = opts.callback;
@ -181,6 +178,4 @@ exports.activate = function (opts) {
render();
render_results();
};
window.todo_widget = exports;
}

View File

@ -1,5 +1,7 @@
"use strict";
const todo_widget = require("./todo_widget");
const widgets = new Map([
["poll", poll_widget],
["todo", todo_widget],