UNPKG

quasar

Version:

Build high-performance VueJS user interfaces (SPA, PWA, SSR, Mobile and Desktop) in record time

29 lines (22 loc) 570 B
import { client } from '../../plugins/platform/Platform.js' const handlers = [] function trigger(e) { handlers[handlers.length - 1](e) } export function addFocusout(fn) { if (client.is.desktop === true) { handlers.push(fn) if (handlers.length === 1) { document.body.addEventListener('focusin', trigger) } } } export function removeFocusout(fn) { const index = handlers.indexOf(fn) if (index !== -1) { handlers.splice(index, 1) if (handlers.length === 0) { document.body.removeEventListener('focusin', trigger) } } }