Incorporate dialog polyfill for better browser support

This commit is contained in:
mtkennerly
2019-07-16 04:49:15 -04:00
parent 3087228256
commit 434ef7a36a
5 changed files with 16 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
import * as tone from 'tone';
import { getSampler } from "./index";
const dialogPolyfill = require("dialog-polyfill");
let playing = false;
const letters = ["C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"];
@@ -234,6 +235,9 @@ function onLoad() {
let helpButton = document.getElementById("helpButton");
let helpModal = document.getElementById("helpModal");
if (helpButton !== null && helpModal !== null) {
if (!(helpModal as any).showModal) {
dialogPolyfill.default.registerDialog(helpModal);
}
helpButton.addEventListener("click", () => { (helpModal as any).showModal(); });
const helpModalClose = helpModal.querySelector(".close");
if (helpModalClose !== null) {