Skip to content

Commit 888de17

Browse files
Remove enqueueMainJob
1 parent a0c4602 commit 888de17

File tree

1 file changed

+1
-16
lines changed

1 file changed

+1
-16
lines changed

Sources/JavaScriptEventLoop/JavaScriptEventLoop.swift

+1-16
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public final class JavaScriptEventLoop: SerialExecutor, @unchecked Sendable {
150150

151151
typealias swift_task_enqueueMainExecutor_hook_Fn = @convention(thin) (UnownedJob, swift_task_enqueueMainExecutor_original) -> Void
152152
let swift_task_enqueueMainExecutor_hook_impl: swift_task_enqueueMainExecutor_hook_Fn = { job, original in
153-
JavaScriptEventLoop.enqueueMainJob(job)
153+
JavaScriptEventLoop.shared.unsafeEnqueue(job)
154154
}
155155
swift_task_enqueueMainExecutor_hook = unsafeBitCast(swift_task_enqueueMainExecutor_hook_impl, to: UnsafeMutableRawPointer?.self)
156156

@@ -188,21 +188,6 @@ public final class JavaScriptEventLoop: SerialExecutor, @unchecked Sendable {
188188
public func asUnownedSerialExecutor() -> UnownedSerialExecutor {
189189
return UnownedSerialExecutor(ordinary: self)
190190
}
191-
192-
public static func enqueueMainJob(_ job: consuming ExecutorJob) {
193-
self.enqueueMainJob(UnownedJob(job))
194-
}
195-
196-
static func enqueueMainJob(_ job: UnownedJob) {
197-
let currentEventLoop = JavaScriptEventLoop.shared
198-
if currentEventLoop === JavaScriptEventLoop.mainThreadEventLoop {
199-
currentEventLoop.unsafeEnqueue(job)
200-
} else {
201-
// Notify the main thread to execute the job
202-
let jobBitPattern = unsafeBitCast(job, to: UInt.self)
203-
_ = JSObject.global.postMessage!(jobBitPattern)
204-
}
205-
}
206191
}
207192

208193
#if compiler(>=5.7)

0 commit comments

Comments
 (0)