Emitter S1
- Stage: Stage 1
- Status: Active
- ECMAScript edition: —
- Synchronized: Aug 28, 2026
- 中文译文 · Source repository
This proposal introduces a general-purpose container called Emitter for handling sync and async, single and multiple values, unifying APIs like EventTarget and EventEmitter. It provides composable operators (e.g., map, filter, reduce, flatten) for algorithmic transformations, aiming for high performance. The proposal includes examples and an API outline, but its stage/status is not mentioned in the provided text.
The README below comes from the upstream repository and may contain outdated stage or status metadata. Use the proposal details above as the current source of truth.
ECMAScript proposal: Emitter
- JavaScript's most general container, over single and multiple, sync and async values
- Operators form the Generics, a large part of the eventual standard library
- Composable algorithmic transformations, decoupled from their input and outputs
- Well-integrated with language rather than inventing lots of new concepts, (i.e. Promises, iteration, async iteration, etc)
- Backwards-compatible unification of platform API (interfaces like EventTarget and EventEmitter)
- Ultra-High Performance (faster than most.js) and memory efficient
Reactive programming examples
Log XY coordinates of click events on <button> elements:
Map clicks from two buttons to a stream of +1 and -1, merge them and render the result:
Fork 10 peers, wait till they've all connected, return a reference to the processes:
Iterable programming examples
From a range of numbers, divide them by 4, remove any greater than 12, then start collecting those one by one:
Transform a series of numbers one by one and log the result:
Log whenever the user presses CTRL+C
API
Transformation
Filtering
Running
Creating
Background
For general background into this space, especially from more of a language perspective, Rich Hickey's talk on the motivation, design and use of Clojure's core.async library is a must.
For comparison, here would be Rob Pike's original example of reducing tail latency using replicated search servers discussed in the talk:
It's useful to also familiarise with existing JavaScript libraries in this space:
More details are included and will be documented in the FAQ.