Index: src/d8.cc |
diff --git a/src/d8.cc b/src/d8.cc |
index 9466ab7d3a727c2fe12d70ac977df0b0cac57f35..c0fc2881ae05eaf19276f22e51b37aa26635dc5e 100644 |
--- a/src/d8.cc |
+++ b/src/d8.cc |
@@ -887,6 +887,10 @@ void Shell::Version(const v8::FunctionCallbackInfo<v8::Value>& args) { |
NewStringType::kNormal).ToLocalChecked()); |
} |
+void Shell::FlushMicrotasks(const v8::FunctionCallbackInfo<v8::Value>& args) { |
+ Isolate* isolate = args.GetIsolate(); |
+ isolate->RunMicrotasks(); |
+} |
void Shell::ReportException(Isolate* isolate, v8::TryCatch* try_catch) { |
HandleScope handle_scope(isolate); |
@@ -1204,6 +1208,11 @@ Local<ObjectTemplate> Shell::CreateGlobalTemplate(Isolate* isolate) { |
.ToLocalChecked(), |
os_templ); |
+ global_template->Set( |
+ String::NewFromUtf8(isolate, "flushMicrotasks", NewStringType::kNormal) |
+ .ToLocalChecked(), |
+ FunctionTemplate::New(isolate, FlushMicrotasks)); |
+ |
return global_template; |
} |