Skip to content

@halone/sdk / Connection

Class: Connection ​

Constructors ​

Constructor ​

ts
new Connection(port, windowId): Connection;

Parameters ​

port ​

MessagePort

windowId ​

string

Returns ​

Connection

Properties ​

windowId ​

ts
readonly windowId: string;

Methods ​

call() ​

ts
call<M>(method, ...args): Promise<Result<M>>;

Type Parameters ​

M ​

M extends keyof Methods

Parameters ​

method ​

M

args ​

...Params<M> extends void ? [] : [Params<M>]

Returns ​

Promise<Result<M>>


close() ​

ts
close(): void;

Returns ​

void


on() ​

ts
on<E>(name, listener): () => void;

Type Parameters ​

E ​

E extends keyof Events

Parameters ​

name ​

E

listener ​

(data) => void

Returns ​

() => void

Released under the MIT License.