Sairin provides a comprehensive API for building reactive applications.

Overview

The API is organized into several modules:

Module Description
Kernel Core reactivity: signals, effects, derived, batch
Store Reactive data structures
Flow Async flow control utilities
Async Async patterns
DOM DOM bindings for reactive UI
Context Context system for dependency injection
Debug Debugging and graph inspection

Quick Reference

Creating Reactivity

import { signal, derived, effect, batch } from 'sairin';

const mySignal = signal(path("path", "to", "value"), initialValue);
const myDerived = derived(path("path", "to", "derived"), () => computation);
const dispose = effect(() => { /* side effect */ });
batch(() => { /* grouped updates */ });

Core Concepts

  • Signals - Reactive value containers
  • Derived - Computed values that auto-update
  • Effects - Side effects that track dependencies
  • Batching - Group multiple updates

Path-Based Features

import { path, watch, lock, alias } from 'sairin';

const myPath = path("app", "component", "state");
watch(myPath, (changedPath) => { /* ... */ });
lock(myPath, { owner: "myModule" });
alias(path("alias"), path("target"));

Installation

npm install @nisoku/sairin

TypeScript

Sairin is written in TypeScript and includes full type definitions. No additional @types package needed.