/** * Zap -- push-based event channel via PubSub. * * @module */ import { Effect, Stream } from 'effect'; import type { Scope } from 'effect'; import type { Millis } from './brands.js'; interface ZapShape { readonly _tag: 'Zap'; readonly stream: Stream.Stream; emit(value: T): Effect.Effect; } /** * Zap -- push-based event channel backed by Effect PubSub. * Provides reactive event streams with map, filter, merge, debounce, and throttle. * * @example * ```ts * const program = Effect.scoped(Effect.gen(function* () { * const zap = yield* Zap.make(); * const doubled = yield* Zap.map(zap, n => n * 2); * yield* zap.emit(5); * // doubled.stream receives 10 * })); * ``` */ export declare const Zap: { make: () => Effect.Effect, never, Scope.Scope>; fromDOMEvent: (element: HTMLElement, event: K) => Effect.Effect, never, Scope.Scope>; merge: (events: ReadonlyArray>) => Effect.Effect, never, Scope.Scope>; map: (event: ZapShape, f: (a: A) => B) => Effect.Effect, never, Scope.Scope>; filter: (event: ZapShape, predicate: (value: T) => boolean) => Effect.Effect, never, Scope.Scope>; debounce: (event: ZapShape, ms: Millis) => Effect.Effect, never, Scope.Scope>; throttle: (event: ZapShape, ms: Millis) => Effect.Effect, never, Scope.Scope>; }; export declare namespace Zap { /** Structural shape of a {@link Zap}: event-sourced reactive primitive exposing a discrete stream. */ type Shape = ZapShape; } export {}; //# sourceMappingURL=zap.d.ts.map