check-render in init
This commit is contained in:
parent
bde3262e3d
commit
301ef64611
2
dist/mailgo.min.js
vendored
2
dist/mailgo.min.js
vendored
File diff suppressed because one or more lines are too long
12
mailgo.js
12
mailgo.js
@ -21,7 +21,7 @@ let gmail, outlook, open, telegram, wa, skype, call, copyMail, copyTel;
|
|||||||
* mailgoInit
|
* mailgoInit
|
||||||
* the function that creates the mailgo elements in DOM
|
* the function that creates the mailgo elements in DOM
|
||||||
*/
|
*/
|
||||||
const mailgoInit = () => {
|
const mailgoInit = (mailgoConfig) => {
|
||||||
// mailgo mail
|
// mailgo mail
|
||||||
{
|
{
|
||||||
// modal
|
// modal
|
||||||
@ -221,6 +221,8 @@ const mailgoInit = () => {
|
|||||||
// every click outside the modal will hide the modal
|
// every click outside the modal will hide the modal
|
||||||
modalBackground.addEventListener("click", hideMailgo);
|
modalBackground.addEventListener("click", hideMailgo);
|
||||||
}
|
}
|
||||||
|
// event listener on body, if the element is mailgo-compatible the mailgo modal will be rendered
|
||||||
|
document.addEventListener("click", mailgoCheckRender);
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* mailgoRender
|
* mailgoRender
|
||||||
@ -670,13 +672,13 @@ const mailgo = (mailgoConfig) => {
|
|||||||
mailgoStyle();
|
mailgoStyle();
|
||||||
// if is set an initEvent add the listener
|
// if is set an initEvent add the listener
|
||||||
if (mailgoConfig === null || mailgoConfig === void 0 ? void 0 : mailgoConfig.initEvent) {
|
if (mailgoConfig === null || mailgoConfig === void 0 ? void 0 : mailgoConfig.initEvent) {
|
||||||
document.addEventListener(mailgoConfig.initEvent, mailgoInit);
|
document.addEventListener(mailgoConfig.initEvent, () => {
|
||||||
|
mailgoInit(mailgoConfig);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mailgoInit();
|
mailgoInit(mailgoConfig);
|
||||||
}
|
}
|
||||||
// event listener on body, if the element is mailgo-compatible the mailgo modal will be rendered
|
|
||||||
document.addEventListener("click", mailgoCheckRender);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
export default mailgo;
|
export default mailgo;
|
||||||
|
@ -57,7 +57,7 @@ let gmail: HTMLLinkElement,
|
|||||||
* mailgoInit
|
* mailgoInit
|
||||||
* the function that creates the mailgo elements in DOM
|
* the function that creates the mailgo elements in DOM
|
||||||
*/
|
*/
|
||||||
const mailgoInit = (): void => {
|
const mailgoInit = (mailgoConfig?: MailgoConfig): void => {
|
||||||
// mailgo mail
|
// mailgo mail
|
||||||
{
|
{
|
||||||
// modal
|
// modal
|
||||||
@ -295,6 +295,9 @@ const mailgoInit = (): void => {
|
|||||||
// every click outside the modal will hide the modal
|
// every click outside the modal will hide the modal
|
||||||
modalBackground.addEventListener("click", hideMailgo);
|
modalBackground.addEventListener("click", hideMailgo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// event listener on body, if the element is mailgo-compatible the mailgo modal will be rendered
|
||||||
|
document.addEventListener("click", mailgoCheckRender);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -840,13 +843,12 @@ const mailgo = (mailgoConfig?: MailgoConfig): void => {
|
|||||||
|
|
||||||
// if is set an initEvent add the listener
|
// if is set an initEvent add the listener
|
||||||
if (mailgoConfig?.initEvent) {
|
if (mailgoConfig?.initEvent) {
|
||||||
document.addEventListener(mailgoConfig.initEvent, mailgoInit);
|
document.addEventListener(mailgoConfig.initEvent, () => {
|
||||||
|
mailgoInit(mailgoConfig);
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
mailgoInit();
|
mailgoInit(mailgoConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
// event listener on body, if the element is mailgo-compatible the mailgo modal will be rendered
|
|
||||||
document.addEventListener("click", mailgoCheckRender);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user