Skip to content

Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.

355 B
Raw Blame
import { runThrottledCheck } from './run-check'

export async function waitForPlausibleFunction(timeout = 5000) {
  const checkFn = (opts) => {
    if (window.plausible?.l) {
      return true
    }
    if (opts.timeout) {
      return false
    }
    return 'continue'
  }
  return await runThrottledCheck(checkFn, { timeout: timeout, interval: 100 })
}