Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature request] applyRxjsOperator for signal #500

Open
MillerSvt opened this issue Sep 18, 2024 · 0 comments
Open

[feature request] applyRxjsOperator for signal #500

MillerSvt opened this issue Sep 18, 2024 · 0 comments

Comments

@MillerSvt
Copy link
Contributor

MillerSvt commented Sep 18, 2024

Hi. Sometimes we need to add various rxjs operators to signals (for example, debounceTime), and we have to do this through a double conversion first to the stream, then to the signal back. I suggest adding a utility for this.

Expected API:

const result = applyRxJSOperator(source, debounceTime(1000));
const result = applyRxJSOperator(source, pipe(debounceTime(1000), map(i => i + 1)));

Draft implementation:

function applyRxJSOperator(signal: Signal, operator: OperatorFunction): Signal {
  const streamFromSignal = toObservable(signal);

  return toSignal(streamFromSignal.pipe(operator));
}

If you support the idea, I can do it...

@MillerSvt MillerSvt changed the title [feature reauest] applyRxjsOperator for signal [feature request] applyRxjsOperator for signal Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant