UNPKG

scrivito

Version:

Scrivito is a professional, yet easy to use SaaS Enterprise Content Management Service, built for digital agencies and medium to large businesses. It is completely maintenance-free, cost-effective, and has unprecedented performance and security.

19 lines (13 loc) 451 B
import { onReset } from 'scrivito_sdk/common'; let handlers: Array<() => void> = []; export function observeWindowFocus(): void { window.addEventListener('focus', triggerWindowFocus); } export function subscribeWindowFocus(handler: () => void): void { handlers.push(handler); } // For test purpose only. export function triggerWindowFocus(): void { Object.values(handlers).forEach((handler) => handler()); } onReset(() => (handlers = []));