Skip to content

Commit 02390f5

Browse files
./Utilities/format.swift
1 parent 511ebc5 commit 02390f5

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

Sources/JavaScriptKit/FundamentalObjects/JSClosure.swift

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ public class JSOneshotClosure: JSObject, JSClosureProtocol {
5252
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
5353
public static func async(
5454
priority: TaskPriority? = nil,
55-
file: String = #fileID, line: UInt32 = #line,
55+
file: String = #fileID,
56+
line: UInt32 = #line,
5657
_ body: sending @escaping (sending [JSValue]) async throws(JSException) -> JSValue
5758
) -> JSOneshotClosure {
5859
JSOneshotClosure(file: file, line: line, makeAsyncClosure(priority: priority, body))
@@ -68,10 +69,15 @@ public class JSOneshotClosure: JSObject, JSClosureProtocol {
6869
public static func async(
6970
executorPreference taskExecutor: (any TaskExecutor)? = nil,
7071
priority: TaskPriority? = nil,
71-
file: String = #fileID, line: UInt32 = #line,
72+
file: String = #fileID,
73+
line: UInt32 = #line,
7274
_ body: @Sendable @escaping (sending [JSValue]) async throws(JSException) -> JSValue
7375
) -> JSOneshotClosure {
74-
JSOneshotClosure(file: file, line: line, makeAsyncClosure(executorPreference: taskExecutor, priority: priority, body))
76+
JSOneshotClosure(
77+
file: file,
78+
line: line,
79+
makeAsyncClosure(executorPreference: taskExecutor, priority: priority, body)
80+
)
7581
}
7682
#endif
7783

@@ -168,7 +174,8 @@ public class JSClosure: JSFunction, JSClosureProtocol {
168174
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
169175
public static func async(
170176
priority: TaskPriority? = nil,
171-
file: String = #fileID, line: UInt32 = #line,
177+
file: String = #fileID,
178+
line: UInt32 = #line,
172179
_ body: sending @escaping @isolated(any) (sending [JSValue]) async throws(JSException) -> JSValue
173180
) -> JSClosure {
174181
JSClosure(file: file, line: line, makeAsyncClosure(priority: priority, body))
@@ -184,7 +191,8 @@ public class JSClosure: JSFunction, JSClosureProtocol {
184191
public static func async(
185192
executorPreference taskExecutor: (any TaskExecutor)? = nil,
186193
priority: TaskPriority? = nil,
187-
file: String = #fileID, line: UInt32 = #line,
194+
file: String = #fileID,
195+
line: UInt32 = #line,
188196
_ body: sending @escaping (sending [JSValue]) async throws(JSException) -> JSValue
189197
) -> JSClosure {
190198
JSClosure(file: file, line: line, makeAsyncClosure(executorPreference: taskExecutor, priority: priority, body))

Tests/JavaScriptEventLoopTests/JSClosure+AsyncTests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class JSClosureAsyncTests: XCTestCase {
7272
)!.value()
7373
XCTAssertEqual(result, 42.0)
7474
}
75-
75+
7676
func testAsyncOneshotClosureWithPriority() async throws {
7777
let priority = UnsafeSendableBox<TaskPriority?>(nil)
7878
let closure = JSOneshotClosure.async(priority: .high) { _ in
@@ -83,7 +83,7 @@ class JSClosureAsyncTests: XCTestCase {
8383
XCTAssertEqual(result, 42.0)
8484
XCTAssertEqual(priority.value, .high)
8585
}
86-
86+
8787
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
8888
func testAsyncOneshotClosureWithTaskExecutor() async throws {
8989
let executor = AnyTaskExecutor()
@@ -93,7 +93,7 @@ class JSClosureAsyncTests: XCTestCase {
9393
let result = try await JSPromise(from: closure.function!())!.value()
9494
XCTAssertEqual(result, 42.0)
9595
}
96-
96+
9797
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
9898
func testAsyncOneshotClosureWithTaskExecutorPreference() async throws {
9999
let executor = AnyTaskExecutor()

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy