The following error occurs when first implementing or updating event handlers:
This happens when calling
initialize first, then listening for the
ready event after the SDK finished initializing. The
ready event is only triggered once, and if you hook the
ready event after it’s already been triggered, the callback will never be called because the event won’t occur again.
Use one of the following approaches:
ready Listener Immediately After
- Place the code that attaches the
readylistener immediately after calling the
initializefunction before the SDK has finished initializing. This ensures that your listener is in place to capture the
readyevent as soon as it occurs.
- Alternatively, you can use the
waitUntilReadypromise. This promise will resolve if the SDK is ever initialized instead of resolving only once. By using this approach, you can avoid missing the
readyevent due to timing issues during initialization.