🚀 DAY 5 OF LAUNCH WEEK:Introducing Webhook Events for Alert Changes.Learn more →
Socket
Book a DemoInstallSign in
Socket

observable-fetch

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

observable-fetch

RxJS Observable wrapped around the WHATWG Fetch API.

latest
Source
npmnpm
Version
1.1.1
Version published
Maintainers
1
Created
Source

observable-fetch

RxJS Observable wrapped around the WHATWG Fetch API.

NPM version Build Status

Installation

$ yarn add observable-fetch

Alternatively using npm:

$ npm i observable-fetch --save

Usage

This library is especially built to be complementary to redux-observable;

import fetch from 'observable-fetch';

// action creators
const fetchUser = username => ({ type: FETCH_USER, payload: username });
const fetchUserFulfilled = payload => ({ type: FETCH_USER_FULFILLED, payload });

// epic
const fetchUserEpic = action$ =>
  action$.ofType(FETCH_USER)
    .mergeMap(action =>
      fetch(`https://api.github.com/users/${action.payload}`)
        .map(response => fetchUserFulfilled(response))
    );

// later...
dispatch(fetchUser('torvalds'));

License

MIT © Robin van der Vleuten

Keywords

Rx

FAQs

Package last updated on 12 May 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts