Skip to content

JavaScript events

Vuukle emits events via the browser’s console and (where supported) window.postMessage. Use them to hook into widget lifecycle, comments, reactions, and login state.

Lifecycle messages

When each widget finishes initialising, Vuukle prints a console message:

MessageFired when
Comments initialized!The comment widget has finished its first paint.
Emotes initialized!The emote widget has finished its first paint.
ShareBar initialized!The ShareBar has finished its first paint.

Inside a WebView you can intercept these via WebChromeClient.onConsoleMessage() (Android) or WKScriptMessageHandler (iOS). See Android integration and iOS integration for examples.

Inject calls into the widget

After lifecycle messages fire, you can call exposed globals:

// Log a user in via SSO
window.vuukleLogin(BASE64_SSO_TOKEN);
// Log a user out
window.vuukleLogout();

Listen for new comments

window.addEventListener('vuukle-comment-submitted', (event) => {
console.log('New comment:', event.detail);
// event.detail = { id, body, authorEmail, articleId, ... }
});

Listen for reactions

window.addEventListener('vuukle-emote-selected', (event) => {
console.log('Reaction:', event.detail.emote);
});
Event names are stable, but the contents of event.detail may grow over time. Build defensively.
Was this page helpful?
Help us improve — drop a note or open the dashboard.