Skip to content

Commit

Permalink
Changed template name Remote to Listener.
Browse files Browse the repository at this point in the history
For clear naming.
  • Loading branch information
samchon committed Apr 29, 2024
1 parent 9f23125 commit 791ba36
Show file tree
Hide file tree
Showing 12 changed files with 41 additions and 37 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tgrid",
"version": "0.11.0",
"version": "0.11.1",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
"exports": {
Expand Down
6 changes: 3 additions & 3 deletions src/components/Communicator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ import { Invoke } from "./Invoke";
* - {@link sendData}
*
* @template Provider Type of features provided for remote system.
* @template Remote Type of features supported by remote system, used for {@link getDriver} function.
* @template Listener Type of features supported by remote system, used for {@link getDriver} function.
* @author Jeongho Nam - https://github.com/samchon
*/
export abstract class Communicator<
Provider extends object | null | undefined,
Remote extends object | null,
Listener extends object | null,
> {
/**
* @hidden
Expand Down Expand Up @@ -209,7 +209,7 @@ export abstract class Communicator<
* @return A Driver for the RFC.
*/
public getDriver<
Controller extends NonNullable<Remote> = NonNullable<Remote>,
Controller extends NonNullable<Listener> = NonNullable<Listener>,
UseParametric extends boolean = false,
>(): Driver<Controller, UseParametric> {
return this.driver_ as Driver<Controller, UseParametric>;
Expand Down
6 changes: 3 additions & 3 deletions src/protocols/internal/AcceptorBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ import { Communicator } from "../../components/Communicator";
*
* @template Header Type of the header containing initial data.
* @template Provider Type of features provided for the remote system.
* @template Remote Type of features supported by remote system, used for {@link getDriver} function.
* @template Listener Type of features supported by remote system, used for {@link getDriver} function.
* @author Jeongho Nam - https://github.com/samchon
*/
export abstract class AcceptorBase<
Header,
Provider extends object | null,
Remote extends object | null,
> extends Communicator<Provider | undefined, Remote> {
Listener extends object | null,
> extends Communicator<Provider | undefined, Listener> {
/**
* @hidden
*/
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 @@ -19,14 +19,14 @@ import { Communicator } from "../../components/Communicator";
*
* @template Header Type of the header containing initial data.
* @template Provider Type of additional features provided for the remote system.
* @template Remote Type of features supported by remote system, used for {@link getDriver} function.
* @template Listener Type of features supported by remote system, used for {@link getDriver} function.
* @author Jeongho Nam - https://github.com/samchon
*/
export abstract class ConnectorBase<
Header,
Provider extends object | null,
Remote extends object | null,
> extends Communicator<Provider, Remote> {
Listener extends object | null,
> extends Communicator<Provider, Listener> {
/**
* @hidden
*/
Expand Down
6 changes: 3 additions & 3 deletions src/protocols/web/WebAcceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ import { IWebCommunicator } from "./internal/IWebCommunicator";
*
* @template Header Type of the header containing initial data.
* @template Provider Type of features provided for the remote system.
* @template Remote Type of features supported by remote system, used for {@link getDriver} function.
* @template Listener Type of features supported by remote system, used for {@link getDriver} function.
* @author Jeongho Nam - https://github.com/samchon
*/
export class WebAcceptor<
Header,
Provider extends object | null,
Remote extends object | null,
Listener extends object | null,
>
extends AcceptorBase<Header, Provider, Remote>
extends AcceptorBase<Header, Provider, Listener>
implements IWebCommunicator
{
/**
Expand Down
6 changes: 3 additions & 3 deletions src/protocols/web/WebConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ import { WebSocketPolyfill } from "./internal/WebSocketPolyfill";
*
* @template Header Type of the header containing initial data.
* @template Provider Type of features provided for the remote system.
* @template Remote Type of features supported by remote system, used for {@link getDriver} function.
* @template Listener Type of features supported by remote system, used for {@link getDriver} function.
* @author Jeongho Nam - https://github.com/samchon
*/
export class WebConnector<
Header,
Provider extends object | null,
Remote extends object | null,
Listener extends object | null,
>
extends ConnectorBase<Header, Provider, Remote>
extends ConnectorBase<Header, Provider, Listener>
implements IWebCommunicator
{
/**
Expand Down
8 changes: 5 additions & 3 deletions src/protocols/web/WebServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ import { WebAcceptor } from "./WebAcceptor";
*
* @template Header Type of header containing initialization data like activation.
* @template Provider Type of features provided for the remote systems.
* @template Remote Type of features supported by remote system, used for {@link getDriver} function.
* @template Listener Type of features supported by remote system, used for {@link getDriver} function.
* @author Jeongho Nam - https://github.com/samchon
*/
export class WebServer<
Header,
Provider extends object | null,
Remote extends object | null,
Listener extends object | null,
> implements IServer<WebServer.State>
{
/**
Expand Down Expand Up @@ -113,7 +113,9 @@ export class WebServer<
*/
public async open(
port: number,
handler: (acceptor: WebAcceptor<Header, Provider, Remote>) => Promise<void>,
handler: (
acceptor: WebAcceptor<Header, Provider, Listener>,
) => Promise<void>,
): Promise<void> {
//----
// PRELIMINARIES
Expand Down
6 changes: 3 additions & 3 deletions src/protocols/workers/SharedWorkerAcceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ import { IWorkerSystem } from "./internal/IWorkerSystem";
*
* @template Header Type of the header containing initial data.
* @template Provider Type of features provided for the remote system.
* @template Remote Type of features supported by remote system, used for {@link getDriver} function.
* @template Listener Type of features supported by remote system, used for {@link getDriver} function.
* @author Jeongho Nam - https://github.com/samchon
*/
export class SharedWorkerAcceptor<
Header,
Provider extends object | null,
Remote extends object | null,
Listener extends object | null,
>
extends AcceptorBase<Header, Provider, Remote>
extends AcceptorBase<Header, Provider, Listener>
implements IWorkerSystem
{
/**
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 @@ -41,15 +41,15 @@ import { WebWorkerCompiler } from "./internal/WebWorkerCompiler";
*
* @template Header Type of the header containing initial data.
* @template Provider Type of features provided for the remote system.
* @template Remote Type of features supported by remote system, used for {@link getDriver} function.
* @template Listener Type of features supported by remote system, used for {@link getDriver} function.
* @author Jeongho Nam - https://github.com/samchon
*/
export class SharedWorkerConnector<
Header,
Provider extends object | null,
Remote extends object | null,
Listener extends object | null,
>
extends ConnectorBase<Header, Provider, Remote>
extends ConnectorBase<Header, Provider, Listener>
implements IWorkerSystem
{
/**
Expand Down
14 changes: 8 additions & 6 deletions src/protocols/workers/SharedWorkerServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ import { SharedWorkerAcceptor } from "./SharedWorkerAcceptor";
*
* @template Header Type of the header containing initial data.
* @template Provider Type of features provided for the remote system.
* @template Remote Type of features supported by remote system, used for {@link getDriver} function.
* @template Listener Type of features supported by remote system, used for {@link getDriver} function.
* @author Jeongho Nam - https://github.com/samchon
*/
export class SharedWorkerServer<
Header,
Provider extends object | null,
Remote extends object | null,
Listener extends object | null,
> implements IServer<SharedWorkerServer.State>
{
/**
Expand All @@ -50,7 +50,7 @@ export class SharedWorkerServer<
/**
* @hidden
*/
private acceptors_: HashSet<SharedWorkerAcceptor<Header, Provider, Remote>>;
private acceptors_: HashSet<SharedWorkerAcceptor<Header, Provider, Listener>>;

/* ----------------------------------------------------------------
CONSTRUCTOR
Expand Down Expand Up @@ -79,7 +79,7 @@ export class SharedWorkerServer<
*/
public async open(
handler: (
acceptor: SharedWorkerAcceptor<Header, Provider, Remote>,
acceptor: SharedWorkerAcceptor<Header, Provider, Listener>,
) => Promise<void>,
): Promise<void> {
// TEST CONDITION
Expand Down Expand Up @@ -134,15 +134,17 @@ export class SharedWorkerServer<
*/
private _Handle_connect(
port: MessagePort,
handler: (acceptor: SharedWorkerAcceptor<Header, Provider, Remote>) => any,
handler: (
acceptor: SharedWorkerAcceptor<Header, Provider, Listener>,
) => any,
): void {
port.onmessage = once((evt) => {
// ARGUMENTS
const wrapper: IHeaderWrapper<Header> = JSON.parse(evt.data);

// CREATE ACCEPTOR
/* eslint-disable */
let acceptor: SharedWorkerAcceptor<Header, Provider, Remote>;
let acceptor: SharedWorkerAcceptor<Header, Provider, Listener>;
acceptor = SharedWorkerAcceptor.create(port, wrapper.header, () => {
this.acceptors_.erase(acceptor);
});
Expand Down
6 changes: 3 additions & 3 deletions src/protocols/workers/WorkerConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ import { WebWorkerCompiler } from "./internal/WebWorkerCompiler";
*
* @template Header Type of header containing initialization data like activation.
* @template Provider Type of features provided for remote system.
* @template Remote Type of features supported by remote system, used for {@link getDriver} function.
* @template Listener Type of features supported by remote system, used for {@link getDriver} function.
* @author Jeongho Nam - https://github.com/samchon
*/
export class WorkerConnector<
Header,
Provider extends object | null,
Remote extends object | null,
Listener extends object | null,
>
extends ConnectorBase<Header, Provider, Remote>
extends ConnectorBase<Header, Provider, Listener>
implements IWorkerSystem
{
/**
Expand Down
6 changes: 3 additions & 3 deletions src/protocols/workers/WorkerServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ import { ThreadPort } from "./internal/threads/ThreadPort";
*
* @template Header Type of header containing initialization data like activation.
* @template Provider Type of features provided for remote system.
* @template Remote Type of features supported by remote system, used for {@link getDriver} function.
* @template Listener Type of features supported by remote system, used for {@link getDriver} function.
* @author Jeongho Nam - https://github.com/samchon
*/
export class WorkerServer<
Header,
Provider extends object | null,
Remote extends object | null,
Listener extends object | null,
>
extends Communicator<Provider | undefined, Remote>
extends Communicator<Provider | undefined, Listener>
implements IWorkerSystem, IServer<WorkerServer.State>
{
/**
Expand Down

0 comments on commit 791ba36

Please sign in to comment.