Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fetch-observable

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fetch-observable - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

dist/lib/fetchObservable.js

2

package.json
{
"name": "fetch-observable",
"description": "Observable-based Fetch API",
"version": "1.0.0",
"version": "1.0.1",
"license": "BSD-3-Clause",

@@ -6,0 +6,0 @@ "repository": {

@@ -1,10 +0,10 @@

# fetchObservable
# fetchObservable()
Observable-based [Fetch API](https://github.com/whatwg/fetch) that automatically refreshes data.
Observable-based [Fetch API](https://github.com/whatwg/fetch) that automatically refreshes data and notifies subscribers.
## Features
- API similar to the standard Fetch API.
- Uses the standard Fetch API.
- Uses Observable syntax from [ES Observable proposal](https://github.com/zenparsing/es-observable).
- Runs in Node and browsers.
- Runs in Node and browsers. (BYO Promises though)

@@ -14,3 +14,2 @@ ## Installation

```bash
# For web or Node:
npm install --save fetch-observable

@@ -24,9 +23,11 @@ ```

// Creates a single fetchObservable for one or multiple URLs.
// Creates a single observable for one or multiple URLs.
const liveFeed = fetchObservable(
"http://example.org/live-feed.json",
{refreshDelay (iteration) { return iteration * 1000; }}
{
refreshDelay: (iteration) => iteration * 1000 // <-- Callback or just integer ms.
}
);
// Subscribe-syntax like ES Observables.
// Subscribe-syntax of ES Observables.
const subscription1 = liveFeed.subscribe({

@@ -48,2 +49,5 @@ next (response) {

subscription1.resubscribe(); // <-- Observable resumes on 1 subscription.
liveFeed.pause(); // <-- Observable can be paused manually.
liveFeed.resume();
````

@@ -50,0 +54,0 @@

@@ -0,1 +1,4 @@

/**
* @copyright © 2015, Rick Wong. All rights reserved.
*/
import __fetch from "isomorphic-fetch";

@@ -2,0 +5,0 @@ import PausableObservable from "lib/PausableObservable";

@@ -0,1 +1,4 @@

/**
* @copyright © 2015, Rick Wong. All rights reserved.
*/
import {Observable} from "lib/Observable";

@@ -2,0 +5,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc