Skip to content

Fix some typos #260

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Runtime/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ export type SwiftRuntimeThreadChannel =
*/
postMessageToWorkerThread: (tid: number, message: MainToWorkerMessage) => void;
/**
* This function is expected to be set in the main thread and shuold listen
* to messsages sent by `postMessageToMainThread` from the worker thread.
* This function is expected to be set in the main thread and should listen
* to messages sent by `postMessageToMainThread` from the worker thread.
* @param tid The thread ID of the worker thread.
* @param listener The listener function to be called when a message is received from the worker thread.
*/
Expand Down
6 changes: 3 additions & 3 deletions Sources/JavaScriptEventLoop/WebWorkerTaskExecutor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -384,12 +384,12 @@ public final class WebWorkerTaskExecutor: TaskExecutor {
/// Executor global statistics
internal struct ExecutorStats: CustomStringConvertible {
var sendJobToMainThread: Int = 0
var recieveJobFromWorkerThread: Int = 0
var receiveJobFromWorkerThread: Int = 0
var enqueueGlobal: Int = 0
var enqueueExecutor: Int = 0

var description: String {
"ExecutorStats(sendWtoM: \(sendJobToMainThread), recvWfromM: \(recieveJobFromWorkerThread)), enqueueGlobal: \(enqueueGlobal), enqueueExecutor: \(enqueueExecutor)"
"ExecutorStats(sendWtoM: \(sendJobToMainThread), recvWfromM: \(receiveJobFromWorkerThread)), enqueueGlobal: \(enqueueGlobal), enqueueExecutor: \(enqueueExecutor)"
}
}
#if JAVASCRIPTKIT_STATS
Expand Down Expand Up @@ -456,7 +456,7 @@ public final class WebWorkerTaskExecutor: TaskExecutor {
@available(macOS 15.0, iOS 18.0, watchOS 11.0, tvOS 18.0, visionOS 2.0, *)
@_expose(wasm, "swjs_enqueue_main_job_from_worker")
func _swjs_enqueue_main_job_from_worker(_ job: UnownedJob) {
WebWorkerTaskExecutor.traceStatsIncrement(\.recieveJobFromWorkerThread)
WebWorkerTaskExecutor.traceStatsIncrement(\.receiveJobFromWorkerThread)
JavaScriptEventLoop.shared.enqueue(ExecutorJob(job))
}

Expand Down
6 changes: 3 additions & 3 deletions Sources/JavaScriptKit/FundamentalObjects/JSClosure.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ public class JSOneshotClosure: JSObject, JSClosureProtocol {
///
/// e.g.
/// ```swift
/// let eventListenter = JSClosure { _ in
/// let eventListener = JSClosure { _ in
/// ...
/// return JSValue.undefined
/// }
///
/// button.addEventListener!("click", JSValue.function(eventListenter))
/// button.addEventListener!("click", JSValue.function(eventListener))
/// ...
/// button.removeEventListener!("click", JSValue.function(eventListenter))
/// button.removeEventListener!("click", JSValue.function(eventListener))
/// ```
///
public class JSClosure: JSFunction, JSClosureProtocol {
Expand Down
8 changes: 4 additions & 4 deletions Sources/JavaScriptKit/FundamentalObjects/JSString.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ public struct JSString: LosslessStringConvertible, Equatable {
/// The initializers of this type must initialize `jsRef` or `buffer`.
/// And the uninitialized one will be lazily initialized
class Guts {
var shouldDealocateRef: Bool = false
var shouldDeallocateRef: Bool = false
lazy var jsRef: JavaScriptObjectRef = {
self.shouldDealocateRef = true
self.shouldDeallocateRef = true
return buffer.withUTF8 { bufferPtr in
return swjs_decode_string(bufferPtr.baseAddress!, Int32(bufferPtr.count))
}
Expand All @@ -47,11 +47,11 @@ public struct JSString: LosslessStringConvertible, Equatable {

init(from jsRef: JavaScriptObjectRef) {
self.jsRef = jsRef
self.shouldDealocateRef = true
self.shouldDeallocateRef = true
}

deinit {
guard shouldDealocateRef else { return }
guard shouldDeallocateRef else { return }
swjs_release(jsRef)
}
}
Expand Down
8 changes: 4 additions & 4 deletions Sources/JavaScriptKit/JSValue.swift
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,15 @@ public extension JSValue {
/// into below code.
///
/// ```swift
/// let eventListenter = JSClosure { _ in
/// let eventListener = JSClosure { _ in
/// ...
/// return JSValue.undefined
/// }
///
/// button.addEventListener!("click", JSValue.function(eventListenter))
/// button.addEventListener!("click", JSValue.function(eventListener))
/// ...
/// button.removeEventListener!("click", JSValue.function(eventListenter))
/// eventListenter.release()
/// button.removeEventListener!("click", JSValue.function(eventListener))
/// eventListener.release()
/// ```
@available(*, deprecated, message: "Please create JSClosure directly and manage its lifetime manually.")
static func function(_ body: @escaping ([JSValue]) -> JSValue) -> JSValue {
Expand Down
2 changes: 1 addition & 1 deletion Sources/_CJavaScriptKit/include/_CJavaScriptKit.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ typedef struct {
typedef unsigned JavaScriptPayload1;
typedef double JavaScriptPayload2;

/// `RawJSValue` is abstract representaion of JavaScript primitive value.
/// `RawJSValue` is abstract representation of JavaScript primitive value.
///
/// For boolean value:
/// payload1: 1 or 0
Expand Down
2 changes: 1 addition & 1 deletion ci/perf-tester/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ async function run(octokit, context) {
}

console.log(
`PR #${pull_number} is targetted at ${pr.base.ref} (${pr.base.sha})`
`PR #${pull_number} is targeted at ${pr.base.ref} (${pr.base.sha})`
);

startGroup(`[current] Build using '${config.buildScript}'`);
Expand Down