nodejs / nodejs/node

Support for WICG Observable

Open
#51,828 2 comments 9 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

  • #53399 by @jasnell — closed without merging
feature request never-stale web-standards
Dominant language
JavaScript
Stars
122k
Forks
37.3k
Avg merge
4d 2h
Merged PRs (30d)
283

Description

What is the problem this feature will solve?

This new proposal adds .when method to EventTarget, then we can control event handling using Observable API.

Example from the spec:

// Filtering and mapping:
element
	.when('click')
	.filter((e) => e.target.matches('.foo'))
	.map((e) => ({ x: e.clientX, y: e.clientY }))
	.subscribe({ next: handleClickAtPoint });

Spec: https://github.com/WICG/Observable
Standard Tracking: https://github.com/WICG/observable/issues/93

This is something that makes sense to implement on Node?

What is the feature you are proposing to solve the problem?

Basically implements the new .when method at:

https://github.com/nodejs/node/blob/a0ac8bd4d85e5614f43e4fed3e0c73641cd45fa8/lib/internal/event_target.js#L551

What alternatives have you considered?

The @benlesh (contributor of the spec) looks like he already tried to implement this new spec at https://github.com/nodejs/node/pull/51065

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with lib/internal/event_target.js at the linked location and read the WICG Observable specification. Review the prior implementation attempt in pull request #51065 and the standard-tracking issue to understand the expected scope. Done means Node supports the proposed EventTarget .when API consistently with the specification and the example behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.