Skip to content

Commit

Permalink
Remove nonstandard Promise.prototype.done implementation
Browse files Browse the repository at this point in the history
Summary:
Changelog:
[General][Breaking] - Remove nonstandard Promise.prototype.done

`Promise.prototype.done` has been deprecated since D34222667. Here we remove it from React Native's default Promise polyfill. Users should switch to using standard Promise features like `.then()`, or install their own custom polyfills for advanced use cases.

Reviewed By: kodafb

Differential Revision: D36001688

fbshipit-source-id: 37f452000c16279280ef6a50b2ce616776377c4e
  • Loading branch information
motiz88 authored and facebook-github-bot committed May 5, 2022
1 parent f11379f commit 93e1f6c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 11 deletions.
10 changes: 0 additions & 10 deletions lib/InternalBytecode/01-Promise.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,15 +317,6 @@
return this.then(null, onRejected);
};

core.prototype.done = function (onFulfilled, onRejected) {
var self = arguments.length ? this.then.apply(this, arguments) : this;
self.then(null, function (err) {
setTimeout(function () {
throw err;
}, 0);
});
};

core.prototype.finally = function (f) {
return this.then(function (value) {
return core.resolve(f()).then(function () {
Expand Down Expand Up @@ -461,7 +452,6 @@




// expose Promise to global.
globalThis.Promise = es6Extensions;

Expand Down
1 change: 0 additions & 1 deletion utils/promise/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

const Promise = require('promise/setimmediate/es6-extensions');

require('promise/setimmediate/done');
require('promise/setimmediate/finally');

// expose Promise to global.
Expand Down

0 comments on commit 93e1f6c

Please sign in to comment.