-
Notifications
You must be signed in to change notification settings - Fork 593
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overwrite non-subclassable promises #23
Labels
Comments
👍 |
so currently precisely 0 browser support this. Would we like to still check and override? |
Happy to clobber all until we get an implementation that supports subclassing, then we can look at how best to feature test it. |
Something like the following (although it adds many bytes). var isNative = Object.prototype.toString.call(Promise.resolve()) === '[object Promise]';
function testSubclassing() {
function SubClass() {
Promise.call(this);
}
SubClass.prototype= Object.create(Promise.prototype)
var seemsToSubClass;
try {
new SubClass(function() { });
seemsToSubClass = true;
} catch(e) {
seemsToSubClass = false
}
return seemsToSubClass;
}
if (isNative) {
canSubclass = testSubClassing();
} |
master should do this now, but If you have time to audit it that would be awesome.! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Firefox/Chrome promises throw when you call constructor on a subclass. The polyfill should take over in browsers that do that.
The text was updated successfully, but these errors were encountered: