@eventkit/base is the primary package in the eventkit project.
Installation
npm i @eventkit/base
Basic Example
This is a basic example of how to use an eventkit stream. To get started, you should check out the Getting Started guide.
import { Stream, filter } from "@eventkit/base";
const stream = new Stream<{ type: string; payload: any }>();
const userEvents = stream.pipe(filter((event) => event.type.startsWith("user.")));
userEvents.subscribe((event) => {
console.log(`Received user event: ${event.type}`);
});
stream.push({ type: "user.login", payload: { userId: "123" } });
stream.push({ type: "system.update", payload: { version: "1.0.1" } });
await stream.drain();
Related Resources