static-observable
Static observable methods next
, error
, and complete
. Equivalent to Promise.resolve()
and Promise.reject()
for promises.
Installation
npm i --save static-observablenpm i --save rxjs # peer dependency
Why?
For quick return cases and test stubs
Usage
Example: chain
var StaticObservable = var observable = StaticObservable next foo: 1 next foo: 2 complete observable// NEXT: { foo: 1 }// NEXT: { foo: 2 }// COMPLETE
Example: error chain
var StaticObservable = var observable = StaticObservable next foo: 1 next foo: 2 observable// NEXT: { foo: 1 }// NEXT: { foo: 2 }// ERROR: [Error: boom]
Example: error and complete are "safe"
var StaticObservable = var observable = StaticObservable next foo: 1 observable// ERROR: [Error: boom] var observable = StaticObservable complete'boom' next foo: 1 observable// COMPLETE
License
MIT