forked from facebook/hermes
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ConsoleHost functions to allow Promise polyfilling.
Summary: The `Promise` polyfill requires `setTimeout` and `setImmediate` to function properly. Add simple versions of these which simply enqueue onto a job queue which is repeatedly drained until empty. This allows us to make Hermes aware of `Promise` without changing any actual functionality in any existing hosts (i.e. RN). Note that because these functions are only set on ConsoleHost, users such as RN still use their existing event loop and timer structure, which allows us to simply swap to a Promise implementation that Hermes is aware of without incurring any extra cost of changing code outside of this one specific polyfill. Reviewed By: tmikov Differential Revision: D20225268 fbshipit-source-id: fd4a518cf7adaab6bf860f8d44b8190a866116af
- Loading branch information
1 parent
5346754
commit 0812b40
Showing
4 changed files
with
176 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters