@rosskevin/ifvisible
Version:
Cross-browser, lightweight way to check if user is looking at the page or interacting with it. (wrapper around HTML5 visibility api)
12 lines (8 loc) • 387 B
text/typescript
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
import { IfVisible } from './IfVisible.js'
// set library singleton and export for direct use
export const ifvisible = new IfVisible(window, document)
// set window singleton (e.g. window.ifvisible) to the same instance
;(window as any).ifvisible = ifvisible
export * from './EventBus.js'
export * from './IfVisible.js'