working on typescript and ssr problems...

This commit is contained in:
Matteo Manzinello 2020-04-24 15:57:07 +02:00
parent dd8c7cde9b
commit 1606a2b30a
3 changed files with 18 additions and 13 deletions

2
dist/mailgo.min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -825,19 +825,24 @@ const mailgo = (config?: MailgoConfig) => {
// start mailgo // start mailgo
(() => { (() => {
// if the window object exists... // if the window is defined...
// mailgo style (gulp) if (window && typeof window !== "undefined") {
let mailgoCSS: HTMLStyleElement = <HTMLStyleElement>createElement("style"); // if the window object exists...
mailgoCSS.id = "mailgo-style"; // mailgo style (gulp)
mailgoCSS.type = "text/css"; let mailgoCSS: HTMLStyleElement = <HTMLStyleElement>(
mailgoCSS.appendChild(createTextNode(`MAILGO_STYLE`)); createElement("style")
document.head.appendChild(mailgoCSS); );
mailgoCSS.id = "mailgo-style";
mailgoCSS.type = "text/css";
mailgoCSS.appendChild(createTextNode(`MAILGO_STYLE`));
document.head.appendChild(mailgoCSS);
// DOMContentLoaded -> mailgoInit (creates the modals) // DOMContentLoaded -> mailgoInit (creates the modals)
document.addEventListener("DOMContentLoaded", mailgoInit); document.addEventListener("DOMContentLoaded", mailgoInit);
// event listener on body, if the element is mailgo-compatible the mailgo modal will be rendered // event listener on body, if the element is mailgo-compatible the mailgo modal will be rendered
document.addEventListener("click", mailgoCheckRender); document.addEventListener("click", mailgoCheckRender);
}
})(); })();
}; };