Skip to content

lit

import {
  StoreController
} from "exome/lit";

class StoreController

Subscribes to store instance update events and trigger updates to component accordingly.

class StoreController<T extends Exome> implements ReactiveController {
  store: T;
  constructor(host: ReactiveControllerHost, store: T);
  hostConnected(): void;
  hostDisconnected(): void;
}
example.ts
import { StoreController } from "exome/lit"
import { counterStore } from "./counter.store.ts"
 
@customElement("counter")
class CounterComponent extends LitElement {
  private counter = new StoreController(this, counterStore)
 
  render() {
    const { count, increment } = this.counter.store
 
    return html`
      <button @click=${increment}>${count}</button>
    `
  }
}