Skip to content
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

Fix some typos #91

Merged
merged 2 commits into from
Dec 2, 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
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ I always welcome your suggestion. When you publishing a suggestion, then please

- A description of the problem you're trying to solve.
- An overview of the suggested solution.
- Examples of how the suggestion whould work in various places.
- Examples of how the suggestion would work in various places.
- Code examples showing the expected behavior.


Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ You can quickly experience `TGrid` on the playground websites:
- [Remote Function Call](https://stackblitz.com/~/github.com/samchon/tgrid.example.remote-function-call?file=src/client.ts&view=editor)
- [Remote Object Call](https://stackblitz.com/~/github.com/samchon/tgrid.example.remote-object-call?file=src/client.ts&view=editor)
- [Object Oriented Network](https://stackblitz.com/~/github.com/samchon/tgrid.example.object-oriented-network?file=src/composite.ts&view=editor)
- [WebSocket Protocool](https://stackblitz.com/~/github.com/samchon/tgrid.example.websocket?file=src/client.ts&view=editor)
- [WebSocket Protocol](https://stackblitz.com/~/github.com/samchon/tgrid.example.websocket?file=src/client.ts&view=editor)
- [Worker Protocol](https://stackblitz.com/~/github.com/samchon/tgrid.example.worker?file=src/client.ts&view=editor)
- [NestJS WebSocket](https://stackblitz.com/~/github.com/samchon/tgrid.example.nestjs?file=src/calculate.test.ts&view=editor)

Expand Down
8 changes: 4 additions & 4 deletions src/components/Communicator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ export abstract class Communicator<
}

/**
* Destory the communicator.
* Destroy the communicator.
*
* A destory function must be called when the network communication has been closed.
* A destroy function must be called when the network communication has been closed.
* It would destroy all function calls in the remote system (by `Driver<Controller>`),
* which are not returned yet.
*
Expand Down Expand Up @@ -199,7 +199,7 @@ export abstract class Communicator<
* - `Driver`: Remote Function Call
*
* @template Controller An interface for provided features (functions & objects) from the remote system (`Provider`).
* @template UseParametric Whether to convert type of function parameters to be compatible with their pritimive.
* @template UseParametric Whether to convert type of function parameters to be compatible with their primitive.
* @return A Driver for the RFC.
*/
public getDriver<
Expand All @@ -219,7 +219,7 @@ export abstract class Communicator<
/**
* Join connection or timeout.
*
* Wait until the connection to be clsoed until timeout.
* Wait until the connection to be closed until timeout.
*
* @param ms The maximum milliseconds for joining.
* @return Whether awaken by disconnection or timeout.
Expand Down
2 changes: 1 addition & 1 deletion src/components/Invoke.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export namespace Invoke {
uid: number;

/**
* Target function (sometimes calsuled in objects) to call.
* Target function (sometimes capsuled in objects) to call.
*/
listener: string;

Expand Down
4 changes: 2 additions & 2 deletions src/protocols/internal/AcceptorBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Communicator } from "../../components/Communicator";
* [RFC](https://github.com/samchon/tgrid#13-remote-function-call) (Remote Function Call).
*
* Also, when declaring this {@link AcceptorBase} type, you've to define two template arguments,
* *Header* and *Provider*. The *Header* type repersents an initial data gotten from the remote
* *Header* and *Provider*. The *Header* type represents an initial data gotten from the remote
* client after the connection. I hope you and client not to omit it and utilize it as an
* activation tool to enhance security.
*
Expand Down Expand Up @@ -113,7 +113,7 @@ export abstract class AcceptorBase<
return new Error(
`Error on ${this.constructor.name}.${method}(): the connection has been closed.`,
);
// UNKNOWN ERROR, IT MAY NOT OCCURED
// UNKNOWN ERROR, IT MAY NOT OCCURRED
else
return new Error(
`Error on ${this.constructor.name}.${method}(): unknown error, but not connected.`,
Expand Down
6 changes: 3 additions & 3 deletions src/protocols/internal/ConnectorBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { Communicator } from "../../components/Communicator";
/**
* Basic Connector.
*
* The `ConnectorBase` is an abtract communicator class, who can connect to remote server who
* The `ConnectorBase` is an abstract communicator class, who can connect to remote server who
* interacts with clients using the RFC (Remote Function Call).
*
* Also, when declaring this {@link ConnectorBase} type, you've to define two template arguments,
* *Header* and *Provider*. The *Header* type repersents an initial data gotten from the remote
* *Header* and *Provider*. The *Header* type represents an initial data gotten from the remote
* client after the connection. I hope you and client not to omit it and utilize it as an
* activation tool to enhance security.
*
Expand Down Expand Up @@ -104,7 +104,7 @@ export abstract class ConnectorBase<
return new Error(
`Error on ${this.constructor.name}.${method}(): the connection has been closed.`,
);
// UNKNOWN ERROR, IT MAY NOT OCCURED
// UNKNOWN ERROR, IT MAY NOT OCCURRED
else
return new Error(
`Error on ${this.constructor.name}.${method}(): unknown error, but not connected.`,
Expand Down
6 changes: 3 additions & 3 deletions src/protocols/web/WebSocketAcceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { IWebSocketCommunicator } from "./internal/IWebSocketCommunicator";
* whether to {@link accept} the client's connection or {@link reject not},
* reading the {@link header} and {@link path} properties. If you've decided to
* accept the connection, call the {@link accept} method with `Provider` instance.
* Otherwise, reject it thorugh the {@link reject} method.
* Otherwise, reject it through the {@link reject} method.
*
* After {@link accept accepting} the connection, don't forget to
* {@link close closing} the connection after your business has been completed
Expand All @@ -34,7 +34,7 @@ import { IWebSocketCommunicator } from "./internal/IWebSocketCommunicator";
* generic arguments; `Header`, `Provider` and `Remote`. Those generic arguments must
* be same with the ones defined in the {@link WebSocketServer} class.
*
* For reference, the first `Header` type repersents an initial data from the
* For reference, the first `Header` type represents an initial data from the
* remote client after the connection. I recommend utilize it as an activation tool
* for security enhancement. The second generic argument `Provider` represents a
* provider from server to client, and the other `Remote` means a provider from the
Expand Down Expand Up @@ -247,7 +247,7 @@ export class WebSocketAcceptor<
* Send a ping message to the remote client repeatedly.
*
* The ping message would be sent every internal milliseconds, until the
* connection be disconnectedd. The remote client will reply with a pong
* connection be disconnected. The remote client will reply with a pong
* message, so that the connection would be alive until be explicitly
* disconnected.
*
Expand Down
6 changes: 3 additions & 3 deletions src/protocols/web/WebSocketConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { WebSocketPolyfill } from "./internal/WebSocketPolyfill";
* be same with the ones defined in the target {@link WebSocketServer} and
* {@link WebSocketAcceptor} classes (`Provider` and `Remote` must be reversed).
*
* For reference, the first `Header` type repersents an initial data from the
* For reference, the first `Header` type represents an initial data from the
* remote client after the connection. I recommend utilize it as an activation tool
* for security enhancement. The second generic argument `Provider` represents a
* provider from client to server, and the other `Remote` means a provider from the
Expand Down Expand Up @@ -97,7 +97,7 @@ export class WebSocketConnector<
this.state_ = WebSocketConnector.State.CONNECTING;

try {
// DO CONNNECT
// DO CONNECT
const factory = is_node()
? ((await WebSocketPolyfill()) as any)
: self.WebSocket;
Expand Down Expand Up @@ -204,7 +204,7 @@ export class WebSocketConnector<
}
});

// EVENT LISTENRES
// EVENT LISTENERS
this.socket_!.onmessage = once((evt) => {
if (expired === false) {
completed = true;
Expand Down
2 changes: 1 addition & 1 deletion src/protocols/web/WebSocketError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class WebSocketError extends Error {
* Initializer Constructor.
*
* @param status Status code.
* @param message Detailed message, the reaason why.
* @param message Detailed message, the reason why.
*/
public constructor(status: number, message: string) {
super(message);
Expand Down
10 changes: 5 additions & 5 deletions src/protocols/web/WebSocketServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { WebSocketAcceptor } from "./WebSocketAcceptor";
* would be propagated to the {@link WebSocketAcceptor}, so that
* {@link WebSocketAcceptor} would have the same generic arguments, too.
*
* For reference, the first `Header` type repersents an initial data from the
* For reference, the first `Header` type represents an initial data from the
* remote client after the connection. I recommend utilize it as an activation tool
* for security enhancement. The second generic argument `Provider` represents a
* provider from server to client, and the other `Remote` means a provider from the
Expand Down Expand Up @@ -90,7 +90,7 @@ export class WebSocketServer<
"Error on WebSocketServer.constructor(): only available in NodeJS.",
);

// PREPARE SREVER INSTANCE
// PREPARE SERVER INSTANCE
this.options_ = !!key && !!cert ? { key, cert } : null;

// INITIALIZE STATUS & PROTOCOL
Expand All @@ -109,7 +109,7 @@ export class WebSocketServer<
*
* When implementing the *handler* function with the {@link WebSocketAcceptor} instance, calls the
* {@link WebSocketAcceptor.accept} method if you want to accept the new client's connection.
* Otherwise you dont't want to accept the client and reject its connection, just calls the
* Otherwise you don't want to accept the client and reject its connection, just calls the
* {@link WebSocketAcceptor.reject} instead.
*
* @param port Port number to listen.
Expand Down Expand Up @@ -181,9 +181,9 @@ export class WebSocketServer<
*
* Close all connections between its remote clients ({@link WebSocketConnector}s).
*
* It destories all RFCs (remote function calls) between this server and remote clients
* It destroys all RFCs (remote function calls) between this server and remote clients
* (through `Driver<Controller>`) that are not returned (completed) yet. The destruction
* causes all incompleted RFCs to throw exceptions.
* causes all incomplete RFCs to throw exceptions.
*/
public async close(): Promise<void> {
// VALIDATION
Expand Down
6 changes: 3 additions & 3 deletions src/protocols/web/internal/IWebSocketCommunicator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ export interface IWebSocketCommunicator {
*
* Close connection with the remote websocket system.
*
* It destories all RFCs (remote function calls) between this and remote websocket system
* It destroys all RFCs (remote function calls) between this and remote websocket system
* (through `Driver<Controller>`) that are not returned (completed) yet. The destruction
* causes all incompleted RFCs to throw exceptions.
* causes all incomplete RFCs to throw exceptions.
*
* If parametric *code* and *reason* are specified, it means the disconnection is
* abnormal and it would throw special exceptions (`WebSocketError`) to the incompleted RFCs.
* abnormal and it would throw special exceptions (`WebSocketError`) to the incomplete RFCs.
*
* @param code Closing code.
* @param reason Reason why.
Expand Down
2 changes: 1 addition & 1 deletion src/protocols/workers/SharedWorkerAcceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { IWorkerSystem } from "./internal/IWorkerSystem";
* generic arguments; `Header`, `Provider` and `Remote`. Those generic arguments must
* be same with the ones defined in the {@link SharedWorkerServer} class.
*
* For reference, the first `Header` type repersents an initial data from the
* For reference, the first `Header` type represents an initial data from the
* remote client after the connection. I recommend utilize it as an activation tool
* for security enhancement. The second generic argument `Provider` represents a
* provider from server to client, and the other `Remote` means a provider from the
Expand Down
6 changes: 3 additions & 3 deletions src/protocols/workers/SharedWorkerConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { WebWorkerCompiler } from "./internal/WebWorkerCompiler";
* be same with the ones defined in the target {@link WebSocketServer} and
* {@link SharedWorkerAcceptor} classes (`Provider` and `Remote` must be reversed).
*
* For reference, the first `Header` type repersents an initial data from the
* For reference, the first `Header` type represents an initial data from the
* remote client after the connection. I recommend utilize it as an activation tool
* for security enhancement. The second generic argument `Provider` represents a
* provider from client to server, and the other `Remote` means a provider from the
Expand Down Expand Up @@ -109,7 +109,7 @@ export class SharedWorkerConnector<
this.state_ = SharedWorkerConnector.State.CONNECTING;

try {
// EXECUET THE WORKER
// EXECUTE THE WORKER
const worker: SharedWorker = new SharedWorker(jsFile);
this.port_ = worker.port as MessagePort;

Expand All @@ -125,7 +125,7 @@ export class SharedWorkerConnector<
// SEND HEADERS
this.port_.postMessage(JSON.stringify(IHeaderWrapper.wrap(this.header)));

// WAIT ACCEPTION OR REJECTION
// WAIT ACCESSION OR REJECTION
const last: string | SharedWorkerConnector.State.OPEN =
await this._Handshake(options.timeout, at);
if (last === SharedWorkerConnector.State.OPEN) {
Expand Down
10 changes: 5 additions & 5 deletions src/protocols/workers/SharedWorkerServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { SharedWorkerAcceptor } from "./SharedWorkerAcceptor";
*
* The `SharedWorkerServer` is a class representing a server in `SharedWorker`
* environment. Clients connecting to the `SharedWorkerServer` would communicate
* with this server through {@link SharedWorkerAcceptor} instaces using RPC
* with this server through {@link SharedWorkerAcceptor} instances using RPC
* (Remote Procedure Call) concept.
*
* To open the server, call the {@link open} method with your callback function
Expand All @@ -24,7 +24,7 @@ import { SharedWorkerAcceptor } from "./SharedWorkerAcceptor";
* would be propagated to the {@link SharedWorkerAcceptor}, so that
* {@link SharedWorkerAcceptor} would have the same generic arguments, too.
*
* For reference, the first `Header` type repersents an initial data from the
* For reference, the first `Header` type represents an initial data from the
* remote client after the connection. I recommend utilize it as an activation tool
* for security enhancement. The second generic argument `Provider` represents a
* provider from server to client, and the other `Remote` means a provider from the
Expand Down Expand Up @@ -72,7 +72,7 @@ export class SharedWorkerServer<
*
* When implementing the *handler* function with the {@link SharedWorkerServer}
* instance, calls the {@link SharedWorkerAcceptor.accept} method if you want to
* accept the new client's connection. Otherwise you dont't want to accept the
* accept the new client's connection. Otherwise you don't want to accept the
* client and reject its connection, just calls the
* {@link SharedWorkerAcceptor.reject} instead.
*
Expand Down Expand Up @@ -115,9 +115,9 @@ export class SharedWorkerServer<
*
* Close all connections between its remote clients ({@link SharedWorkerConnector}s).
*
* It destories all RFCs (remote function calls) between this server and remote clients
* It destroys all RFCs (remote function calls) between this server and remote clients
* (through `Driver<Controller>`) that are not returned (completed) yet. The destruction
* causes all incompleted RFCs to throw exceptions.
* causes all incomplete RFCs to throw exceptions.
*/
public async close(): Promise<void> {
// TEST VALIDATION
Expand Down
4 changes: 2 additions & 2 deletions src/protocols/workers/WorkerConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { WebWorkerCompiler } from "./internal/WebWorkerCompiler";
* be same with the ones defined in the target {@link WorkerServer} class
* (`Provider` and `Remote` must be reversed).
*
* For reference, the first `Header` type repersents an initial data from the
* For reference, the first `Header` type represents an initial data from the
* remote client after the connection. I recommend utilize it as an activation tool
* for security enhancement. The second generic argument `Provider` represents a
* provider from client to server, and the other `Remote` means a provider from the
Expand Down Expand Up @@ -106,7 +106,7 @@ export class WorkerConnector<
options: Partial<WorkerConnector.IConnectOptions> = {},
): Promise<void> {
//----
// PRELIMINIARIES
// PRELIMINARIES
//----
// TEST CONDITION
this._Test_connection("compile");
Expand Down
8 changes: 4 additions & 4 deletions src/protocols/workers/WorkerServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { ThreadPort } from "./internal/threads/ThreadPort";
* and communicates with client (its parent) directly.
*
* To start communication with the client, call the {@link open} method
* with `Provider` instance. After your business, don't forget {@link close cosing}
* with `Provider` instance. After your business, don't forget {@link close closing}
* this `Worker` instance. If the termination is performed by the
* {@link WorkerConnector}, you can wait the closing signal through the
* {@link join} method.
Expand All @@ -31,7 +31,7 @@ import { ThreadPort } from "./internal/threads/ThreadPort";
* be same with the ones defined in the target {@link WorkerConnector} class
* (`Provider` and `Remote` must be reversed).
*
* For reference, the first `Header` type repersents an initial data from the
* For reference, the first `Header` type represents an initial data from the
* client after the connection. I recommend utilize it as an activation tool
* for security enhancement. The second generic argument `Provider` represents a
* provider from server to client, and the other `Remote` means a provider from the
Expand Down Expand Up @@ -103,7 +103,7 @@ export class WorkerServer<
* waste of memory leak. Close this worker by yourself ({@link close}) or let
* client to close this worker ({@link WorkerConnector.close}).
*
* @param provider An object providing featrues for the client.
* @param provider An object providing features for the client.
*/
public async open(provider: Provider): Promise<void> {
// TEST CONDITION
Expand Down Expand Up @@ -242,7 +242,7 @@ export class WorkerServer<
return new Error(
"Error on WorkerServer.inspectReady(): server is on closing.",
);
// MAY NOT BE OCCURED
// MAY NOT BE OCCURRED
else if (this.state_ === WorkerServer.State.CLOSED)
return new Error(
"Error on WorkerServer.inspectReady(): the server has been closed.",
Expand Down
4 changes: 2 additions & 2 deletions src/protocols/workers/internal/IWorkerSystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ export interface IWorkerSystem {
*
* Close connection between the remote worker system.
*
* It destroies all RFCs (remote function calls) between this and the remote system
* It destroys all RFCs (remote function calls) between this and the remote system
* (through `Driver<Controller>`) that are not returned (completed) yet. The destruction
* causes all incompleted RFCs to throw exceptions.
* causes all incomplete RFCs to throw exceptions.
*/
close(): Promise<void>;
}
2 changes: 1 addition & 1 deletion src/typings/Driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { Promisive } from "./Promisive";
* - `Driver`: Remote Function Call
*
* @template Controller An interface defining features (functions & objects) provided from the remote system.
* @template UseParametric Whether to convert type of function parameters to be compatible with their pritimive.
* @template UseParametric Whether to convert type of function parameters to be compatible with their primitive.
* @author Jeongho Nam - https://github.com/samchon
*/
export type Driver<
Expand Down
2 changes: 1 addition & 1 deletion test/browser/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ async function main(): Promise<void> {
await _Paginate(browser, "worker.html");
await _Paginate(browser, "shared-worker.html");
} catch (exp) {
console.log("An error has occured");
console.log("An error has occurred");
console.log(exp);
process.exit(-1);
}
Expand Down
2 changes: 1 addition & 1 deletion test/node/protocols/web/test_web_calculator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export async function test_web_calculator(): Promise<void> {
const server: WebSocketServer<object, Calculator | Vector<number>, null> =
new WebSocketServer();
await server.open(PORT, async (acceptor) => {
// SPEICFY PROVIDER
// SPECIFY PROVIDER
const provider = /calculator/.test(acceptor.path)
? new Calculator()
: new Vector<number>();
Expand Down
2 changes: 1 addition & 1 deletion test/providers/Calculator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class Scientific implements IScientific {
}

public sqrt(x: number): number {
if (x < 0) throw new Error("Negative value on sqaure.");
if (x < 0) throw new Error("Negative value on square.");
return Math.sqrt(x);
}
}
Expand Down
Loading