mirror of
https://github.com/welton89/RRBEC.git
synced 2026-04-05 13:35:42 +00:00
feat: estudo sobre notificação
This commit is contained in:
Binary file not shown.
@@ -1,5 +1,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
function openTab(evt, etapa) {
|
function openTab(evt, etapa) {
|
||||||
// Declarar todas as abas e conteúdos
|
|
||||||
var i, tabcontent, tablinks;
|
var i, tabcontent, tablinks;
|
||||||
tabcontent = document.getElementsByClassName("tabcontent");
|
tabcontent = document.getElementsByClassName("tabcontent");
|
||||||
for (i = 0; i < tabcontent.length; i++) {
|
for (i = 0; i < tabcontent.length; i++) {
|
||||||
@@ -9,10 +11,8 @@ function openTab(evt, etapa) {
|
|||||||
for (i = 0; i < tablinks.length; i++) {
|
for (i = 0; i < tablinks.length; i++) {
|
||||||
tablinks[i].className = tablinks[i].className.replace(" active", "");
|
tablinks[i].className = tablinks[i].className.replace(" active", "");
|
||||||
}
|
}
|
||||||
// Mostrar o conteúdo da aba selecionada e marcar a aba como ativa
|
|
||||||
document.getElementById(etapa).style.display = "block";
|
document.getElementById(etapa).style.display = "block";
|
||||||
evt.currentTarget.className += " active";
|
evt.currentTarget.className += " active";
|
||||||
// console.log(evt.currentTarget.className += " active");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function displayBlock(etapa) {
|
function displayBlock(etapa) {
|
||||||
@@ -42,4 +42,39 @@ function openTab(evt, etapa) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
displayBlock('Fila');
|
displayBlock('Fila');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function mostrarNotificacao() {
|
||||||
|
if (Notification.permission != 'granted') {
|
||||||
|
Notification.requestPermission().then(function(permission) {
|
||||||
|
if (permission == 'granted') {
|
||||||
|
var notification = new Notification('Nova Mensagem', {
|
||||||
|
body: 'Você tem uma nova mensagem!',
|
||||||
|
icon: 'https://example.com/icon.png'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
var notification = new Notification('Nova Mensagem', {
|
||||||
|
body: 'Você tem uma nova mensagem!',
|
||||||
|
icon: 'https://example.com/icon.png'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
let i = 0;
|
||||||
|
while (i < 10) {
|
||||||
|
setTimeout(function() {
|
||||||
|
mostrarNotificacao();}, 3000);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
setTimeout(function() {
|
||||||
|
mostrarNotificacao();}, 3000);
|
||||||
|
|||||||
Reference in New Issue
Block a user