turnero: notificación del sistema cuando vence el countdown de toma progresiva
Usa Web Notifications API via postMessage iframe→parent para alertar incluso cuando el tab está en segundo plano o la pantalla ocupada. Pide permiso al iniciar el protocolo (primer gesto del usuario). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
6ce2fc340b
commit
019d2f4fb0
@@ -1541,7 +1541,13 @@ function cerrarModalConsentimiento(forzar) {
|
||||
window.addEventListener('message', function(e) {
|
||||
if (e.data && e.data.type === 'tomaProgresivaIniciada') {
|
||||
_tomaProgresivaActiva = true;
|
||||
// Botón cerrar permanece habilitado; el operador puede cerrar en cualquier momento
|
||||
if ('Notification' in window && Notification.permission === 'default') Notification.requestPermission();
|
||||
}
|
||||
if (e.data && e.data.type === 'tomaProgresivaAlerta') {
|
||||
var lbl = (e.data.label || '¡Siguiente muestra!');
|
||||
if ('Notification' in window && Notification.permission === 'granted') {
|
||||
new Notification('⏰ Toma de muestras', { body: lbl, icon: '/favicon.ico', requireInteraction: true });
|
||||
}
|
||||
}
|
||||
if (e.data && e.data.type === 'turneroFirmado') {
|
||||
_tomaProgresivaActiva = false;
|
||||
|
||||
Reference in New Issue
Block a user