Skip to content

Commit

Permalink
Fix host build
Browse files Browse the repository at this point in the history
  • Loading branch information
kateinoigakukun committed May 8, 2024
1 parent 36408f5 commit d8e3a89
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift
Original file line number Diff line number Diff line change
Expand Up @@ -225,3 +225,8 @@ public extension JSPromise {
}

#endif

// See `Sources/JavaScriptKit/XcodeSupport.swift` for rationale of the stub functions.
#if !arch(wasm32)
func _unsafe_event_loop_yield() { fatalError() }
#endif
8 changes: 4 additions & 4 deletions Sources/JavaScriptKit/XcodeSupport.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import _CJavaScriptKit

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

0 comments on commit d8e3a89

Please sign in to comment.