
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
@cycle/fetch
Advanced tools
A Cycle.js Driver for making HTTP requests, using the Fetch API.
npm install @cycle/fetch
makeFetchDriver(scheduler: Scheduler) -> fetchDriver: function
Factory that returns a fetch driver. It takes an optional scheduler
argument to pass into fromPromise
.
Basics:
import 'whatwg-fetch' // polyfill if you want to support older browsers
import Cycle from '@cycle/core';
import { makeFetchDriver } from 'cycle-fetch-driver';
function main(responses) {
// ...
}
const drivers = {
Fetch: makeFetchDriver()
}
Cycle.run(main, drivers);
Simple and normal use case:
function main(responses) {
const HELLO_URL = 'http://localhost:8080/hello';
let request$ = Rx.Observable.just(HELLO_URL);
let vtree$ = responses.Fetch
.byUrl(HELLO_URL)
.mergeAll()
.flatMap(res => res.text()) // We expect this to be "Hello World"
.startWith('Loading...')
.map(text =>
h('div.container', [
h('h1', text)
])
);
return {
DOM: vtree$,
Fetch: request$
};
}
Select all the responses for a certain key:
function main(responses) {
const HELLO_URL = 'http://localhost:8080/hello';
let request$ = Rx.Observable.just({
key: 'hello',
url: HELLO_URL
});
let vtree$ = responses.Fetch
.byKey('hello')
.mergeAll()
.flatMap(res => res.text()) // We expect this to be "Hello World"
.startWith('Loading...')
.map(text =>
h('div.container', [
h('h1', text)
])
);
return {
DOM: vtree$,
Fetch: request$
};
}
FAQs
A Cycle.js Driver for making HTTP requests through fetch
The npm package @cycle/fetch receives a total of 2 weekly downloads. As such, @cycle/fetch popularity was classified as not popular.
We found that @cycle/fetch demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.