SynergyJSv0.4.x

Core API Reference

SynergyJS exposes a minimal surface area centered around define(), standard JavaScript getters for derived state, and native Custom Element lifecycle hooks.

define(tagName, factory, [options])

Registers a Custom Element with the browser's customElements registry.

Computed Properties

Define standard JavaScript getters on your returned object. SynergyJS automatically tracks any reactive dependencies read inside the getter:

define('cart-summary', () => ({
  items: [12, 18, 25],
  get total() {
    return this.items.reduce((sum, n) => sum + n, 0)
  }
}))

Lifecycle Hooks

Include connectedCallback() or disconnectedCallback() methods on your view-model to initialize timers, fetch initial data, or clean up subscriptions when the element enters or leaves the document.