Skip to content

Commit

Permalink
Implementing JSI drainMicrotasks
Browse files Browse the repository at this point in the history
Summary:
This diff implement the new JSI API `drainMicrotasks` by draining
the internal job queue and throw JSIException.

Reviewed By: dulinriley

Differential Revision: D27731602

fbshipit-source-id: b2c99e516bd183df37778b25d4202b1e0dd077eb
  • Loading branch information
Huxpro authored and facebook-github-bot committed Apr 23, 2021
1 parent a5bee55 commit f41574d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions API/hermes/hermes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1473,6 +1473,11 @@ jsi::Value HermesRuntimeImpl::evaluateJavaScript(
}

bool HermesRuntimeImpl::drainMicrotasks(int maxMicrotasksHint) {
if (runtime_.useJobQueue()) {
checkStatus(runtime_.drainJobs());
}
// \c drainJobs is currently an unbounded execution, hence no exceptions
// implies drained until TODO(T89426441): \c maxMicrotasksHint is supported
return true;
}

Expand Down

0 comments on commit f41574d

Please sign in to comment.