Recipe: vanilla JavaScript
Subscribe directly from any browser application and render with your own DOM, web component, or framework adapter.
import { createClient } from '@loggylogs/core'
const client = createClient({ publicKey: 'pk_your_public_key' })
const root = document.querySelector('#changelog')
const stop = client.subscribeLogs((logs) => {
root.replaceChildren(
...logs.map((log) => {
const article = document.createElement('article')
const heading = document.createElement('h2')
heading.textContent = log.title
article.append(heading)
return article
})
)
})
window.addEventListener('pagehide', () => {
stop()
client.destroy()
})