Parameters

  1. fn: Function
    A function to be called when window.xkit is available and configured

Returns

void

xkit.js loads itself onto the page in an asynchronous fashion, so it may not be available in a script that is executed synchronously. To remedy this, it exports a ready function that allows you to pass callbacks to be executed as soon as xkit.js is available.

ready accepts a single parameter, a function, that will be executed as soon as xkit.js is available and configured. Subsequent calls to ready will execute immediately and synchronously, so ready should not be relied on to always call asynchronously.

<script src="https://<your-slug>.xkit.co/xkit.js"></script>
<script>
  xkit.ready(() => {
    console.log('xkit.js is ready!')
  })
</script>