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:
- Fingerprint detection complete
- Site configuration loaded
- User session restored (if logged in)
- E-commerce products loaded (if enabled)
- 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
- Events Overview - All available events
- PelcroSiteLoaded - Fires earlier, when site config is ready
- PelcroUserLoaded - Fires when user data is available
Updated 1 day ago
