Skip to content

Commit be4a85d

Browse files
authored
Load dialog while picking port (#107)
1 parent 071a702 commit be4a85d

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

src/provision.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { SerialLaunchButton } from "./serial-launch-button.js";
2-
import "./serial-provision-dialog.js";
32

43
export const startProvisioning = async (button: SerialLaunchButton) => {
4+
import("./serial-provision-dialog.js");
55
let port: SerialPort | undefined;
66
try {
77
port = await navigator.serial.requestPort();

src/serial-launch-button.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { startProvisioning } from "./provision";
2+
13
export class SerialLaunchButton extends HTMLElement {
24
public static isSupported = "serial" in navigator;
35

@@ -61,11 +63,6 @@ export class SerialLaunchButton extends HTMLElement {
6163

6264
this.toggleAttribute("supported", true);
6365

64-
this.addEventListener("mouseover", () => {
65-
// Preload
66-
import("./provision");
67-
});
68-
6966
const slot = document.createElement("slot");
7067
slot.name = "activate";
7168
const button = document.createElement("button");
@@ -74,8 +71,7 @@ export class SerialLaunchButton extends HTMLElement {
7471

7572
slot.addEventListener("click", async (ev) => {
7673
ev.preventDefault();
77-
const mod = await import("./provision");
78-
mod.startProvisioning(this);
74+
startProvisioning(this);
7975
});
8076

8177
if (

0 commit comments

Comments
 (0)