MatrixAI / js-rpc

Stream-based JSON RPC for JavaScript/TypeScript Applications

Home Page:https://polykey.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make `rpc` handlers abstract arrow function properties.

tegefaulkes opened this issue · comments

Specification

Currently the rpc handlers are abstract methods that need to be implemented. These should be an abstract arrow function property and handlers should be implemented as arrow functions. This will allow us to use them without rebinding the this context.

This should be done during the agent migration PR.

Additional context

Tasks

  1. Update the abstract handler's handle methods to be abstract arrow function properties.

This is moved here as updating this in js-rpc will force the adoption of it in Polykey when it updates.

Resolved in #8

You need to re-open this. It should be closed automatically by #8 being merged.

@addievo this issue is not fixed in your PR #8. You need to change the classes to specify that handlers should a be an arrow property and add tests into the RPC to be make it to be the case.

I'm not sure if class methods even satisfy arrow property types, and vice versa.