Skip to content

Commit 3b93924

Browse files
Apply suggestions from code review
Co-authored-by: Jed Fox <git@jedfox.com>
1 parent 65658bd commit 3b93924

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

Diff for: Sources/JavaScriptKit/FundamentalObjects/JSClosure.swift

+3-5
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public class JSClosure: JSOneshotClosure {
5656

5757
var isReleased: Bool = false
5858

59-
@available(*, deprecated, message: "This initializer will be removed in the next minor version update. Please use `init(_ body: @escaping ([JSValue]) -> JSValue)`")
59+
@available(*, deprecated, message: "This initializer will be removed in the next minor version update. Please use `init(_ body: @escaping ([JSValue]) -> JSValue)` and add `return .undefined` to the end of your closure")
6060
@_disfavoredOverload
6161
public init(_ body: @escaping ([JSValue]) -> ()) {
6262
super.init({
@@ -80,10 +80,8 @@ public class JSClosure: JSOneshotClosure {
8080

8181
deinit {
8282
guard isReleased else {
83-
fatalError("""
84-
release() must be called on closures manually before deallocating.
85-
This is caused by the lack of support for the `FinalizationRegistry` API in Safari.
86-
""")
83+
// Safari doesn't support `FinalizationRegistry`, so we cannot automatically manage the lifetime of Swift objects
84+
fatalError("release() must be called on JSClosure objects manually before they are deallocated")
8785
}
8886
}
8987
}

0 commit comments

Comments
 (0)