Enable async/await in DOM Fiber renderer

This commit is contained in:
Lukas 2022-09-18 03:50:22 +02:00 committed by GitHub
parent af810902bd
commit cf8e508d09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -16,6 +16,7 @@
//
import Foundation
import JavaScriptEventLoop
import JavaScriptKit
import OpenCombineJS
import OpenCombineShim
@ -97,6 +98,10 @@ public struct DOMFiberRenderer: FiberRenderer {
}
public init(_ rootSelector: String, useDynamicLayout: Bool = true) {
if #available(macOS 10.15, *) {
JavaScriptEventLoop.installGlobalExecutor()
}
guard let reference = document.querySelector!(rootSelector).object else {
fatalError("""
The root element with selector '\(rootSelector)' could not be found. \