Skip to content

Commit d8e3a89

Browse files
Fix host build
1 parent 36408f5 commit d8e3a89

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift

+5
Original file line numberDiff line numberDiff line change
@@ -225,3 +225,8 @@ public extension JSPromise {
225225
}
226226

227227
#endif
228+
229+
// See `Sources/JavaScriptKit/XcodeSupport.swift` for rationale of the stub functions.
230+
#if !arch(wasm32)
231+
func _unsafe_event_loop_yield() { fatalError() }
232+
#endif

Sources/JavaScriptKit/XcodeSupport.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import _CJavaScriptKit
22

33
/// Note:
4-
/// Define all runtime function stubs which are imported from JavaScript environment.
5-
/// SwiftPM doesn't support WebAssembly target yet, so we need to define them to
6-
/// avoid link failure.
7-
/// When running with JavaScript runtime library, they are ignored completely.
4+
/// Define stubs for runtime functions which are usually imported from JavaScript environment.
5+
/// JavaScriptKit itself supports only WebAssembly target, but it should be able
6+
/// to be built for host platforms like macOS or Linux for tentative IDE support.
7+
/// (ideally, IDE should build for WebAssembly target though)
88
#if !arch(wasm32)
99
func _set_prop(
1010
_: JavaScriptObjectRef,

0 commit comments

Comments
 (0)