@tty-pt/xylem logo

@tty-pt/xylem

npm version License: BSD-2-Clause TypeScript Ready Node.js Native WebAssembly Zero Dependencies

Universal Node.js and Browser bindings for libxylem, the extensible C module bus and dynamic hook dispatch runtime. Canonical C headers: <ttypt/xy.h> and <ttypt/xy-mod.h>.

๐Ÿ“– Full C & Module Bus Documentation: See the main libxylem GitHub README for XY_DECL / XY_IMPL cross-.so symbol contracts, xy_load() DAG resolution, and hook dispatch.


1. Quickstart & Installation

npm config set @tty-pt:registry https://tty.pt/npm/
npm install @tty-pt/xylem

Native OS & Mobile Packages (tty.pt): Prebuilt native C packages (libxylem) for Linux (apt, apk, pacman, dnf), macOS (brew), Windows (winget, MSYS2), OpenBSD (pkg_add), plus static mobile sysroots for Android (https://tty.pt/android/) and iOS (https://tty.pt/ios/ โ€” libxylem.xcframework, supporting XY_STATIC_MOD and xy_load_mem()) are available via the tty.pt package repositories.

import { XylemBus, areg, call } from "@tty-pt/xylem";

// 1. Register a dynamic hook listener
const unregister = areg("on_event", (payload) => {
  console.log("Received event payload:", payload);
  return { status: "processed" };
});

// 2. Dispatch event across registered listeners
const results = call("on_event", { userId: 101, action: "login" });
console.log("Hook return values:", results);

unregister();

2. JavaScript / TypeScript API Reference

XylemBus

Dynamic module hook and lifecycle event bus.

Standalone Functions & Capability Bridge


3. C Development Headers & Native Integration

CFLAGS += -I./node_modules/@tty-pt/xylem/include
LDLIBS += -lxylem

License

BSD-2-Clause โ€” Copyright (c) 2026, Paulo Quirino <quirinpa@gmail.com>. See LICENSE.