PelcroBootComplete

Fired when SDK initialization completes

Overview

Fired when the SDK has completed its full initialization sequence. This is the safest event to wait for before interacting with any SDK feature.


When It Fires

This event fires once per page load, after:

  1. Fingerprint detection complete
  2. Site configuration loaded
  3. User session restored (if logged in)
  4. E-commerce products loaded (if enabled)
  5. Paywall initialized

Event Detail

This event has no detail payload.

document.addEventListener('PelcroBootComplete', (event) => {
  // event.detail is undefined
  console.log('Pelcro SDK is ready');
});

Example

// Wait for SDK to be fully ready before using any features
document.addEventListener('PelcroBootComplete', () => {
  // Safe to use all SDK features
  if (Pelcro.user.isAuthenticated()) {
    console.log('User is logged in:', Pelcro.user.read().email);
  }

  // Safe to check subscriptions
  const subscriptions = Pelcro.user.read().subscriptions;

  // Safe to interact with paywall
  Pelcro.paywall.displayNewsletterModal();
});

Common Use Cases

  • Initializing custom UI that depends on user state
  • Setting up analytics tracking
  • Conditionally showing content based on subscription status
  • Triggering custom paywall logic

Related