Konsep Core
ZhinNX memakai sedikit fungsi inti. Tujuannya agar alur umum mudah dipahami dan fitur lanjutan tetap opsional.
page()
page() mendaftarkan route dan fungsi render.
js
page('/about', () => `
<main>
<h1>About</h1>
</main>
`)go()
go() berpindah halaman tanpa reload.
js
go('/about')action()
action() mendaftarkan logic yang bisa dipanggil dari HTML memakai @click.
js
action('save', () => {
console.log('saved')
})html
<button @click="save">Save</button>each()
each() merender array menjadi HTML string.
js
const songs = [
{ title: 'Ocean', artist: 'Nova' },
{ title: 'Redline', artist: 'Vera' }
]
page('/music', () => `
<main>
${each(songs, song => `
<article>
<h2>${song.title}</h2>
<p>${song.artist}</p>
</article>
`)}
</main>
`)createApp()
createApp() menghubungkan runtime ke root element browser. Template bawaan biasanya memanggilnya dari src/main.js.
js
createApp('#app')Baca Runtime API kalau butuh daftar fungsi lengkap.