es-observable

2.0.5 • Public • Published

es-observable

ES Observable proposal implementation

Build Status Coverage Status Greenkeeper badge

Install

npm install --save es-observable or yarn add es-observable

Usage

import { Observable } from 'es-observable'
 
Observable.of( ... )
Observable.from( ... )
new Observable(observer => { ... })

Flow

It works good only with

  [libs]
+ node_modules/es-observable/flow-typed
 
  [lints]

in .flowconfig.

API

import {
  Observable,
  type SubscriptionObserver,  // Class declaration
  type Subscription,          // Class declaration
  type Observer,              // Type declaration
  type ObservableCompatible,  // Type declaration
  type ObservableLike,        // Type declaration
  type SubscriptionLike,      // Interface declaration
} from 'es-observable'

ObservableCompatible

import type { SymbolObservable } from 'symbol-observable'
 
type ObservableCompatible<T> = {
  '@@observable'(): ObservableLike<T>,
}

ObservableLike

import type { SymbolObservable } from 'symbol-observable'
 
export type ObservableLike<T> = {
  +subscribe: ((observer: Observer<T>) => SubscriptionLike<T>) &
    ((
      onNext: (T) => mixed,
      onError?: (T) => mixed,
      onComplete?: () => mixed,
    ) => SubscriptionLike<T>),
  '@@observable'(): ObservableLike<T>,
}

Package Sidebar

Install

npm i es-observable

Weekly Downloads

1

Version

2.0.5

License

MIT

Unpacked Size

29.9 kB

Total Files

15

Last publish

Collaborators

  • bigslycat