> For the complete documentation index, see [llms.txt](https://soufatn.gitbook.io/rxjs-book/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://soufatn.gitbook.io/rxjs-book/summary/observer/observer_methods/fromnotifier.md).

# fromNotifier

Creates an observer from a notification callback.

### Arguments

1. `handler` *(Function)*: Function that handles a notification.

### Returns

*(Observer)*: The observer object that invokes the specified handler using a notification corresponding to each message it receives.

### [Example](http://jsbin.com/difobe/3/edit?js,console)

```javascript
function handler(n) {
    // Handle next calls
    if (n.kind === 'N') {
        console.log('Next: ' + n.value);
    }

    // Handle error calls
    if (n.kind === 'E') {
        console.log('Error: ' + n.exception);
    }

    // Handle completed
    if (n.kind === 'C') {
        console.log('Completed');
    }
}

Rx.Observer.fromNotifier(handler).onNext(42);
// => Next: 42

Rx.Observer.fromNotifier(handler).onError(new Error('error!!!'));
// => Error: Error: error!!!

Rx.Observer.fromNotifier(handler).onCompleted();
// => false
```

### Example


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://soufatn.gitbook.io/rxjs-book/summary/observer/observer_methods/fromnotifier.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
