Comments (4)
I believe it's mostly true: never
itself does consume almost no resources, and near() will tend to collapse promise chains over time.
I'd thought about detecting never and short circuiting in merge/all/settle (I think I even wrote the code for it at some point), and I still think it's a pretty cool idea. I ended up believe that real world usages of never
will be few and far between, and so I didn't feel like the extra code was worth it. I could definitely be convinced that it's worthwhile, tho, if the code to do it is extremely small and simple.
from creed.
Yes, real-world usages of never
seem to be rare. I wonder if anyone used it as a poor-mans cancellation, otherwise I can hardly imagine use cases.
If anything, it might have been used in the monoid instance together with concat
, but that one already is short-circuited.
from creed.
I wonder if anyone used it as a poor-mans cancellation
That's an interesting question. I hadn't even considered it :) Now I'm wondering what that would look like ... any chance you've tried it?
from creed.
I mean something like
let isCancelled = false;
cancelButton.onclick = () => { isCancelled = true; … };
….then(r => {
if (isCancelled) return never();
…
}).then(r => {
if (isCancelled) return never();
…
})
from creed.
Related Issues (20)
- Benefits over using Bluebird? HOT 4
- Consider integrating type class morphisms HOT 3
- Implement Cancellation HOT 2
- thisArg in merge - really necessary? HOT 1
- Make never/empty a singleton
- ES6 shim subclassability HOT 1
- Implement async/await semantics more closely in coroutines HOT 6
- Overhaul rejection tracking
- Implement bifunctor HOT 2
- TypeError: Cannot read property 'near' of undefined HOT 4
- Folding HOT 8
- An in-range update of eslint-plugin-standard is breaking the build 🚨 HOT 2
- An in-range update of nyc is breaking the build 🚨 HOT 6
- An in-range update of mocha is breaking the build 🚨
- An in-range update of jsinspect is breaking the build 🚨 HOT 2
- Why there is no `creed.of` method? HOT 10
- more accessible documentation? HOT 16
- Improve documentation and examples
- Any interest in TypeScript definitions? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from creed.