Close #90: add Communicator.on()
message with event types.
#92
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces several enhancements and new features to the
Communicator
class, focusing on adding event listeners for various RPC invocation events and updating the handling of function calls and returns. The most important changes include the addition of event listeners, modifications to theInvoke
andInvokeEvent
types, and updates to theCommunicator
class to support these new features.Enhancements to event handling:
src/components/Communicator.ts
: Added event listeners for "send", "receive", "complete", and "return" events. Theon
andoff
methods were introduced to manage these listeners. [1] [2] [3] [4] [5] [6]Updates to
Invoke
andInvokeEvent
types:src/components/Invoke.ts
: Made theuid
,listener
, andsuccess
properties readonly. [1] [2]src/components/InvokeEvent.ts
: Introduced theInvokeEvent
type and its associated interfaces to represent different RPC invocation events.Codebase improvements:
src/components/Communicator.ts
: Refactored the_Handle_function
and_Handle_complete
methods to call event listeners and handle events more effectively. [1] [2]src/components/Communicator.ts
: Renamed_Handle_return
to_Handle_complete
and updated its logic to include event listener calls.Version update:
package.json
: Updated the version from1.0.3
to1.1.0
to reflect the new features and improvements.New test cases:
test/node/protocols/web/test_web_event.ts
: Added new test cases to validate the functionality of the event listeners for RPC invocation events.