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

Observable without this should not fail silently #1017

Closed
compulim opened this issue Dec 2, 2021 · 1 comment
Closed

Observable without this should not fail silently #1017

compulim opened this issue Dec 2, 2021 · 1 comment
Labels

Comments

@compulim
Copy link
Contributor

compulim commented Dec 2, 2021

Version: [email protected]

When SubscriberFunction.next is executed without this, it will fail silently.

In the following code (CodeSandbox), only 1 and 3 is observed.

import Observable from "core-js/features/observable";

const observer = new Observable((observer) => {
  const { next } = observer;

  observer.next(1); // Will reach subscriber
  next(2);          // Will not reach subscriber, and fail silently
  observer.next(3); // Will reach subscriber
});

observer.subscribe({
  next: (value) => console.log(value)
});

In the console log:

1
3

I believe when calling next(2), it should be either:

  • Fail with exception
  • Succeed/observed (this is bound)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants