From 17e6ae81a0bbc0392930127d77b30fd918570381 Mon Sep 17 00:00:00 2001 From: Jeremy Wall Date: Sun, 3 Mar 2024 18:15:41 -0500 Subject: [PATCH] Turn our lib into an es6 module --- src/routes.rs | 2 +- static/lib.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/routes.rs b/src/routes.rs index c04d20a..097b6f9 100644 --- a/src/routes.rs +++ b/src/routes.rs @@ -191,7 +191,7 @@ pub fn mk_ui_routes(config: Arc>) -> Router { fn graph_lib_prelude() -> Markup { html! { script src="/js/plotly.js" { } - script defer src="/js/lib.js" { } + script type="module" defer src="/js/lib.js" { } link rel="stylesheet" href="/static/site.css" { } } } diff --git a/static/lib.js b/static/lib.js index 2cbce54..ec2d447 100644 --- a/static/lib.js +++ b/static/lib.js @@ -55,7 +55,7 @@ function getCssVariableValue(variableName) { * * @extends HTMLElement */ -class GraphPlot extends HTMLElement { +export class GraphPlot extends HTMLElement { /** @type {?string} */ #uri; /** @type {?number} */ @@ -457,7 +457,7 @@ class GraphPlot extends HTMLElement { GraphPlot.registerElement(); /** Custom Element for selecting a timespan for the dashboard. */ -class SpanSelector extends HTMLElement { +export class SpanSelector extends HTMLElement { /** @type {HTMLElement} */ #targetNode = null; /** @type {HTMLInputElement} */ @@ -518,3 +518,4 @@ class SpanSelector extends HTMLElement { } SpanSelector.registerElement(); +