Socket
Book a DemoInstallSign in
Socket

@eventkit/base

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@eventkit/base

Declarative event stream processing library

latest
Source
npmnpm
Version
0.3.1
Version published
Maintainers
1
Created
Source

@eventkit/base is the primary package in the eventkit project.

Installation

npm i @eventkit/base

Using a CDN

This package also bundles a browser-friendly version that can be accessed using a CDN like unpkg.

<!-- Development -->
<script src="https://unpkg.com/@eventkit/base/dist/index.global.js"></script>
<!-- Minified -->
<script src="https://unpkg.com/@eventkit/base/dist/index.global.min.js"></script>

When imported this way, all exports are available on the eventkit global variable.

const { Stream, filter } = eventkit;

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";

// Create a stream of events
const stream = new Stream<{ type: string; payload: any }>();

// Filter for specific event types
const userEvents = stream.pipe(filter((event) => event.type.startsWith("user.")));

// Subscribe to the filtered stream
userEvents.subscribe((event) => {
  console.log(`Received user event: ${event.type}`);
});

// Push events to the stream
stream.push({ type: "user.login", payload: { userId: "123" } });
stream.push({ type: "system.update", payload: { version: "1.0.1" } }); // This won't be logged

// Wait for all events to be processed
await stream.drain();

Keywords

event

FAQs

Package last updated on 22 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts