File size: 355 Bytes
6778ee0
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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 })
}