Bug on notification click fixed

This commit is contained in:
Eudes Inácio
2021-06-21 09:10:45 +01:00
parent 5b4f607225
commit fd89bbfcaf
3 changed files with 86 additions and 17 deletions
+37
View File
@@ -86,4 +86,41 @@ export class ToastService {
}
async notificationMessage(message?: any, callback?: any,data?: any) {
let notification = document.createElement('div')
notification.className = 'notificationPush'
notification.innerHTML = `
<div class="main-content width-100 pa-20">
<p class="message d-flex align-left">
<p class="text">{{ message }}</p>
</p>
</div>
`
let funcx = ()=>{
callback(data);
document.body.removeEventListener('click', funcx);
notification.remove();
}
document.body.append(notification)
document.body.addEventListener('click', funcx);
notification.querySelector('.text').innerHTML = message || 'Processo efetuado'
setTimeout(()=>{
notification.style.top = "-100%"
setTimeout(()=>{
notification.remove()
},1000)
},6000)
}
}