Skip to content

Observable without this should not fail silently #1017

@compulim

Description

@compulim

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions