async-call-rpc

A lightweight JSON RPC client & server

Home > async-call-rpc > EventBasedChannel > on

EventBasedChannel.on() method

Register the message listener.

Signature:

on(listener: (data: Data, hint?: 'request' | 'response' | undefined) => void): void | (() => void);

Parameters

Parameter Type Description
listener (data: Data, hint?: ‘request’ | ‘response’ | undefined) => void The message listener.

Returns:

void | (() => void)

a function that unregister the listener.