Comments (7)
Hey Joe! That is a great idea. I think we should create a safe then function along the lines of this
. If you create a pull request, I will definitely accept it. Please add tests as well.
from promise-polyfill.
Will do later today, thanks!
from promise-polyfill.
@benderTheCrime Have you had time to work on this? I think this would be a useful feature. If not, I can work on it.
from promise-polyfill.
I'm sorry. I forgot about this altogether. If you have time to work on it that would be great. Otherwise, I can work on it during the week.
from promise-polyfill.
Here is a first pass at this: #27
I say first pass because I did not see the advantage of defining the safeThen
once I got down to it. I don't know that all of the work that the safeThen
method does is necessary to ensure that the Promise that is being resolved is actually a Promise and not an instance of the subclass.
SO I started with safeThen
, and then pulled out the handle
and the creation of the new Promise, and then changed the method to safeCtor
, and then moved that into then
, and then realized that that is where I started in the first place.
Any user subclassing this should be able to use it in such a way that prevents augmentation to any of the private properties created (or at least know when they've broken something sufficiently to backpedal and undo the changes they've made). With this consideration in mind, we prevent ourselves from adding too much code for this functionality.
I can still add the safeThen
if you want. At the end of the day i'm not too fussed about it and it's your preference.
Also, let me know if the tests added are sufficient. They are pretty basic in comparison to the extent to which the rest of the library is tested.
from promise-polyfill.
This is completed in #27.
from promise-polyfill.
Thanks!
from promise-polyfill.
Related Issues (20)
- dist/polyfill.min.js missing v8.1.2 fix HOT 1
- catch causing `expected identifier` in IE8, it seems promise is not returned for chaining HOT 1
- Exception not rejected? HOT 1
- Using promise in a 'for' loop behaves differently on IE11 HOT 2
- Unhandled Promise Rejection - Desktop Safari 13.0.2 HOT 4
- Use window.queueMicrotask where available HOT 4
- Promise.prototype.finally is not aligned with the most current spec draft HOT 3
- Conditional check insufficient due to legacy HTML by ID conflict
- Missing Promise.allSettled HOT 4
- Invalid calls to wrapped setTimeout on IE7 and IE8 HOT 12
- Document meanings of _state values HOT 3
- ' import 'promise-polyfill/src/polyfill' 'has syntaxerror when i excute 'npm run test' HOT 2
- unhandledrejection event not fired HOT 2
- v8.2.1: setImmediate in IE11 can lose its context and throw "Invalid calling object" HOT 1
- zte HOT 1
- Could you support Promise.any() ? HOT 1
- Has Promise-Polyfill replaced the use of Bluebird? HOT 1
- Set minimum permissions for workflows HOT 1
- Add Security Policy HOT 1
- error in ie8 HOT 1
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 promise-polyfill.