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:
| Message | Fired 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 SSOwindow.vuukleLogin(BASE64_SSO_TOKEN);
// Log a user outwindow.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.detail may grow over time. Build defensively.
Related
Was this page helpful?
Help us improve — drop a note or open the dashboard.