From 488f9738ecae5b05fe01481c3aff7d2984b75c44 Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Sun, 30 Aug 2020 10:46:05 +0900 Subject: [PATCH] Allow non-body mount host node --- Sources/TokamakDOM/App/App.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Sources/TokamakDOM/App/App.swift b/Sources/TokamakDOM/App/App.swift index 27c07b43e..3b5266d2e 100644 --- a/Sources/TokamakDOM/App/App.swift +++ b/Sources/TokamakDOM/App/App.swift @@ -21,6 +21,9 @@ import TokamakCore import TokamakStaticHTML extension App { + public static func _launch(_ app: Self, _ rootEnvironment: EnvironmentValues) { + _launch(app, rootEnvironment, TokamakDOM.body) + } /// The default implementation of `launch` for a `TokamakDOM` app. /// /// Creates a host `div` node and appends it to the body. @@ -28,8 +31,7 @@ extension App { /// The body is styled with `margin: 0;` to match the `SwiftUI` layout /// system as closely as possible /// - public static func _launch(_ app: Self, _ rootEnvironment: EnvironmentValues) { - let body = TokamakDOM.body + public static func _launch(_ app: Self, _ rootEnvironment: EnvironmentValues, _ body: JSObjectRef) { if body.style.object!.all == "" { body.style = "margin: 0;" }