Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 170ff51

Browse filesBrowse files
Use availablility guarded APIs under available attr for Xcode development
Co-authored-by: Valeriy Van <github@w7software.com>
1 parent d2f0765 commit 170ff51
Copy full SHA for 170ff51

2 files changed

+8Lines changed: 8 additions & 0 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift‎

Copy file name to clipboardExpand all lines: Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import JavaScriptKit
22
import _CJavaScriptEventLoop
33

4+
// NOTE: `@available` annotations are semantically wrong, but they make it easier to develop applications targeting WebAssembly in Xcode.
5+
46
#if compiler(>=5.5)
57

8+
@available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *)
69
public final class JavaScriptEventLoop: SerialExecutor, @unchecked Sendable {
710

811
/// A function that queues a given closure as a microtask into JavaScript event loop.
@@ -94,6 +97,7 @@ public final class JavaScriptEventLoop: SerialExecutor, @unchecked Sendable {
9497
}
9598
}
9699

100+
@available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *)
97101
public extension JSPromise {
98102
/// Wait for the promise to complete, returning (or throwing) its result.
99103
var value: JSValue {
Collapse file

‎Sources/JavaScriptEventLoop/JobQueue.swift‎

Copy file name to clipboardExpand all lines: Sources/JavaScriptEventLoop/JobQueue.swift
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@
55
import _CJavaScriptEventLoop
66

77
#if compiler(>=5.5)
8+
9+
@available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *)
810
struct QueueState: Sendable {
911
fileprivate var headJob: UnownedJob? = nil
1012
fileprivate var isSpinning: Bool = false
1113
}
1214

15+
@available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *)
1316
extension JavaScriptEventLoop {
1417

1518
func insertJobQueue(job newJob: UnownedJob) {
@@ -55,6 +58,7 @@ extension JavaScriptEventLoop {
5558
}
5659
}
5760

61+
@available(macOS 12.0, iOS 15.0, watchOS 8.0, tvOS 15.0, *)
5862
fileprivate extension UnownedJob {
5963
private func asImpl() -> UnsafeMutablePointer<_CJavaScriptEventLoop.Job> {
6064
unsafeBitCast(self, to: UnsafeMutablePointer<_CJavaScriptEventLoop.Job>.self)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.