question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cycle.js coding style puzzle: sink-HTTP-source, or just wrapping ajax promise to a metastream and then flatMap?

See original GitHub issue

In the traditional RxJS programming, when doing Http request, we just use fromCallback or fromPromise to wrap a new stream, then map the request stream with it, building a meta-stream, and then flatMap it.

But cycle.js recommends to put the Http thing out of main() and into the HTTP driver, just like what we do with DOM.

I understand the drivers mean ‘outside world’ or 'human user’and main() means ‘computer’. But, yes, DOM events are from human users, while HTTP should still be on the ‘computer’ side.

So what’s the point to put HTTP operations into drivers? Is it just because Http operations introduce side effects? Does that mean main() is not just ‘computer’ bu also pure, and all side effects must go to drivers, no matter they are from humans or from HTTP data fetching?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:19 (6 by maintainers)

github_iconTop GitHub Comments

5reactions
beeplincommented, Apr 6, 2016

@staltz thank you for your patience. Yes now I realize my previous proposal is actually reducing Cycle.js into merely a wrapper of RxJS with a v-dom plugin. That’s clearly not what you want. Cycle.js is more about a beautiful programming paradigm.

2reactions
3n-mbcommented, Apr 12, 2017

@jvanbruegge don’t get me wrong, I get @staltz 's analogy with horses and cars made in a talk. I just happen to question edges that look a little sharper than needed for a smooth introduction of cycles to a 14-year old. There are 14-year olds that fly planes, you know. Activity that doesn’t require pure math thinking. Just practical.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Avoid re-creation/evaluation of VDOM subtrees · Issue #204
Cycle.js coding style puzzle: sink-HTTP-source, or just wrapping ajax promise to a metastream and then flatMap? #289.
Read more >
Wrap AJAX in a Promise - JavaScript Promises Tutorial
In this video we're going to be wrapping a traditional AJAX call (or XMLHttpRequest call) inside a Promise, mimicking the behaviour of the...
Read more >
Wrapping $.ajax with Promise doesn't resolve
jQuery Ajax requests are promises. They may not be Promise instances, but they implement the Promise interface. There is no need to wrap...
Read more >
How to Promisify an Ajax Call
Let's say you have an AJAX call, and some other function that depends on the AJAX call loading before it runs. Here's the...
Read more >
AJAX Introduction
A browser built-in XMLHttpRequest object (to request data from a web server); JavaScript and HTML DOM (to display or use the data). AJAX...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found