Skip to content

Commit

Permalink
Use import/export instead of window
Browse files Browse the repository at this point in the history
  • Loading branch information
balloob committed Jun 17, 2021
1 parent 6385001 commit cb15c22
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
5 changes: 3 additions & 2 deletions src/install-update/install-update-dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
getConfiguration,
} from "../api/configuration";
import { flashConfiguration } from "../flash";
import { compileModal, uploadModal } from "../legacy";

const OK_ICON = "🎉";
const WARNING_ICON = "👀";
Expand Down Expand Up @@ -52,12 +53,12 @@ const selectLegacyPort = (value: string) => {
};

const openLegacyCompileModal = (filename: string) =>
(window as any).compileModal.open({
compileModal.open({
target: { dataset: { filename } },
});

const openLegacyUploadModal = (filename: string) =>
(window as any).uploadModal.open({
uploadModal.open({
target: { dataset: { filename } },
});

Expand Down
8 changes: 2 additions & 6 deletions src/legacy.js
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ const logsModal = new LogModal({
logsModal.setup();

// Upload Modal
const uploadModal = new LogModal({
export const uploadModal = new LogModal({
name: "upload",
onPrepare: (modalElement, activeFilename) => {
modalElement
Expand Down Expand Up @@ -486,8 +486,6 @@ const uploadModal = new LogModal({
dismissible: false,
});

window.uploadModal = uploadModal;

const downloadAfterUploadButton = document.querySelector(
"#js-upload-modal [data-action='download-binary']"
);
Expand Down Expand Up @@ -549,7 +547,7 @@ const validateModal = new LogModal({
validateModal.setup();

// Compile Modal
const compileModal = new LogModal({
export const compileModal = new LogModal({
name: "compile",
onPrepare: (modalElement, activeFilename) => {
modalElement.querySelector(
Expand Down Expand Up @@ -587,8 +585,6 @@ const compileModal = new LogModal({
dismissible: false,
});

window.compileModal = compileModal;

const downloadAfterCompileButton = document.querySelector(
"#js-compile-modal [data-action='download-binary']"
);
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"noImplicitReturns": true,
"noUnusedLocals": true,
"skipLibCheck": true,
"allowJs": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"suppressImplicitAnyIndexErrors": true
Expand Down

0 comments on commit cb15c22

Please sign in to comment.