Index: include/v8.h |
diff --git a/include/v8.h b/include/v8.h |
index 6d1c8d87eefe7294a03bb37dd38b7de7f88ff865..d9c2cca14db21e52b88a540c38a7ffa16ec08529 100644 |
--- a/include/v8.h |
+++ b/include/v8.h |
@@ -5047,7 +5047,8 @@ class PromiseRejectMessage { |
typedef void (*PromiseRejectCallback)(PromiseRejectMessage message); |
-// --- Microtask Callback --- |
+// --- Microtasks Callbacks --- |
+typedef void (*MicrotasksCompletedCallback)(Isolate*); |
typedef void (*MicrotaskCallback)(void* data); |
// --- Failed Access Check Callback --- |
@@ -5888,6 +5889,25 @@ class V8_EXPORT Isolate { |
bool WillAutorunMicrotasks() const; |
/** |
+ * Experimental: adds a callback to notify the host application after |
+ * microtasks were run. The callback is triggered by explicit RunMicrotasks |
+ * call or automatic microtasks execution (see SetAutorunMicrotasks). |
+ * |
+ * Callback will trigger even if microtasks were attempted to run, |
+ * but the microtasks queue was empty and no single microtask was actually |
+ * executed. |
+ * |
+ * Executing scriptsinside the callback will not re-trigger microtasks and |
+ * the callback. |
+ */ |
+ void AddMicrotasksCompletedCallback(MicrotasksCompletedCallback callback); |
+ |
+ /** |
+ * Removes callback that was installed by AddMicrotasksCompletedCallback. |
+ */ |
+ void RemoveMicrotasksCompletedCallback(MicrotasksCompletedCallback callback); |
+ |
+ /** |
* Sets a callback for counting the number of times a feature of V8 is used. |
*/ |
void SetUseCounterCallback(UseCounterCallback callback); |