Skip to content

Commit 0057558

Browse files
committed
Add availability annotations
1 parent 7aeffbf commit 0057558

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

Sources/JavaScriptKit/BasicObjects/JSPromise.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ public final class JSPromise: JSBridgedClass {
7777

7878
#if compiler(>=5.5)
7979
/// Schedules the `success` closure to be invoked on successful completion of `self`.
80+
@available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *)
8081
@discardableResult
8182
public func then(success: @escaping (JSValue) async -> ConvertibleToJSValue) -> JSPromise {
8283
let closure = JSOneshotClosure.async {
@@ -101,6 +102,7 @@ public final class JSPromise: JSBridgedClass {
101102

102103
#if compiler(>=5.5)
103104
/// Schedules the `success` closure to be invoked on successful completion of `self`.
105+
@available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *)
104106
@discardableResult
105107
public func then(success: @escaping (JSValue) async -> ConvertibleToJSValue,
106108
failure: @escaping (JSValue) async -> ConvertibleToJSValue) -> JSPromise {
@@ -125,6 +127,7 @@ public final class JSPromise: JSBridgedClass {
125127

126128
#if compiler(>=5.5)
127129
/// Schedules the `failure` closure to be invoked on rejected completion of `self`.
130+
@available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *)
128131
@discardableResult
129132
public func `catch`(failure: @escaping (JSValue) async -> ConvertibleToJSValue) -> JSPromise {
130133
let closure = JSOneshotClosure.async {

Sources/JavaScriptKit/FundamentalObjects/JSClosure.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ public class JSClosure: JSObject, JSClosureProtocol {
9191
}
9292

9393
#if compiler(>=5.5)
94+
@available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *)
9495
static func async(_ body: @escaping ([JSValue]) async throws -> JSValue) -> JSClosure {
9596
JSClosure(makeAsyncClosure(body))
9697
}
@@ -106,6 +107,7 @@ public class JSClosure: JSObject, JSClosureProtocol {
106107
}
107108

108109
#if compiler(>=5.5)
110+
@available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *)
109111
private func makeAsyncClosure(_ body: @escaping ([JSValue]) async throws -> JSValue) -> (([JSValue]) -> JSValue) {
110112
{ arguments in
111113
JSPromise { resolver in

0 commit comments

Comments
 (0)